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

Create view events in Viewmodels #1601

Merged
merged 19 commits into from Feb 15, 2017

Conversation

Projects
None yet
5 participants
@martijn00
Member

martijn00 commented Feb 10, 2017

This enables devs to do stuff in their viewmodel on certain lifecycle events

@kjeremy

This comment has been minimized.

Show comment
Hide comment
@kjeremy

kjeremy Feb 9, 2017

Contributor

The Loaded event in WPF can happen multiple times. I don't know how this effects our semantics.

Contributor

kjeremy commented on MvvmCross/Windows/Wpf/Views/MvxWpfView.cs in c1a27a1 Feb 9, 2017

The Loaded event in WPF can happen multiple times. I don't know how this effects our semantics.

@Cheesebaron

This comment has been minimized.

Show comment
Hide comment
@Cheesebaron

Cheesebaron Feb 10, 2017

Member

If you are wondering why it does not build.

[00:04:45] "C:\projects\mvvmcross\MvvmCross_All.sln" (Build target) (1) ->
[00:04:45] "C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj" (default target) (138) ->
[00:04:45] (CoreCompile target) -> 
[00:04:45]   Views\MvxWpfView.cs(37,23): error CS1061: 'IMvxViewModel' does not contain a definition for 'Disappearing' and no extension method 'Disappearing' accepting a first argument of type 'IMvxViewModel' could be found (are you missing a using directive or an assembly reference?) [C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj]
[00:04:45]   Views\MvxWpfView.cs(38,23): error CS1061: 'IMvxViewModel' does not contain a definition for 'Disappeared' and no extension method 'Disappeared' accepting a first argument of type 'IMvxViewModel' could be found (are you missing a using directive or an assembly reference?) [C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj]
[00:04:45]   Views\MvxWpfView.cs(43,23): error CS1061: 'IMvxViewModel' does not contain a definition for 'Appearing' and no extension method 'Appearing' accepting a first argument of type 'IMvxViewModel' could be found (are you missing a using directive or an assembly reference?) [C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj]
[00:04:45]   Views\MvxWpfView.cs(44,23): error CS1061: 'IMvxViewModel' does not contain a definition for 'Appeared' and no extension method 'Appeared' accepting a first argument of type 'IMvxViewModel' could be found (are you missing a using directive or an assembly reference?) [C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj]
[00:04:45] 
[00:04:45] 
[00:04:45] "C:\projects\mvvmcross\MvvmCross_All.sln" (Build target) (1) ->
[00:04:45] "C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj" (default target) (139) ->
[00:04:45]   ViewModels\FirstViewModel.cs(10,24): error CS0115: 'FirstViewModel.Appearing()': no suitable method found to override [C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj]
[00:04:45]   ViewModels\FirstViewModel.cs(15,24): error CS0115: 'FirstViewModel.Appeared()': no suitable method found to override [C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj]
[00:04:45]   ViewModels\FirstViewModel.cs(20,24): error CS0115: 'FirstViewModel.Disappearing()': no suitable method found to override [C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj]
[00:04:45]   ViewModels\FirstViewModel.cs(25,24): error CS0115: 'FirstViewModel.Disappeared()': no suitable method found to override [C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj]
Member

Cheesebaron commented Feb 10, 2017

If you are wondering why it does not build.

[00:04:45] "C:\projects\mvvmcross\MvvmCross_All.sln" (Build target) (1) ->
[00:04:45] "C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj" (default target) (138) ->
[00:04:45] (CoreCompile target) -> 
[00:04:45]   Views\MvxWpfView.cs(37,23): error CS1061: 'IMvxViewModel' does not contain a definition for 'Disappearing' and no extension method 'Disappearing' accepting a first argument of type 'IMvxViewModel' could be found (are you missing a using directive or an assembly reference?) [C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj]
[00:04:45]   Views\MvxWpfView.cs(38,23): error CS1061: 'IMvxViewModel' does not contain a definition for 'Disappeared' and no extension method 'Disappeared' accepting a first argument of type 'IMvxViewModel' could be found (are you missing a using directive or an assembly reference?) [C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj]
[00:04:45]   Views\MvxWpfView.cs(43,23): error CS1061: 'IMvxViewModel' does not contain a definition for 'Appearing' and no extension method 'Appearing' accepting a first argument of type 'IMvxViewModel' could be found (are you missing a using directive or an assembly reference?) [C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj]
[00:04:45]   Views\MvxWpfView.cs(44,23): error CS1061: 'IMvxViewModel' does not contain a definition for 'Appeared' and no extension method 'Appeared' accepting a first argument of type 'IMvxViewModel' could be found (are you missing a using directive or an assembly reference?) [C:\projects\mvvmcross\MvvmCross\Windows\Wpf\MvvmCross.Wpf.csproj]
[00:04:45] 
[00:04:45] 
[00:04:45] "C:\projects\mvvmcross\MvvmCross_All.sln" (Build target) (1) ->
[00:04:45] "C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj" (default target) (139) ->
[00:04:45]   ViewModels\FirstViewModel.cs(10,24): error CS0115: 'FirstViewModel.Appearing()': no suitable method found to override [C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj]
[00:04:45]   ViewModels\FirstViewModel.cs(15,24): error CS0115: 'FirstViewModel.Appeared()': no suitable method found to override [C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj]
[00:04:45]   ViewModels\FirstViewModel.cs(20,24): error CS0115: 'FirstViewModel.Disappearing()': no suitable method found to override [C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj]
[00:04:45]   ViewModels\FirstViewModel.cs(25,24): error CS0115: 'FirstViewModel.Disappeared()': no suitable method found to override [C:\projects\mvvmcross\TestProjects\Eventhooks\Eventhooks.Core\Eventhooks.Core.csproj]
@kjeremy

This comment has been minimized.

Show comment
Hide comment
@kjeremy

kjeremy Feb 10, 2017

Contributor

How will these event hooks work wrt things like list items? Should we modify our adapters/viewholders or are these more of a 'page' level concept?

Contributor

kjeremy commented Feb 10, 2017

How will these event hooks work wrt things like list items? Should we modify our adapters/viewholders or are these more of a 'page' level concept?

@martijn00

This comment has been minimized.

Show comment
Hide comment
@martijn00

martijn00 Feb 10, 2017

Member

For now it's more a page level concept. This is more something i think we should integrate because i see a lot of projects implementing something like this on their own. We just start on this now, and could be improved by more PR's later on.

As also explained in this post for Xamarin Forms, this is not going to cover 100% but at least helps a lot for now.

https://forums.xamarin.com/discussion/comment/240043/

Member

martijn00 commented Feb 10, 2017

For now it's more a page level concept. This is more something i think we should integrate because i see a lot of projects implementing something like this on their own. We just start on this now, and could be improved by more PR's later on.

As also explained in this post for Xamarin Forms, this is not going to cover 100% but at least helps a lot for now.

https://forums.xamarin.com/discussion/comment/240043/

Nickolas Shpotenko and others added some commits Feb 12, 2017

@Cheesebaron

This comment has been minimized.

Show comment
Hide comment
@Cheesebaron

Cheesebaron Feb 12, 2017

Member

Still had issues building this on my machine, getting the same errors as the CI does. Rebuilding after it failed worked though.

Not sure what is going on, but I find it strange that it couldn't find the newly added methods on the IMvxViewModel interface.

Member

Cheesebaron commented Feb 12, 2017

Still had issues building this on my machine, getting the same errors as the CI does. Rebuilding after it failed worked though.

Not sure what is going on, but I find it strange that it couldn't find the newly added methods on the IMvxViewModel interface.

martijn00 and others added some commits Feb 12, 2017

Merge commit 'c94c17bb1197d41bc7bc97d71c3b0de26c2dec61' into eventhooks
# Conflicts:
#	MvvmCross/Core/Core/ViewModels/MvxViewModel.cs
Merge branch 'develop' into eventhooks
# Conflicts:
#	MvvmCross_All.sln

@martijn00 martijn00 changed the title from [WIP] Create view events in Viewmodels to Create view events in Viewmodels Feb 15, 2017

@martijn00 martijn00 merged commit b6d3461 into develop Feb 15, 2017

1 check failed

continuous-integration/appveyor/pr AppVeyor build failed
Details

@Cheesebaron Cheesebaron deleted the eventhooks branch Feb 15, 2017

@martijn00 martijn00 referenced this pull request Feb 28, 2017

Closed

MvvmCross roadmap 5.x #1415

15 of 22 tasks complete

@martijn00 martijn00 added this to the 5.0.0 milestone Apr 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment