diff --git a/MADE.App.Views.Navigation.MvvmLight/MADE.App.Views.Navigation.MvvmLight.csproj b/MADE.App.Views.Navigation.MvvmLight/MADE.App.Views.Navigation.MvvmLight.csproj new file mode 100644 index 00000000..5b6906cb --- /dev/null +++ b/MADE.App.Views.Navigation.MvvmLight/MADE.App.Views.Navigation.MvvmLight.csproj @@ -0,0 +1,76 @@ + + + + netstandard2.0;xamarin.ios10;monoandroid81;uap10.0.16299 + + + + bin\Debug\netstandard2.0\MADE.App.Views.Navigation.MvvmLight.xml + + + + bin\Release\netstandard2.0\MADE.App.Views.Navigation.MvvmLight.xml + + + + + + + + + + + + + + + + Docfx-$(TargetFramework).log + true + true + 1.0.0.0 + MADE Apps + MADE Apps + MADE App View Navigation MvvmLight Library + Making App Development Easier with a collection of easy to use components for building MVVM friendly page to page navigation for .NET projects using MvvmLight across Windows, Android, and iOS. + Copyright (C) MADE Apps. All rights reserved. + https://github.com/MADE-Apps/MADE-App-Components/blob/master/LICENSE + https://github.com/MADE-Apps/MADE-App-Components + https://github.com/MADE-Apps/MADE-App-Components + git + https://pbs.twimg.com/profile_images/927154020422160385/6HSRU36P_400x400.jpg + MADE App Development MvvmLight Mvvm View Navigation Service Frame Windows Android iOS Xamarin + MADE.App.Views.Navigation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MADE.App.Views.Navigation.MvvmLight/Pages/MvvmPage.cs b/MADE.App.Views.Navigation.MvvmLight/Pages/MvvmPage.cs new file mode 100644 index 00000000..574cbfd2 --- /dev/null +++ b/MADE.App.Views.Navigation.MvvmLight/Pages/MvvmPage.cs @@ -0,0 +1,73 @@ +#if WINDOWS_UWP || __ANDROID__ +namespace MADE.App.Views.Navigation.Pages +{ + using MADE.App.Views.Navigation.ViewModels; + + /// + /// Defines an MVVM friendly page that is compatible with MvvmLight and the application NavigationFrame. + /// + public class MvvmPage : Page + { + /// + /// Called when the page has loaded. + /// + public override void OnPageLoaded() + { + base.OnPageLoaded(); + + if (this.DataContext is PageViewModel vm) + { + vm.OnPageLoaded(); + } + } + + /// + /// Called when the page has been navigated from. + /// + /// + /// The navigation event argument for the navigation. + /// + public override void OnNavigatedFrom(NavigationEventArgs e) + { + base.OnNavigatedFrom(e); + + if (this.DataContext is PageViewModel vm) + { + vm.OnNavigatedFrom(e); + } + } + + /// + /// Called when the page has been navigated to. + /// + /// + /// The navigation event argument for the navigation. + /// + public override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + if (this.DataContext is PageViewModel vm) + { + vm.OnNavigatedTo(e); + } + } + + /// + /// Called when the page is being navigated from. + /// + /// + /// The navigation event argument for the navigation supporting the cancellation of the navigation. + /// + public override void OnNavigatingFrom(NavigatingCancelEventArgs e) + { + base.OnNavigatingFrom(e); + + if (this.DataContext is PageViewModel vm) + { + vm.OnNavigatingFrom(e); + } + } + } +} +#endif \ No newline at end of file diff --git a/MADE.App.Views.Navigation.MvvmLight/ViewModels/PageViewModel.cs b/MADE.App.Views.Navigation.MvvmLight/ViewModels/PageViewModel.cs new file mode 100644 index 00000000..30f0ac5e --- /dev/null +++ b/MADE.App.Views.Navigation.MvvmLight/ViewModels/PageViewModel.cs @@ -0,0 +1,81 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Copyright (c) MADE Apps. +// +// +// Defines a view-model for a MADE page. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace MADE.App.Views.Navigation.ViewModels +{ + using CommonServiceLocator; + + using GalaSoft.MvvmLight; + using GalaSoft.MvvmLight.Ioc; + using GalaSoft.MvvmLight.Messaging; + + /// + /// Defines a view-model for a MADE page. + /// + public class PageViewModel : ViewModelBase + { + /// + /// Initializes a new instance of the class. + /// + public PageViewModel() + : this(ServiceLocator.Current.GetInstance()) + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The MVVM message aggregator. + /// + [PreferredConstructor] + public PageViewModel(IMessenger messenger) + { + this.MessengerInstance = messenger; + } + + /// + /// Called when the page has loaded. + /// + public virtual void OnPageLoaded() + { + } + + /// + /// Called when the page has been navigated from. + /// + /// + /// The navigation event argument for the navigation. + /// + public virtual void OnNavigatedFrom(NavigationEventArgs e) + { + } + + /// + /// Called when the page has been navigated to. + /// + /// + /// The navigation event argument for the navigation. + /// + public virtual void OnNavigatedTo(NavigationEventArgs e) + { + } + + /// + /// Called when the page is being navigated from. + /// + /// + /// The navigation event argument for the navigation supporting the cancellation of the navigation. + /// + public virtual void OnNavigatingFrom(NavigatingCancelEventArgs e) + { + } + } +} \ No newline at end of file diff --git a/MADE.App.Views.Navigation/NavigationFrame.Android.cs b/MADE.App.Views.Navigation/NavigationFrame.Android.cs index 3df99141..5aa163ac 100644 --- a/MADE.App.Views.Navigation/NavigationFrame.Android.cs +++ b/MADE.App.Views.Navigation/NavigationFrame.Android.cs @@ -8,6 +8,8 @@ namespace MADE.App.Views.Navigation using Android.Support.V4.App; using Android.Support.V7.App; + using MADE.App.Views.Navigation.Pages; + /// /// Defines a frame for navigating and displaying page content. /// @@ -82,25 +84,21 @@ public void GoBack() return; } - if (!this.CanNavigateAway()) + NavigationEventArgs previousPageEvent = this.GetNavigationEvent(this.BackStackDepth - 1); + if (previousPageEvent == null) { + // ToDo, if there is no page event, we are at the end of the stack. Should exit app. return; } - NavigationEventArgs currentPageEvent = this.GetNavigationEvent(this.BackStackDepth); - if (currentPageEvent != null) - { - currentPageEvent.NavigationMode = NavigationMode.Back; - } + previousPageEvent.NavigationMode = NavigationMode.Back; - NavigationEventArgs previousPageEvent = this.GetNavigationEvent(this.BackStackDepth - 1); - if (previousPageEvent != null) + if (!this.CanNavigateAway(previousPageEvent)) { - previousPageEvent.NavigationMode = NavigationMode.Back; + return; } this.HandleNavigation( - currentPageEvent, previousPageEvent, () => { @@ -137,11 +135,6 @@ public bool Navigate(Type sourcePageType) /// public bool Navigate(Type sourcePageType, object parameter) { - if (!this.CanNavigateAway()) - { - return false; - } - if (!(Activator.CreateInstance(sourcePageType) is Page page)) { return false; @@ -154,6 +147,11 @@ public bool Navigate(Type sourcePageType, object parameter) SourcePageType = sourcePageType }; + if (!this.CanNavigateAway(navArgs)) + { + return false; + } + this.HandleNavigation( navArgs, () => @@ -193,26 +191,18 @@ protected override void OnCreate(Bundle savedInstanceState) } private void HandleNavigation(NavigationEventArgs navArgs, Action navigationAction) - { - this.HandleNavigation(navArgs, navArgs, navigationAction); - } - - private void HandleNavigation( - NavigationEventArgs previousNavArgs, - NavigationEventArgs newNavArgs, - Action navigationAction) { IPage previousPage = this.currentPage; - previousPage?.OnNavigatedFrom(previousNavArgs); + previousPage?.OnNavigatedFrom(navArgs); navigationAction?.Invoke(); this.currentPage = this.SupportFragmentManager.GetCurrentFragment() as Page; if (this.currentPage != null) { - this.currentPage.OnNavigatedTo(newNavArgs); - this.CurrentSourcePageParameter = newNavArgs.Parameter; - this.PageNavigated?.Invoke(this, newNavArgs); + this.currentPage.OnNavigatedTo(navArgs); + this.CurrentSourcePageParameter = navArgs.Parameter; + this.PageNavigated?.Invoke(this, navArgs); } } @@ -239,7 +229,7 @@ private void RemoveNavigationEvent(int key) } } - private bool CanNavigateAway() + private bool CanNavigateAway(NavigationEventArgs args) { IPage previousPage = this.currentPage; @@ -248,9 +238,10 @@ private bool CanNavigateAway() NavigatingCancelEventArgs navArgs = new NavigatingCancelEventArgs(() => shouldCancel = true) { - SourcePageType = previousPage?.GetType(), - NavigationMode = NavigationMode.Back - }; + SourcePageType = args.SourcePageType, + NavigationMode = args.NavigationMode, + Parameter = args.Parameter + }; previousPage?.OnNavigatingFrom(navArgs); diff --git a/MADE.App.Views.Navigation/IAndroidPage.cs b/MADE.App.Views.Navigation/Pages/IAndroidPage.cs similarity index 95% rename from MADE.App.Views.Navigation/IAndroidPage.cs rename to MADE.App.Views.Navigation/Pages/IAndroidPage.cs index 106b8c92..f911727a 100644 --- a/MADE.App.Views.Navigation/IAndroidPage.cs +++ b/MADE.App.Views.Navigation/Pages/IAndroidPage.cs @@ -1,5 +1,5 @@ #if __ANDROID__ -namespace MADE.App.Views.Navigation +namespace MADE.App.Views.Navigation.Pages { using Android.Views; diff --git a/MADE.App.Views.Navigation/IPage.cs b/MADE.App.Views.Navigation/Pages/IPage.cs similarity index 97% rename from MADE.App.Views.Navigation/IPage.cs rename to MADE.App.Views.Navigation/Pages/IPage.cs index 472ef72f..e334bd5f 100644 --- a/MADE.App.Views.Navigation/IPage.cs +++ b/MADE.App.Views.Navigation/Pages/IPage.cs @@ -7,7 +7,7 @@ // // -------------------------------------------------------------------------------------------------------------------- -namespace MADE.App.Views.Navigation +namespace MADE.App.Views.Navigation.Pages { /// /// Defines an interface for an application page. diff --git a/MADE.App.Views.Navigation/Page.Android.cs b/MADE.App.Views.Navigation/Pages/Page.Android.cs similarity index 98% rename from MADE.App.Views.Navigation/Page.Android.cs rename to MADE.App.Views.Navigation/Pages/Page.Android.cs index 35fe60d8..7d0060ba 100644 --- a/MADE.App.Views.Navigation/Page.Android.cs +++ b/MADE.App.Views.Navigation/Pages/Page.Android.cs @@ -1,5 +1,5 @@ #if __ANDROID__ -namespace MADE.App.Views.Navigation +namespace MADE.App.Views.Navigation.Pages { using Android.OS; using Android.Support.V4.App; diff --git a/MADE.App.Views.Navigation/Page.Windows.cs b/MADE.App.Views.Navigation/Pages/Page.Windows.cs similarity index 98% rename from MADE.App.Views.Navigation/Page.Windows.cs rename to MADE.App.Views.Navigation/Pages/Page.Windows.cs index f4a0d414..b08fe28c 100644 --- a/MADE.App.Views.Navigation/Page.Windows.cs +++ b/MADE.App.Views.Navigation/Pages/Page.Windows.cs @@ -1,5 +1,5 @@ #if WINDOWS_UWP -namespace MADE.App.Views.Navigation +namespace MADE.App.Views.Navigation.Pages { using Windows.ApplicationModel; diff --git a/MADE.App.sln b/MADE.App.sln index 2e1c0db7..9e47c163 100644 --- a/MADE.App.sln +++ b/MADE.App.sln @@ -19,6 +19,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MADE.App.Views.Navigation", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MADE.Samples.Windows", "MADE.Samples.Windows\MADE.Samples.Windows.csproj", "{1E87BE6D-F379-4437-B0FC-1A6E0BD990F7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MADE.App.Views.Navigation.MvvmLight", "MADE.App.Views.Navigation.MvvmLight\MADE.App.Views.Navigation.MvvmLight.csproj", "{CE2D8871-EE52-428D-978A-295883B4384A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MADE.Samples", "MADE.Samples\MADE.Samples.csproj", "{03CE46B2-F4FA-4375-A493-F9E37B352299}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -139,6 +143,38 @@ Global {1E87BE6D-F379-4437-B0FC-1A6E0BD990F7}.Release|x86.ActiveCfg = Release|x86 {1E87BE6D-F379-4437-B0FC-1A6E0BD990F7}.Release|x86.Build.0 = Release|x86 {1E87BE6D-F379-4437-B0FC-1A6E0BD990F7}.Release|x86.Deploy.0 = Release|x86 + {CE2D8871-EE52-428D-978A-295883B4384A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Debug|ARM.Build.0 = Debug|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Debug|x64.ActiveCfg = Debug|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Debug|x64.Build.0 = Debug|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Debug|x86.ActiveCfg = Debug|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Debug|x86.Build.0 = Debug|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Release|Any CPU.Build.0 = Release|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Release|ARM.ActiveCfg = Release|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Release|ARM.Build.0 = Release|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Release|x64.ActiveCfg = Release|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Release|x64.Build.0 = Release|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Release|x86.ActiveCfg = Release|Any CPU + {CE2D8871-EE52-428D-978A-295883B4384A}.Release|x86.Build.0 = Release|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Debug|Any CPU.Build.0 = Debug|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Debug|ARM.ActiveCfg = Debug|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Debug|ARM.Build.0 = Debug|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Debug|x64.ActiveCfg = Debug|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Debug|x64.Build.0 = Debug|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Debug|x86.ActiveCfg = Debug|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Debug|x86.Build.0 = Debug|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Release|Any CPU.ActiveCfg = Release|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Release|Any CPU.Build.0 = Release|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Release|ARM.ActiveCfg = Release|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Release|ARM.Build.0 = Release|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Release|x64.ActiveCfg = Release|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Release|x64.Build.0 = Release|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Release|x86.ActiveCfg = Release|Any CPU + {03CE46B2-F4FA-4375-A493-F9E37B352299}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -147,6 +183,7 @@ Global {D3A5CB4E-7B83-43BF-89F4-FF562F815448} = {BEA51B94-B162-47D9-9822-394B2778A225} {4697E972-329C-4FB9-81E3-25833FA73924} = {16CEC8F1-3A12-4C75-8D65-A58B4CB47917} {1E87BE6D-F379-4437-B0FC-1A6E0BD990F7} = {BEA51B94-B162-47D9-9822-394B2778A225} + {03CE46B2-F4FA-4375-A493-F9E37B352299} = {BEA51B94-B162-47D9-9822-394B2778A225} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3921AD86-E6C0-4436-8880-2D9EDFAD6151} diff --git a/MADE.Samples.Android/Fragments/MainFragment.cs b/MADE.Samples.Android/Fragments/MainFragment.cs index ea832325..1643c2a7 100644 --- a/MADE.Samples.Android/Fragments/MainFragment.cs +++ b/MADE.Samples.Android/Fragments/MainFragment.cs @@ -1,9 +1,15 @@ namespace MADE.Samples.Android.Fragments { - using MADE.App.Views.Navigation; + using MADE.App.Views.Navigation.Pages; + using MADE.App.Views.Navigation.ViewModels; - public class MainFragment : Page + public class MainFragment : MvvmPage { + public MainFragment() + { + this.DataContext = new PageViewModel(); + } + public override int LayoutId => Resource.Layout.MainFragment; } } \ No newline at end of file diff --git a/MADE.Samples.Android/Fragments/SecondFragment.cs b/MADE.Samples.Android/Fragments/SecondFragment.cs index 29787c1e..ec115ee2 100644 --- a/MADE.Samples.Android/Fragments/SecondFragment.cs +++ b/MADE.Samples.Android/Fragments/SecondFragment.cs @@ -1,9 +1,16 @@ namespace MADE.Samples.Android.Fragments { using MADE.App.Views.Navigation; + using MADE.App.Views.Navigation.Pages; + using MADE.App.Views.Navigation.ViewModels; public class SecondFragment : Page { + public SecondFragment() + { + this.DataContext = new PageViewModel(); + } + public override int LayoutId => Resource.Layout.SecondFragment; } } \ No newline at end of file diff --git a/MADE.Samples.Android/MADE.Samples.Android.csproj b/MADE.Samples.Android/MADE.Samples.Android.csproj index 704dc1c2..1f3c8a55 100644 --- a/MADE.Samples.Android/MADE.Samples.Android.csproj +++ b/MADE.Samples.Android/MADE.Samples.Android.csproj @@ -57,6 +57,7 @@ + @@ -83,6 +84,10 @@ {ce1370ae-4985-41e2-8dce-24b11a5ea177} MADE.App.Mvvm + + {ce2d8871-ee52-428d-978a-295883b4384a} + MADE.App.Views.Navigation.MvvmLight + {00abf0e3-2ad1-4002-8527-920e9ea6a138} MADE.App.Views.Navigation @@ -91,8 +96,18 @@ {006114aa-3919-4393-b836-d03995c5e230} MADE.App + + {03ce46b2-f4fa-4375-a493-f9e37b352299} + MADE.Samples + + + 2.0.3 + + + 5.4.1 + 1.1.0 diff --git a/MADE.Samples.Android/MainApplication.cs b/MADE.Samples.Android/MainApplication.cs new file mode 100644 index 00000000..d8b3feb4 --- /dev/null +++ b/MADE.Samples.Android/MainApplication.cs @@ -0,0 +1,58 @@ +namespace MADE.Samples.Android +{ + using System; + + using global::Android.App; + using global::Android.OS; + using global::Android.Runtime; + + [Application] + public class MainApplication : Application, Application.IActivityLifecycleCallbacks + { + private static Locator locator; + + public MainApplication(IntPtr handle, JniHandleOwnership transfer) + : base(handle, transfer) + { + } + + public static Locator Locator => locator ?? (locator = new Locator()); + + public override void OnCreate() + { + base.OnCreate(); + + this.RegisterActivityLifecycleCallbacks(this); + + locator = new Locator(); + } + + public void OnActivityCreated(Activity activity, Bundle savedInstanceState) + { + } + + public void OnActivityDestroyed(Activity activity) + { + } + + public void OnActivityPaused(Activity activity) + { + } + + public void OnActivityResumed(Activity activity) + { + } + + public void OnActivitySaveInstanceState(Activity activity, Bundle outState) + { + } + + public void OnActivityStarted(Activity activity) + { + } + + public void OnActivityStopped(Activity activity) + { + } + } +} \ No newline at end of file diff --git a/MADE.Samples.Windows/App.xaml b/MADE.Samples.Windows/App.xaml index 36b71b3d..ff6bd90d 100644 --- a/MADE.Samples.Windows/App.xaml +++ b/MADE.Samples.Windows/App.xaml @@ -2,7 +2,13 @@ x:Class="MADE.Samples.Windows.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="using:MADE.Samples.Windows" + xmlns:samples="using:MADE.Samples" RequestedTheme="Light"> - + + + + + + + \ No newline at end of file diff --git a/MADE.Samples.Windows/App.xaml.cs b/MADE.Samples.Windows/App.xaml.cs index 53f809a9..93d9f0f3 100644 --- a/MADE.Samples.Windows/App.xaml.cs +++ b/MADE.Samples.Windows/App.xaml.cs @@ -63,7 +63,9 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter - rootFrame.Navigate(typeof(MainPage), e.Arguments); + rootFrame.Navigate(typeof(MainPage), "Hello Main Page"); + rootFrame.Navigate(typeof(SecondPage), "Hello Second Page"); + rootFrame.GoBack(); } // Ensure the current window is active diff --git a/MADE.Samples.Windows/MADE.Samples.Windows.csproj b/MADE.Samples.Windows/MADE.Samples.Windows.csproj index e17c96eb..8fd57c5a 100644 --- a/MADE.Samples.Windows/MADE.Samples.Windows.csproj +++ b/MADE.Samples.Windows/MADE.Samples.Windows.csproj @@ -99,6 +99,9 @@ MainPage.xaml + + SecondPage.xaml + @@ -125,17 +128,31 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + + + 2.0.3 + 6.1.4 + + 5.4.1 + {ce1370ae-4985-41e2-8dce-24b11a5ea177} MADE.App.Mvvm + + {ce2d8871-ee52-428d-978a-295883b4384a} + MADE.App.Views.Navigation.MvvmLight + {00abf0e3-2ad1-4002-8527-920e9ea6a138} MADE.App.Views.Navigation @@ -144,6 +161,10 @@ {006114aa-3919-4393-b836-d03995c5e230} MADE.App + + {03ce46b2-f4fa-4375-a493-f9e37b352299} + MADE.Samples + 14.0 diff --git a/MADE.Samples.Windows/MainPage.xaml b/MADE.Samples.Windows/MainPage.xaml index 54d9640b..1853f629 100644 --- a/MADE.Samples.Windows/MainPage.xaml +++ b/MADE.Samples.Windows/MainPage.xaml @@ -1,12 +1,13 @@ - - - + + + + \ No newline at end of file diff --git a/MADE.Samples.Windows/MainPage.xaml.cs b/MADE.Samples.Windows/MainPage.xaml.cs index e24ed272..17f8c904 100644 --- a/MADE.Samples.Windows/MainPage.xaml.cs +++ b/MADE.Samples.Windows/MainPage.xaml.cs @@ -1,10 +1,13 @@ namespace MADE.Samples.Windows { - public sealed partial class MainPage : MADE.App.Views.Navigation.Page + using MADE.App.Views.Navigation.ViewModels; + + public sealed partial class MainPage : MADE.App.Views.Navigation.Pages.MvvmPage { public MainPage() { this.InitializeComponent(); + this.DataContext = new PageViewModel(); } } } diff --git a/MADE.Samples.Windows/SecondPage.xaml b/MADE.Samples.Windows/SecondPage.xaml new file mode 100644 index 00000000..fd36bbbc --- /dev/null +++ b/MADE.Samples.Windows/SecondPage.xaml @@ -0,0 +1,13 @@ + + + + + + diff --git a/MADE.Samples.Windows/SecondPage.xaml.cs b/MADE.Samples.Windows/SecondPage.xaml.cs new file mode 100644 index 00000000..ec25927f --- /dev/null +++ b/MADE.Samples.Windows/SecondPage.xaml.cs @@ -0,0 +1,14 @@ +namespace MADE.Samples.Windows +{ + using MADE.App.Views.Navigation.Pages; + using MADE.App.Views.Navigation.ViewModels; + + public sealed partial class SecondPage : MvvmPage + { + public SecondPage() + { + this.InitializeComponent(); + this.DataContext = new PageViewModel(); + } + } +} \ No newline at end of file diff --git a/MADE.Samples/Locator.cs b/MADE.Samples/Locator.cs new file mode 100644 index 00000000..92fe2fd4 --- /dev/null +++ b/MADE.Samples/Locator.cs @@ -0,0 +1,16 @@ +namespace MADE.Samples +{ + using CommonServiceLocator; + + using GalaSoft.MvvmLight.Ioc; + using GalaSoft.MvvmLight.Messaging; + + public class Locator + { + static Locator() + { + ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + SimpleIoc.Default.Register(); + } + } +} \ No newline at end of file diff --git a/MADE.Samples/MADE.Samples.csproj b/MADE.Samples/MADE.Samples.csproj new file mode 100644 index 00000000..e2a9e7a1 --- /dev/null +++ b/MADE.Samples/MADE.Samples.csproj @@ -0,0 +1,12 @@ + + + + netstandard2.0 + + + + + + + +