Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore ActionEventHandler when null - UI.Demo #199

Merged
merged 7 commits into from
Dec 26, 2023

Conversation

ricaun
Copy link
Contributor

@ricaun ricaun commented Dec 26, 2023

Summary of the Pull Request

When using UI.Demo the Application.ActionEventHandler is null.

The EventMonitor.Subscribe and EventMonitor.Unsubscribe throw exception.

Quality Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Copy link
Collaborator

@Nice3point Nice3point left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better solution would be to create a Mock viewmodel to create logic for the demo project that does not reference the Revit Api

изображение

@ricaun
Copy link
Contributor Author

ricaun commented Dec 26, 2023

A better solution would be to create a Mock viewmodel to create logic for the demo project that does not reference the Revit Api

Yes. I'm not sure if this is right, the IEventsViewModel is something like this.

public interface IEventsViewModel : ISnoopViewModel
{
    void OnNavigatedTo();
    void OnNavigatedFrom();
}

@ricaun
Copy link
Contributor Author

ricaun commented Dec 26, 2023

A better solution would be to create a Mock viewmodel to create logic for the demo project that does not reference the Revit Api

Yes. I'm not sure if this is right, the IEventsViewModel is something like this.

public interface IEventsViewModel : ISnoopViewModel
{
    void OnNavigatedTo();
    void OnNavigatedFrom();
}

Or this. 😀

public interface IEventsViewModel : INavigationAware, ISnoopViewModel 
{
}

@Nice3point
Copy link
Collaborator

Nice3point commented Dec 26, 2023

Or this. 😀

public interface IEventsViewModel : INavigationAware, ISnoopViewModel 
{
}

or this 😉

public interface IEventsViewModel : INavigationAware, ISnoopViewModel;

in C# 12 you can use ; instead of {}
yeah, that's a great plan, let's do that)

@ricaun
Copy link
Contributor Author

ricaun commented Dec 26, 2023

IEventsViewModel 

Done! I added a Subscribe/Unsubscribe in the moq. Strange that all de RevitApi.dll is loaded when you go into the Events.

@Nice3point Nice3point merged commit 4397794 into jeremytammik:dev Dec 26, 2023
1 of 2 checks passed
@Nice3point
Copy link
Collaborator

Awesome, thanks)

@Nice3point
Copy link
Collaborator

Strange that all de RevitApi.dll is loaded when you go into the Events.

There because of using using Autodesk.Revit.Exceptions; in SnoopViewModelBase, I fixed it by inheriting ObservableObject instead of SnoopViewModelBase

@ricaun ricaun deleted the dev-eventnull-demo branch December 26, 2023 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants