├── .gitignore ├── LICENSE ├── README.md ├── samples ├── FreshMvvmApp │ └── FreshMvvmApp │ │ ├── FreshMvvmApp.Android │ │ ├── Assets │ │ │ └── AboutAssets.txt │ │ ├── FreshMvvmApp.Android.csproj │ │ ├── MainActivity.cs │ │ ├── Properties │ │ │ ├── AndroidManifest.xml │ │ │ └── AssemblyInfo.cs │ │ └── Resources │ │ │ ├── AboutResources.txt │ │ │ ├── Resource.designer.cs │ │ │ ├── layout │ │ │ ├── Tabbar.axml │ │ │ └── Toolbar.axml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── icon.xml │ │ │ └── icon_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── Icon.png │ │ │ └── launcher_foreground.png │ │ │ ├── mipmap-mdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── Icon.png │ │ │ └── launcher_foreground.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── Icon.png │ │ │ └── launcher_foreground.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── Icon.png │ │ │ └── launcher_foreground.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── FreshMvvmApp.UWP │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── Assets │ │ │ ├── LargeTile.scale-100.png │ │ │ ├── LargeTile.scale-200.png │ │ │ ├── LargeTile.scale-400.png │ │ │ ├── SmallTile.scale-100.png │ │ │ ├── SmallTile.scale-200.png │ │ │ ├── SmallTile.scale-400.png │ │ │ ├── SplashScreen.scale-100.png │ │ │ ├── SplashScreen.scale-200.png │ │ │ ├── SplashScreen.scale-400.png │ │ │ ├── Square150x150Logo.scale-100.png │ │ │ ├── Square150x150Logo.scale-200.png │ │ │ ├── Square150x150Logo.scale-400.png │ │ │ ├── Square44x44Logo.altform-unplated_targetsize-16.png │ │ │ ├── Square44x44Logo.altform-unplated_targetsize-256.png │ │ │ ├── Square44x44Logo.altform-unplated_targetsize-48.png │ │ │ ├── Square44x44Logo.scale-100.png │ │ │ ├── Square44x44Logo.scale-200.png │ │ │ ├── Square44x44Logo.scale-400.png │ │ │ ├── Square44x44Logo.targetsize-16.png │ │ │ ├── Square44x44Logo.targetsize-256.png │ │ │ ├── Square44x44Logo.targetsize-48.png │ │ │ ├── StoreLogo.backup.png │ │ │ ├── StoreLogo.scale-100.png │ │ │ ├── StoreLogo.scale-200.png │ │ │ ├── StoreLogo.scale-400.png │ │ │ ├── Wide310x150Logo.scale-100.png │ │ │ ├── Wide310x150Logo.scale-200.png │ │ │ └── Wide310x150Logo.scale-400.png │ │ ├── FreshMvvmApp.UWP.csproj │ │ ├── MainPage.xaml │ │ ├── MainPage.xaml.cs │ │ ├── Package.appxmanifest │ │ └── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ └── Default.rd.xml │ │ ├── FreshMvvmApp.iOS │ │ ├── AppDelegate.cs │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon120.png │ │ │ │ ├── Icon152.png │ │ │ │ ├── Icon167.png │ │ │ │ ├── Icon180.png │ │ │ │ ├── Icon20.png │ │ │ │ ├── Icon29.png │ │ │ │ ├── Icon40.png │ │ │ │ ├── Icon58.png │ │ │ │ ├── Icon60.png │ │ │ │ ├── Icon76.png │ │ │ │ ├── Icon80.png │ │ │ │ └── Icon87.png │ │ ├── Entitlements.plist │ │ ├── FreshMvvmApp.iOS.csproj │ │ ├── Info.plist │ │ ├── Main.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Resources │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default-Portrait.png │ │ │ ├── Default-Portrait@2x.png │ │ │ ├── Default.png │ │ │ ├── Default@2x.png │ │ │ └── LaunchScreen.storyboard │ │ └── FreshMvvmApp │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── FodyWeavers.xml │ │ ├── FodyWeavers.xsd │ │ ├── FreshMvvmApp.csproj │ │ ├── LaunchPage.cs │ │ ├── MainPage.xaml │ │ ├── MainPage.xaml.cs │ │ ├── Models │ │ ├── Contact.cs │ │ └── Quote.cs │ │ ├── Navigation │ │ └── CustomImplementedNav.cs │ │ ├── PageModels │ │ ├── ContactListPageModel.cs │ │ ├── ContactPageModel.cs │ │ ├── MainMenuPageModel.cs │ │ ├── ModalPageModel.cs │ │ ├── QuoteListPageModel.cs │ │ └── QuotePageModel.cs │ │ ├── Pages │ │ ├── BasePage.cs │ │ ├── ContactListPage.xaml │ │ ├── ContactListPage.xaml.cs │ │ ├── ContactPage.xaml │ │ ├── ContactPage.xaml.cs │ │ ├── MainMenuPage.xaml │ │ ├── MainMenuPage.xaml.cs │ │ ├── ModalPage.xaml │ │ ├── ModalPage.xaml.cs │ │ ├── QuoteListPage.xaml │ │ ├── QuoteListPage.xaml.cs │ │ ├── QuotePage.xaml │ │ └── QuotePage.xaml.cs │ │ └── Services │ │ ├── DatabaseService.cs │ │ └── IDatabaseService.cs └── FreshMvvmSampleApp │ └── FreshMvvmSampleApp.UWP │ └── project.lock.json └── src ├── FreshIOC ├── FreshTinyIOC.cs ├── IOC.csproj └── IRegisterOptions.cs ├── FreshMvvm.Tests ├── Fixtures │ ├── FreshBasePageModelFixture.cs │ ├── FreshIOCFixture.cs │ ├── FreshMasterDetailNavigationContainerFixture.cs │ ├── FreshNavigationContainerFixture.cs │ ├── FreshPageModelResolverFixture.cs │ ├── FreshTabbedNavigationContainerFixture.cs │ ├── MultipleNavigationProviderTests.cs │ └── PageModelCoreMethodsFixture.cs ├── FreshMvvm.Tests.csproj ├── Helpers │ └── Helper.cs ├── Mocks.cs ├── Mocks │ ├── MockContentPage.cs │ ├── MockContentPageModel.cs │ ├── MockFreshBasePageModel.cs │ ├── MockItemPage.cs │ ├── MockItemPageModel.cs │ └── MockPageModelCoreMethods.cs ├── app.config └── packages.config ├── FreshMvvm.sln └── FreshMvvm ├── Constants.cs ├── Extensions └── ObservableExtensions.cs ├── FreshAwaitCommand.cs ├── FreshBaseContentPage.cs ├── FreshBasePageModel.cs ├── FreshMvvm.csproj ├── FreshMvvm.nuspec ├── FreshMvvm ├── FreshMvvm.nuspec ├── [Content_Types].xml ├── _rels │ └── .rels ├── lib │ ├── FreshIOC.dll │ ├── FreshIOC.dll.mdb │ ├── FreshMvvm.dll │ ├── FreshMvvm.dll.mdb │ └── FreshMvvm.sln └── package │ └── services │ └── metadata │ └── core-properties │ └── 1.psmdcp ├── FreshPageModelMapper.cs ├── FreshPageModelResolver.cs ├── FreshTinyIOCBuiltIn.cs ├── IFreshNavigationService.cs ├── IFreshPageModelMapper.cs ├── IOC ├── FreshIOC.cs └── IFreshIOC.cs ├── IPageModelCoreMethods.cs ├── NavigationContainers ├── FreshMasterDetailNavigationContainer.cs ├── FreshNavigationContainer.cs ├── FreshTabbedFONavigationContainer.cs └── FreshTabbedNavigationContainer.cs ├── PageExtensions.cs ├── PageModelCoreMethods.cs ├── PropertyChangedExtensions.cs └── WeakEventHandler.cs /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | .idea 166 | 167 | # RIA/Silverlight projects 168 | Generated_Code/ 169 | 170 | # Backup & report files from converting an old project file 171 | # to a newer Visual Studio version. Backup files are not needed, 172 | # because we have git ;-) 173 | _UpgradeReport_Files/ 174 | Backup*/ 175 | UpgradeLog*.XML 176 | UpgradeLog*.htm 177 | 178 | # SQL Server files 179 | *.mdf 180 | *.ldf 181 | 182 | # Business Intelligence projects 183 | *.rdl.data 184 | *.bim.layout 185 | *.bim_*.settings 186 | 187 | # Microsoft Fakes 188 | FakesAssemblies/ 189 | 190 | # Node.js Tools for Visual Studio 191 | .ntvs_analysis.dat 192 | 193 | # Visual Studio 6 build log 194 | *.plg 195 | 196 | # Visual Studio 6 workspace options file 197 | *.opt 198 | /samples/FreshMvvmSampleApp/Droid/FreshMvvmSampleApp.Droid.csproj.bak 199 | 200 | # NuGet 201 | .nuget/ 202 | nuget.exe 203 | samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/Resource.designer.cs 204 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with you package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/FreshMvvmApp.Android.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {CC2CD6A3-E6F9-4EB0-9FAB-D2E839C653AA} 7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | {c9e5eea5-ca05-42a1-839b-61506e0a37df} 9 | Library 10 | FreshMvvmApp.Droid 11 | FreshMvvmApp.Android 12 | True 13 | Resources\Resource.designer.cs 14 | Resource 15 | Properties\AndroidManifest.xml 16 | Resources 17 | Assets 18 | v10.0 19 | 20 | 21 | 2.2.0 22 | 23 | 24 | true 25 | full 26 | false 27 | bin\Debug 28 | DEBUG; 29 | prompt 30 | 4 31 | None 32 | 33 | 34 | true 35 | pdbonly 36 | true 37 | bin\Release 38 | prompt 39 | 4 40 | true 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 4.6.0.772 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | {2042ECC6-98FA-4D4F-A924-F9A8924C0E63} 98 | FreshMvvmApp 99 | 100 | 101 | {ACBA1111-2C39-4126-B60A-51EE9D0C734B} 102 | FreshMvvm 103 | 104 | 105 | {CE6AA8F2-BD67-4051-8AE6-9FFCA9E663FE} 106 | IOC 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Android.App; 4 | using Android.Content.PM; 5 | using Android.Runtime; 6 | using Android.Views; 7 | using Android.Widget; 8 | using Android.OS; 9 | 10 | namespace FreshMvvmApp.Droid 11 | { 12 | [Activity(Label = "FreshMvvmApp", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 13 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 14 | { 15 | protected override void OnCreate(Bundle bundle) 16 | { 17 | TabLayoutResource = Resource.Layout.Tabbar; 18 | ToolbarResource = Resource.Layout.Toolbar; 19 | 20 | base.OnCreate(bundle); 21 | 22 | global::Xamarin.Forms.Forms.Init(this, bundle); 23 | LoadApplication(new App()); 24 | } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("FreshMvvmApp.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("FreshMvvmApp.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | 32 | // Add some common permissions, these can be removed if not needed 33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 35 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.xml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable-hdpi/ 12 | icon.png 13 | 14 | drawable-ldpi/ 15 | icon.png 16 | 17 | drawable-mdpi/ 18 | icon.png 19 | 20 | layout/ 21 | main.xml 22 | 23 | values/ 24 | strings.xml 25 | 26 | In order to get the build system to recognize Android resources, set the build action to 27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 28 | instead operate on resource IDs. When you compile an Android application that uses resources, 29 | the build system will package the resources for distribution and generate a class called 30 | "Resource" that contains the tokens for each one of the resources included. For example, 31 | for the above Resources layout, this is what the Resource class would expose: 32 | 33 | public class Resource { 34 | public class drawable { 35 | public const int icon = 0x123; 36 | } 37 | 38 | public class layout { 39 | public const int main = 0x456; 40 | } 41 | 42 | public class strings { 43 | public const int first_string = 0xabc; 44 | public const int second_string = 0xbcd; 45 | } 46 | } 47 | 48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main 49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first 50 | string in the dictionary file values/strings.xml. 51 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/layout/Tabbar.axml: -------------------------------------------------------------------------------- 1 | 2 | 12 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/layout/Toolbar.axml: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-anydpi-v26/icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-anydpi-v26/icon_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-hdpi/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-hdpi/Icon.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-hdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-hdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-mdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-mdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xhdpi/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xhdpi/Icon.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xxhdpi/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xxhdpi/Icon.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xxxhdpi/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xxxhdpi/Icon.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #3F51B5 5 | #303F9F 6 | #FF4081 7 | 8 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 26 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.ApplicationModel; 7 | using Windows.ApplicationModel.Activation; 8 | using Windows.Foundation; 9 | using Windows.Foundation.Collections; 10 | using Windows.UI.Xaml; 11 | using Windows.UI.Xaml.Controls; 12 | using Windows.UI.Xaml.Controls.Primitives; 13 | using Windows.UI.Xaml.Data; 14 | using Windows.UI.Xaml.Input; 15 | using Windows.UI.Xaml.Media; 16 | using Windows.UI.Xaml.Navigation; 17 | 18 | namespace FreshMvvmApp.UWP 19 | { 20 | /// 21 | /// Provides application-specific behavior to supplement the default Application class. 22 | /// 23 | sealed partial class App : Application 24 | { 25 | /// 26 | /// Initializes the singleton application object. This is the first line of authored code 27 | /// executed, and as such is the logical equivalent of main() or WinMain(). 28 | /// 29 | public App() 30 | { 31 | this.InitializeComponent(); 32 | this.Suspending += OnSuspending; 33 | } 34 | 35 | /// 36 | /// Invoked when the application is launched normally by the end user. Other entry points 37 | /// will be used such as when the application is launched to open a specific file. 38 | /// 39 | /// Details about the launch request and process. 40 | protected override void OnLaunched(LaunchActivatedEventArgs e) 41 | { 42 | 43 | 44 | Frame rootFrame = Window.Current.Content as Frame; 45 | 46 | // Do not repeat app initialization when the Window already has content, 47 | // just ensure that the window is active 48 | if (rootFrame == null) 49 | { 50 | // Create a Frame to act as the navigation context and navigate to the first page 51 | rootFrame = new Frame(); 52 | 53 | rootFrame.NavigationFailed += OnNavigationFailed; 54 | 55 | Xamarin.Forms.Forms.Init(e); 56 | 57 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 58 | { 59 | //TODO: Load state from previously suspended application 60 | } 61 | 62 | // Place the frame in the current Window 63 | Window.Current.Content = rootFrame; 64 | } 65 | 66 | if (rootFrame.Content == null) 67 | { 68 | // When the navigation stack isn't restored navigate to the first page, 69 | // configuring the new page by passing required information as a navigation 70 | // parameter 71 | rootFrame.Navigate(typeof(MainPage), e.Arguments); 72 | } 73 | // Ensure the current window is active 74 | Window.Current.Activate(); 75 | } 76 | 77 | /// 78 | /// Invoked when Navigation to a certain page fails 79 | /// 80 | /// The Frame which failed navigation 81 | /// Details about the navigation failure 82 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 83 | { 84 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 85 | } 86 | 87 | /// 88 | /// Invoked when application execution is being suspended. Application state is saved 89 | /// without knowing whether the application will be terminated or resumed with the contents 90 | /// of memory still intact. 91 | /// 92 | /// The source of the suspend request. 93 | /// Details about the suspend request. 94 | private void OnSuspending(object sender, SuspendingEventArgs e) 95 | { 96 | var deferral = e.SuspendingOperation.GetDeferral(); 97 | //TODO: Save application state and stop any background activity 98 | deferral.Complete(); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/LargeTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/LargeTile.scale-100.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/LargeTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/LargeTile.scale-200.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/LargeTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/LargeTile.scale-400.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SmallTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SmallTile.scale-100.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SmallTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SmallTile.scale-200.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SmallTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SmallTile.scale-400.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SplashScreen.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/SplashScreen.scale-400.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square150x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square150x150Logo.scale-100.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square150x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square150x150Logo.scale-400.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-16.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-256.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.altform-unplated_targetsize-48.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.scale-100.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.scale-400.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.targetsize-16.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.targetsize-256.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Square44x44Logo.targetsize-48.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/StoreLogo.backup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/StoreLogo.backup.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/StoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/StoreLogo.scale-100.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/StoreLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/StoreLogo.scale-200.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/StoreLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/StoreLogo.scale-400.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Wide310x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Wide310x150Logo.scale-100.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Wide310x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Assets/Wide310x150Logo.scale-400.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/FreshMvvmApp.UWP.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x86 7 | {59D091FA-DD9B-4749-8F47-8E6B5357D4C6} 8 | AppContainerExe 9 | Properties 10 | FreshMvvmApp.UWP 11 | FreshMvvmApp.UWP 12 | en-US 13 | UAP 14 | 10.0.17134.0 15 | 10.0.16299.0 16 | 14 17 | true 18 | 512 19 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 20 | FreshMvvmApp.UWP_TemporaryKey.pfx 21 | 2.2.0 22 | 23 | 24 | true 25 | bin\ARM\Debug\ 26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 27 | ;2008 28 | full 29 | ARM 30 | false 31 | prompt 32 | true 33 | 34 | 35 | bin\ARM\Release\ 36 | TRACE;NETFX_CORE;WINDOWS_UWP 37 | true 38 | ;2008 39 | pdbonly 40 | ARM 41 | false 42 | prompt 43 | true 44 | true 45 | 46 | 47 | true 48 | bin\x64\Debug\ 49 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 50 | ;2008 51 | full 52 | x64 53 | false 54 | prompt 55 | true 56 | 57 | 58 | bin\x64\Release\ 59 | TRACE;NETFX_CORE;WINDOWS_UWP 60 | true 61 | ;2008 62 | pdbonly 63 | x64 64 | false 65 | prompt 66 | true 67 | true 68 | 69 | 70 | true 71 | bin\x86\Debug\ 72 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP 73 | ;2008 74 | full 75 | x86 76 | false 77 | prompt 78 | true 79 | 80 | 81 | bin\x86\Release\ 82 | TRACE;NETFX_CORE;WINDOWS_UWP 83 | true 84 | ;2008 85 | pdbonly 86 | x86 87 | false 88 | prompt 89 | true 90 | true 91 | 92 | 93 | 94 | App.xaml 95 | 96 | 97 | MainPage.xaml 98 | 99 | 100 | 101 | 102 | 103 | Designer 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | MSBuild:Compile 139 | Designer 140 | 141 | 142 | MSBuild:Compile 143 | Designer 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | {65E3B45F-A75E-476A-B16A-DA0461B1530F} 153 | FreshMvvmApp 154 | 155 | 156 | 157 | 14.0 158 | 159 | 160 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | namespace FreshMvvmApp.UWP 17 | { 18 | public sealed partial class MainPage 19 | { 20 | public MainPage() 21 | { 22 | this.InitializeComponent(); 23 | 24 | LoadApplication(new FreshMvvmApp.App()); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | FreshMvvmApp.UWP 18 | ee0ab072-4540-4456-bd65-918b9b5947db 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FreshMvvmApp.UWP")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("FreshMvvmApp.UWP")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.UWP/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace FreshMvvmApp.iOS 9 | { 10 | // The UIApplicationDelegate for the application. This class is responsible for launching the 11 | // User Interface of the application, as well as listening (and optionally responding) to 12 | // application events from iOS. 13 | [Register("AppDelegate")] 14 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 15 | { 16 | // 17 | // This method is invoked when the application has loaded and is ready to run. In this 18 | // method you should instantiate the window, load the UI into it and then make the window 19 | // visible. 20 | // 21 | // You have 17 seconds to return from this method, or iOS will terminate your application. 22 | // 23 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 24 | { 25 | global::Xamarin.Forms.Forms.Init(); 26 | LoadApplication(new App()); 27 | 28 | return base.FinishedLaunching(app, options); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "scale": "2x", 5 | "size": "20x20", 6 | "idiom": "iphone", 7 | "filename": "Icon40.png" 8 | }, 9 | { 10 | "scale": "3x", 11 | "size": "20x20", 12 | "idiom": "iphone", 13 | "filename": "Icon60.png" 14 | }, 15 | { 16 | "scale": "2x", 17 | "size": "29x29", 18 | "idiom": "iphone", 19 | "filename": "Icon58.png" 20 | }, 21 | { 22 | "scale": "3x", 23 | "size": "29x29", 24 | "idiom": "iphone", 25 | "filename": "Icon87.png" 26 | }, 27 | { 28 | "scale": "2x", 29 | "size": "40x40", 30 | "idiom": "iphone", 31 | "filename": "Icon80.png" 32 | }, 33 | { 34 | "scale": "3x", 35 | "size": "40x40", 36 | "idiom": "iphone", 37 | "filename": "Icon120.png" 38 | }, 39 | { 40 | "scale": "2x", 41 | "size": "60x60", 42 | "idiom": "iphone", 43 | "filename": "Icon120.png" 44 | }, 45 | { 46 | "scale": "3x", 47 | "size": "60x60", 48 | "idiom": "iphone", 49 | "filename": "Icon180.png" 50 | }, 51 | { 52 | "scale": "1x", 53 | "size": "20x20", 54 | "idiom": "ipad", 55 | "filename": "Icon20.png" 56 | }, 57 | { 58 | "scale": "2x", 59 | "size": "20x20", 60 | "idiom": "ipad", 61 | "filename": "Icon40.png" 62 | }, 63 | { 64 | "scale": "1x", 65 | "size": "29x29", 66 | "idiom": "ipad", 67 | "filename": "Icon29.png" 68 | }, 69 | { 70 | "scale": "2x", 71 | "size": "29x29", 72 | "idiom": "ipad", 73 | "filename": "Icon58.png" 74 | }, 75 | { 76 | "scale": "1x", 77 | "size": "40x40", 78 | "idiom": "ipad", 79 | "filename": "Icon40.png" 80 | }, 81 | { 82 | "scale": "2x", 83 | "size": "40x40", 84 | "idiom": "ipad", 85 | "filename": "Icon80.png" 86 | }, 87 | { 88 | "scale": "1x", 89 | "size": "76x76", 90 | "idiom": "ipad", 91 | "filename": "Icon76.png" 92 | }, 93 | { 94 | "scale": "2x", 95 | "size": "76x76", 96 | "idiom": "ipad", 97 | "filename": "Icon152.png" 98 | }, 99 | { 100 | "scale": "2x", 101 | "size": "83.5x83.5", 102 | "idiom": "ipad", 103 | "filename": "Icon167.png" 104 | }, 105 | { 106 | "scale": "1x", 107 | "size": "1024x1024", 108 | "idiom": "ios-marketing" 109 | } 110 | ], 111 | "properties": {}, 112 | "info": { 113 | "version": 1, 114 | "author": "xcode" 115 | } 116 | } -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/FreshMvvmApp.iOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | 8.0.30703 7 | 2.0 8 | {5D7F169B-D454-462D-B80E-DF9DE2E05FFF} 9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | {6143fdea-f3c2-4a09-aafa-6e230626515e} 11 | Exe 12 | FreshMvvmApp.iOS 13 | Resources 14 | FreshMvvmApp.iOS 15 | 16 | 17 | 2.2.0 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\iPhoneSimulator\Debug 24 | DEBUG 25 | prompt 26 | 4 27 | false 28 | x86_64 29 | None 30 | true 31 | 32 | 33 | none 34 | true 35 | bin\iPhoneSimulator\Release 36 | prompt 37 | 4 38 | None 39 | x86_64 40 | false 41 | 42 | 43 | true 44 | full 45 | false 46 | bin\iPhone\Debug 47 | DEBUG 48 | prompt 49 | 4 50 | false 51 | ARM64 52 | iPhone Developer 53 | true 54 | Entitlements.plist 55 | 56 | 57 | none 58 | true 59 | bin\iPhone\Release 60 | prompt 61 | 4 62 | ARM64 63 | false 64 | iPhone Developer 65 | Entitlements.plist 66 | 67 | 68 | none 69 | True 70 | bin\iPhone\Ad-Hoc 71 | prompt 72 | 4 73 | False 74 | ARM64 75 | True 76 | Automatic:AdHoc 77 | iPhone Distribution 78 | Entitlements.plist 79 | 80 | 81 | none 82 | True 83 | bin\iPhone\AppStore 84 | prompt 85 | 4 86 | False 87 | ARM64 88 | Automatic:AppStore 89 | iPhone Distribution 90 | Entitlements.plist 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | false 103 | 104 | 105 | false 106 | 107 | 108 | false 109 | 110 | 111 | false 112 | 113 | 114 | false 115 | 116 | 117 | false 118 | 119 | 120 | false 121 | 122 | 123 | false 124 | 125 | 126 | false 127 | 128 | 129 | false 130 | 131 | 132 | false 133 | 134 | 135 | false 136 | 137 | 138 | false 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | {2042ECC6-98FA-4D4F-A924-F9A8924C0E63} 154 | FreshMvvmApp 155 | 156 | 157 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UISupportedInterfaceOrientations 11 | 12 | UIInterfaceOrientationPortrait 13 | UIInterfaceOrientationLandscapeLeft 14 | UIInterfaceOrientationLandscapeRight 15 | 16 | UISupportedInterfaceOrientations~ipad 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationPortraitUpsideDown 20 | UIInterfaceOrientationLandscapeLeft 21 | UIInterfaceOrientationLandscapeRight 22 | 23 | MinimumOSVersion 24 | 8.0 25 | CFBundleDisplayName 26 | FreshMvvmApp 27 | CFBundleIdentifier 28 | com.companyname.FreshMvvmApp 29 | CFBundleVersion 30 | 1.0 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | CFBundleName 34 | FreshMvvmApp 35 | XSAppIconAssets 36 | Assets.xcassets/AppIcon.appiconset 37 | 38 | 39 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace FreshMvvmApp.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, "AppDelegate"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FreshMvvmApp.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("FreshMvvmApp.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.iOS/Resources/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using System.Collections.Generic; 4 | using FreshMvvm; 5 | 6 | namespace FreshMvvmApp 7 | { 8 | public partial class App : Application 9 | { 10 | public App() 11 | { 12 | FreshIOC.Container.Register(); 13 | 14 | MainPage = new NavigationPage(new LaunchPage(this)); 15 | } 16 | 17 | public void LoadBasicNav() 18 | { 19 | var page = FreshPageModelResolver.ResolvePageModel(); 20 | var basicNavContainer = new FreshNavigationContainer(page); 21 | MainPage = basicNavContainer; 22 | } 23 | 24 | public void LoadMasterDetail() 25 | { 26 | var masterDetailNav = new FreshMasterDetailNavigationContainer(); 27 | masterDetailNav.Init("Menu", "Menu.png"); 28 | masterDetailNav.AddPage("Contacts", null); 29 | masterDetailNav.AddPage("Quotes", null); 30 | MainPage = masterDetailNav; 31 | } 32 | 33 | public void LoadTabbedNav() 34 | { 35 | var tabbedNavigation = new FreshTabbedNavigationContainer(); 36 | tabbedNavigation.AddTab("Contacts", "contacts.png", null); 37 | tabbedNavigation.AddTab("Quotes", "document.png", null); 38 | MainPage = tabbedNavigation; 39 | } 40 | 41 | public void LoadFOTabbedNav() 42 | { 43 | var tabbedNavigation = new FreshTabbedFONavigationContainer("CRM"); 44 | tabbedNavigation.AddTab("Contacts", "contacts.png", null); 45 | tabbedNavigation.AddTab("Quotes", "document.png", null); 46 | MainPage = tabbedNavigation; 47 | } 48 | 49 | public void LoadCustomNav() 50 | { 51 | MainPage = new CustomImplementedNav(); 52 | } 53 | 54 | public void LoadMultipleNavigation() 55 | { 56 | var masterDetailsMultiple = new MasterDetailPage(); //generic master detail page 57 | 58 | //we setup the first navigation container with ContactList 59 | var contactListPage = FreshPageModelResolver.ResolvePageModel(); 60 | contactListPage.Title = "Contact List"; 61 | //we setup the first navigation container with name MasterPageArea 62 | var masterPageArea = new FreshNavigationContainer(contactListPage, "MasterPageArea"); 63 | masterPageArea.Title = "Menu"; 64 | 65 | masterDetailsMultiple.Master = masterPageArea; //set the first navigation container to the Master 66 | 67 | //we setup the second navigation container with the QuoteList 68 | var quoteListPage = FreshPageModelResolver.ResolvePageModel(); 69 | quoteListPage.Title = "Quote List"; 70 | //we setup the second navigation container with name DetailPageArea 71 | var detailPageArea = new FreshNavigationContainer(quoteListPage, "DetailPageArea"); 72 | 73 | masterDetailsMultiple.Detail = detailPageArea; //set the second navigation container to the Detail 74 | 75 | MainPage = masterDetailsMultiple; 76 | } 77 | 78 | protected override void OnStart() 79 | { 80 | // Handle when your app starts 81 | } 82 | 83 | protected override void OnSleep() 84 | { 85 | // Handle when your app sleeps 86 | } 87 | 88 | protected override void OnResume() 89 | { 90 | // Handle when your app resumes 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/FodyWeavers.xsd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Used to control if the On_PropertyName_Changed feature is enabled. 12 | 13 | 14 | 15 | 16 | Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form. 17 | 18 | 19 | 20 | 21 | Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project. 22 | 23 | 24 | 25 | 26 | Used to control if equality checks should use the Equals method resolved from the base class. 27 | 28 | 29 | 30 | 31 | Used to control if equality checks should use the static Equals method resolved from the base class. 32 | 33 | 34 | 35 | 36 | Used to turn off build warnings from this weaver. 37 | 38 | 39 | 40 | 41 | Used to turn off build warnings about mismatched On_PropertyName_Changed methods. 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. 50 | 51 | 52 | 53 | 54 | A comma-separated list of error codes that can be safely ignored in assembly verification. 55 | 56 | 57 | 58 | 59 | 'false' to turn off automatic generation of the XML Schema file. 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 2.2.0 6 | latest 7 | 8 | 9 | 10 | 11 | all 12 | runtime; build; native; contentfiles; analyzers 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | MSBuild:Compile 25 | 26 | 27 | MSBuild:Compile 28 | 29 | 30 | MSBuild:Compile 31 | 32 | 33 | MSBuild:Compile 34 | 35 | 36 | MSBuild:Compile 37 | 38 | 39 | MSBuild:Compile 40 | 41 | 42 | 43 | 44 | 45 | MSBuild:Compile 46 | 47 | 48 | MSBuild:Compile 49 | 50 | 51 | MSBuild:Compile 52 | 53 | 54 | MSBuild:Compile 55 | 56 | 57 | MSBuild:Compile 58 | 59 | 60 | MSBuild:Compile 61 | 62 | 63 | MSBuild:Compile 64 | 65 | 66 | MSBuild:Compile 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/LaunchPage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using System.Collections.Generic; 4 | 5 | namespace FreshMvvmApp 6 | { 7 | public class LaunchPage : ContentPage 8 | { 9 | public LaunchPage (App app) 10 | { 11 | Title = "Select Sample"; 12 | var list = new ListView (); 13 | list.ItemsSource = new List { 14 | "Basic Navigation", 15 | "Master Detail", 16 | "Tabbed Navigation", 17 | "Custom Navigation", 18 | "Tabbed (FO) Navigation", 19 | "Multiple Navigation" 20 | }; 21 | list.ItemTapped += (object sender, ItemTappedEventArgs e) => { 22 | if ((string)e.Item == "Basic Navigation") 23 | app.LoadBasicNav (); 24 | else if ((string)e.Item == "Master Detail") 25 | app.LoadMasterDetail (); 26 | else if ((string)e.Item == "Tabbed Navigation") 27 | app.LoadTabbedNav (); 28 | else if ((string)e.Item == "Tabbed (FO) Navigation") 29 | app.LoadFOTabbedNav (); 30 | else if ((string)e.Item == "Custom Navigation") 31 | app.LoadCustomNav (); 32 | else if ((string)e.Item == "Multiple Navigation") 33 | app.LoadMultipleNavigation (); 34 | }; 35 | this.Content = list; 36 | } 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Xamarin.Forms; 7 | 8 | namespace FreshMvvmApp 9 | { 10 | public partial class MainPage : ContentPage 11 | { 12 | public MainPage() 13 | { 14 | InitializeComponent(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Models/Contact.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using PropertyChanged; 3 | 4 | namespace FreshMvvmApp 5 | { 6 | [PropertyChanged.AddINotifyPropertyChangedInterface] 7 | public class Contact 8 | { 9 | public Contact () 10 | { 11 | } 12 | public int Id { get; set; } 13 | 14 | public string Name { get; set; } 15 | 16 | public string Phone { get; set; } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Models/Quote.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using PropertyChanged; 3 | 4 | namespace FreshMvvmApp 5 | { 6 | [PropertyChanged.AddINotifyPropertyChangedInterface] 7 | public class Quote 8 | { 9 | public Quote () 10 | { 11 | } 12 | public int Id { get; set; } 13 | 14 | public string CustomerName { get; set; } 15 | 16 | public string Total { get; set; } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Navigation/CustomImplementedNav.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FreshMvvm; 3 | using Xamarin.Forms; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace FreshMvvmApp 8 | { 9 | /// 10 | /// This is a sample custom implemented Navigation. It combines a MasterDetail and a TabbedPage. 11 | /// 12 | public class CustomImplementedNav : Xamarin.Forms.MasterDetailPage, IFreshNavigationService 13 | { 14 | FreshTabbedNavigationContainer _tabbedNavigationPage; 15 | Page _contactsPage, _quotesPage; 16 | 17 | public CustomImplementedNav () 18 | { 19 | NavigationServiceName = "CustomImplementedNav"; 20 | SetupTabbedPage (); 21 | CreateMenuPage ("Menu"); 22 | RegisterNavigation (); 23 | } 24 | 25 | void SetupTabbedPage() 26 | { 27 | _tabbedNavigationPage = new FreshTabbedNavigationContainer (); 28 | _contactsPage = _tabbedNavigationPage.AddTab ("Contacts", "contacts.png"); 29 | _quotesPage = _tabbedNavigationPage.AddTab ("Quotes", "document.png"); 30 | this.Detail = _tabbedNavigationPage; 31 | } 32 | 33 | protected void RegisterNavigation() 34 | { 35 | FreshIOC.Container.Register (this, NavigationServiceName); 36 | } 37 | 38 | protected void CreateMenuPage(string menuPageTitle) 39 | { 40 | var _menuPage = new ContentPage (); 41 | _menuPage.Title = menuPageTitle; 42 | var listView = new ListView(); 43 | 44 | listView.ItemsSource = new string[] { "Contacts", "Quotes", "Modal Demo" }; 45 | 46 | listView.ItemSelected += async (sender, args) => 47 | { 48 | 49 | switch ((string)args.SelectedItem) { 50 | case "Contacts": 51 | _tabbedNavigationPage.CurrentPage = _contactsPage; 52 | break; 53 | case "Quotes": 54 | _tabbedNavigationPage.CurrentPage = _quotesPage; 55 | break; 56 | case "Modal Demo": 57 | var modalPage = FreshPageModelResolver.ResolvePageModel(); 58 | await PushPage(modalPage, null, true); 59 | break; 60 | default: 61 | break; 62 | } 63 | 64 | IsPresented = false; 65 | }; 66 | 67 | _menuPage.Content = listView; 68 | 69 | Master = new NavigationPage(_menuPage) { Title = "Menu" }; 70 | } 71 | 72 | public virtual async Task PushPage (Xamarin.Forms.Page page, FreshBasePageModel model, bool modal = false, bool animated = true) 73 | { 74 | if (modal) 75 | await Navigation.PushModalAsync (new NavigationPage(page), animated); 76 | else 77 | await ((NavigationPage)_tabbedNavigationPage.CurrentPage).PushAsync (page, animated); 78 | } 79 | 80 | public virtual async Task PopPage (bool modal = false, bool animate = true) 81 | { 82 | if (modal) 83 | await Navigation.PopModalAsync (); 84 | else 85 | await ((NavigationPage)_tabbedNavigationPage.CurrentPage).PopAsync (); 86 | } 87 | 88 | public virtual async Task PopToRoot (bool animate = true) 89 | { 90 | await ((NavigationPage)_tabbedNavigationPage.CurrentPage).PopToRootAsync (animate); 91 | } 92 | 93 | public string NavigationServiceName { get; private set; } 94 | 95 | public void NotifyChildrenPageWasPopped() 96 | { 97 | if (Master is NavigationPage) 98 | ((NavigationPage)Master).NotifyAllChildrenPopped(); 99 | foreach (var page in _tabbedNavigationPage.Children) 100 | { 101 | if (page is NavigationPage) 102 | ((NavigationPage)page).NotifyAllChildrenPopped(); 103 | } 104 | } 105 | 106 | public Task SwitchSelectedRootPageModel () where T : FreshBasePageModel 107 | { 108 | if (_contactsPage.GetModel ().GetType ().FullName == typeof (T).FullName) { 109 | _tabbedNavigationPage.CurrentPage = _contactsPage; 110 | return Task.FromResult(_contactsPage.GetModel ()); 111 | } 112 | 113 | if (_quotesPage.GetModel ().GetType ().FullName == typeof (T).FullName) { 114 | _tabbedNavigationPage.CurrentPage = _quotesPage; 115 | return Task.FromResult(_quotesPage.GetModel ()); 116 | } 117 | 118 | throw new Exception ("Cannot do this"); 119 | } 120 | } 121 | } 122 | 123 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/PageModels/ContactListPageModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using PropertyChanged; 4 | using System.Collections.ObjectModel; 5 | using FreshMvvm; 6 | using System.Diagnostics.Contracts; 7 | using System.Linq; 8 | using System.Windows.Input; 9 | 10 | namespace FreshMvvmApp 11 | { 12 | [PropertyChanged.AddINotifyPropertyChangedInterface] 13 | public class ContactListPageModel : FreshBasePageModel 14 | { 15 | IDatabaseService _databaseService; 16 | 17 | public ContactListPageModel (IDatabaseService databaseService) 18 | { 19 | _databaseService = databaseService; 20 | } 21 | 22 | public ObservableCollection Contacts { get; set; } 23 | 24 | public override void Init (object initData) 25 | { 26 | Contacts = new ObservableCollection (_databaseService.GetContacts ()); 27 | } 28 | 29 | protected override void ViewIsAppearing (object sender, EventArgs e) 30 | { 31 | base.ViewIsAppearing(sender, e); 32 | } 33 | 34 | public override void ReverseInit (object value) 35 | { 36 | var newContact = value as Contact; 37 | if (!Contacts.Contains (newContact)) { 38 | Contacts.Add (newContact); 39 | } 40 | } 41 | 42 | Contact _selectedContact; 43 | 44 | public Contact SelectedContact { 45 | get { 46 | return _selectedContact; 47 | } 48 | set { 49 | _selectedContact = value; 50 | if (value != null) 51 | ContactSelected.Execute (value); 52 | } 53 | } 54 | 55 | public Command AddContact { 56 | get { 57 | return new Command (async () => { 58 | await CoreMethods.PushPageModel (); 59 | }); 60 | } 61 | } 62 | 63 | public Command ContactSelected { 64 | get { 65 | return new Command (async (contact) => { 66 | await CoreMethods.PushPageModel (contact); 67 | }); 68 | } 69 | } 70 | 71 | public ICommand OpenFirst 72 | { 73 | get 74 | { 75 | return new FreshAwaitCommand(async (contact, tcs) => 76 | { 77 | await CoreMethods.PushPageModel(this.Contacts.First()); 78 | tcs.SetResult(true); 79 | }); 80 | } 81 | } 82 | } 83 | } 84 | 85 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/PageModels/ContactPageModel.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | using PropertyChanged; 3 | using FreshMvvm; 4 | using System; 5 | 6 | namespace FreshMvvmApp 7 | { 8 | [PropertyChanged.AddINotifyPropertyChangedInterface] 9 | public class ContactPageModel : FreshBasePageModel 10 | { 11 | IDatabaseService _dataService; 12 | 13 | public ContactPageModel (IDatabaseService dataService) 14 | { 15 | _dataService = dataService; 16 | 17 | this.WhenAny(HandleContactChanged, o => o.Contact); 18 | } 19 | 20 | void HandleContactChanged(string propertyName) 21 | { 22 | //handle the property changed, nice 23 | } 24 | 25 | public Contact Contact { get; set; } 26 | 27 | public override void Init (object initData) 28 | { 29 | if (initData != null) { 30 | Contact = (Contact)initData; 31 | } else { 32 | Contact = new Contact (); 33 | } 34 | } 35 | 36 | public Command SaveCommand { 37 | get { 38 | return new Command (() => { 39 | _dataService.UpdateContact (Contact); 40 | CoreMethods.PopPageModel (Contact); 41 | } 42 | ); 43 | } 44 | } 45 | 46 | public Command TestModal { 47 | get { 48 | return new Command (async () => { 49 | await CoreMethods.PushPageModel (null, true); 50 | }); 51 | } 52 | } 53 | 54 | public Command TestModalNavigationBasic { 55 | get { 56 | return new Command (async () => { 57 | 58 | var page = FreshPageModelResolver.ResolvePageModel (); 59 | var basicNavContainer = new FreshNavigationContainer (page, Guid.NewGuid ().ToString ()); 60 | await CoreMethods.PushNewNavigationServiceModal(basicNavContainer, new FreshBasePageModel[] { page.GetModel() }); 61 | }); 62 | } 63 | } 64 | 65 | 66 | public Command TestModalNavigationTabbed { 67 | get { 68 | return new Command (async () => { 69 | 70 | var tabbedNavigation = new FreshTabbedNavigationContainer (Guid.NewGuid ().ToString ()); 71 | tabbedNavigation.AddTab ("Contacts", "contacts.png", null); 72 | tabbedNavigation.AddTab ("Quotes", "document.png", null); 73 | await CoreMethods.PushNewNavigationServiceModal(tabbedNavigation); 74 | }); 75 | } 76 | } 77 | 78 | public Command TestModalNavigationMasterDetail { 79 | get { 80 | return new Command (async () => { 81 | 82 | var masterDetailNav = new FreshMasterDetailNavigationContainer (Guid.NewGuid ().ToString ()); 83 | masterDetailNav.Init ("Menu", "Menu.png"); 84 | masterDetailNav.AddPage ("Contacts", null); 85 | masterDetailNav.AddPage ("Quotes", null); 86 | await CoreMethods.PushNewNavigationServiceModal(masterDetailNav); 87 | 88 | }); 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/PageModels/MainMenuPageModel.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | using FreshMvvm; 3 | 4 | namespace FreshMvvmApp 5 | { 6 | public class MainMenuPageModel : FreshBasePageModel 7 | { 8 | public MainMenuPageModel () 9 | { 10 | } 11 | 12 | public Command ShowQuotes { 13 | get { 14 | return new Command (async () => { 15 | await CoreMethods.PushPageModel (); 16 | }); 17 | } 18 | } 19 | 20 | public Command ShowContacts { 21 | get { 22 | return new Command (async () => { 23 | await CoreMethods.PushPageModel (); 24 | }); 25 | } 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/PageModels/ModalPageModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FreshMvvm; 3 | using Xamarin.Forms; 4 | 5 | namespace FreshMvvmApp 6 | { 7 | public class ModalPageModel : FreshBasePageModel 8 | { 9 | public ModalPageModel () 10 | { 11 | } 12 | 13 | public Command CloseCommand { 14 | get { 15 | return new Command (() => { 16 | CoreMethods.PopPageModel (true); 17 | }); 18 | } 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/PageModels/QuoteListPageModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using Xamarin.Forms; 3 | using FreshMvvm; 4 | using PropertyChanged; 5 | using System.Diagnostics; 6 | using System; 7 | 8 | namespace FreshMvvmApp 9 | { 10 | [PropertyChanged.AddINotifyPropertyChangedInterface] 11 | public class QuoteListPageModel : FreshBasePageModel 12 | { 13 | IDatabaseService _databaseService; 14 | 15 | public QuoteListPageModel (IDatabaseService databaseService) 16 | { 17 | _databaseService = databaseService; 18 | } 19 | 20 | public ObservableCollection Quotes { get; set; } 21 | 22 | public override void Init (object initData) 23 | { 24 | Quotes = new ObservableCollection (_databaseService.GetQuotes ()); 25 | } 26 | 27 | protected override void ViewIsAppearing (object sender, System.EventArgs e) 28 | { 29 | Debug.WriteLine ("View is appearing"); 30 | base.ViewIsAppearing (sender, e); 31 | } 32 | 33 | protected override void ViewIsDisappearing (object sender, System.EventArgs e) 34 | { 35 | base.ViewIsDisappearing (sender, e); 36 | } 37 | 38 | public override void ReverseInit (object value) 39 | { 40 | var newContact = value as Quote; 41 | if (!Quotes.Contains (newContact)) { 42 | Quotes.Add (newContact); 43 | } 44 | } 45 | 46 | public Command AddQuote { 47 | get { 48 | return new Command (async () => { 49 | await CoreMethods.PushPageModel (); 50 | }); 51 | } 52 | } 53 | 54 | Quote _selectedQuote; 55 | 56 | public Quote SelectedQuote { 57 | get { 58 | return _selectedQuote; 59 | } 60 | set { 61 | _selectedQuote = value; 62 | if (value != null) 63 | QuoteSelected.Execute (value); 64 | } 65 | } 66 | 67 | public Command QuoteSelected => new Command(async (quote) => 68 | { 69 | await CoreMethods.PushPageModel(vm => vm.Quote = quote); 70 | }); 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/PageModels/QuotePageModel.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | using FreshMvvm; 3 | 4 | namespace FreshMvvmApp 5 | { 6 | [PropertyChanged.AddINotifyPropertyChangedInterface] 7 | public class QuotePageModel : FreshBasePageModel 8 | { 9 | IDatabaseService _databaseService; 10 | 11 | public Quote Quote { get; set; } 12 | 13 | public QuotePageModel (IDatabaseService databaseService) 14 | { 15 | _databaseService = databaseService; 16 | } 17 | 18 | public Command SaveCommand { 19 | get { 20 | return new Command (async () => { 21 | _databaseService.UpdateQuote (Quote); 22 | await CoreMethods.PopPageModel (Quote); 23 | }); 24 | } 25 | } 26 | 27 | public Command TestModal { 28 | get { 29 | return new Command (async () => { 30 | await CoreMethods.PushPageModel (null, true); 31 | }); 32 | } 33 | } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/BasePage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using System.ComponentModel; 4 | 5 | namespace FreshMvvmApp 6 | { 7 | public class BasePage : ContentPage 8 | { 9 | public BasePage () 10 | { 11 | ToolbarItems.Add (new ToolbarItem ("", "Home.png", () => { 12 | Application.Current.MainPage = new NavigationPage (new LaunchPage ((App)Application.Current)); 13 | })); 14 | } 15 | 16 | protected override void OnAppearing () 17 | { 18 | base.OnAppearing (); 19 | 20 | var basePageModel = this.BindingContext as FreshMvvm.FreshBasePageModel; 21 | if (basePageModel != null) { 22 | if (basePageModel.IsModalAndHasPreviousNavigationStack ()) { 23 | if (ToolbarItems.Count < 2) 24 | { 25 | var closeModal = new ToolbarItem ("Close Modal", "", () => { 26 | basePageModel.CoreMethods.PopModalNavigationService(); 27 | }); 28 | 29 | ToolbarItems.Add (closeModal); 30 | } 31 | } 32 | } 33 | } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/ContactListPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/ContactListPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Xamarin.Forms; 5 | 6 | namespace FreshMvvmApp 7 | { 8 | public partial class ContactListPage : BasePage 9 | { 10 | public ContactListPage () 11 | { 12 | InitializeComponent (); 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/ContactPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/ContactPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Xamarin.Forms; 5 | 6 | namespace FreshMvvmApp 7 | { 8 | public partial class ContactPage : BasePage 9 | { 10 | public ContactPage () 11 | { 12 | InitializeComponent (); 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/MainMenuPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/MainMenuPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Xamarin.Forms; 5 | 6 | namespace FreshMvvmApp 7 | { 8 | public partial class MainMenuPage : BasePage 9 | { 10 | public MainMenuPage () 11 | { 12 | InitializeComponent (); 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/ModalPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/ModalPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Xamarin.Forms; 5 | 6 | namespace FreshMvvmApp 7 | { 8 | public partial class ModalPage : ContentPage 9 | { 10 | public ModalPage () 11 | { 12 | InitializeComponent (); 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/QuoteListPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/QuoteListPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Xamarin.Forms; 5 | 6 | namespace FreshMvvmApp 7 | { 8 | public partial class QuoteListPage : BasePage 9 | { 10 | public QuoteListPage () 11 | { 12 | InitializeComponent (); 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/QuotePage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Pages/QuotePage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | using Xamarin.Forms; 5 | 6 | namespace FreshMvvmApp 7 | { 8 | public partial class QuotePage : BasePage 9 | { 10 | public QuotePage () 11 | { 12 | InitializeComponent (); 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Services/DatabaseService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace FreshMvvmApp 5 | { 6 | public class DatabaseService : IDatabaseService 7 | { 8 | private List _contacts; 9 | private List _quotes; 10 | 11 | public DatabaseService () 12 | { 13 | _contacts = InitContacts(); 14 | _quotes = InitQuotes(); 15 | } 16 | 17 | public void UpdateContact (Contact contact) 18 | { 19 | if (contact.Id == 0) 20 | { 21 | contact.Id = _contacts.Count + 1; 22 | _contacts.Add(contact); 23 | } 24 | else 25 | { 26 | var oldContact = _contacts.Find(c => c.Id == contact.Id); 27 | oldContact.Name = contact.Name; 28 | oldContact.Phone = contact.Phone; 29 | } 30 | } 31 | 32 | public void UpdateQuote (Quote quote) 33 | { 34 | if (quote.Id == 0) 35 | { 36 | quote.Id = _quotes.Count + 1; 37 | _quotes.Add(quote); 38 | } 39 | else 40 | { 41 | var oldQuote = _quotes.Find(c => c.Id == quote.Id); 42 | oldQuote.CustomerName = quote.CustomerName; 43 | oldQuote.Total = quote.Total; 44 | } 45 | } 46 | 47 | public List GetContacts () 48 | { 49 | return _contacts; 50 | } 51 | 52 | public List GetQuotes () 53 | { 54 | return _quotes; 55 | } 56 | 57 | private List InitContacts () 58 | { 59 | return new List { 60 | new Contact { Id = 1, Name = "Xam Consulting", Phone = "0404 865 350" }, 61 | new Contact { Id = 2, Name = "Michael Ridland", Phone = "0404 865 350" }, 62 | new Contact { Id = 3, Name = "Thunder Apps", Phone = "0404 865 350" }, 63 | }; 64 | } 65 | 66 | private List InitQuotes () 67 | { 68 | return new List { 69 | new Quote { Id = 1, CustomerName = "Xam Consulting", Total = "$350.00" }, 70 | new Quote { Id = 2, CustomerName = "Michael Ridland", Total = "$3503.00" }, 71 | new Quote { Id = 3, CustomerName = "Thunder Apps", Total = "$3504.00" }, 72 | }; 73 | } 74 | } 75 | } 76 | 77 | -------------------------------------------------------------------------------- /samples/FreshMvvmApp/FreshMvvmApp/FreshMvvmApp/Services/IDatabaseService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace FreshMvvmApp 5 | { 6 | public interface IDatabaseService 7 | { 8 | List GetContacts (); 9 | 10 | void UpdateContact (Contact contact); 11 | 12 | List GetQuotes (); 13 | 14 | void UpdateQuote (Quote quote); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/FreshIOC/IOC.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | netstandard2.0 4 | FreshIOC 5 | IOC 6 | 1.0.* 7 | michaelridland 8 | false 9 | 2.2.0 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/FreshIOC/IRegisterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | namespace FreshMvvm 5 | { 6 | public interface IRegisterOptions 7 | { 8 | IRegisterOptions AsSingleton(); 9 | IRegisterOptions AsMultiInstance(); 10 | IRegisterOptions WithWeakReference(); 11 | IRegisterOptions WithStrongReference(); 12 | IRegisterOptions UsingConstructor(Expression> constructor); 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Fixtures/FreshBasePageModelFixture.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using FreshMvvm.Tests.Mocks; 3 | using NUnit.Framework; 4 | 5 | namespace FreshMvvm.Tests.Fixtures 6 | { 7 | [TestFixture] 8 | public class FreshBasePageModelTests 9 | { 10 | [Test] 11 | public void Test_ImplementationINotifyPropertyChanged() 12 | { 13 | var viewModel = new MockFreshBasePageModel(); 14 | 15 | Assert.IsInstanceOf(viewModel); 16 | } 17 | 18 | [TestCase("test name")] 19 | public void Test_RaisePropertyChanged(string name) 20 | { 21 | string actual = null; 22 | var viewModel = new MockFreshBasePageModel(); 23 | viewModel.PropertyChanged += (s, e) => 24 | { 25 | actual = e.PropertyName; 26 | }; 27 | 28 | viewModel.Name = name; 29 | 30 | Assert.IsNotNull(actual); 31 | Assert.AreEqual("Name", actual); 32 | Assert.AreEqual(name, viewModel.Name); 33 | } 34 | 35 | [TestCase("default name", "new name")] 36 | public void Test_Init(string defaultValue, string newValue) 37 | { 38 | var viewModel = new MockFreshBasePageModel { Name = defaultValue }; 39 | 40 | viewModel.Init(newValue); 41 | 42 | Assert.AreEqual(newValue, viewModel.Name); 43 | } 44 | 45 | [TestCase("default name", "new name")] 46 | public void Test_ReverseInit(string defaultValue, string newValue) 47 | { 48 | var viewModel = new MockFreshBasePageModel { Name = defaultValue }; 49 | 50 | viewModel.ReverseInit(newValue); 51 | 52 | Assert.AreEqual(newValue, viewModel.Name); 53 | } 54 | 55 | [Test] 56 | public void Test_CurrentPage_Property() 57 | { 58 | var viewModel = new MockFreshBasePageModel(); 59 | var page = new MockContentPage(); 60 | page.BindingContext = viewModel; 61 | 62 | viewModel.CurrentPage = page; 63 | 64 | Assert.IsNotNull(viewModel.CurrentPage); 65 | Assert.AreEqual(page, viewModel.CurrentPage); 66 | } 67 | 68 | [Test] 69 | public void Test_PreviousPageModel_Property() 70 | { 71 | var viewModel = new MockFreshBasePageModel(); 72 | var prevViewModel = new MockFreshBasePageModel(); 73 | 74 | viewModel.PreviousPageModel = prevViewModel; 75 | 76 | Assert.IsNotNull(viewModel.PreviousPageModel); 77 | Assert.AreEqual(prevViewModel, viewModel.PreviousPageModel); 78 | } 79 | 80 | [Test] 81 | public void Test_CoreMethods_Property() 82 | { 83 | var viewModel = new MockFreshBasePageModel(); 84 | var methods = new MockPageModelCoreMethods(); 85 | 86 | viewModel.CoreMethods = methods; 87 | 88 | Assert.IsNotNull(viewModel.CoreMethods); 89 | Assert.AreEqual(methods, viewModel.CoreMethods); 90 | } 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Fixtures/FreshIOCFixture.cs: -------------------------------------------------------------------------------- 1 | using FreshTinyIoC; 2 | using NUnit.Framework; 3 | 4 | namespace FreshMvvm.Tests.Fixtures 5 | { 6 | [TestFixture] 7 | class FreshIocTests 8 | { 9 | [Test] 10 | public void Test_Get_IoC_Container() 11 | { 12 | var container = FreshIOC.Container; 13 | 14 | Assert.That(container, Is.Not.Null); 15 | Assert.That(container, Is.TypeOf()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Fixtures/FreshMasterDetailNavigationContainerFixture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using NUnit.Framework; 7 | 8 | namespace FreshMvvm.Tests.Fixtures 9 | { 10 | [TestFixture] 11 | class FreshMasterDetailNavigationContainerFixture 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Fixtures/FreshNavigationContainerFixture.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using FreshMvvm.Tests.Mocks; 4 | using NUnit.Framework; 5 | 6 | namespace FreshMvvm.Tests.Fixtures 7 | { 8 | [TestFixture] 9 | class FreshNavigationContainerFixture 10 | { 11 | [Test] 12 | public void Test_Register_IFreshNavigationService() 13 | { 14 | var page = new MockContentPage(); 15 | page.BindingContext = new MockContentPageModel(); 16 | 17 | var navigation = new FreshNavigationContainer(page); 18 | var navigationService = FreshIOC.Container.Resolve(Constants.DefaultNavigationServiceName); 19 | 20 | Assert.IsNotNull(navigationService); 21 | Assert.AreEqual(navigation, navigationService); 22 | } 23 | 24 | [Test] 25 | public async Task Test_PushPage() 26 | { 27 | var mainPageViewModel = new MockFreshBasePageModel(); 28 | var mainPage = new MockContentPage(); 29 | mainPage.BindingContext = new MockContentPageModel(); 30 | 31 | var detailsPage = new MockContentPage(); 32 | detailsPage.BindingContext = new MockContentPageModel(); 33 | 34 | var navigation = new FreshNavigationContainer(mainPage); 35 | 36 | await navigation.PushPage(detailsPage, mainPageViewModel); 37 | 38 | var page = navigation.Navigation.NavigationStack.FirstOrDefault(p => p.Id.Equals(detailsPage.Id)); 39 | 40 | Assert.IsNotNull(page); 41 | Assert.AreSame(detailsPage, page); 42 | } 43 | 44 | [Test] 45 | public async Task Test_PushPage_Modal() 46 | { 47 | var mainPageViewModel = new MockFreshBasePageModel(); 48 | var mainPage = new MockContentPage(); 49 | mainPage.BindingContext = new MockContentPageModel(); 50 | 51 | var detailsPage = new MockContentPage(); 52 | detailsPage.BindingContext = new MockContentPageModel(); 53 | 54 | var navigation = new FreshNavigationContainer(mainPage); 55 | 56 | Assert.That(navigation.Navigation.ModalStack.Count, Is.EqualTo(0)); 57 | 58 | await navigation.PushPage(detailsPage, mainPageViewModel, true); 59 | 60 | Assert.That(navigation.Navigation.ModalStack.Count, Is.EqualTo(1)); 61 | } 62 | 63 | [Test] 64 | public async Task Test_PopPage() 65 | { 66 | var mainPageViewModel = new MockFreshBasePageModel(); 67 | var mainPage = new MockContentPage(); 68 | mainPage.BindingContext = new MockContentPageModel(); 69 | 70 | var detailsPage = new MockContentPage(); 71 | detailsPage.BindingContext = new MockContentPageModel(); 72 | 73 | var navigation = new FreshNavigationContainer(mainPage); 74 | 75 | await navigation.PushPage(detailsPage, mainPageViewModel); 76 | await navigation.PopPage(); 77 | 78 | var page = navigation.Navigation.NavigationStack.FirstOrDefault(p => p.Id.Equals(detailsPage.Id)); 79 | var firstPage = navigation.Navigation.NavigationStack.FirstOrDefault(); 80 | 81 | Assert.IsNull(page); 82 | Assert.IsNotNull(firstPage); 83 | Assert.AreSame(mainPage, firstPage); 84 | } 85 | 86 | [Test] 87 | public async Task Test_PopPage_Modal() 88 | { 89 | var mainPageViewModel = new MockFreshBasePageModel(); 90 | var mainPage = new MockContentPage(); 91 | mainPage.BindingContext = new MockContentPageModel(); 92 | 93 | var detailsPage = new MockContentPage(); 94 | detailsPage.BindingContext = new MockContentPageModel(); 95 | 96 | var navigation = new FreshNavigationContainer(mainPage); 97 | 98 | await navigation.PushPage(detailsPage, mainPageViewModel, true); 99 | 100 | Assert.That(navigation.Navigation.ModalStack.Count, Is.EqualTo(1)); 101 | 102 | await navigation.PopPage(true); 103 | 104 | Assert.That(navigation.Navigation.ModalStack.Count, Is.EqualTo(0)); 105 | } 106 | 107 | [Test] 108 | public async Task Test_PopToRoot() 109 | { 110 | var mainPage = new MockContentPage(); 111 | mainPage.BindingContext = new MockContentPageModel(); 112 | var navigation = new FreshNavigationContainer(mainPage); 113 | 114 | await navigation.PushPage(new MockContentPage {BindingContext = new MockContentPageModel() }, new MockFreshBasePageModel()); 115 | await navigation.PushPage(new MockContentPage { BindingContext = new MockContentPageModel() }, new MockFreshBasePageModel()); 116 | await navigation.PopToRoot(); 117 | 118 | var firstPage = navigation.Navigation.NavigationStack.FirstOrDefault(); 119 | 120 | Assert.IsNotNull(firstPage); 121 | Assert.AreSame(mainPage, firstPage); 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Fixtures/FreshPageModelResolverFixture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FreshMvvm.Tests.Mocks; 3 | using NUnit.Framework; 4 | 5 | namespace FreshMvvm.Tests.Fixtures 6 | { 7 | [TestFixture] 8 | public class FreshPageModelResolverFixture 9 | { 10 | [TestCase] 11 | public void Test_ResolvePageModel_Not_Found() 12 | { 13 | Assert.Throws(() => 14 | { 15 | FreshPageModelResolver.ResolvePageModel(); 16 | }); 17 | } 18 | 19 | [TestCase] 20 | public void Test_ResolvePageModel() 21 | { 22 | var page = FreshPageModelResolver.ResolvePageModel(); 23 | var context = page.BindingContext as MockContentPageModel; 24 | 25 | Assert.IsNotNull(context); 26 | Assert.IsNotNull(context.CurrentPage); 27 | Assert.IsNotNull(context.CoreMethods); 28 | } 29 | 30 | [TestCase("test data")] 31 | public void Test_ResolvePageModel_With_Init(object data) 32 | { 33 | var page = FreshPageModelResolver.ResolvePageModel(data); 34 | var context = page.BindingContext as MockContentPageModel; 35 | 36 | Assert.IsNotNull(context); 37 | Assert.IsNotNull(context.CurrentPage); 38 | Assert.IsNotNull(context.CoreMethods); 39 | Assert.AreSame(data, context.Data); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Fixtures/FreshTabbedNavigationContainerFixture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using NUnit.Framework; 7 | 8 | namespace FreshMvvm.Tests.Fixtures 9 | { 10 | [TestFixture] 11 | class FreshTabbedNavigationContainerFixture 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Fixtures/PageModelCoreMethodsFixture.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using FreshMvvm.Tests.Mocks; 3 | using NSubstitute; 4 | using NUnit.Framework; 5 | using Xamarin.Forms; 6 | 7 | namespace FreshMvvm.Tests.Fixtures 8 | { 9 | [TestFixture] 10 | class PageModelCoreMethodsFixture 11 | { 12 | PageModelCoreMethods _coreMethods; 13 | IFreshNavigationService _navigationMock; 14 | Page _page; 15 | FreshBasePageModel _pageModel; 16 | 17 | void SetupFirstNavigationAndPage() 18 | { 19 | _navigationMock = Substitute.For(); 20 | FreshIOC.Container.Register(_navigationMock, "firstNav"); 21 | 22 | _page = FreshPageModelResolver.ResolvePageModel(); 23 | _pageModel = _page.BindingContext as MockContentPageModel; 24 | _pageModel.CurrentNavigationServiceName = "firstNav"; 25 | 26 | 27 | _coreMethods = new PageModelCoreMethods(_page, _pageModel); 28 | } 29 | 30 | [Test] 31 | public async Task model_property_populated_by_action() 32 | { 33 | SetupFirstNavigationAndPage(); 34 | 35 | const string item = "asj"; 36 | await _coreMethods.PushPageModel(pm => pm.Item = item); 37 | 38 | _navigationMock.Received().PushPage(Arg.Any(), Arg.Is(o => o.Item == item), Arg.Any(), Arg.Any()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/FreshMvvm.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {6344C1A9-FF3B-43BB-B8AE-4F89B4BC2075} 9 | Library 10 | FreshMvvm.Tests 11 | FreshMvvm.Tests 12 | v4.7.1 13 | 2.2.0 14 | 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug 23 | DEBUG; 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | full 30 | true 31 | bin\Release 32 | prompt 33 | 4 34 | false 35 | 36 | 37 | 38 | 39 | 40 | 41 | ..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll 42 | 43 | 44 | ..\packages\FluentAssertions.5.6.0\lib\net45\FluentAssertions.dll 45 | 46 | 47 | ..\packages\Moq.4.10.1\lib\net45\Moq.dll 48 | 49 | 50 | ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll 51 | 52 | 53 | 54 | ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll 55 | 56 | 57 | ..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll 58 | 59 | 60 | ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll 61 | 62 | 63 | 64 | 65 | 66 | ..\packages\NSubstitute.3.1.0\lib\net45\NSubstitute.dll 67 | 68 | 69 | 70 | ..\packages\Xamarin.Forms.3.4.0.1009999\lib\netstandard2.0\Xamarin.Forms.Core.dll 71 | 72 | 73 | ..\packages\Xamarin.Forms.3.4.0.1009999\lib\netstandard2.0\Xamarin.Forms.Platform.dll 74 | 75 | 76 | ..\packages\Xamarin.Forms.3.4.0.1009999\lib\netstandard2.0\Xamarin.Forms.Xaml.dll 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | {CE6AA8F2-BD67-4051-8AE6-9FFCA9E663FE} 100 | IOC 101 | 102 | 103 | {acba1111-2c39-4126-b60a-51ee9d0c734b} 104 | FreshMvvm 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Helpers/Helper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | 4 | namespace FreshMvvm.Tests 5 | { 6 | public static class HelperExtensions 7 | { 8 | public static Page GetPageFromNav(this Page page) 9 | { 10 | return (page as NavigationPage).CurrentPage; 11 | } 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Mocks.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FreshMvvm.Tests 4 | { 5 | public class Mocks 6 | { 7 | public Mocks () 8 | { 9 | } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Mocks/MockContentPage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Xamarin.Forms; 7 | 8 | namespace FreshMvvm.Tests.Mocks 9 | { 10 | class MockContentPage : ContentPage 11 | { 12 | public MockContentPage() 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Mocks/MockContentPageModel.cs: -------------------------------------------------------------------------------- 1 | namespace FreshMvvm.Tests.Mocks 2 | { 3 | class MockContentPageModel : MockFreshBasePageModel 4 | { 5 | public object Data { get; set; } 6 | 7 | 8 | public override void Init(object initData) 9 | { 10 | base.Init(initData); 11 | 12 | if (initData != null) 13 | { 14 | Data = initData; 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Mocks/MockFreshBasePageModel.cs: -------------------------------------------------------------------------------- 1 | namespace FreshMvvm.Tests 2 | { 3 | public class MockFreshBasePageModel : FreshBasePageModel 4 | { 5 | private string _name; 6 | 7 | public string Name 8 | { 9 | get 10 | { 11 | return _name; 12 | } 13 | 14 | set 15 | { 16 | _name = value; 17 | RaisePropertyChanged(); 18 | } 19 | } 20 | 21 | public override void Init(object initData) 22 | { 23 | base.Init(initData); 24 | 25 | Name = initData as string; 26 | } 27 | 28 | public override void ReverseInit(object returndData) 29 | { 30 | base.ReverseInit(returndData); 31 | 32 | Name = returndData as string; 33 | } 34 | 35 | public MockFreshBasePageModel() 36 | { 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Mocks/MockItemPage.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | 3 | namespace FreshMvvm.Tests.Mocks 4 | { 5 | public class MockItemPage : ContentPage 6 | { 7 | public MockItemPage() 8 | { 9 | 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Mocks/MockItemPageModel.cs: -------------------------------------------------------------------------------- 1 | namespace FreshMvvm.Tests.Mocks 2 | { 3 | public class MockItemPageModel : MockFreshBasePageModel 4 | { 5 | public string Item { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/Mocks/MockPageModelCoreMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Xamarin.Forms; 4 | 5 | namespace FreshMvvm.Tests.Mocks 6 | { 7 | class MockPageModelCoreMethods : IPageModelCoreMethods 8 | { 9 | public void SwitchOutRootNavigation(string navigationServiceName) 10 | { 11 | throw new NotImplementedException(); 12 | } 13 | 14 | public void BatchBegin() 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | 19 | public void BatchCommit() 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | 24 | public Task PushPageModel(Action setPageModel, bool modal = false, bool animate = true) where T : FreshBasePageModel 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | 29 | public Task DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons) 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | 34 | public Task DisplayAlert(string title, string message, string cancel) 35 | { 36 | throw new NotImplementedException(); 37 | } 38 | 39 | public Task DisplayAlert(string title, string message, string accept, string cancel) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | 44 | public Task PushPageModel(object data, bool modal = false) where T : FreshBasePageModel where TPage : Xamarin.Forms.Page 45 | { 46 | throw new NotImplementedException(); 47 | } 48 | 49 | public Task PushPageModel() where T : FreshBasePageModel where TPage : Xamarin.Forms.Page 50 | { 51 | throw new NotImplementedException(); 52 | } 53 | 54 | public Task PushNewNavigationServiceModal(FreshTabbedNavigationContainer tabbedNavigationContainer, FreshBasePageModel basePageModel = null) 55 | { 56 | throw new NotImplementedException(); 57 | } 58 | 59 | public Task PushNewNavigationServiceModal(FreshMasterDetailNavigationContainer masterDetailContainer, FreshBasePageModel basePageModel = null) 60 | { 61 | throw new NotImplementedException(); 62 | } 63 | 64 | public Task PopPageModel(bool modal = false) 65 | { 66 | throw new NotImplementedException(); 67 | } 68 | 69 | public Task PopPageModel(object data, bool modal = false) 70 | { 71 | throw new NotImplementedException(); 72 | } 73 | 74 | public Task PopToRoot(bool animate) 75 | { 76 | throw new NotImplementedException(); 77 | } 78 | 79 | public Task PushPageModel(Type pageModelType) 80 | { 81 | throw new NotImplementedException(); 82 | } 83 | 84 | public Task PushPageModel(Type pageModelType, object data, bool modal = false) 85 | { 86 | throw new NotImplementedException(); 87 | } 88 | 89 | public Task PushPageModel() where T : FreshBasePageModel 90 | { 91 | throw new NotImplementedException(); 92 | } 93 | 94 | public Task PushPageModel(object data, bool modal = false) where T : FreshBasePageModel 95 | { 96 | throw new NotImplementedException(); 97 | } 98 | 99 | public Task PushNewNavigationServiceModal (IFreshNavigationService newNavigationService, FreshBasePageModel[] basePageModels) 100 | { 101 | throw new NotImplementedException (); 102 | } 103 | 104 | public Task PopModalNavigationService () 105 | { 106 | throw new NotImplementedException (); 107 | } 108 | 109 | public Task PushNewNavigationServiceModal (FreshTabbedNavigationContainer tabbedNavigationContainer) 110 | { 111 | throw new NotImplementedException (); 112 | } 113 | 114 | public Task PushNewNavigationServiceModal (FreshMasterDetailNavigationContainer masterDetailContainer) 115 | { 116 | throw new NotImplementedException (); 117 | } 118 | 119 | public Task PushNewNavigationServiceModal (IFreshNavigationService newNavigationService, FreshBasePageModel basePageModels) 120 | { 121 | throw new NotImplementedException (); 122 | } 123 | 124 | public Task PushPageModel(object data, bool modal = false, bool animate = true) where T : FreshBasePageModel 125 | { 126 | throw new NotImplementedException(); 127 | } 128 | 129 | public Task PushPageModel(object data, bool modal = false, bool animate = true) 130 | where T : FreshBasePageModel 131 | where TPage : Page 132 | { 133 | throw new NotImplementedException(); 134 | } 135 | 136 | public Task PopPageModel(bool modal = false, bool animate = true) 137 | { 138 | throw new NotImplementedException(); 139 | } 140 | 141 | public Task PopPageModel(object data, bool modal = false, bool animate = true) 142 | { 143 | throw new NotImplementedException(); 144 | } 145 | 146 | public Task PushPageModel(bool animate = true) where T : FreshBasePageModel 147 | { 148 | throw new NotImplementedException(); 149 | } 150 | 151 | public Task PushPageModel(bool animate = true) 152 | where T : FreshBasePageModel 153 | where TPage : Page 154 | { 155 | throw new NotImplementedException(); 156 | } 157 | 158 | public Task PushPageModel(Type pageModelType, bool animate = true) 159 | { 160 | throw new NotImplementedException(); 161 | } 162 | 163 | public void RemoveFromNavigation() 164 | { 165 | throw new NotImplementedException(); 166 | } 167 | 168 | public void RemoveFromNavigation(bool removeAll = false) where TPageModel : FreshBasePageModel 169 | { 170 | throw new NotImplementedException(); 171 | } 172 | 173 | public Task PushPageModelWithNewNavigation(object data, bool animate = true) where T : FreshBasePageModel 174 | { 175 | throw new NotImplementedException(); 176 | } 177 | 178 | public Task PushNewNavigationServiceModal(IFreshNavigationService newNavigationService, FreshBasePageModel[] basePageModels, bool animate = true) 179 | { 180 | throw new NotImplementedException(); 181 | } 182 | 183 | public Task PushNewNavigationServiceModal(FreshTabbedNavigationContainer tabbedNavigationContainer, FreshBasePageModel basePageModel = null, bool animate = true) 184 | { 185 | throw new NotImplementedException(); 186 | } 187 | 188 | public Task PushNewNavigationServiceModal(FreshMasterDetailNavigationContainer masterDetailContainer, FreshBasePageModel basePageModel = null, bool animate = true) 189 | { 190 | throw new NotImplementedException(); 191 | } 192 | 193 | public Task PushNewNavigationServiceModal(IFreshNavigationService newNavigationService, FreshBasePageModel basePageModels, bool animate = true) 194 | { 195 | throw new NotImplementedException(); 196 | } 197 | 198 | public Task PopModalNavigationService(bool animate = true) 199 | { 200 | throw new NotImplementedException(); 201 | } 202 | 203 | public Task SwitchSelectedRootPageModel() where T : FreshBasePageModel 204 | { 205 | throw new NotImplementedException(); 206 | } 207 | 208 | public Task SwitchSelectedTab() where T : FreshBasePageModel 209 | { 210 | throw new NotImplementedException(); 211 | } 212 | 213 | public Task SwitchSelectedMaster() where T : FreshBasePageModel 214 | { 215 | throw new NotImplementedException(); 216 | } 217 | 218 | public Task PushPageModel(Type pageModelType, object data, bool modal = false, bool animate = true) 219 | { 220 | //TODO 221 | throw new NotImplementedException(); 222 | } 223 | 224 | public void RemoveFromNavigation(Type type, bool removeAll = false) 225 | { 226 | //TODO 227 | throw new NotImplementedException(); 228 | } 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/FreshMvvm.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/FreshMvvm/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FreshMvvm 4 | { 5 | public static class Constants 6 | { 7 | public const string DefaultNavigationServiceName = "DefaultNavigationServiceName"; 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/FreshMvvm/Extensions/ObservableExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reactive; 3 | using System.Reactive.Linq; 4 | using Xamarin.Forms; 5 | 6 | namespace FreshMvvm.Extensions 7 | { 8 | public static class ObservableExtensions 9 | { 10 | public static IDisposable SubscribeWeakly(this IObservable observable, TTarget target, Action onNext) where TTarget : class 11 | { 12 | var reference = new WeakReference(target); 13 | 14 | if (onNext.Target != null) 15 | { 16 | throw new ArgumentException("onNext must refer to a static method, or else the subscription will still hold a strong reference to target"); 17 | } 18 | 19 | IDisposable subscription = null; 20 | subscription = observable.Subscribe(item => 21 | { 22 | var currentTarget = reference.Target as TTarget; 23 | if (currentTarget != null) 24 | { 25 | onNext(currentTarget, item); 26 | } 27 | else 28 | { 29 | subscription.Dispose(); 30 | } 31 | }); 32 | 33 | return subscription; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/FreshMvvm/FreshAwaitCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using System.Windows.Input; 4 | 5 | namespace FreshMvvm 6 | { 7 | /// 8 | /// FreshAwaitCommand is designed to avoid the double tap issue in Xamarin.Forms for Android, 9 | /// in Xamarin.Forms it's a common issue that double taps on command would open the same window multiple times. 10 | /// 11 | /// This command awaits TaskCompletionSource before allowing anymore of the command to execute. 12 | /// 13 | /// NB* You must call the SetResult on the TaskCompletionSource otherwise this command will wait forever. 14 | /// 15 | public class FreshAwaitCommand : ICommand 16 | { 17 | private readonly Func _canExecute; 18 | 19 | private readonly Action> _execute; 20 | 21 | private volatile bool _inProgress = false; 22 | 23 | /// 24 | /// NB* This command waits until you call SetResult on the TaskCompletionSource. The return 25 | /// value on the TaskCompletionSource is not used. 26 | /// 27 | /// Execute. 28 | public FreshAwaitCommand(Action> execute) 29 | { 30 | _execute = execute ?? throw new ArgumentNullException(nameof(execute)); 31 | } 32 | 33 | /// 34 | /// NB* This command waits until you call SetResult on the TaskCompletionSource. The return 35 | /// value on the TaskCompletionSource is not used. 36 | /// 37 | /// Execute. 38 | public FreshAwaitCommand(Action> execute) : this((o, tcs) => execute(tcs)) 39 | { 40 | if (execute == null) 41 | { 42 | throw new ArgumentNullException(nameof(execute)); 43 | } 44 | } 45 | 46 | /// 47 | /// NB* This command waits until you call SetResult on the TaskCompletionSource. The return 48 | /// value on the TaskCompletionSource is not used. 49 | /// 50 | /// Execute. 51 | public FreshAwaitCommand(Action> execute, Func canExecute) : this(execute) 52 | { 53 | _canExecute = canExecute ?? throw new ArgumentNullException(nameof(canExecute)); 54 | } 55 | 56 | /// 57 | /// NB* This command waits until you call SetResult on the TaskCompletionSource. The return 58 | /// value on the TaskCompletionSource is not used. 59 | /// 60 | /// Execute. 61 | public FreshAwaitCommand(Action> execute, Func canExecute) : this((o, tcs) => execute(tcs), o => canExecute()) 62 | { 63 | if (execute == null) 64 | { 65 | throw new ArgumentNullException(nameof(execute)); 66 | } 67 | if (canExecute == null) 68 | { 69 | throw new ArgumentNullException(nameof(canExecute)); 70 | } 71 | } 72 | 73 | public bool CanExecute(object parameter) 74 | { 75 | if (_inProgress) 76 | { 77 | return false; 78 | } 79 | if (_canExecute != null) 80 | { 81 | return _canExecute(parameter); 82 | } 83 | return true; 84 | } 85 | 86 | public event EventHandler CanExecuteChanged; 87 | 88 | public async void Execute(object parameter) 89 | { 90 | try 91 | { 92 | _inProgress = true; 93 | ChangeCanExecute(); 94 | 95 | var tcs = new TaskCompletionSource(); 96 | 97 | _execute(parameter, tcs); 98 | 99 | await tcs.Task; 100 | } 101 | finally 102 | { 103 | _inProgress = false; 104 | ChangeCanExecute(); 105 | } 106 | } 107 | 108 | public void ChangeCanExecute() 109 | { 110 | try 111 | { 112 | var changed = CanExecuteChanged; 113 | 114 | changed?.Invoke(this, EventArgs.Empty); 115 | } 116 | catch 117 | { 118 | } 119 | } 120 | } 121 | } -------------------------------------------------------------------------------- /src/FreshMvvm/FreshBaseContentPage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using System.Collections.Specialized; 4 | 5 | namespace FreshMvvm 6 | { 7 | public class FreshBaseContentPage : ContentPage 8 | { 9 | public FreshBaseContentPage () 10 | { 11 | } 12 | 13 | protected override void OnBindingContextChanged () 14 | { 15 | base.OnBindingContextChanged (); 16 | 17 | var pageModel = BindingContext as FreshBasePageModel; 18 | 19 | if (pageModel != null && pageModel.ToolbarItems != null && pageModel.ToolbarItems.Count > 0) { 20 | 21 | pageModel.ToolbarItems.CollectionChanged += PageModel_ToolbarItems_CollectionChanged; 22 | 23 | foreach (var toolBarItem in pageModel.ToolbarItems) { 24 | if (!(this.ToolbarItems.Contains (toolBarItem))) { 25 | this.ToolbarItems.Add (toolBarItem); 26 | } 27 | } 28 | } 29 | 30 | } 31 | 32 | void PageModel_ToolbarItems_CollectionChanged (object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) 33 | { 34 | foreach (ToolbarItem toolBarItem in e.NewItems) { 35 | if (!(this.ToolbarItems.Contains (toolBarItem))) { 36 | this.ToolbarItems.Add (toolBarItem); 37 | } 38 | } 39 | 40 | if (e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Replace) 41 | { 42 | foreach (ToolbarItem toolBarItem in e.OldItems) { 43 | if (!(this.ToolbarItems.Contains (toolBarItem))) { 44 | this.ToolbarItems.Add (toolBarItem); 45 | } 46 | } 47 | } 48 | } 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/FreshMvvm/FreshBasePageModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Threading.Tasks; 4 | using Xamarin.Forms; 5 | using System.Runtime.CompilerServices; 6 | using System.Collections.Generic; 7 | using System.Collections.ObjectModel; 8 | using System.Diagnostics; 9 | 10 | namespace FreshMvvm 11 | { 12 | public abstract class FreshBasePageModel : INotifyPropertyChanged 13 | { 14 | NavigationPage _navigationPage; 15 | 16 | public event PropertyChangedEventHandler PropertyChanged; 17 | 18 | /// 19 | /// This event is raise when a page is Popped, this might not be raise everytime a page is Popped. 20 | /// Note* this might be raised multiple times. 21 | /// 22 | public event EventHandler PageWasPopped; 23 | 24 | /// 25 | /// This property is used by the FreshBaseContentPage and allows you to set the toolbar items on the page. 26 | /// 27 | public ObservableCollection ToolbarItems { get; set; } 28 | 29 | /// 30 | /// The previous page model, that's automatically filled, on push 31 | /// 32 | public FreshBasePageModel PreviousPageModel { get; set; } 33 | 34 | /// 35 | /// A reference to the current page, that's automatically filled, on push 36 | /// 37 | public Page CurrentPage { get; set; } 38 | 39 | /// 40 | /// Core methods are basic built in methods for the App including Pushing, Pop and Alert 41 | /// 42 | public IPageModelCoreMethods CoreMethods { get; set; } 43 | 44 | /// 45 | /// This method is called when a page is Pop'd, it also allows for data to be returned. 46 | /// 47 | /// This data that's returned from 48 | public virtual void ReverseInit (object returnedData) 49 | { 50 | } 51 | 52 | /// 53 | /// This method is called when the PageModel is loaded, the initData is the data that's sent from pagemodel before 54 | /// 55 | /// Data that's sent to this PageModel from the pusher 56 | public virtual void Init (object initData) 57 | { 58 | } 59 | 60 | protected void RaisePropertyChanged ([CallerMemberName] string propertyName = null) 61 | { 62 | var handler = PropertyChanged; 63 | if (handler != null) { 64 | handler (this, new PropertyChangedEventArgs (propertyName)); 65 | } 66 | } 67 | 68 | internal void WireEvents (Page page) 69 | { 70 | page.Appearing += new WeakEventHandler(ViewIsAppearing).Handler; 71 | page.Disappearing += new WeakEventHandler(ViewIsDisappearing).Handler; 72 | } 73 | 74 | /// 75 | /// Is true when this model is the first of a new navigation stack 76 | /// 77 | public bool IsModalFirstChild; 78 | 79 | /// 80 | /// Used when a page is shown modal and wants a new Navigation Stack 81 | /// 82 | public string PreviousNavigationServiceName; 83 | 84 | /// 85 | /// Used when a page is shown modal and wants a new Navigation Stack 86 | /// 87 | public string CurrentNavigationServiceName = Constants.DefaultNavigationServiceName; 88 | 89 | /// 90 | /// This means the current PageModel is shown modally and can be pop'd modally 91 | /// 92 | public bool IsModalAndHasPreviousNavigationStack() 93 | { 94 | return !string.IsNullOrWhiteSpace (PreviousNavigationServiceName) && PreviousNavigationServiceName != CurrentNavigationServiceName; 95 | } 96 | 97 | /// 98 | /// This method is called when the view is disappearing. 99 | /// 100 | protected virtual void ViewIsDisappearing (object sender, EventArgs e) 101 | { 102 | 103 | } 104 | 105 | /// 106 | /// This methods is called when the View is appearing 107 | /// 108 | protected virtual void ViewIsAppearing (object sender, EventArgs e) 109 | { 110 | if (!_alreadyAttached) 111 | AttachPageWasPoppedEvent(); 112 | } 113 | 114 | bool _alreadyAttached = false; 115 | /// 116 | /// This is used to attach the page was popped method to a NavigationPage if available 117 | /// 118 | void AttachPageWasPoppedEvent() 119 | { 120 | var navPage = (this.CurrentPage.Parent as NavigationPage); 121 | if (navPage != null) 122 | { 123 | _navigationPage = navPage; 124 | _alreadyAttached = true; 125 | navPage.Popped += new WeakEventHandler(HandleNavPagePopped).Handler; 126 | } 127 | } 128 | 129 | void HandleNavPagePopped(object sender, NavigationEventArgs e) 130 | { 131 | if (e.Page == this.CurrentPage) 132 | { 133 | RaisePageWasPopped(); 134 | } 135 | } 136 | 137 | public void RaisePageWasPopped() 138 | { 139 | if (PageWasPopped != null) 140 | PageWasPopped(this, EventArgs.Empty); 141 | 142 | var navPage = (this.CurrentPage.Parent as NavigationPage); 143 | if (navPage != null) 144 | navPage.Popped -= HandleNavPagePopped; 145 | 146 | if (_navigationPage != null) 147 | _navigationPage.Popped -= HandleNavPagePopped; 148 | 149 | _navigationPage = null; 150 | 151 | CurrentPage.Appearing -= ViewIsAppearing; 152 | CurrentPage.Disappearing -= ViewIsDisappearing; 153 | CurrentPage.BindingContext = null; 154 | } 155 | } 156 | } 157 | 158 | -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netstandard2.0 4 | FreshMvvm 5 | FreshMvvm 6 | 3.0.* 7 | michaelridland 8 | false 9 | 3.0.0 10 | 3.0.0 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FreshMvvm 5 | 3.0.0 6 | FreshMvvm 7 | Michael Ridland 8 | rid00z 9 | https://github.com/rid00z/FreshMvvm 10 | Apache-2.0 11 | false 12 | 13 | 14 | 15 | 16 | FreshMvvm is a super light Mvvm Framework designed specifically for Xamarin.Forms. Its designed to be Easy, Simple and Flexible. 17 | Mvvm, Xamarin.Forms, FreshMvvm 18 | 19 | 3.0.0 20 | Using the latest Xamarin forms nuget 3.4.0, updated the solution to be .net standard, fixed all the unit test errors. 21 | 22 | 2.2.4 23 | New method on FreshMasterDetailNavigationContainer, a none generic version of AddPage which adds ability for dynamically built menu's 24 | FreshAwaitCommand now supports canExecute Function 25 | 26 | 2.2.3 27 | Support for .net standard 28 | 29 | 2.2.2 30 | Resolve memory leak 31 | Remove dependancy on rx.net 32 | 33 | 2.2.0 34 | Better debug messages displayed 35 | Ability to remove a page from Navigation 36 | Add ability to SwitchSelectedRoot page in Tabs and MasterDetail 37 | 38 | 2.1.0 39 | Adds ability to control pagemodel mapping via PageModelMapper 40 | Adds ability to navigate without animation 41 | Better cleanup of objects 42 | IOC now has unregister feature 43 | Add First Only Tabbed Navigation Container 44 | 45 | 2.0.1 46 | Support for Xamarin.Forms 2.2. 47 | 48 | 2.0 49 | IOC Container Lifetime Registration Options 50 | Switching out NavigationStacks on the Xamarin.Forms MainPage 51 | Multiple Navigation Services 52 | Custom IOC Containers 53 | WhenAny 54 | Control over which Models and Views are linked 55 | Events when page is popped (for disposal) 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm/FreshMvvm.nuspec: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | FreshMvvm 5 | 0.0.5 6 | FreshMvvm 7 | Michael Ridland 8 | Michael Ridland 9 | https://github.com/rid00z/FreshMvvm 10 | false 11 | FreshMvvm is a super light Mvvm Framework designed specifically for Xamarin.Forms. Its designed to be Easy, Simple and Flexible. 12 | Mvvm, Xamarin.Forms 13 | 14 | -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm/[Content_Types].xml: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm/_rels/.rels: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm/lib/FreshIOC.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/src/FreshMvvm/FreshMvvm/lib/FreshIOC.dll -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm/lib/FreshIOC.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/src/FreshMvvm/FreshMvvm/lib/FreshIOC.dll.mdb -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm/lib/FreshMvvm.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/src/FreshMvvm/FreshMvvm/lib/FreshMvvm.dll -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm/lib/FreshMvvm.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rid00z/FreshMvvm/a83ccdbbfaf5a39c135fbe1243565d471c2dc0aa/src/FreshMvvm/FreshMvvm/lib/FreshMvvm.dll.mdb -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm/lib/FreshMvvm.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB9-8B4A-11D0-8D11-00A0C91BC942}") = "FreshMvvm", "FreshMvvm.dll", "{F0BFA391-3F52-47E0-9FF6-0D88CC90736F}" 5 | ProjectSection(MonoDevelopProperties) = preProject 6 | BaseDirectory = ..\.. 7 | name = FreshMvvm 8 | Configurations = $0 9 | $0.Configuration = $1 10 | $1.name = Default 11 | $1.OutputPath = .\ 12 | $1.ctype = ProjectConfiguration 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Default|Any CPU = Default|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {F0BFA391-3F52-47E0-9FF6-0D88CC90736F}.Default|Any CPU.ActiveCfg = Default|Any CPU 21 | {F0BFA391-3F52-47E0-9FF6-0D88CC90736F}.Default|Any CPU.Build.0 = Default|Any CPU 22 | EndGlobalSection 23 | EndGlobal 24 | -------------------------------------------------------------------------------- /src/FreshMvvm/FreshMvvm/package/services/metadata/core-properties/1.psmdcp: -------------------------------------------------------------------------------- 1 | Michael RidlandFreshMvvm is a super light Mvvm Framework designed specifically for Xamarin.Forms. Its designed to be Easy, Simple and Flexible.FreshMvvmMvvm, Xamarin.Forms0.0.5 -------------------------------------------------------------------------------- /src/FreshMvvm/FreshPageModelMapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FreshMvvm 4 | { 5 | public class FreshPageModelMapper : IFreshPageModelMapper 6 | { 7 | public string GetPageTypeName(Type pageModelType) 8 | { 9 | return pageModelType.AssemblyQualifiedName 10 | .Replace ("PageModel", "Page") 11 | .Replace ("ViewModel", "Page"); 12 | } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/FreshMvvm/FreshPageModelResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | 4 | namespace FreshMvvm 5 | { 6 | public static class FreshPageModelResolver 7 | { 8 | public static IFreshPageModelMapper PageModelMapper { get; set; } = new FreshPageModelMapper(); 9 | 10 | public static Page ResolvePageModel () where T : FreshBasePageModel 11 | { 12 | return ResolvePageModel (null); 13 | } 14 | 15 | public static Page ResolvePageModel (object initData) where T : FreshBasePageModel 16 | { 17 | var pageModel = FreshIOC.Container.Resolve (); 18 | 19 | return ResolvePageModel (initData, pageModel); 20 | } 21 | 22 | public static Page ResolvePageModel (object data, T pageModel) where T : FreshBasePageModel 23 | { 24 | var type = pageModel.GetType (); 25 | return ResolvePageModel (type, data, pageModel); 26 | } 27 | 28 | public static Page ResolvePageModel (Type type, object data) 29 | { 30 | var pageModel = FreshIOC.Container.Resolve (type) as FreshBasePageModel; 31 | return ResolvePageModel (type, data, pageModel); 32 | } 33 | 34 | public static Page ResolvePageModel (Type type, object data, FreshBasePageModel pageModel) 35 | { 36 | var name = PageModelMapper.GetPageTypeName (type); 37 | var pageType = Type.GetType (name); 38 | if (pageType == null) 39 | throw new Exception (name + " not found"); 40 | 41 | var page = (Page)FreshIOC.Container.Resolve (pageType); 42 | 43 | BindingPageModel(data, page, pageModel); 44 | 45 | return page; 46 | } 47 | 48 | public static Page BindingPageModel(object data, Page targetPage, FreshBasePageModel pageModel) 49 | { 50 | pageModel.WireEvents (targetPage); 51 | pageModel.CurrentPage = targetPage; 52 | pageModel.CoreMethods = new PageModelCoreMethods (targetPage, pageModel); 53 | pageModel.Init (data); 54 | targetPage.BindingContext = pageModel; 55 | return targetPage; 56 | } 57 | } 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/FreshMvvm/FreshTinyIOCBuiltIn.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FreshTinyIoC; 3 | 4 | namespace FreshMvvm 5 | { 6 | /// 7 | /// Built in TinyIOC for ease of use 8 | /// 9 | public class FreshTinyIOCBuiltIn : IFreshIOC 10 | { 11 | public static FreshTinyIoCContainer Current 12 | { 13 | get 14 | { 15 | return FreshTinyIoCContainer.Current; 16 | } 17 | } 18 | 19 | public IRegisterOptions Register(RegisterType instance, string name) where RegisterType : class 20 | { 21 | return FreshTinyIoCContainer.Current.Register (instance, name); 22 | } 23 | 24 | public IRegisterOptions Register(RegisterType instance) where RegisterType : class 25 | { 26 | return FreshTinyIoCContainer.Current.Register (instance); 27 | } 28 | 29 | public ResolveType Resolve(string name) where ResolveType : class 30 | { 31 | return FreshTinyIoCContainer.Current.Resolve (name); 32 | } 33 | 34 | public ResolveType Resolve() where ResolveType : class 35 | { 36 | return FreshTinyIoCContainer.Current.Resolve (); 37 | } 38 | 39 | public IRegisterOptions Register () 40 | where RegisterType : class 41 | where RegisterImplementation : class, RegisterType 42 | { 43 | return FreshTinyIoCContainer.Current.Register(); 44 | } 45 | 46 | public object Resolve(Type resolveType) 47 | { 48 | return FreshTinyIoCContainer.Current.Resolve (resolveType); 49 | } 50 | 51 | public void Unregister() 52 | { 53 | FreshTinyIoCContainer.Current.Unregister(); 54 | } 55 | 56 | public void Unregister(string name) 57 | { 58 | FreshTinyIoCContainer.Current.Unregister(name); 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/FreshMvvm/IFreshNavigationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using System.Threading.Tasks; 4 | 5 | namespace FreshMvvm 6 | { 7 | public interface IFreshNavigationService 8 | { 9 | Task PopToRoot(bool animate = true); 10 | 11 | Task PushPage (Page page, FreshBasePageModel model, bool modal = false, bool animate = true); 12 | 13 | Task PopPage (bool modal = false, bool animate = true); 14 | 15 | /// 16 | /// This method switches the selected main page, TabbedPage the selected tab or if MasterDetail, works with custom pages also 17 | /// 18 | /// The BagePageModel, allows you to PopToRoot, Pass Data 19 | /// The pagemodel of the root you want to change 20 | Task SwitchSelectedRootPageModel() where T : FreshBasePageModel; 21 | 22 | void NotifyChildrenPageWasPopped(); 23 | 24 | string NavigationServiceName { get; } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/FreshMvvm/IFreshPageModelMapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FreshMvvm 4 | { 5 | public interface IFreshPageModelMapper 6 | { 7 | string GetPageTypeName(Type pageModelType); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/FreshMvvm/IOC/FreshIOC.cs: -------------------------------------------------------------------------------- 1 | using FreshTinyIoC; 2 | 3 | namespace FreshMvvm 4 | { 5 | public class FreshIOC 6 | { 7 | static FreshIOC () 8 | { 9 | } 10 | 11 | static IFreshIOC _freshIOCContainer; 12 | 13 | public static IFreshIOC Container { 14 | get { 15 | if (_freshIOCContainer == null) 16 | _freshIOCContainer = new FreshTinyIOCBuiltIn (); 17 | 18 | return _freshIOCContainer; 19 | } 20 | } 21 | 22 | public static void OverrideContainer(IFreshIOC overrideContainer) 23 | { 24 | _freshIOCContainer = overrideContainer; 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/FreshMvvm/IOC/IFreshIOC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FreshMvvm 4 | { 5 | public interface IFreshIOC 6 | { 7 | object Resolve(Type resolveType); 8 | IRegisterOptions Register(RegisterType instance) where RegisterType : class; 9 | IRegisterOptions Register(RegisterType instance, string name) where RegisterType : class; 10 | ResolveType Resolve() where ResolveType : class; 11 | ResolveType Resolve(string name) where ResolveType : class; 12 | IRegisterOptions Register () 13 | where RegisterType : class 14 | where RegisterImplementation : class, RegisterType; 15 | void Unregister(); 16 | void Unregister(string name); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/FreshMvvm/IPageModelCoreMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Xamarin.Forms; 4 | 5 | namespace FreshMvvm 6 | { 7 | public interface IPageModelCoreMethods 8 | { 9 | Task DisplayAlert (string title, string message, string cancel); 10 | 11 | Task DisplayActionSheet (string title, string cancel, string destruction, params string[] buttons); 12 | 13 | Task DisplayAlert (string title, string message, string accept, string cancel); 14 | 15 | Task PushPageModel (object data, bool modal = false, bool animate = true) where T : FreshBasePageModel; 16 | 17 | Task PushPageModel (object data, bool modal = false, bool animate = true) where T : FreshBasePageModel where TPage : Page; 18 | 19 | Task PopPageModel (bool modal = false, bool animate = true); 20 | 21 | Task PopPageModel (object data, bool modal = false, bool animate = true); 22 | 23 | Task PushPageModel (bool animate = true) where T : FreshBasePageModel; 24 | 25 | Task PushPageModel (bool animate = true) where T : FreshBasePageModel where TPage : Page; 26 | 27 | Task PushPageModel (Type pageModelType, bool animate = true); 28 | 29 | Task PushPageModel (Type pageModelType, object data, bool modal = false, bool animate = true); 30 | 31 | /// 32 | /// Removes current page/pagemodel from navigation 33 | /// 34 | void RemoveFromNavigation (); 35 | 36 | /// 37 | /// Removes specific page/pagemodel from navigation 38 | /// 39 | /// Will remove all, otherwise it will just remove first on from the top of the stack 40 | /// The 1st type parameter. 41 | void RemoveFromNavigation (bool removeAll = false) where TPageModel : FreshBasePageModel; 42 | 43 | /// 44 | /// Removes specific page/pagemodel from navigation 45 | /// 46 | /// Will remove all, otherwise it will just remove first on from the top of the stack 47 | /// The 1st type parameter 48 | void RemoveFromNavigation (Type type, bool removeAll = false); 49 | 50 | /// 51 | /// This method pushes a new PageModel modally with a new NavigationContainer 52 | /// 53 | /// Returns the name of the new service 54 | Task PushPageModelWithNewNavigation (object data, bool animate = true) where T : FreshBasePageModel; 55 | 56 | Task PushNewNavigationServiceModal (IFreshNavigationService newNavigationService, FreshBasePageModel[] basePageModels, bool animate = true); 57 | 58 | Task PushNewNavigationServiceModal (FreshTabbedNavigationContainer tabbedNavigationContainer, FreshBasePageModel basePageModel = null, bool animate = true); 59 | 60 | Task PushNewNavigationServiceModal (FreshMasterDetailNavigationContainer masterDetailContainer, FreshBasePageModel basePageModel = null, bool animate = true); 61 | 62 | Task PushNewNavigationServiceModal (IFreshNavigationService newNavigationService, FreshBasePageModel basePageModels, bool animate = true); 63 | 64 | Task PopModalNavigationService(bool animate = true); 65 | 66 | void SwitchOutRootNavigation(string navigationServiceName); 67 | 68 | /// 69 | /// This method switches the selected main page, TabbedPage the selected tab or if MasterDetail, works with custom pages also 70 | /// 71 | /// The BagePageModel, allows you to PopToRoot, Pass Data 72 | /// The pagemodel of the root you want to change 73 | Task SwitchSelectedRootPageModel() where T : FreshBasePageModel; 74 | 75 | /// 76 | /// This method is used when you want to switch the selected page, 77 | /// 78 | /// The BagePageModel, allows you to PopToRoot, Pass Data 79 | /// The pagemodel of the root you want to change 80 | Task SwitchSelectedTab() where T : FreshBasePageModel; 81 | 82 | /// 83 | /// This method is used when you want to switch the selected page, 84 | /// 85 | /// The BagePageModel, allows you to PopToRoot, Pass Data 86 | /// The pagemodel of the root you want to change 87 | Task SwitchSelectedMaster()where T : FreshBasePageModel; 88 | 89 | Task PopToRoot(bool animate); 90 | 91 | void BatchBegin(); 92 | 93 | void BatchCommit(); 94 | Task PushPageModel(Action setPageModel, bool modal = false, bool animate = true) where T : FreshBasePageModel; 95 | } 96 | } 97 | 98 | -------------------------------------------------------------------------------- /src/FreshMvvm/NavigationContainers/FreshMasterDetailNavigationContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Xamarin.Forms; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using System.Linq; 7 | 8 | namespace FreshMvvm 9 | { 10 | public class FreshMasterDetailNavigationContainer : Xamarin.Forms.MasterDetailPage, IFreshNavigationService 11 | { 12 | List _pagesInner = new List (); 13 | Dictionary _pages = new Dictionary (); 14 | ContentPage _menuPage; 15 | ObservableCollection _pageNames = new ObservableCollection (); 16 | ListView _listView = new ListView (); 17 | 18 | public Dictionary Pages { get { return _pages; } } 19 | protected ObservableCollection PageNames { get { return _pageNames; } } 20 | 21 | public FreshMasterDetailNavigationContainer () : this(Constants.DefaultNavigationServiceName) 22 | { 23 | } 24 | 25 | public FreshMasterDetailNavigationContainer (string navigationServiceName) 26 | { 27 | NavigationServiceName = navigationServiceName; 28 | RegisterNavigation (); 29 | } 30 | 31 | public void Init (string menuTitle, string menuIcon = null) 32 | { 33 | CreateMenuPage (menuTitle, menuIcon); 34 | RegisterNavigation (); 35 | } 36 | 37 | protected virtual void RegisterNavigation () 38 | { 39 | FreshIOC.Container.Register (this, NavigationServiceName); 40 | } 41 | 42 | public virtual void AddPage (string title, object data = null) where T : FreshBasePageModel 43 | { 44 | var page = FreshPageModelResolver.ResolvePageModel (data); 45 | page.GetModel ().CurrentNavigationServiceName = NavigationServiceName; 46 | _pagesInner.Add(page); 47 | var navigationContainer = CreateContainerPage (page); 48 | _pages.Add (title, navigationContainer); 49 | _pageNames.Add (title); 50 | if (_pages.Count == 1) 51 | Detail = navigationContainer; 52 | } 53 | public virtual void AddPage(string modelName, string title, object data = null) 54 | { 55 | var pageModelType = Type.GetType(modelName); 56 | var page = FreshPageModelResolver.ResolvePageModel(pageModelType, null); 57 | page.GetModel().CurrentNavigationServiceName = NavigationServiceName; 58 | _pagesInner.Add(page); 59 | var navigationContainer = CreateContainerPage(page); 60 | _pages.Add(title, navigationContainer); 61 | _pageNames.Add(title); 62 | if (_pages.Count == 1) 63 | Detail = navigationContainer; 64 | } 65 | 66 | internal Page CreateContainerPageSafe (Page page) 67 | { 68 | if (page is NavigationPage || page is MasterDetailPage || page is TabbedPage) 69 | return page; 70 | 71 | return CreateContainerPage(page); 72 | } 73 | 74 | protected virtual Page CreateContainerPage (Page page) 75 | { 76 | return new NavigationPage (page); 77 | } 78 | 79 | protected virtual void CreateMenuPage (string menuPageTitle, string menuIcon = null) 80 | { 81 | _menuPage = new ContentPage (); 82 | _menuPage.Title = menuPageTitle; 83 | 84 | _listView.ItemsSource = _pageNames; 85 | 86 | _listView.ItemSelected += (sender, args) => { 87 | if (_pages.ContainsKey ((string)args.SelectedItem)) { 88 | Detail = _pages [(string)args.SelectedItem]; 89 | } 90 | 91 | IsPresented = false; 92 | }; 93 | 94 | _menuPage.Content = _listView; 95 | 96 | var navPage = new NavigationPage (_menuPage) { Title = "Menu" }; 97 | 98 | if (!string.IsNullOrEmpty (menuIcon)) 99 | navPage.Icon = menuIcon; 100 | 101 | Master = navPage; 102 | } 103 | 104 | public Task PushPage (Page page, FreshBasePageModel model, bool modal = false, bool animate = true) 105 | { 106 | if (modal) 107 | return Navigation.PushModalAsync (CreateContainerPageSafe(page)); 108 | return (Detail as NavigationPage).PushAsync (page, animate); //TODO: make this better 109 | } 110 | 111 | public Task PopPage (bool modal = false, bool animate = true) 112 | { 113 | if (modal) 114 | return Navigation.PopModalAsync (animate); 115 | return (Detail as NavigationPage).PopAsync (animate); //TODO: make this better 116 | } 117 | 118 | public Task PopToRoot (bool animate = true) 119 | { 120 | return (Detail as NavigationPage).PopToRootAsync (animate); 121 | } 122 | 123 | public string NavigationServiceName { get; private set; } 124 | 125 | public void NotifyChildrenPageWasPopped() 126 | { 127 | if (Master is NavigationPage) 128 | ((NavigationPage)Master).NotifyAllChildrenPopped(); 129 | if (Master is IFreshNavigationService) 130 | ((IFreshNavigationService)Master).NotifyChildrenPageWasPopped(); 131 | 132 | foreach (var page in this.Pages.Values) 133 | { 134 | if (page is NavigationPage) 135 | ((NavigationPage)page).NotifyAllChildrenPopped(); 136 | if (page is IFreshNavigationService) 137 | ((IFreshNavigationService)page).NotifyChildrenPageWasPopped(); 138 | } 139 | if (this.Pages != null && !this.Pages.ContainsValue(Detail) && Detail is NavigationPage) 140 | ((NavigationPage)Detail).NotifyAllChildrenPopped(); 141 | if (this.Pages != null && !this.Pages.ContainsValue(Detail) && Detail is IFreshNavigationService) 142 | ((IFreshNavigationService)Detail).NotifyChildrenPageWasPopped(); 143 | } 144 | 145 | public Task SwitchSelectedRootPageModel() where T : FreshBasePageModel 146 | { 147 | var tabIndex = _pagesInner.FindIndex(o => o.GetModel().GetType().FullName == typeof(T).FullName); 148 | 149 | _listView.SelectedItem = _pageNames[tabIndex]; 150 | 151 | return Task.FromResult((Detail as NavigationPage).CurrentPage.GetModel()); 152 | } 153 | } 154 | } 155 | 156 | -------------------------------------------------------------------------------- /src/FreshMvvm/NavigationContainers/FreshNavigationContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Xamarin.Forms; 4 | 5 | namespace FreshMvvm 6 | { 7 | public class FreshNavigationContainer : Xamarin.Forms.NavigationPage, IFreshNavigationService 8 | { 9 | public FreshNavigationContainer (Page page) 10 | : this (page, Constants.DefaultNavigationServiceName) 11 | { 12 | } 13 | 14 | public FreshNavigationContainer (Page page, string navigationPageName) 15 | : base (page) 16 | { 17 | var pageModel = page.GetModel (); 18 | if (pageModel == null) 19 | throw new InvalidCastException("BindingContext was not a FreshBasePageModel on this Page"); 20 | 21 | pageModel.CurrentNavigationServiceName = navigationPageName; 22 | NavigationServiceName = navigationPageName; 23 | RegisterNavigation (); 24 | } 25 | 26 | protected void RegisterNavigation () 27 | { 28 | FreshIOC.Container.Register (this, NavigationServiceName); 29 | } 30 | 31 | internal Page CreateContainerPageSafe (Page page) 32 | { 33 | if (page is NavigationPage || page is MasterDetailPage || page is TabbedPage) 34 | return page; 35 | 36 | return CreateContainerPage(page); 37 | } 38 | 39 | protected virtual Page CreateContainerPage (Page page) 40 | { 41 | return new NavigationPage (page); 42 | } 43 | 44 | public virtual Task PushPage (Xamarin.Forms.Page page, FreshBasePageModel model, bool modal = false, bool animate = true) 45 | { 46 | if (modal) 47 | return Navigation.PushModalAsync (CreateContainerPageSafe (page), animate); 48 | return Navigation.PushAsync (page, animate); 49 | } 50 | 51 | public virtual Task PopPage (bool modal = false, bool animate = true) 52 | { 53 | if (modal) 54 | return Navigation.PopModalAsync (animate); 55 | return Navigation.PopAsync (animate); 56 | } 57 | 58 | public Task PopToRoot (bool animate = true) 59 | { 60 | return Navigation.PopToRootAsync (animate); 61 | } 62 | 63 | public string NavigationServiceName { get; private set; } 64 | 65 | public void NotifyChildrenPageWasPopped() 66 | { 67 | this.NotifyAllChildrenPopped(); 68 | } 69 | 70 | public Task SwitchSelectedRootPageModel() where T : FreshBasePageModel 71 | { 72 | throw new Exception("This navigation container has no selected roots, just a single root"); 73 | } 74 | } 75 | } 76 | 77 | -------------------------------------------------------------------------------- /src/FreshMvvm/NavigationContainers/FreshTabbedFONavigationContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using System.Threading.Tasks; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | namespace FreshMvvm 8 | { 9 | /// 10 | /// This Tabbed navigation container for when you only want the tabs to appear on the first page and then push to a second page without tabs 11 | /// 12 | public class FreshTabbedFONavigationContainer : NavigationPage, IFreshNavigationService 13 | { 14 | TabbedPage _innerTabbedPage; 15 | public TabbedPage FirstTabbedPage { get { return _innerTabbedPage; } } 16 | List _tabs = new List(); 17 | public IEnumerable TabbedPages { get { return _tabs; } } 18 | 19 | public FreshTabbedFONavigationContainer (string titleOfFirstTab) : this(titleOfFirstTab, Constants.DefaultNavigationServiceName) 20 | { 21 | } 22 | 23 | public FreshTabbedFONavigationContainer(string titleOfFirstTab, string navigationServiceName) : base(new TabbedPage()) 24 | { 25 | NavigationServiceName = navigationServiceName; 26 | RegisterNavigation(); 27 | _innerTabbedPage = (TabbedPage)this.CurrentPage; 28 | _innerTabbedPage.Title = titleOfFirstTab; 29 | } 30 | 31 | protected void RegisterNavigation () 32 | { 33 | FreshIOC.Container.Register (this, NavigationServiceName); 34 | } 35 | 36 | public virtual Page AddTab (string title, string icon, object data = null) where T : FreshBasePageModel 37 | { 38 | var page = FreshPageModelResolver.ResolvePageModel (data); 39 | page.GetModel ().CurrentNavigationServiceName = NavigationServiceName; 40 | _tabs.Add (page); 41 | var container = CreateContainerPageSafe (page); 42 | container.Title = title; 43 | if (!string.IsNullOrWhiteSpace(icon)) 44 | container.Icon = icon; 45 | _innerTabbedPage.Children.Add (container); 46 | return container; 47 | } 48 | 49 | internal Page CreateContainerPageSafe (Page page) 50 | { 51 | if (page is NavigationPage || page is MasterDetailPage || page is TabbedPage) 52 | return page; 53 | 54 | return CreateContainerPage(page); 55 | } 56 | 57 | protected virtual Page CreateContainerPage (Page page) 58 | { 59 | return page; 60 | } 61 | 62 | public System.Threading.Tasks.Task PushPage (Xamarin.Forms.Page page, FreshBasePageModel model, bool modal = false, bool animate = true) 63 | { 64 | if (modal) 65 | return this.Navigation.PushModalAsync (CreateContainerPageSafe (page)); 66 | return this.Navigation.PushAsync (page); 67 | } 68 | 69 | public System.Threading.Tasks.Task PopPage (bool modal = false, bool animate = true) 70 | { 71 | if (modal) 72 | return this.Navigation.PopModalAsync (animate); 73 | return this.Navigation.PopAsync (animate); 74 | } 75 | 76 | public Task PopToRoot (bool animate = true) 77 | { 78 | return this.Navigation.PopToRootAsync (animate); 79 | } 80 | 81 | public string NavigationServiceName { get; private set; } 82 | 83 | public void NotifyChildrenPageWasPopped() 84 | { 85 | foreach (var page in _innerTabbedPage.Children) 86 | { 87 | if (page is NavigationPage) 88 | ((NavigationPage)page).NotifyAllChildrenPopped(); 89 | } 90 | } 91 | 92 | public Task SwitchSelectedRootPageModel() where T : FreshBasePageModel 93 | { 94 | if (this.CurrentPage == _innerTabbedPage) 95 | { 96 | var page = _tabs.FindIndex(o => o.GetModel().GetType().FullName == typeof(T).FullName); 97 | if (page > -1) 98 | { 99 | _innerTabbedPage.CurrentPage = this._innerTabbedPage.Children[page]; 100 | return Task.FromResult(_innerTabbedPage.CurrentPage.GetModel()); 101 | } 102 | } 103 | else 104 | { 105 | throw new Exception("Cannot switch tabs when the tab screen is not visible"); 106 | } 107 | 108 | return null; 109 | } 110 | } 111 | } 112 | 113 | -------------------------------------------------------------------------------- /src/FreshMvvm/NavigationContainers/FreshTabbedNavigationContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using System.Linq; 6 | 7 | namespace FreshMvvm 8 | { 9 | public class FreshTabbedNavigationContainer : TabbedPage, IFreshNavigationService 10 | { 11 | List _tabs = new List(); 12 | public IEnumerable TabbedPages { get { return _tabs; } } 13 | 14 | public FreshTabbedNavigationContainer () : this(Constants.DefaultNavigationServiceName) 15 | { 16 | 17 | } 18 | 19 | public FreshTabbedNavigationContainer(string navigationServiceName) 20 | { 21 | NavigationServiceName = navigationServiceName; 22 | RegisterNavigation (); 23 | } 24 | 25 | protected void RegisterNavigation () 26 | { 27 | FreshIOC.Container.Register (this, NavigationServiceName); 28 | } 29 | 30 | public virtual Page AddTab (string title, string icon, object data = null) where T : FreshBasePageModel 31 | { 32 | var page = FreshPageModelResolver.ResolvePageModel (data); 33 | page.GetModel ().CurrentNavigationServiceName = NavigationServiceName; 34 | _tabs.Add (page); 35 | var navigationContainer = CreateContainerPageSafe (page); 36 | navigationContainer.Title = title; 37 | if (!string.IsNullOrWhiteSpace(icon)) 38 | navigationContainer.Icon = icon; 39 | Children.Add (navigationContainer); 40 | return navigationContainer; 41 | } 42 | 43 | internal Page CreateContainerPageSafe (Page page) 44 | { 45 | if (page is NavigationPage || page is MasterDetailPage || page is TabbedPage) 46 | return page; 47 | 48 | return CreateContainerPage(page); 49 | } 50 | 51 | protected virtual Page CreateContainerPage (Page page) 52 | { 53 | return new NavigationPage (page); 54 | } 55 | 56 | public System.Threading.Tasks.Task PushPage (Xamarin.Forms.Page page, FreshBasePageModel model, bool modal = false, bool animate = true) 57 | { 58 | if (modal) 59 | return this.CurrentPage.Navigation.PushModalAsync (CreateContainerPageSafe (page)); 60 | return this.CurrentPage.Navigation.PushAsync (page); 61 | } 62 | 63 | public System.Threading.Tasks.Task PopPage (bool modal = false, bool animate = true) 64 | { 65 | if (modal) 66 | return this.CurrentPage.Navigation.PopModalAsync (animate); 67 | return this.CurrentPage.Navigation.PopAsync (animate); 68 | } 69 | 70 | public Task PopToRoot (bool animate = true) 71 | { 72 | return this.CurrentPage.Navigation.PopToRootAsync (animate); 73 | } 74 | 75 | public string NavigationServiceName { get; private set; } 76 | 77 | public void NotifyChildrenPageWasPopped() 78 | { 79 | foreach (var page in this.Children) 80 | { 81 | if (page is NavigationPage) 82 | ((NavigationPage)page).NotifyAllChildrenPopped(); 83 | } 84 | } 85 | 86 | public Task SwitchSelectedRootPageModel() where T : FreshBasePageModel 87 | { 88 | var page = _tabs.FindIndex(o => o.GetModel().GetType().FullName == typeof(T).FullName); 89 | 90 | if (page > -1) 91 | { 92 | CurrentPage = this.Children[page]; 93 | var topOfStack = CurrentPage.Navigation.NavigationStack.LastOrDefault(); 94 | if (topOfStack != null) 95 | return Task.FromResult(topOfStack.GetModel()); 96 | 97 | } 98 | return null; 99 | } 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /src/FreshMvvm/PageExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | 4 | namespace FreshMvvm 5 | { 6 | public static class PageExtensions 7 | { 8 | public static FreshBasePageModel GetModel(this Page page) 9 | { 10 | var pageModel = page.BindingContext as FreshBasePageModel; 11 | return pageModel; 12 | } 13 | 14 | public static void NotifyAllChildrenPopped(this NavigationPage navigationPage) 15 | { 16 | foreach (var page in navigationPage.Navigation.ModalStack) 17 | { 18 | var pageModel = page.GetModel(); 19 | if (pageModel != null) 20 | pageModel.RaisePageWasPopped(); 21 | } 22 | 23 | foreach (var page in navigationPage.Navigation.NavigationStack) 24 | { 25 | var pageModel = page.GetModel(); 26 | if (pageModel != null) 27 | pageModel.RaisePageWasPopped(); 28 | } 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/FreshMvvm/PropertyChangedExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Collections.Generic; 4 | using System.Linq.Expressions; 5 | using System.Reflection; 6 | 7 | namespace FreshMvvm 8 | { 9 | public static class PropertyChangedExtensions 10 | { 11 | public static void WhenAny (this T source, Action action, params Expression>[] properties) where T : INotifyPropertyChanged 12 | { 13 | Dictionary> propertyNames = new Dictionary> (); 14 | Expression>[] properties2 = properties; 15 | for (int i = 0; i < properties2.Length; i++) { 16 | Expression> expression = properties2 [i]; 17 | propertyNames.Add (expression.GetPropertyInfo ().Name, expression.Compile ()); 18 | } 19 | source.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { 20 | if (propertyNames.ContainsKey (e.PropertyName)) { 21 | action(e.PropertyName); 22 | } 23 | }; 24 | } 25 | 26 | /// 27 | /// Gets property information for the specified expression. 28 | /// 29 | /// Type of the parameter in the expression. 30 | /// Type of the property's value. 31 | /// The expression from which to retrieve the property information. 32 | /// Property information for the specified expression. 33 | /// The expression is not understood. 34 | public static PropertyInfo GetPropertyInfo(this Expression> property) 35 | { 36 | if (property == null) 37 | throw new ArgumentNullException("property"); 38 | 39 | var body = property.Body as MemberExpression; 40 | if (body == null) 41 | throw new ArgumentException("Expression is not a property", "property"); 42 | 43 | var propertyInfo = body.Member as PropertyInfo; 44 | if (propertyInfo == null) 45 | throw new ArgumentException("Expression is not a property", "property"); 46 | 47 | return propertyInfo; 48 | } 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/FreshMvvm/WeakEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | 5 | namespace FreshMvvm 6 | { 7 | public sealed class WeakEventHandler where TEventArgs : EventArgs 8 | { 9 | private readonly WeakReference _targetReference; 10 | private readonly MethodInfo _method; 11 | 12 | public WeakEventHandler(EventHandler callback) 13 | { 14 | _method = callback.GetMethodInfo(); 15 | _targetReference = new WeakReference(callback.Target, true); 16 | } 17 | 18 | public void Handler(object sender, TEventArgs e) 19 | { 20 | var target = _targetReference.Target; 21 | if (target != null) 22 | { 23 | var callback = (Action)_method.CreateDelegate(typeof(Action), target); 24 | if (callback != null) 25 | { 26 | callback(sender, e); 27 | } 28 | } 29 | } 30 | } 31 | } 32 | --------------------------------------------------------------------------------