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

winforms view hosts #396

Merged
merged 3 commits into from
Nov 6, 2013
Merged

winforms view hosts #396

merged 3 commits into from
Nov 6, 2013

Conversation

rikbosch
Copy link
Contributor

@rikbosch rikbosch commented Nov 5, 2013

Hi,

I've added a winforms ViewModelViewHost and RoutedViewHost using the xaml project as example.

I've also included a set of tests for both controls.

This should make it easier to host viewmodels in a Windows Forms app.

Rik Bosch added 2 commits November 5, 2013 12:12
* Added RxApp.DefaultExceptionhandler to ViewModelViewHost

namespace ReactiveUI.Winforms
{
using System.Reactive.Disposables;
Copy link
Member

Choose a reason for hiding this comment

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

Can you put these ⬆️

@anaisbetts
Copy link
Member

Hey @rikbosch, this looks rad! Your editor has run rampant with the style though, do you mind fixing these up? I've annotated one of the files thoroughly with the kinds of things to look for

@rikbosch
Copy link
Contributor Author

rikbosch commented Nov 6, 2013

I've made some changes to the styling. (CleanUp code using ReSharper).

One thing though about the functionality:

The routed viewhosts disposes the previous view when routers current viewmodel changes.
However, when registering the views as 'constant', this will not give the desired result, as the view will already be disposed when navigating back. Not disposing views will however potentially create a memoryleak.

Do you know what the behavior should be?
Some other MVVM frameworks have contracts in the like of IActivate and IDeactivate, which can be used to cleanup resources / temporary disable eventhandlers when a view is not active, e.g. not the router's current view.

@anaisbetts anaisbetts merged commit fa457d1 into master Nov 6, 2013
@anaisbetts
Copy link
Member

Do you know what the behavior should be?

I think in the WinForms case, you should never register views as constant, especially since they are HWND-based - we should definitely trash them when not visible.

Some other MVVM frameworks have contracts in the like of IActivate and IDeactivate, which can be used to cleanup resources / temporary disable eventhandlers when a view is not active, e.g. not the router's current view.

This is Coming Soon™ to ReactiveUI :)

@anaisbetts anaisbetts deleted the winforms-viewhosts branch December 16, 2013 02:19
@lock lock bot locked and limited conversation to collaborators Jun 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants