├── .gitattributes ├── .gitignore ├── CODE-OF-CONDUCT.md ├── LICENSE-3rd-PARTY.md ├── LICENSE.md ├── README.md ├── doc └── images │ ├── OpenMVVM_diagram.PNG │ └── WebView_diagram.png └── src ├── Core ├── JS │ └── platform │ │ ├── css │ │ └── openmvvm.css │ │ └── js │ │ ├── openmvvm.bridge.android.js │ │ ├── openmvvm.bridge.ios.js │ │ ├── openmvvm.bridge.windows.js │ │ ├── openmvvm.bridge.wpf.js │ │ ├── openmvvm.js │ │ └── oss │ │ └── mt.js ├── OpenMVVM.Android │ ├── AndroidHelpers.cs │ ├── OpenMVVM.Android.csproj │ ├── OpenMVVM.Android.csproj.bak │ ├── PlatformServices │ │ ├── CacheService.cs │ │ ├── ContentDialogService.cs │ │ ├── DescriptionService.cs │ │ ├── DispatcherService.cs │ │ ├── FileServices.cs │ │ ├── LifecycleService.cs │ │ ├── NullEventTracker.cs │ │ ├── ReminderService.cs │ │ └── WebLauncher.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Resources │ │ ├── AboutResources.txt │ │ └── Resource.Designer.cs ├── OpenMVVM.Core │ ├── ActionCommand.cs │ ├── ActionCommandT.cs │ ├── IInstanceFactory.cs │ ├── IMvvmCommand.cs │ ├── IocInstanceFactory.cs │ ├── ObservableObject.cs │ ├── OpenMVVM.Core.csproj │ ├── Pages │ │ ├── MultiPageViewModel.cs │ │ ├── PageItemViewModel.cs │ │ └── PageViewModel.cs │ ├── PlatformServices │ │ ├── CalendarEvent.cs │ │ ├── ICacheService.cs │ │ ├── IContentDialogService.cs │ │ ├── IDescriptionService.cs │ │ ├── IDispatcherService.cs │ │ ├── IEventTracker.cs │ │ ├── IFileServices.cs │ │ ├── IReminderService.cs │ │ ├── IWebLauncher.cs │ │ ├── Lifecycle │ │ │ └── ILifecycleService.cs │ │ └── Navigation │ │ │ ├── INavigationService.cs │ │ │ ├── NavigationEventHandler.cs │ │ │ ├── NavigationEventHandlerArgs.cs │ │ │ ├── NavigationResult.cs │ │ │ └── NavigationType.cs │ └── ViewModelLocatorBase.cs ├── OpenMVVM.DotNetCore │ ├── DescriptionService.cs │ ├── DispatcherService.cs │ ├── LifecycleService.cs │ ├── OpenMVVM.DotNetCore.csproj │ └── PlatformServices │ │ ├── NullCacheService.cs │ │ ├── NullContentDialogService.cs │ │ ├── NullEventTracker.cs │ │ ├── NullReminderService.cs │ │ └── NullWebLauncher.cs ├── OpenMVVM.Ios │ ├── OpenMVVM.Ios.csproj │ ├── PlatformServices │ │ ├── CacheService.cs │ │ ├── ContentDialogService.cs │ │ ├── DescriptionService.cs │ │ ├── DispatcherService.cs │ │ ├── FileServices.cs │ │ ├── IosLifecycleService.cs │ │ ├── NullEventTracker.cs │ │ ├── ReminderService.cs │ │ └── WebLauncher.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── OpenMVVM.UWP │ ├── NavigationService.cs │ ├── OpenMVVM.UWP.csproj │ ├── PlatformServices │ │ ├── ContentDialogService.cs │ │ ├── DescriptionService.cs │ │ ├── DispatcherService.cs │ │ ├── LifecycleService.cs │ │ └── WebLauncher.cs │ └── Properties │ │ ├── AssemblyInfo.cs │ │ └── OpenMVVM.UWP.rd.xml ├── OpenMVVM.WPF │ ├── NavigationService.cs │ ├── OpenMVVM.WPF.csproj │ ├── PlatformServices │ │ ├── ContentDialogService.cs │ │ ├── DescriptionService.cs │ │ ├── DispatcherService.cs │ │ ├── LifecycleService.cs │ │ └── WebLauncher.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── OpenMVVM.WebView.Android │ ├── AndroidBridge.cs │ ├── JavaScriptMessageHandler.cs │ ├── OpenMVVM.WebView.Android.csproj │ ├── OpenMVVM.WebView.Android.csproj.bak │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── AboutResources.txt │ │ └── Resource.Designer.cs │ ├── WebViewActivity.cs │ └── packages.config ├── OpenMVVM.WebView.DotNetCore │ ├── DotNetCoreBridge.cs │ └── OpenMVVM.WebView.DotNetCore.csproj ├── OpenMVVM.WebView.Ios │ ├── IosBridge.cs │ ├── OpenMVVM.WebView.Ios.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── WebViewController.cs │ └── packages.config ├── OpenMVVM.WebView.JS │ ├── .babelrc │ ├── .eslintrc.json │ ├── .gitignore │ ├── OpenMVVM.WebView.JS.njsproj │ ├── README.md │ ├── dist │ │ ├── openmvvm.android.js │ │ ├── openmvvm.dotnetcore.js │ │ ├── openmvvm.ios.js │ │ ├── openmvvm.test.js │ │ ├── openmvvm.windows.js │ │ └── openmvvm.wpf.js │ ├── lib │ │ ├── base64.min.js │ │ └── mt.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── BridgeMapper.js │ │ ├── OpenMvvmService.js │ │ ├── ParserService.js │ │ ├── RendererService.js │ │ ├── android │ │ │ ├── AndroidBridge.js │ │ │ ├── ViewLoader.js │ │ │ └── openmvvm.android.js │ │ ├── dotnetcore │ │ │ ├── SignalrBridge.js │ │ │ ├── ViewLoader.js │ │ │ └── openmvvm.dotnetcore.js │ │ ├── ios │ │ │ ├── IosBridge.js │ │ │ ├── ViewLoader.js │ │ │ └── openmvvm.ios.js │ │ ├── windows │ │ │ ├── ViewLoader.js │ │ │ ├── WindowsBridge.js │ │ │ └── openmvvm.windows.js │ │ └── wpf │ │ │ ├── ViewLoader.js │ │ │ ├── WpfBridge.js │ │ │ └── openmvvm.wpf.js │ ├── test │ │ └── test-sample.js │ └── webpack.config.js ├── OpenMVVM.WebView.UWP │ ├── OpenMVVM.WebView.UWP.csproj │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── OpenMVVM.WebView.UWP.rd.xml │ ├── WebViewPage.cs │ └── WindowsBridge.cs ├── OpenMVVM.WebView.WPF │ ├── OpenMVVM.WebView.WPF.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ScriptingHelper.cs │ ├── WebViewPage.cs │ ├── WpfBridge.cs │ └── packages.config ├── OpenMVVM.WebView │ ├── BindingInfo.cs │ ├── Bridge.cs │ ├── BridgeMapper.cs │ ├── BridgeMessage.cs │ ├── IBridge.cs │ ├── NavigationService.cs │ ├── OpenMVVM.WebView.csproj │ └── WebViewApp.cs ├── OpenMVVM.XamarinForms.Ios │ ├── IosNavigationService.cs │ ├── OpenMVVM.XamarinForms.Ios.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config └── OpenMVVM.XamarinForms │ ├── NavigationService.cs │ ├── OpenMVVM.XamarinForms.csproj │ └── RootNavigationPage.cs ├── OpenMVVM.sln ├── OpenMVVM.sln.DotSettings ├── Samples └── Basic │ ├── OpenMVVM.Samples.Basic.UWP │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ │ ├── LockScreenLogo.scale-200.png │ │ ├── SplashScreen.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ │ ├── StoreLogo.png │ │ └── Wide310x150Logo.scale-200.png │ ├── DetailView.xaml │ ├── DetailView.xaml.cs │ ├── MainView.xaml │ ├── MainView.xaml.cs │ ├── OpenMVVM.Samples.Basic.UWP.csproj │ ├── OpenMVVM.Samples.Basic.UWP_TemporaryKey.pfx │ ├── Package.appxmanifest │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── Default.rd.xml │ └── ViewModelLocator.cs │ ├── OpenMVVM.Samples.Basic.ViewModel │ ├── DetailViewModel.cs │ ├── ItemViewModel.cs │ ├── MainViewModel.cs │ ├── Model │ │ ├── Item.cs │ │ ├── Owner.cs │ │ └── Repository.cs │ ├── OpenMVVM.Samples.Basic.ViewModel.csproj │ └── Services │ │ ├── DataService.cs │ │ └── IDataService.cs │ ├── OpenMVVM.Samples.Basic.WPF │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── DetailView.xaml │ ├── DetailView.xaml.cs │ ├── MainView.xaml │ ├── MainView.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── OpenMVVM.Samples.Basic.WPF.csproj │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ViewModelLocator.cs │ └── packages.config │ ├── OpenMVVM.Samples.Basic.WebView.Android │ ├── Assets │ │ └── www │ │ │ ├── Views │ │ │ ├── DetailView.html │ │ │ └── MainView.html │ │ │ ├── css │ │ │ └── style.css │ │ │ └── index.html │ ├── MainActivity.cs │ ├── MainApplication.cs │ ├── OpenMVVM.Samples.Basic.WebView.Android.csproj │ ├── OpenMVVM.Samples.Basic.WebView.Android.csproj.bak │ ├── Properties │ │ ├── AndroidManifest.xml │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── AboutResources.txt │ │ ├── Resource.Designer.cs │ │ ├── drawable │ │ │ └── Icon.png │ │ ├── layout │ │ │ └── Main.axml │ │ └── values │ │ │ └── Strings.xml │ ├── ViewModelLocator.cs │ └── packages.config │ ├── OpenMVVM.Samples.Basic.WebView.DotNetCore │ ├── MVVMContext.cs │ ├── OpenMVVM.Samples.Basic.WebView.DotNetCore.csproj │ ├── OpenMvvmHub.cs │ ├── Program.cs │ ├── Startup.cs │ ├── ViewModelLocator.cs │ └── wwwroot │ │ ├── Views │ │ ├── DetailView.html │ │ └── MainView.html │ │ ├── css │ │ └── style.css │ │ ├── index.html │ │ └── platform │ │ └── css │ │ └── openmvvm.css │ ├── OpenMVVM.Samples.Basic.WebView.Ios │ ├── AppDelegate.cs │ ├── Entitlements.plist │ ├── Info.plist │ ├── Main.cs │ ├── Main.storyboard │ ├── OpenMVVM.Samples.Basic.WebView.Ios.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ └── LaunchScreen.xib │ ├── ViewModelLocator.cs │ ├── WebViewController.cs │ ├── WebViewController.designer.cs │ ├── packages.config │ └── www │ │ ├── Views │ │ ├── DetailView.html │ │ └── MainView.html │ │ ├── css │ │ └── style.css │ │ └── index.html │ ├── OpenMVVM.Samples.Basic.WebView.UWP │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ │ ├── LockScreenLogo.scale-200.png │ │ ├── SplashScreen.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ │ ├── StoreLogo.png │ │ └── Wide310x150Logo.scale-200.png │ ├── OpenMVVM.Samples.Basic.WebView.UWP.csproj │ ├── OpenMVVM.Samples.Basic.WebView.UWP_TemporaryKey.pfx │ ├── Package.appxmanifest │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── Default.rd.xml │ ├── ViewModelLocator.cs │ └── www │ │ ├── Views │ │ ├── DetailView.html │ │ └── MainView.html │ │ ├── css │ │ └── style.css │ │ └── index.html │ ├── OpenMVVM.Samples.Basic.WebView.WPF │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── OpenMVVM.Samples.Basic.WebView.WPF.csproj │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ViewModelLocator.cs │ ├── packages.config │ └── www │ │ ├── Views │ │ ├── DetailView.html │ │ └── MainView.html │ │ ├── css │ │ └── style.css │ │ └── index.html │ ├── OpenMVVM.Samples.Basic.XamarinForms.Android │ ├── Assets │ │ └── AboutAssets.txt │ ├── MainActivity.cs │ ├── MainApplication.cs │ ├── OpenMVVM.Samples.Basic.XamarinForms.Android.csproj │ ├── OpenMVVM.Samples.Basic.XamarinForms.Android.csproj.bak │ ├── Properties │ │ ├── AndroidManifest.xml │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── AboutResources.txt │ │ ├── Resource.Designer.cs │ │ ├── drawable-hdpi │ │ │ └── icon.png │ │ ├── drawable-xhdpi │ │ │ └── icon.png │ │ ├── drawable-xxhdpi │ │ │ └── icon.png │ │ ├── drawable │ │ │ └── icon.png │ │ ├── layout │ │ │ ├── Tabbar.axml │ │ │ └── Toolbar.axml │ │ └── values │ │ │ └── styles.xml │ ├── ViewModelLocator.cs │ └── packages.config │ ├── OpenMVVM.Samples.Basic.XamarinForms.UWP │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ │ ├── LockScreenLogo.scale-200.png │ │ ├── SplashScreen.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ │ ├── StoreLogo.png │ │ └── Wide310x150Logo.scale-200.png │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── OpenMVVM.Samples.Basic.XamarinForms.UWP.csproj │ ├── OpenMVVM.Samples.Basic.XamarinForms.UWP_TemporaryKey.pfx │ ├── Package.appxmanifest │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── Default.rd.xml │ └── ViewModelLocator.cs │ ├── OpenMVVM.Samples.Basic.XamarinForms.iOS │ ├── AppDelegate.cs │ ├── Entitlements.plist │ ├── Info.plist │ ├── Main.cs │ ├── OpenMVVM.Samples.Basic.XamarinForms.iOS.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Default-568h@2x.png │ │ ├── Default-Portrait.png │ │ ├── Default-Portrait@2x.png │ │ ├── Default.png │ │ ├── Default@2x.png │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ ├── Icon-76.png │ │ ├── Icon-76@2x.png │ │ ├── Icon-Small-40.png │ │ ├── Icon-Small-40@2x.png │ │ ├── Icon-Small-40@3x.png │ │ ├── Icon-Small.png │ │ ├── Icon-Small@2x.png │ │ ├── Icon-Small@3x.png │ │ └── LaunchScreen.storyboard │ ├── ViewModelLocator.cs │ ├── iTunesArtwork │ ├── iTunesArtwork@2x │ └── packages.config │ └── OpenMVVM.Samples.Basic.XamarinForms │ ├── App.xaml │ ├── App.xaml.cs │ ├── DetailView.xaml │ ├── DetailView.xaml.cs │ ├── LandingView.xaml │ ├── LandingView.xaml.cs │ ├── MainView.xaml │ ├── MainView.xaml.cs │ └── OpenMVVM.Samples.Basic.XamarinForms.csproj ├── Tests └── WebViewUnitTests │ ├── Properties │ └── AssemblyInfo.cs │ ├── TestBridge.cs │ ├── TestViewModel.cs │ ├── TestViewModelLocator.cs │ ├── WebViewBridgeUnitTest.cs │ ├── WebViewUnitTests.csproj │ └── packages.config ├── Utils └── OpenMVVM.Utils.HttpClient │ ├── AdvancedHttpClient.cs │ ├── IHttpClient.cs │ ├── OpenMVVM.Utils.HttpClient.csproj │ └── ServiceResult.cs └── lib └── jsbridge ├── JsBridge.iOS.Unified.dll └── mt.js /doc/images/OpenMVVM_diagram.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/doc/images/OpenMVVM_diagram.PNG -------------------------------------------------------------------------------- /doc/images/WebView_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/doc/images/WebView_diagram.png -------------------------------------------------------------------------------- /src/Core/JS/platform/css/openmvvm.css: -------------------------------------------------------------------------------- 1 | html { 2 | /*background-color: black;*/ 3 | } 4 | 5 | body { 6 | -moz-user-select: none; 7 | -webkit-user-select: none; 8 | -ms-user-select: none; 9 | user-select: none; 10 | -o-user-select: none; 11 | } 12 | -------------------------------------------------------------------------------- /src/Core/JS/platform/js/openmvvm.bridge.android.js: -------------------------------------------------------------------------------- 1 | var OpenMVVM = ( 2 | function (openmvvm) { 3 | "use strict"; 4 | 5 | openmvvm.loadView = function (viewName, callback) { 6 | var xhr = new XMLHttpRequest(); 7 | xhr.open('GET', 'Views/' + viewName + '.html', true); 8 | xhr.onreadystatechange = function () { 9 | if (this.readyState !== 4) return null; 10 | if (this.status !== 200) return null; 11 | var div = document.createElement('div'); 12 | div.innerHTML = this.responseText; 13 | var element = div.firstChild; 14 | callback(element); 15 | }; 16 | xhr.send(); 17 | } 18 | 19 | return openmvvm; 20 | }(OpenMVVM || {}) 21 | ); 22 | 23 | var receiveMessage = function (context, message) { 24 | var messageObject = JSON.parse(message); 25 | this[context][messageObject.FunctionName].apply(this, messageObject.Params); 26 | } 27 | 28 | var sendMessage = function (message) { 29 | NotifyCs.notify(JSON.stringify(message)); 30 | } -------------------------------------------------------------------------------- /src/Core/JS/platform/js/openmvvm.bridge.ios.js: -------------------------------------------------------------------------------- 1 | var OpenMVVM = ( 2 | function(openmvvm) { 3 | "use strict"; 4 | 5 | openmvvm.loadView = function (viewName, callback) { 6 | var xhr = new XMLHttpRequest(); 7 | xhr.open('GET', 'Views/' + viewName + '.html', true); 8 | xhr.onreadystatechange = function () { 9 | var div = document.createElement('div'); 10 | div.innerHTML = this.responseText; 11 | var element = div.firstChild; 12 | callback(element); 13 | }; 14 | xhr.send(); 15 | } 16 | 17 | return openmvvm; 18 | }(OpenMVVM || {}) 19 | ); 20 | 21 | var receiveMessage = function(context, message) { 22 | var messageObject = JSON.parse(message); 23 | this[context][messageObject.FunctionName].apply(this, messageObject.Params); 24 | }; 25 | 26 | var sendMessage = function(message) { 27 | Mt.App.fireEvent('doNativeStuff', message); 28 | }; 29 | 30 | Mt.App.addEventListener('receiveMessage', 31 | function(data) { 32 | receiveMessage(data[0], data[1]); 33 | }); 34 | -------------------------------------------------------------------------------- /src/Core/JS/platform/js/openmvvm.bridge.windows.js: -------------------------------------------------------------------------------- 1 | var OpenMVVM = ( 2 | function (openmvvm) { 3 | "use strict"; 4 | 5 | openmvvm.loadView = function (viewName, callback) { 6 | var xhr = new XMLHttpRequest(); 7 | xhr.open('GET', 'Views/' + viewName + '.html', true); 8 | xhr.onreadystatechange = function () { 9 | if (this.readyState !== 4) return null; 10 | if (this.status !== 200) return null; 11 | var div = document.createElement('div'); 12 | div.innerHTML = this.responseText; 13 | var element = div.firstChild; 14 | callback(element); 15 | }; 16 | xhr.send(); 17 | } 18 | 19 | return openmvvm; 20 | }(OpenMVVM || {}) 21 | ); 22 | 23 | var receiveMessage = function (context, message) { 24 | var messageObject = JSON.parse(message); 25 | this[context][messageObject.FunctionName].apply(this, messageObject.Params); 26 | } 27 | 28 | var sendMessage = function(message) { 29 | window.external.notify(JSON.stringify(message)); 30 | } 31 | -------------------------------------------------------------------------------- /src/Core/JS/platform/js/openmvvm.bridge.wpf.js: -------------------------------------------------------------------------------- 1 | var OpenMVVM = ( 2 | function (openmvvm) { 3 | "use strict"; 4 | 5 | openmvvm.loadView = function (viewName, callback) { 6 | 7 | var xhr = new ActiveXObject("Msxml2.XMLHTTP"); 8 | xhr.open('GET', 'Views/' + viewName + '.html', true); 9 | 10 | xhr.onreadystatechange = function () { 11 | 12 | if (xhr.readyState !== 4) return null; 13 | 14 | var div = document.createElement('div'); 15 | div.innerHTML = xhr.responseText; 16 | var element = div.getElementsByTagName('div')[0]; 17 | 18 | callback(element); 19 | return null; 20 | }; 21 | 22 | xhr.send(); 23 | } 24 | 25 | return openmvvm; 26 | }(OpenMVVM || {}) 27 | ); 28 | 29 | var receiveMessage = function (context, message) { 30 | var messageObject = JSON.parse(message); 31 | this[context][messageObject.FunctionName].apply(this, messageObject.Params); 32 | } 33 | 34 | var sendMessage = function(message) { 35 | window.external.Notify(JSON.stringify(message)); 36 | } 37 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Android/AndroidHelpers.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Android 2 | { 3 | using global::Android.App; 4 | 5 | public static class AndroidHelpers 6 | { 7 | public static Activity CurrentActivity { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Android/PlatformServices/ContentDialogService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Android.PlatformServices 2 | { 3 | using System.Threading.Tasks; 4 | 5 | using global::Android.App; 6 | 7 | using OpenMVVM.Core.PlatformServices; 8 | 9 | public class ContentDialogService : IContentDialogService 10 | { 11 | private readonly IDispatcherService dispatcherService; 12 | 13 | public ContentDialogService(IDispatcherService dispatcherService) 14 | { 15 | this.dispatcherService = dispatcherService; 16 | } 17 | 18 | public Task Alert(string title, string message) 19 | { 20 | this.dispatcherService.Run( 21 | () => 22 | { 23 | AlertDialog.Builder alert = new AlertDialog.Builder(AndroidHelpers.CurrentActivity); 24 | alert.SetTitle(title); 25 | alert.SetMessage(message); 26 | alert.SetPositiveButton("OK", (senderAlert, args) => { }); 27 | 28 | Dialog dialog = alert.Create(); 29 | dialog.Show(); 30 | }); 31 | 32 | return Task.CompletedTask; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Android/PlatformServices/DescriptionService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Android.PlatformServices 2 | { 3 | using OpenMVVM.Core.PlatformServices; 4 | public class DescriptionService : IDescriptionService 5 | { 6 | public string Platform => "Android"; 7 | } 8 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Android/PlatformServices/DispatcherService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Android.PlatformServices 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | using OpenMVVM.Core.PlatformServices; 6 | 7 | public class DispatcherService : IDispatcherService 8 | { 9 | public void Run(Action action) 10 | { 11 | AndroidHelpers.CurrentActivity.RunOnUiThread(action); 12 | } 13 | 14 | public Task RunAsync(Action action) 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Android/PlatformServices/FileServices.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Android.PlatformServices 2 | { 3 | using System; 4 | using System.IO; 5 | 6 | using OpenMVVM.Core.PlatformServices; 7 | 8 | public class FileServices : IFileServices 9 | { 10 | public void WriteFile(string filename, string content) 11 | { 12 | var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); 13 | var filePath = Path.Combine(documentsPath, filename); 14 | System.IO.File.WriteAllText(filePath, content); 15 | } 16 | 17 | public string ReadFile(string filename) 18 | { 19 | var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); 20 | var filePath = Path.Combine(documentsPath, filename); 21 | return System.IO.File.ReadAllText(filePath); 22 | } 23 | 24 | public DateTime GetCreationTimeUtc(string filename) 25 | { 26 | var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); 27 | var filePath = Path.Combine(documentsPath, filename); 28 | return System.IO.File.GetLastAccessTimeUtc(filePath); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Android/PlatformServices/LifecycleService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Android.PlatformServices 2 | { 3 | using System; 4 | 5 | using global::Android.OS; 6 | 7 | using OpenMVVM.Core.PlatformServices.Lifecycle; 8 | 9 | public class LifecycleService : ILifecycleService 10 | { 11 | public bool TryCloseApplication() 12 | { 13 | try 14 | { 15 | Process.KillProcess(Process.MyPid()); 16 | return true; 17 | } 18 | catch (Exception) { } 19 | 20 | return false; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Android/PlatformServices/NullEventTracker.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Android.PlatformServices 2 | { 3 | using OpenMVVM.Core.PlatformServices; 4 | 5 | public class NullEventTracker : IEventTracker 6 | { 7 | public void TrackEvent(string eventDescription) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Android/PlatformServices/WebLauncher.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Android.PlatformServices 2 | { 3 | using System.Threading.Tasks; 4 | 5 | using global::Android.Content; 6 | 7 | using OpenMVVM.Core.PlatformServices; 8 | 9 | public class WebLauncher : IWebLauncher 10 | { 11 | public Task TryOpenUri(string url) 12 | { 13 | var uri = global::Android.Net.Uri.Parse(url); 14 | var intent = new Intent(Intent.ActionView, uri); 15 | AndroidHelpers.CurrentActivity.StartActivity(intent); 16 | 17 | return Task.FromResult(true); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.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("OpenMVVM.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("OpenMVVM.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2017")] 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 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Android/Resources/Resource.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Core/OpenMVVM.Android/Resources/Resource.Designer.cs -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/ActionCommand.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core 2 | { 3 | using System; 4 | 5 | public class ActionCommand : IMvvmCommand 6 | { 7 | private readonly Func canExecute; 8 | 9 | private readonly Action execute; 10 | 11 | public ActionCommand(Action execute, Func canExecute = null) 12 | { 13 | this.execute = execute; 14 | this.canExecute = canExecute; 15 | } 16 | 17 | public event EventHandler CanExecuteChanged; 18 | 19 | public bool CanExecute(object parameter) 20 | { 21 | if (this.canExecute == null) 22 | { 23 | return true; 24 | } 25 | return this.canExecute.Invoke(); 26 | } 27 | 28 | public void Execute(object parameter) 29 | { 30 | if (!this.CanExecute(parameter) || this.execute == null) 31 | { 32 | return; 33 | } 34 | 35 | this.execute(); 36 | } 37 | 38 | public void RaiseCanExecuteChanged() 39 | { 40 | this.CanExecuteChanged?.Invoke(this, EventArgs.Empty); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/ActionCommandT.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core 2 | { 3 | using System; 4 | 5 | public class ActionCommand : IMvvmCommand 6 | { 7 | private readonly Func canExecute; 8 | 9 | private readonly Action execute; 10 | 11 | public ActionCommand(Action execute, Func canExecute = null) 12 | { 13 | this.execute = execute; 14 | this.canExecute = canExecute; 15 | } 16 | 17 | public event EventHandler CanExecuteChanged; 18 | 19 | public bool CanExecute(object parameter) 20 | { 21 | if (this.canExecute == null) 22 | { 23 | return true; 24 | } 25 | 26 | if (parameter is T) 27 | { 28 | return this.canExecute.Invoke((T)parameter); 29 | } 30 | return this.canExecute.Invoke(default(T)); 31 | } 32 | 33 | public void Execute(object parameter) 34 | { 35 | if (!this.CanExecute(parameter) || this.execute == null) 36 | { 37 | return; 38 | } 39 | 40 | if (parameter is T) 41 | { 42 | this.execute((T)parameter); 43 | } 44 | else 45 | { 46 | this.execute(default(T)); 47 | } 48 | } 49 | 50 | public void RaiseCanExecuteChanged() 51 | { 52 | this.CanExecuteChanged?.Invoke(this, EventArgs.Empty); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/IInstanceFactory.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core 2 | { 3 | using System; 4 | 5 | public interface IInstanceFactory 6 | { 7 | void RegisterType(bool isSingleton = true) 8 | where TService : class, TInterface 9 | where TInterface : class; 10 | 11 | void RegisterType(bool isSingleton = true) 12 | where TService : class; 13 | 14 | void RegisterInstance(TService instance, bool isSingleton = true) 15 | where TService : class; 16 | 17 | void RegisterNamedInstance(TService instance, string key) 18 | where TService : class; 19 | 20 | TService GetInstance(); 21 | 22 | TService GetNamedInstance(string key); 23 | 24 | void RegisterFactory(Func factory, bool isSingleton = true) 25 | where TService : class; 26 | 27 | object GetInstance(Type type); 28 | 29 | void RegisterInstanceByKey(string key) 30 | where TService : class; 31 | 32 | TService GetInstanceByKey(string key) 33 | where TService : class; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/IMvvmCommand.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core 2 | { 3 | using System.Windows.Input; 4 | 5 | public interface IMvvmCommand : ICommand 6 | { 7 | void RaiseCanExecuteChanged(); 8 | } 9 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/OpenMVVM.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/CalendarEvent.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices 2 | { 3 | using System; 4 | 5 | public class CalendarEvent 6 | { 7 | public string Name { get; set; } 8 | 9 | public DateTime Start { get; set; } 10 | 11 | public DateTime End { get; set; } 12 | 13 | public string Location { get; set; } 14 | 15 | public bool AllDay { get; set; } 16 | 17 | public string Description { get; set; } 18 | 19 | public string ExternalId { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/ICacheService.cs: -------------------------------------------------------------------------------- 1 | // https://github.com/jamesmontemagno/SettingsPlugin 2 | 3 | namespace OpenMVVM.Core.PlatformServices 4 | { 5 | using System.Threading.Tasks; 6 | 7 | public interface ICacheService 8 | { 9 | /// 10 | /// Gets the current value or the default that you specify. 11 | /// 12 | /// Vaue of t (bool, int, float, long, string) 13 | /// Key for settings 14 | /// default value if not set 15 | /// Value or default 16 | T GetValueOrDefault(string key, T defaultValue = default(T)); 17 | 18 | /// 19 | /// Adds or updates the value 20 | /// 21 | /// Key for cache value 22 | /// Value to set 23 | /// True of was added or updated and you need to save it. 24 | bool AddOrUpdateValue(string key, T value); 25 | 26 | /// 27 | /// Removes a desired key from the cache 28 | /// 29 | /// Key for cache value 30 | void Remove(string key); 31 | 32 | /// 33 | /// Clear all keys from cache 34 | /// 35 | void Clear(); 36 | 37 | /// 38 | /// Checks to see if the key has been added. 39 | /// 40 | /// Key to check 41 | /// True if contains key, else false 42 | bool Contains(string key); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/IContentDialogService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices 2 | { 3 | using System.Threading.Tasks; 4 | 5 | public interface IContentDialogService 6 | { 7 | Task Alert(string title, string message); 8 | } 9 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/IDescriptionService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices 2 | { 3 | public interface IDescriptionService 4 | { 5 | string Platform { get; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/IDispatcherService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | public interface IDispatcherService 7 | { 8 | void Run(Action action); 9 | 10 | Task RunAsync(Action action); 11 | } 12 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/IEventTracker.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices 2 | { 3 | public interface IEventTracker 4 | { 5 | void TrackEvent(string eventDescription); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/IFileServices.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices 2 | { 3 | using System; 4 | 5 | public interface IFileServices 6 | { 7 | void WriteFile(string filename, string content); 8 | 9 | string ReadFile(string filename); 10 | 11 | DateTime GetCreationTimeUtc(string filename); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/IReminderService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices 2 | { 3 | using System.Threading.Tasks; 4 | 5 | public interface IReminderService 6 | { 7 | Task HasReminderAsync(string id); 8 | 9 | Task AddReminderAsync(string id, CalendarEvent calEvent); 10 | 11 | Task RemoveReminderAsync(string id); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/IWebLauncher.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices 2 | { 3 | using System.Threading.Tasks; 4 | 5 | public interface IWebLauncher 6 | { 7 | Task TryOpenUri(string uri); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/Lifecycle/ILifecycleService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices.Lifecycle 2 | { 3 | public interface ILifecycleService 4 | { 5 | bool TryCloseApplication(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/Navigation/INavigationService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices.Navigation 2 | { 3 | using System.Threading.Tasks; 4 | 5 | public interface INavigationService 6 | { 7 | event NavigationEventHandler NavigatingTo; 8 | 9 | event NavigationEventHandler NavigatingFrom; 10 | 11 | bool CanGoBack { get; } 12 | 13 | Task NavigateTo(string pageName, object parameter = null, bool removeBackEntry = false); 14 | 15 | Task GoBack(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/Navigation/NavigationEventHandler.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices.Navigation 2 | { 3 | public delegate void NavigationEventHandler(object sender, NavigationEventHandlerArgs args); 4 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/Navigation/NavigationEventHandlerArgs.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices.Navigation 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | public class NavigationEventHandlerArgs : EventArgs 8 | { 9 | public NavigationEventHandlerArgs(string pageView, NavigationType navigationType, dynamic parameter) 10 | { 11 | this.PageView = pageView; 12 | this.Parameter = parameter; 13 | this.NavigationType = navigationType; 14 | } 15 | 16 | public NavigationType NavigationType { get; private set; } 17 | 18 | public object Parameter { get; private set; } 19 | 20 | public string PageView { get; private set; } 21 | 22 | public List> Tasks { get; set; } = new List>(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/Navigation/NavigationResult.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices.Navigation 2 | { 3 | public enum NavigationResult 4 | { 5 | Continue, 6 | Cancel 7 | } 8 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/PlatformServices/Navigation/NavigationType.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core.PlatformServices.Navigation 2 | { 3 | public enum NavigationType 4 | { 5 | Forward, 6 | Backward 7 | } 8 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Core/ViewModelLocatorBase.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Core 2 | { 3 | public abstract class ViewModelLocatorBase 4 | { 5 | public static IInstanceFactory InstanceFactory => IocInstanceFactory.Default; 6 | } 7 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.DotNetCore/DescriptionService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.DotNetCore 2 | { 3 | using OpenMVVM.Core.PlatformServices; 4 | 5 | public class DescriptionService : IDescriptionService 6 | { 7 | public string Platform 8 | { 9 | get 10 | { 11 | return "DotNetCore"; 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.DotNetCore/DispatcherService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.DotNetCore 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | using OpenMVVM.Core.PlatformServices; 7 | 8 | public class DispatcherService : IDispatcherService 9 | { 10 | public void Run(Action action) 11 | { 12 | action(); 13 | } 14 | 15 | public Task RunAsync(Action action) 16 | { 17 | return Task.Run(action); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.DotNetCore/LifecycleService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.DotNetCore 2 | { 3 | using OpenMVVM.Core.PlatformServices.Lifecycle; 4 | 5 | public class LifecycleService : ILifecycleService 6 | { 7 | public bool TryCloseApplication() 8 | { 9 | return true; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.DotNetCore/OpenMVVM.DotNetCore.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.DotNetCore/PlatformServices/NullCacheService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using OpenMVVM.Core.PlatformServices; 5 | 6 | namespace OpenMVVM.DotNetCore.PlatformServices 7 | { 8 | public class NullCacheService : ICacheService 9 | { 10 | public T GetValueOrDefault(string key, T defaultValue = default(T)) 11 | { 12 | return default(T); 13 | } 14 | 15 | public bool AddOrUpdateValue(string key, T value) 16 | { 17 | return false; 18 | } 19 | 20 | public void Remove(string key) 21 | { 22 | 23 | } 24 | 25 | public void Clear() 26 | { 27 | 28 | } 29 | 30 | public bool Contains(string key) 31 | { 32 | return false; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.DotNetCore/PlatformServices/NullContentDialogService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using OpenMVVM.Core.PlatformServices; 3 | 4 | namespace OpenMVVM.DotNetCore.PlatformServices 5 | { 6 | public class NullContentDialogService : IContentDialogService 7 | { 8 | public Task Alert(string title, string message) 9 | { 10 | return Task.FromResult(0); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.DotNetCore/PlatformServices/NullEventTracker.cs: -------------------------------------------------------------------------------- 1 | using OpenMVVM.Core.PlatformServices; 2 | 3 | namespace OpenMVVM.DotNetCore.PlatformServices 4 | { 5 | public class NullEventTracker : IEventTracker 6 | { 7 | public void TrackEvent(string eventDescription) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.DotNetCore/PlatformServices/NullReminderService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using OpenMVVM.Core.PlatformServices; 3 | 4 | namespace OpenMVVM.DotNetCore.PlatformServices 5 | { 6 | public class NullReminderService : IReminderService 7 | { 8 | public Task HasReminderAsync(string id) 9 | { 10 | return Task.FromResult(false); 11 | } 12 | 13 | public Task AddReminderAsync(string id, CalendarEvent calEvent) 14 | { 15 | return Task.FromResult(false); 16 | } 17 | 18 | public Task RemoveReminderAsync(string id) 19 | { 20 | return Task.FromResult(false); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.DotNetCore/PlatformServices/NullWebLauncher.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using OpenMVVM.Core.PlatformServices; 3 | 4 | namespace OpenMVVM.DotNetCore.PlatformServices 5 | { 6 | public class NullWebLauncher : IWebLauncher 7 | { 8 | public Task TryOpenUri(string uri) 9 | { 10 | return Task.FromResult(true); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Ios/PlatformServices/ContentDialogService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Ios.PlatformServices 2 | { 3 | using System.Threading.Tasks; 4 | 5 | using OpenMVVM.Core.PlatformServices; 6 | 7 | using UIKit; 8 | 9 | public class ContentDialogService : IContentDialogService 10 | { 11 | private readonly IDispatcherService dispatcherService; 12 | 13 | public ContentDialogService(IDispatcherService dispatcherService) 14 | { 15 | this.dispatcherService = dispatcherService; 16 | } 17 | 18 | public Task Alert(string title, string message) 19 | { 20 | this.dispatcherService.Run( 21 | () => 22 | { 23 | UIAlertView alert = new UIAlertView() { Title = title, Message = message }; 24 | 25 | alert.AddButton("OK"); 26 | alert.Show(); 27 | }); 28 | 29 | return Task.CompletedTask; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Ios/PlatformServices/DescriptionService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Ios.PlatformServices 2 | { 3 | using OpenMVVM.Core.PlatformServices; 4 | 5 | public class DescriptionService : IDescriptionService 6 | { 7 | public string Platform => "iOS"; 8 | } 9 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Ios/PlatformServices/DispatcherService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Ios.PlatformServices 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | using OpenMVVM.Core.PlatformServices; 7 | 8 | using UIKit; 9 | 10 | public class DispatcherService : IDispatcherService 11 | { 12 | public void Run(Action action) 13 | { 14 | UIApplication.SharedApplication.InvokeOnMainThread(action); 15 | } 16 | 17 | public Task RunAsync(Action action) 18 | { 19 | throw new System.NotImplementedException(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Ios/PlatformServices/FileServices.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Ios.PlatformServices 2 | { 3 | using System; 4 | using System.IO; 5 | 6 | using OpenMVVM.Core.PlatformServices; 7 | 8 | public class FileServices : IFileServices 9 | { 10 | public void WriteFile(string filename, string content) 11 | { 12 | var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); 13 | var filePath = Path.Combine(documentsPath, filename); 14 | System.IO.File.WriteAllText(filePath, content); 15 | } 16 | 17 | public string ReadFile(string filename) 18 | { 19 | var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); 20 | var filePath = Path.Combine(documentsPath, filename); 21 | return System.IO.File.ReadAllText(filePath); 22 | } 23 | 24 | public DateTime GetCreationTimeUtc(string filename) 25 | { 26 | var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); 27 | var filePath = Path.Combine(documentsPath, filename); 28 | return System.IO.File.GetLastAccessTimeUtc(filePath); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Ios/PlatformServices/IosLifecycleService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Ios.PlatformServices 2 | { 3 | using OpenMVVM.Core.PlatformServices.Lifecycle; 4 | 5 | public class IosLifecycleService : ILifecycleService 6 | { 7 | public bool TryCloseApplication() 8 | { 9 | return true; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Ios/PlatformServices/NullEventTracker.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Ios.PlatformServices 2 | { 3 | using OpenMVVM.Core.PlatformServices; 4 | 5 | public class NullEventTracker : IEventTracker 6 | { 7 | public void TrackEvent(string eventDescription) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.Ios/PlatformServices/WebLauncher.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Ios.PlatformServices 2 | { 3 | using System.Threading.Tasks; 4 | 5 | using Foundation; 6 | 7 | using OpenMVVM.Core.PlatformServices; 8 | 9 | using UIKit; 10 | 11 | public class WebLauncher : IWebLauncher 12 | { 13 | public Task TryOpenUri(string uri) 14 | { 15 | UIApplication.SharedApplication.OpenUrl(new NSUrl(uri)); 16 | 17 | return Task.FromResult(true); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.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("OpenMVVM.Ios")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.Ios")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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("74d004c4-775f-402c-bfe8-b5bdedc6077f")] 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 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.UWP/PlatformServices/ContentDialogService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.UWP.PlatformServices 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | using OpenMVVM.Core.PlatformServices; 7 | 8 | using global::Windows.UI.Popups; 9 | 10 | public class ContentDialogService : IContentDialogService 11 | { 12 | private readonly IDispatcherService dispatcherService; 13 | 14 | public ContentDialogService(IDispatcherService dispatcherService) 15 | { 16 | this.dispatcherService = dispatcherService; 17 | } 18 | 19 | public async Task Alert(string title, string message) 20 | { 21 | await this.dispatcherService.RunAsync(async () => 22 | { 23 | var dialog = new MessageDialog(message, title); 24 | await dialog.ShowAsync(); 25 | }); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.UWP/PlatformServices/DescriptionService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.UWP.PlatformServices 2 | { 3 | using OpenMVVM.Core.PlatformServices; 4 | 5 | public class DescriptionService : IDescriptionService 6 | { 7 | public string Platform => "Windows"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.UWP/PlatformServices/DispatcherService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.UWP.PlatformServices 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | using OpenMVVM.Core.PlatformServices; 7 | 8 | using global::Windows.ApplicationModel.Core; 9 | using global::Windows.UI.Core; 10 | 11 | public class DispatcherService : IDispatcherService 12 | { 13 | public async void Run(Action action) 14 | { 15 | await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(action)); 16 | } 17 | 18 | public async Task RunAsync(Action action) 19 | { 20 | await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(action)); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.UWP/PlatformServices/LifecycleService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.UWP.PlatformServices 2 | { 3 | using global::Windows.UI.Xaml; 4 | 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | 7 | public class LifecycleService : ILifecycleService 8 | { 9 | public bool TryCloseApplication() 10 | { 11 | Application.Current.Exit(); 12 | 13 | return true; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.UWP/PlatformServices/WebLauncher.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.UWP.PlatformServices 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | using OpenMVVM.Core.PlatformServices; 7 | 8 | public class WebLauncher : IWebLauncher 9 | { 10 | public async Task TryOpenUri(string uri) 11 | { 12 | Uri uriResult; 13 | 14 | var isValid = Uri.TryCreate(uri, UriKind.Absolute, out uriResult); 15 | if (isValid) 16 | { 17 | return await global::Windows.System.Launcher.LaunchUriAsync(uriResult); 18 | } 19 | 20 | return false; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.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("OpenMVVM.UWP")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.UWP")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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)] -------------------------------------------------------------------------------- /src/Core/OpenMVVM.UWP/Properties/OpenMVVM.UWP.rd.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WPF/PlatformServices/ContentDialogService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WPF.PlatformServices 2 | { 3 | using System.Threading.Tasks; 4 | using System.Windows; 5 | 6 | using OpenMVVM.Core.PlatformServices; 7 | 8 | public class ContentDialogService : IContentDialogService 9 | { 10 | public async Task Alert(string title, string message) 11 | { 12 | await Application.Current.Dispatcher.InvokeAsync( 13 | () => 14 | { 15 | MessageBox.Show(message, title); 16 | }); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WPF/PlatformServices/DescriptionService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WPF.PlatformServices 2 | { 3 | using OpenMVVM.Core.PlatformServices; 4 | 5 | public class DescriptionService : IDescriptionService 6 | { 7 | public string Platform => "Windows Desktop"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WPF/PlatformServices/DispatcherService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WPF.PlatformServices 2 | { 3 | using System; 4 | using System.Threading.Tasks; 5 | using System.Windows; 6 | 7 | using OpenMVVM.Core.PlatformServices; 8 | 9 | public class DispatcherService : IDispatcherService 10 | { 11 | public void Run(Action action) 12 | { 13 | var dispatcher = Application.Current.Dispatcher; 14 | 15 | if (dispatcher.CheckAccess()) 16 | { 17 | action.Invoke(); 18 | } 19 | else 20 | { 21 | dispatcher.BeginInvoke(action); 22 | } 23 | } 24 | 25 | public async Task RunAsync(Action action) 26 | { 27 | var dispatcher = Application.Current.Dispatcher; 28 | 29 | if (dispatcher.CheckAccess()) 30 | { 31 | action(); 32 | } 33 | else 34 | { 35 | await dispatcher.InvokeAsync(action); 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WPF/PlatformServices/LifecycleService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WPF.PlatformServices 2 | { 3 | using System.Windows; 4 | 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | 7 | public class LifecycleService : ILifecycleService 8 | { 9 | public bool TryCloseApplication() 10 | { 11 | Application.Current.Shutdown(); 12 | 13 | return true; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WPF/PlatformServices/WebLauncher.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WPF.PlatformServices 2 | { 3 | using System; 4 | using System.Diagnostics; 5 | using System.Threading.Tasks; 6 | 7 | using OpenMVVM.Core.PlatformServices; 8 | 9 | public class WebLauncher : IWebLauncher 10 | { 11 | public Task TryOpenUri(string uri) 12 | { 13 | try 14 | { 15 | Process.Start(uri); 16 | } 17 | catch (Exception) 18 | { 19 | return Task.FromResult(false); 20 | } 21 | return Task.FromResult(true); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WPF/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("OpenMVVM.WPF")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.WPF")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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("ad0ed9a0-af1b-4e94-bc66-12d4f8660c42")] 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 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.Android/JavaScriptMessageHandler.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView.Android 2 | { 3 | using System; 4 | 5 | using global::Android.Content; 6 | using global::Android.Webkit; 7 | 8 | using Java.Interop; 9 | 10 | public class JavaScriptMessageHandler : Java.Lang.Object 11 | { 12 | Context context; 13 | 14 | public JavaScriptMessageHandler(Context context) 15 | { 16 | this.context = context; 17 | } 18 | 19 | public Action NotifyAction { get; set; } 20 | 21 | [Export("notify")] 22 | [JavascriptInterface] 23 | public void Notify(string url) 24 | { 25 | this.NotifyAction(url); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.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("OpenMVVM.WebView.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("OpenMVVM.WebView.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2017")] 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 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.Android/Resources/Resource.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Core/OpenMVVM.WebView.Android/Resources/Resource.Designer.cs -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.DotNetCore/DotNetCoreBridge.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView.DotNetCore 2 | { 3 | using System; 4 | 5 | public class DotNetCoreBridge : Bridge 6 | { 7 | public EventHandler MessageSent; 8 | 9 | public DotNetCoreBridge() 10 | { 11 | 12 | } 13 | 14 | public override void SendMessage(BridgeMessage message) 15 | { 16 | this.MessageSent?.Invoke(this, message); 17 | } 18 | 19 | public void WebViewControlScriptNotify(string message) 20 | { 21 | var bridgeMessage = Newtonsoft.Json.JsonConvert.DeserializeObject(message); 22 | this.OnMessageReceived(bridgeMessage); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.DotNetCore/OpenMVVM.WebView.DotNetCore.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.Ios/IosBridge.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView.Ios 2 | { 3 | using cdeutsch; 4 | 5 | using Newtonsoft.Json; 6 | 7 | using UIKit; 8 | 9 | public class IosBridge : Bridge 10 | { 11 | private const string JsContextName = "OpenMVVM"; 12 | private const string JsFunction = "receiveMessage"; 13 | 14 | private readonly UIWebView webViewControl; 15 | 16 | public IosBridge(UIWebView webViewControl) 17 | { 18 | this.webViewControl = webViewControl; 19 | this.webViewControl.AddEventListener("doNativeStuff", this.WebViewControlScriptNotify); 20 | } 21 | 22 | public override void SendMessage(BridgeMessage message) 23 | { 24 | this.webViewControl.FireEvent(JsFunction, new[] { JsContextName, JsonConvert.SerializeObject(message) }); 25 | } 26 | 27 | private void WebViewControlScriptNotify(FireEventData message) 28 | { 29 | var bridgeMessage = JsonConvert.DeserializeObject((string)message.JsonData); 30 | this.OnMessageReceived(bridgeMessage); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.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("OpenMVVM.WebView.Ios")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.WebView.Ios")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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("3486bbc3-05d0-47ac-ad96-cd313b3d3f7e")] 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 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ "@babel/preset-env" ] 3 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "commonjs": true, 5 | "es6": true, 6 | "node": true 7 | }, 8 | "extends": "eslint:recommended", 9 | "parserOptions": { 10 | "ecmaVersion": 2018, 11 | "sourceType": "module" 12 | }, 13 | "rules": { 14 | "indent": [ 15 | "error", 16 | 4 17 | ], 18 | "linebreak-style": [ 19 | "error", 20 | "windows" 21 | ], 22 | "quotes": [ 23 | "error", 24 | "double" 25 | ], 26 | "semi": [ 27 | "error", 28 | "always" 29 | ] 30 | } 31 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/README.md: -------------------------------------------------------------------------------- 1 | # OpenMVVM.WebView.JS 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "openmvvm-webview-js", 3 | "version": "0.0.1", 4 | "description": "OpenMVVM WebView JS Project", 5 | "author": { 6 | "name": "Banana Bytes" 7 | }, 8 | "scripts": { 9 | "test": "mocha --require @babel/register test", 10 | "start": "", 11 | "build": "webpack" 12 | }, 13 | "devDependencies": { 14 | "@babel/core": "^7.1.2", 15 | "@babel/preset-env": "^7.1.0", 16 | "@babel/register": "^7.0.0", 17 | "assert": "^1.4.1", 18 | "babel-loader": "^8.0.4", 19 | "eslint": "^5.7.0", 20 | "eslint-loader": "^2.1.1", 21 | "mocha": "^5.2.0", 22 | "webpack": "^4.23.1", 23 | "webpack-cli": "^3.1.2" 24 | }, 25 | "-vs-binding": { 26 | "BeforeBuild": [ 27 | "build" 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/BridgeMapper.js: -------------------------------------------------------------------------------- 1 | class BridgeMapper { 2 | constructor(bridge) { 3 | this.bridge = bridge; 4 | 5 | this.registerBinding = this.registerBinding.bind(this); 6 | this.propertySet = this.propertySet.bind(this); 7 | this.fireCommand = this.fireCommand.bind(this); 8 | this.appReady = this.appReady.bind(this); 9 | } 10 | 11 | registerBinding (path, insideTemplate) { 12 | if (insideTemplate) { 13 | this.bridge.sendMessage({ 14 | functionName: "RegisterBindingCollection", 15 | params: [path] 16 | }); 17 | } else { 18 | this.bridge.sendMessage({ 19 | functionName: "RegisterBinding", 20 | params: [path, false] 21 | }); 22 | } 23 | } 24 | 25 | propertySet (path, newValue) { 26 | this.bridge.sendMessage({ 27 | functionName: "PropertySet", 28 | params: [path, newValue] 29 | }); 30 | } 31 | 32 | fireCommand (path, param) { 33 | var parameter = param ? param : ""; 34 | 35 | this.bridge.sendMessage({ 36 | functionName: "FireCommand", 37 | params: [path, parameter] 38 | }); 39 | } 40 | 41 | appReady () { 42 | this.bridge.sendMessage({ 43 | functionName: "Init", 44 | params: [] 45 | }); 46 | } 47 | } 48 | 49 | export default BridgeMapper; -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/android/AndroidBridge.js: -------------------------------------------------------------------------------- 1 | import "../../lib/base64.min"; 2 | 3 | class AndroidBridge { 4 | constructor() { 5 | this.start = this.start.bind(this); 6 | this.receiveMessage = this.receiveMessage.bind(this); 7 | this.sendMessage = this.sendMessage.bind(this); 8 | 9 | window.receiveMessage = this.receiveMessage; 10 | } 11 | 12 | start(service) { 13 | this.service = service; 14 | this.service.jsbind(); 15 | } 16 | 17 | receiveMessage (context, message) { 18 | var jsonData = window.Base64.decode(message); 19 | var messageObject = JSON.parse(jsonData); 20 | this.service[messageObject.FunctionName].apply(this, messageObject.Params); 21 | } 22 | 23 | sendMessage (message) { 24 | window.NotifyCs.notify(JSON.stringify(message)); 25 | } 26 | } 27 | 28 | export const bridge = new AndroidBridge(); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/android/ViewLoader.js: -------------------------------------------------------------------------------- 1 | class ViewLoader { 2 | loadView(viewName, callback) { 3 | var xhr = new XMLHttpRequest(); 4 | xhr.open("GET", "Views/" + viewName + ".html", true); 5 | xhr.onreadystatechange = function () { 6 | if (this.readyState !== 4) return null; 7 | if (this.status !== 200) return null; 8 | var div = document.createElement("div"); 9 | div.innerHTML = this.responseText; 10 | var element = div.firstChild; 11 | callback(element); 12 | }; 13 | xhr.send(); 14 | } 15 | } 16 | 17 | export const viewLoader = new ViewLoader(); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/android/openmvvm.android.js: -------------------------------------------------------------------------------- 1 | import { viewLoader } from "./ViewLoader"; 2 | import { bridge } from "./AndroidBridge"; 3 | import ParserService from "../ParserService"; 4 | import RendererService from "../RendererService"; 5 | import BridgeMapper from "../BridgeMapper"; 6 | import OpenMvvmService from "../OpenMvvmService"; 7 | 8 | const context = { 9 | elementCache: {}, 10 | collectionCache: {} 11 | }; 12 | 13 | const mapper = new BridgeMapper(bridge); 14 | const parserService = new ParserService(mapper, context); 15 | const rendererService = new RendererService(parserService, context); 16 | const openMvvm = new OpenMvvmService(mapper, viewLoader, parserService, rendererService, context); 17 | 18 | bridge.start(openMvvm); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/dotnetcore/ViewLoader.js: -------------------------------------------------------------------------------- 1 | class ViewLoader { 2 | loadView(viewName, callback) { 3 | var xhr = new XMLHttpRequest(); 4 | xhr.open("GET", "Views/" + viewName + ".html", true); 5 | xhr.onreadystatechange = function () { 6 | if (this.readyState !== 4) return null; 7 | if (this.status !== 200) return null; 8 | var div = document.createElement("div"); 9 | div.innerHTML = this.responseText; 10 | var element = div.firstChild; 11 | callback(element); 12 | }; 13 | xhr.send(); 14 | } 15 | } 16 | 17 | export const viewLoader = new ViewLoader(); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/dotnetcore/openmvvm.dotnetcore.js: -------------------------------------------------------------------------------- 1 | import { viewLoader } from "./ViewLoader"; 2 | import { bridge } from "./SignalrBridge"; 3 | import ParserService from "../ParserService"; 4 | import RendererService from "../RendererService"; 5 | import BridgeMapper from "../BridgeMapper"; 6 | import OpenMvvmService from "../OpenMvvmService"; 7 | 8 | const context = { 9 | elementCache: {}, 10 | collectionCache: {} 11 | }; 12 | 13 | const mapper = new BridgeMapper(bridge); 14 | const parserService = new ParserService(mapper, context); 15 | const rendererService = new RendererService(parserService, context); 16 | const openMvvm = new OpenMvvmService(mapper, viewLoader, parserService, rendererService, context); 17 | 18 | bridge.start(openMvvm); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/ios/IosBridge.js: -------------------------------------------------------------------------------- 1 | import "../../lib/mt"; 2 | 3 | class IosBridge { 4 | constructor() { 5 | this.start = this.start.bind(this); 6 | this.receiveMessage = this.receiveMessage.bind(this); 7 | this.sendMessage = this.sendMessage.bind(this); 8 | 9 | window.Mt.App.addEventListener("receiveMessage", 10 | (data) => { 11 | this.receiveMessage(data[0], data[1]); 12 | }); 13 | } 14 | 15 | start(service) { 16 | this.service = service; 17 | this.service.jsbind(); 18 | } 19 | 20 | receiveMessage (context, message) { 21 | var messageObject = JSON.parse(message); 22 | this.service[messageObject.FunctionName].apply(this, messageObject.Params); 23 | } 24 | 25 | sendMessage (message) { 26 | window.Mt.App.fireEvent("doNativeStuff", message); 27 | } 28 | } 29 | 30 | export const bridge = new IosBridge(); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/ios/ViewLoader.js: -------------------------------------------------------------------------------- 1 | class ViewLoader { 2 | loadView(viewName, callback) { 3 | var xhr = new XMLHttpRequest(); 4 | xhr.open("GET", "Views/" + viewName + ".html", true); 5 | xhr.onreadystatechange = function () { 6 | var div = document.createElement("div"); 7 | div.innerHTML = this.responseText; 8 | var element = div.firstChild; 9 | callback(element); 10 | }; 11 | xhr.send(); 12 | } 13 | } 14 | 15 | export const viewLoader = new ViewLoader(); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/ios/openmvvm.ios.js: -------------------------------------------------------------------------------- 1 | import { viewLoader } from "./ViewLoader"; 2 | import { bridge } from "./IosBridge"; 3 | import ParserService from "../ParserService"; 4 | import RendererService from "../RendererService"; 5 | import BridgeMapper from "../BridgeMapper"; 6 | import OpenMvvmService from "../OpenMvvmService"; 7 | 8 | const context = { 9 | elementCache: {}, 10 | collectionCache: {} 11 | }; 12 | 13 | const mapper = new BridgeMapper(bridge); 14 | const parserService = new ParserService(mapper, context); 15 | const rendererService = new RendererService(parserService, context); 16 | const openMvvm = new OpenMvvmService(mapper, viewLoader, parserService, rendererService, context); 17 | 18 | bridge.start(openMvvm); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/windows/ViewLoader.js: -------------------------------------------------------------------------------- 1 | class ViewLoader { 2 | loadView(viewName, callback) { 3 | var xhr = new XMLHttpRequest(); 4 | xhr.open("GET", "Views/" + viewName + ".html", true); 5 | xhr.onreadystatechange = function () { 6 | if (this.readyState !== 4) return null; 7 | if (this.status !== 200) return null; 8 | var div = document.createElement("div"); 9 | div.innerHTML = this.responseText; 10 | var element = div.firstChild; 11 | callback(element); 12 | }; 13 | 14 | xhr.send(); 15 | } 16 | } 17 | 18 | export const viewLoader = new ViewLoader(); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/windows/WindowsBridge.js: -------------------------------------------------------------------------------- 1 | class WindowsBridge { 2 | constructor() { 3 | this.start = this.start.bind(this); 4 | this.receiveMessage = this.receiveMessage.bind(this); 5 | this.sendMessage = this.sendMessage.bind(this); 6 | 7 | window.receiveMessage = this.receiveMessage; 8 | } 9 | 10 | start(service) { 11 | this.service = service; 12 | this.service.jsbind(); 13 | } 14 | 15 | receiveMessage(context, message) { 16 | var messageObject = JSON.parse(message); 17 | this.service[messageObject.FunctionName].apply(this, messageObject.Params); 18 | } 19 | 20 | sendMessage (message) { 21 | window.external.notify(JSON.stringify(message)); 22 | } 23 | } 24 | 25 | export const bridge = new WindowsBridge(); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/windows/openmvvm.windows.js: -------------------------------------------------------------------------------- 1 | import { viewLoader } from "./ViewLoader"; 2 | import { bridge } from "./WindowsBridge"; 3 | import ParserService from "../ParserService"; 4 | import RendererService from "../RendererService"; 5 | import BridgeMapper from "../BridgeMapper"; 6 | import OpenMvvmService from "../OpenMvvmService"; 7 | 8 | const context = { 9 | elementCache: {}, 10 | collectionCache: {} 11 | }; 12 | 13 | const mapper = new BridgeMapper(bridge); 14 | const parserService = new ParserService(mapper, context); 15 | const rendererService = new RendererService(parserService, context); 16 | const openMvvm = new OpenMvvmService(mapper, viewLoader, parserService, rendererService, context); 17 | 18 | bridge.start(openMvvm); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/wpf/ViewLoader.js: -------------------------------------------------------------------------------- 1 | class ViewLoader { 2 | loadView(viewName, callback) { 3 | var xhr = new ActiveXObject("Msxml2.XMLHTTP"); // eslint-disable-line no-undef 4 | xhr.open("GET", "Views/" + viewName + ".html", true); 5 | 6 | xhr.onreadystatechange = function () { 7 | 8 | if (xhr.readyState !== 4) return null; 9 | 10 | var div = document.createElement("div"); 11 | div.innerHTML = xhr.responseText; 12 | var element = div.getElementsByTagName("div")[0]; 13 | 14 | callback(element); 15 | return null; 16 | }; 17 | 18 | xhr.send(); 19 | } 20 | } 21 | 22 | export const viewLoader = new ViewLoader(); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/wpf/WpfBridge.js: -------------------------------------------------------------------------------- 1 | class WpfBridge { 2 | constructor() { 3 | this.start = this.start.bind(this); 4 | this.receiveMessage = this.receiveMessage.bind(this); 5 | this.sendMessage = this.sendMessage.bind(this); 6 | 7 | window.receiveMessage = this.receiveMessage; 8 | } 9 | 10 | start(service) { 11 | this.service = service; 12 | this.service.jsbind(); 13 | } 14 | 15 | receiveMessage(context, message) { 16 | var messageObject = JSON.parse(message); 17 | this.service[messageObject.FunctionName].apply(this, messageObject.Params); 18 | } 19 | 20 | sendMessage (message) { 21 | window.external.notify(JSON.stringify(message)); 22 | } 23 | } 24 | 25 | export const bridge = new WpfBridge(); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/src/wpf/openmvvm.wpf.js: -------------------------------------------------------------------------------- 1 | import { viewLoader } from "./ViewLoader"; 2 | import { bridge } from "./WpfBridge"; 3 | import ParserService from "../ParserService"; 4 | import RendererService from "../RendererService"; 5 | import BridgeMapper from "../BridgeMapper"; 6 | import OpenMvvmService from "../OpenMvvmService"; 7 | 8 | const context = { 9 | elementCache: {}, 10 | collectionCache: {} 11 | }; 12 | 13 | const mapper = new BridgeMapper(bridge); 14 | const parserService = new ParserService(mapper, context); 15 | const rendererService = new RendererService(parserService, context); 16 | const openMvvm = new OpenMvvmService(mapper, viewLoader, parserService, rendererService, context); 17 | 18 | bridge.start(openMvvm); -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/test/test-sample.js: -------------------------------------------------------------------------------- 1 | import { describe, it } from "mocha"; 2 | import assert from "assert"; 3 | 4 | describe("Test Suite 1", function () { 5 | it("Test 1", function () { 6 | assert.ok(true, "This shouldn't fail"); 7 | }); 8 | 9 | it("Test 2", function () { 10 | assert.ok(1 === 1, "This shouldn't fail"); 11 | assert.ok(false, "This should fail"); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.JS/webpack.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | entry: { 5 | android: "./src/android/openmvvm.android.js", 6 | windows: "./src/windows/openmvvm.windows.js", 7 | wpf: "./src/wpf/openmvvm.wpf.js", 8 | dotnetcore: "./src/dotnetcore/openmvvm.dotnetcore.js", 9 | ios: "./src/ios/openmvvm.ios.js" 10 | }, 11 | output: { 12 | path: __dirname + "/dist", 13 | filename: "openmvvm.[name].js" 14 | }, 15 | module: { 16 | rules: [ 17 | { 18 | enforce: "pre", 19 | test: /\.js?$/, 20 | use: { 21 | loader: "eslint-loader" 22 | }, 23 | exclude: [/node_modules/, /lib/] 24 | }, 25 | { 26 | test: /\.js?$/, 27 | use: { 28 | loader: "babel-loader", 29 | options: { 30 | presets: ["@babel/preset-env"] 31 | } 32 | }, 33 | exclude: [/node_modules/, /lib/] 34 | } 35 | ] 36 | }, 37 | mode: "production" 38 | }; -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.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("OpenMVVM.WebView.UWP")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.WebView.UWP")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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)] -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.UWP/Properties/OpenMVVM.WebView.UWP.rd.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.UWP/WindowsBridge.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView.UWP 2 | { 3 | using global::Windows.ApplicationModel.Core; 4 | using global::Windows.UI.Core; 5 | using global::Windows.UI.Xaml.Controls; 6 | 7 | using Newtonsoft.Json; 8 | 9 | public class WindowsBridge : Bridge 10 | { 11 | private const string JsContextName = "OpenMVVM"; 12 | private const string JsFunction = "receiveMessage"; 13 | 14 | private WebView webViewControl; 15 | 16 | public WindowsBridge(WebView webViewControl) 17 | { 18 | this.webViewControl = webViewControl; 19 | this.webViewControl.ScriptNotify += this.WebViewControlScriptNotify; 20 | } 21 | 22 | public override void SendMessage(BridgeMessage message) 23 | { 24 | var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; 25 | dispatcher.RunAsync( 26 | CoreDispatcherPriority.Normal, 27 | () => 28 | { 29 | this.webViewControl.InvokeScriptAsync( 30 | JsFunction, 31 | new[] { JsContextName, JsonConvert.SerializeObject(message) }); 32 | }); 33 | } 34 | 35 | private void WebViewControlScriptNotify(object sender, NotifyEventArgs e) 36 | { 37 | var bridgeMessage = JsonConvert.DeserializeObject(e.Value); 38 | this.OnMessageReceived(bridgeMessage); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.WPF/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("OpenMVVM.WebView.WPF")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.WebView.WPF")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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("0a7211c4-5f6c-4598-8485-88be87dcca3c")] 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 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.WPF/ScriptingHelper.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView.WPF 2 | { 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | [ComVisible(true)] 7 | public class ScriptingHelper 8 | { 9 | private readonly Action webViewControlScriptNotify; 10 | 11 | public ScriptingHelper(Action webViewControlScriptNotify) 12 | { 13 | this.webViewControlScriptNotify = webViewControlScriptNotify; 14 | } 15 | 16 | public void Notify(string message) 17 | { 18 | this.webViewControlScriptNotify(message); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.WPF/WebViewPage.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView.WPF 2 | { 3 | using System; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | using OpenMVVM.Core; 8 | using OpenMVVM.Core.PlatformServices.Navigation; 9 | using OpenMVVM.WebView.WPF; 10 | 11 | public class WebViewPage : Page 12 | { 13 | private readonly Uri homeUri; 14 | 15 | private readonly WebViewApp webViewApp; 16 | 17 | public event EventHandler AppReady; 18 | 19 | public WebViewPage(ViewModelLocatorBase viewModelLocator) 20 | { 21 | this.homeUri = new Uri("pack://siteoforigin:,,,/www/index.html", UriKind.Absolute); 22 | var webViewControl = new WebBrowser() 23 | { 24 | HorizontalAlignment = HorizontalAlignment.Stretch, 25 | VerticalAlignment = VerticalAlignment.Stretch 26 | }; 27 | 28 | this.Content = webViewControl; 29 | 30 | var windowsBridge = new WpfBridge(webViewControl); 31 | 32 | this.webViewApp = new WebViewApp(viewModelLocator, windowsBridge, this.OnAppReady); 33 | 34 | var navigationService = ViewModelLocatorBase.InstanceFactory.GetInstance(); 35 | ((NavigationService)navigationService).Bridge = windowsBridge; 36 | 37 | webViewControl.Navigate(this.homeUri); 38 | } 39 | 40 | protected virtual void OnAppReady() 41 | { 42 | this.AppReady?.Invoke(this, EventArgs.Empty); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.WPF/WpfBridge.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView.WPF 2 | { 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | using System.Windows.Controls; 7 | 8 | using Newtonsoft.Json; 9 | 10 | using OpenMVVM.WPF.PlatformServices; 11 | 12 | public class WpfBridge : Bridge 13 | { 14 | private const string JsContextName = "OpenMVVM"; 15 | private const string JsFunction = "receiveMessage"; 16 | 17 | private WebBrowser webViewControl; 18 | 19 | private DispatcherService dispatcherService; 20 | 21 | public WpfBridge(WebBrowser webViewControl) 22 | { 23 | this.dispatcherService = new DispatcherService(); 24 | this.webViewControl = webViewControl; 25 | this.webViewControl.ObjectForScripting = new ScriptingHelper(this.WebViewControlScriptNotify); 26 | } 27 | 28 | public override void SendMessage(BridgeMessage message) 29 | { 30 | this.dispatcherService.RunAsync( 31 | () => 32 | { 33 | this.webViewControl.InvokeScript( 34 | JsFunction, 35 | new[] { JsContextName, JsonConvert.SerializeObject(message) }); 36 | }); 37 | } 38 | 39 | private void WebViewControlScriptNotify(string message) 40 | { 41 | var bridgeMessage = JsonConvert.DeserializeObject(message); 42 | this.OnMessageReceived(bridgeMessage); 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView.WPF/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView/Bridge.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView 2 | { 3 | using System; 4 | 5 | public abstract class Bridge : IBridge 6 | { 7 | public event EventHandler MessageReceived; 8 | 9 | public abstract void SendMessage(BridgeMessage message); 10 | 11 | protected virtual void OnMessageReceived(BridgeMessage e) 12 | { 13 | this.MessageReceived?.Invoke(this, e); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView/BridgeMapper.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView 2 | { 3 | using System.Linq; 4 | using System.Reflection; 5 | 6 | public class BridgeMapper 7 | { 8 | private readonly IBridge bridge; 9 | 10 | private readonly object targetObject; 11 | 12 | public BridgeMapper(IBridge bridge, object targetObject) 13 | { 14 | this.bridge = bridge; 15 | this.targetObject = targetObject; 16 | 17 | this.bridge.MessageReceived += this.BridgeMessageReceived; 18 | } 19 | 20 | public void NotifyValueChanged(string path, object value) 21 | { 22 | this.bridge.SendMessage( 23 | new BridgeMessage() { FunctionName = "setValue", Params = new object[] { path, value } }); 24 | } 25 | 26 | public void NotifyCollectionChanged(string path, object param) 27 | { 28 | this.bridge.SendMessage( 29 | new BridgeMessage() { FunctionName = "handleCollectionChange", Params = new object[] { path, param } }); 30 | } 31 | 32 | private void BridgeMessageReceived(object sender, BridgeMessage e) 33 | { 34 | var targetObjectType = this.targetObject.GetType(); 35 | var methodInfo = targetObjectType.GetRuntimeMethods().FirstOrDefault(m => m.Name == e.FunctionName && m.GetParameters().Length == e.Params.Length); 36 | 37 | methodInfo?.Invoke(this.targetObject, e.Params); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView/BridgeMessage.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView 2 | { 3 | public class BridgeMessage 4 | { 5 | public string FunctionName { get; set; } 6 | 7 | public object[] Params { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView/IBridge.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.WebView 2 | { 3 | using System; 4 | 5 | public interface IBridge 6 | { 7 | event EventHandler MessageReceived; 8 | 9 | void SendMessage(BridgeMessage message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.WebView/OpenMVVM.WebView.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.XamarinForms.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("OpenMVVM.XamarinForms.Ios")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.XamarinForms.Ios")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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("ad8c12c9-dee4-4382-9076-cf59f313177c")] 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 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.XamarinForms.Ios/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.XamarinForms/OpenMVVM.XamarinForms.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Core/OpenMVVM.XamarinForms/RootNavigationPage.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.XamarinForms 2 | { 3 | using System; 4 | 5 | using Xamarin.Forms; 6 | 7 | public class RootNavigationPage : NavigationPage 8 | { 9 | public RootNavigationPage(Page firstView) : base(firstView) 10 | { 11 | 12 | } 13 | 14 | public RootNavigationPage() 15 | : base() 16 | { 17 | 18 | } 19 | 20 | public event EventHandler BackButtonPressedEvent; 21 | 22 | protected override bool OnBackButtonPressed() 23 | { 24 | this.OnBackButtonPressedEvent(); 25 | return true; 26 | } 27 | 28 | protected void OnBackButtonPressedEvent() 29 | { 30 | this.BackButtonPressedEvent?.Invoke(this, null); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/OpenMVVM.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True 3 | True -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/DetailView.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/DetailView.xaml.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 4 | 5 | namespace OpenMVVM.Samples.Basic.UWP 6 | { 7 | using Windows.UI.Xaml.Controls; 8 | 9 | /// 10 | /// An empty page that can be used on its own or navigated to within a Frame. 11 | /// 12 | public sealed partial class DetailView : Page 13 | { 14 | public DetailView() 15 | { 16 | this.InitializeComponent(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/MainView.xaml.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 4 | 5 | namespace OpenMVVM.Samples.Basic.UWP 6 | { 7 | using Windows.UI.Xaml.Controls; 8 | 9 | /// 10 | /// An empty page that can be used on its own or navigated to within a Frame. 11 | /// 12 | public sealed partial class MainView : Page 13 | { 14 | public MainView() 15 | { 16 | this.InitializeComponent(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/OpenMVVM.Samples.Basic.UWP_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/OpenMVVM.Samples.Basic.UWP_TemporaryKey.pfx -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.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("OpenMVVM.Samples.Basic.UWP")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.Samples.Basic.UWP")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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)] -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.UWP/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.UWP 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Core.PlatformServices; 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | using OpenMVVM.Samples.Basic.ViewModel; 8 | using OpenMVVM.Samples.Basic.ViewModel.Services; 9 | using OpenMVVM.UWP; 10 | using OpenMVVM.UWP.PlatformServices; 11 | 12 | public class ViewModelLocator : ViewModelLocatorBase 13 | { 14 | public ViewModelLocator() 15 | { 16 | var ioc = IocInstanceFactory.Default; 17 | 18 | // Services 19 | ioc.RegisterType(); 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | ioc.RegisterType(); 25 | 26 | // ViewModels 27 | ioc.RegisterType(); 28 | ioc.RegisterType(); 29 | 30 | ioc.RegisterInstanceByKey("MainView"); 31 | ioc.RegisterInstanceByKey("DetailView"); 32 | } 33 | 34 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 35 | 36 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.ViewModel/DetailViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.ViewModel 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Core.Pages; 5 | using OpenMVVM.Core.PlatformServices.Navigation; 6 | 7 | public class DetailViewModel : PageViewModel 8 | { 9 | private string title; 10 | 11 | private IMvvmCommand goBackCommand; 12 | 13 | public DetailViewModel(INavigationService navigationService) 14 | : base("DetailView", navigationService) 15 | { 16 | } 17 | 18 | public IMvvmCommand GoBackCommand => this.goBackCommand ?? (this.goBackCommand = new ActionCommand(() => 19 | { 20 | this.NavigationService.GoBack(); 21 | })); 22 | 23 | public string Title 24 | { 25 | get 26 | { 27 | return this.title; 28 | } 29 | 30 | set 31 | { 32 | this.Set(ref this.title, value); 33 | } 34 | } 35 | 36 | protected override void OnNavigatedTo(ItemViewModel item) 37 | { 38 | base.OnNavigatedTo(item); 39 | 40 | this.Title = $"Hello, {item.Title}!"; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.ViewModel/ItemViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.ViewModel 2 | { 3 | using OpenMVVM.Samples.Basic.ViewModel.Model; 4 | 5 | public class ItemViewModel 6 | { 7 | private readonly Item item; 8 | 9 | public ItemViewModel(Item item) 10 | { 11 | this.item = item; 12 | } 13 | 14 | public string Title => this.item.Title; 15 | 16 | public string ImageUrl => this.item.ImageUrl; 17 | 18 | public string Description => this.item.Description; 19 | 20 | public Item GetModel() 21 | { 22 | return this.item; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.ViewModel/Model/Item.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.ViewModel.Model 2 | { 3 | public class Item 4 | { 5 | public string Title { get; set; } 6 | 7 | public string ImageUrl { get; set; } 8 | 9 | public string Description { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.ViewModel/OpenMVVM.Samples.Basic.ViewModel.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.ViewModel/Services/DataService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.ViewModel.Services 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Net.Http; 6 | using System.Net.Http.Headers; 7 | using System.Threading.Tasks; 8 | 9 | using Newtonsoft.Json; 10 | 11 | using OpenMVVM.Core.PlatformServices; 12 | using OpenMVVM.Samples.Basic.ViewModel.Model; 13 | 14 | public class DataService : IDataService 15 | { 16 | public const string BaseUrl = "https://api.github.com"; 17 | 18 | private readonly IContentDialogService contentDialogService; 19 | 20 | public DataService(IContentDialogService contentDialogService) 21 | { 22 | this.contentDialogService = contentDialogService; 23 | } 24 | 25 | private readonly HttpClient httpClient = new HttpClient(); 26 | 27 | public async Task> GetRepositoriesAsync() 28 | { 29 | this.httpClient.DefaultRequestHeaders.Accept.Clear(); 30 | this.httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json")); 31 | this.httpClient.DefaultRequestHeaders.Add("User-Agent", "OpenMVVM"); 32 | 33 | try 34 | { 35 | var result = await this.httpClient.GetStringAsync($"{BaseUrl}/repositories"); 36 | return JsonConvert.DeserializeObject>(result); 37 | } 38 | catch (Exception exception) 39 | { 40 | await this.contentDialogService.Alert("Error", exception.Message); 41 | } 42 | 43 | return new List(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.ViewModel/Services/IDataService.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.ViewModel.Services 2 | { 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | using OpenMVVM.Samples.Basic.ViewModel.Model; 7 | 8 | public interface IDataService 9 | { 10 | Task> GetRepositoriesAsync(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WPF 2 | { 3 | using System.Windows; 4 | 5 | using OpenMVVM.Core; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | 8 | /// 9 | /// Interaction logic for App.xaml 10 | /// 11 | public partial class App : Application 12 | { 13 | private bool initialized; 14 | 15 | public App() 16 | { 17 | this.Activated += this.AppActivated; 18 | } 19 | 20 | private void AppActivated(object sender, System.EventArgs e) 21 | { 22 | if (!this.initialized) 23 | { 24 | this.initialized = true; 25 | 26 | this.Resources.Add("Locator", new ViewModelLocator()); 27 | 28 | var navigationService = ViewModelLocatorBase.InstanceFactory.GetInstance(); 29 | 30 | navigationService.NavigateTo("MainView"); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/DetailView.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/DetailView.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 System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OpenMVVM.Samples.Basic.WPF 17 | { 18 | /// 19 | /// Interaction logic for DetailView.xaml 20 | /// 21 | public partial class DetailView : Page 22 | { 23 | public DetailView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/MainView.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 System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OpenMVVM.Samples.Basic.WPF 17 | { 18 | /// 19 | /// Interaction logic for MainView.xaml 20 | /// 21 | public partial class MainView : Page 22 | { 23 | public MainView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/MainWindow.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 System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OpenMVVM.Samples.Basic.WPF 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace OpenMVVM.Samples.Basic.WPF.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WPF 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Core.PlatformServices; 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | using OpenMVVM.Samples.Basic.ViewModel; 8 | using OpenMVVM.Samples.Basic.ViewModel.Services; 9 | using OpenMVVM.WPF; 10 | using OpenMVVM.WPF.PlatformServices; 11 | 12 | public class ViewModelLocator : ViewModelLocatorBase 13 | { 14 | public ViewModelLocator() 15 | { 16 | var ioc = IocInstanceFactory.Default; 17 | 18 | // Services 19 | ioc.RegisterType(); 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | ioc.RegisterType(); 25 | 26 | // ViewModels 27 | ioc.RegisterType(); 28 | ioc.RegisterType(); 29 | 30 | ioc.RegisterInstanceByKey("MainView"); 31 | ioc.RegisterInstanceByKey("DetailView"); 32 | } 33 | 34 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 35 | 36 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WPF/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/Assets/www/Views/DetailView.html: -------------------------------------------------------------------------------- 1 | 
2 |

3 | 4 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/Assets/www/Views/MainView.html: -------------------------------------------------------------------------------- 1 | 
2 |

3 | 4 |
5 |
    6 |
  • 7 | 8 | 9 | 10 |
    11 |

    12 |

    13 |
    14 |
  • 15 |
16 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/Assets/www/css/style.css: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 10px; 3 | background: white; 4 | } 5 | 6 | /*a little bit of reset*/ 7 | #services-list, #services-list p, #services-list h3 { 8 | list-style: none; 9 | margin:0; padding:0; 10 | } 11 | 12 | #services-list > li{ 13 | margin-bottom: 20px; 14 | width: 200px; 15 | } 16 | 17 | #services-list > li > .image{ 18 | display:block; 19 | float:left; 20 | margin-right:10px; 21 | } 22 | 23 | /* 24 | this instructions are to force the dimensions of image and its container 25 | */ 26 | #services-list > li > .image, 27 | #services-list > li > .image > img{ 28 | width:64px; height:64px; 29 | } 30 | 31 | input[type="text"] { 32 | display: block; 33 | margin: 0; 34 | width: 300px; 35 | font-family: sans-serif; 36 | font-size: 18px; 37 | appearance: none; 38 | box-shadow: none; 39 | border-radius: none; 40 | } 41 | 42 | input[type="text"]:focus { 43 | outline: none; 44 | } 45 | 46 | .style-2 input[type="text"] { 47 | padding: 10px; 48 | border: solid 5px #c9c9c9; 49 | transition: border 0.3s; 50 | } 51 | .style-2 input[type="text"]:focus, 52 | .style-2 input[type="text"].focus { 53 | border: solid 5px #969696; 54 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/Assets/www/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Hello, World! 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.Android 2 | { 3 | using global::Android.App; 4 | using global::Android.OS; 5 | using global::Android.Views; 6 | 7 | using OpenMVVM.WebView.Android; 8 | 9 | [Activity(Label = "OpenMVVM.Samples.Basic.WebView.Android", MainLauncher = true)] 10 | public class MainActivity : WebViewActivity 11 | { 12 | public MainActivity() 13 | : base(new ViewModelLocator()) 14 | { 15 | } 16 | 17 | protected override void OnCreate(Bundle bundle) 18 | { 19 | base.OnCreate(bundle); 20 | 21 | this.RequestWindowFeature(WindowFeatures.NoTitle); 22 | 23 | this.SetContentView(Resource.Layout.Main); 24 | 25 | var webView = this.FindViewById(Resource.Id.webView); 26 | this.InitializeWebView(webView); 27 | 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.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("OpenMVVM.Samples.Basic.WebView.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("OpenMVVM.Samples.Basic.WebView.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2017")] 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 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/Resources/drawable/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/Resources/drawable/Icon.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/Resources/layout/Main.axml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/Resources/values/Strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello World, Click Me! 4 | OpenMVVM.Samples.Basic.WebView.Android 5 | 6 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Android/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.Android 2 | { 3 | using OpenMVVM.Android.PlatformServices; 4 | using OpenMVVM.Core; 5 | using OpenMVVM.Core.PlatformServices; 6 | using OpenMVVM.Core.PlatformServices.Lifecycle; 7 | using OpenMVVM.Core.PlatformServices.Navigation; 8 | using OpenMVVM.Samples.Basic.ViewModel; 9 | using OpenMVVM.Samples.Basic.ViewModel.Services; 10 | using OpenMVVM.WebView; 11 | 12 | public class ViewModelLocator : ViewModelLocatorBase 13 | { 14 | public ViewModelLocator() 15 | { 16 | var ioc = IocInstanceFactory.DefaultWeb; 17 | 18 | // Services 19 | ioc.RegisterType(); 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | ioc.RegisterType(); 25 | 26 | // ViewModels 27 | ioc.RegisterType(); 28 | ioc.RegisterType(); 29 | } 30 | 31 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 32 | 33 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/MVVMContext.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.DotNetCore 2 | { 3 | using OpenMVVM.WebView; 4 | using OpenMVVM.WebView.DotNetCore; 5 | 6 | public class MVVMContext 7 | { 8 | private const string JsContextName = "OpenMVVM"; 9 | 10 | private readonly string id; 11 | 12 | private readonly WebViewApp webViewApp; 13 | 14 | private readonly DotNetCoreBridge bridge; 15 | 16 | private readonly dynamic clientsCaller; 17 | 18 | public MVVMContext( 19 | string id, 20 | dynamic clientsCaller, 21 | WebViewApp webViewApp, 22 | ViewModelLocator viewModelLocatorBase, 23 | DotNetCoreBridge bridge) 24 | { 25 | this.ViewModelLocatorBase = viewModelLocatorBase; 26 | this.id = id; 27 | this.clientsCaller = clientsCaller; 28 | this.webViewApp = webViewApp; 29 | this.bridge = bridge; 30 | } 31 | 32 | public ViewModelLocator ViewModelLocatorBase { get; } 33 | 34 | public WebViewApp ViewApp 35 | { 36 | get 37 | { 38 | return this.webViewApp; 39 | } 40 | } 41 | 42 | public void MessageSent(object sender, BridgeMessage bridgeMessage) 43 | { 44 | this.clientsCaller.receiveMessage(JsContextName, bridgeMessage); 45 | } 46 | 47 | public void FromJs(string message) 48 | { 49 | this.bridge.WebViewControlScriptNotify(message); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/OpenMVVM.Samples.Basic.WebView.DotNetCore.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.0 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 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/OpenMvvmHub.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.DotNetCore 2 | { 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | using Microsoft.AspNetCore.SignalR; 7 | 8 | using OpenMVVM.WebView; 9 | using OpenMVVM.WebView.DotNetCore; 10 | 11 | public class OpenMvvmHub : Hub 12 | { 13 | private const string JsFunction = "receiveMessage"; 14 | 15 | private static Dictionary contexts = new Dictionary(); 16 | 17 | public void Register(string id) 18 | { 19 | if (!contexts.ContainsKey(id)) 20 | { 21 | var viewModelLocatorBase = new ViewModelLocator(); 22 | DotNetCoreBridge bridge = new DotNetCoreBridge(); 23 | ((NavigationService)viewModelLocatorBase.NavigationService).Bridge = bridge; 24 | var mvvmContext = new MVVMContext( 25 | id, 26 | this.Clients.Caller, 27 | new WebViewApp(viewModelLocatorBase, bridge, this.OnAppReady), 28 | viewModelLocatorBase, 29 | bridge); 30 | 31 | bridge.MessageSent += mvvmContext.MessageSent; 32 | 33 | contexts.Add( 34 | id, 35 | mvvmContext); 36 | } 37 | } 38 | 39 | public void FromJs(string id, string message) 40 | { 41 | contexts.First(c => c.Key == id).Value.FromJs(message); 42 | } 43 | 44 | private void OnAppReady() 45 | { 46 | contexts.First().Value.ViewModelLocatorBase.NavigationService.NavigateTo("MainView"); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/Program.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.DotNetCore 2 | { 3 | using System; 4 | using System.IO; 5 | 6 | using Microsoft.AspNetCore.Hosting; 7 | 8 | class Program 9 | { 10 | static void Main(string[] args) 11 | { 12 | Console.WriteLine("Hello, OpenMVVM!"); 13 | 14 | var host = new WebHostBuilder() 15 | .UseKestrel() 16 | .UseContentRoot(Directory.GetCurrentDirectory()) 17 | .UseStartup() 18 | .UseUrls("http://*:6886") 19 | .Build(); 20 | 21 | host.Run(); 22 | 23 | 24 | Console.ReadLine(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/Startup.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.DotNetCore 2 | { 3 | using Microsoft.AspNetCore.Builder; 4 | using Microsoft.Extensions.DependencyInjection; 5 | 6 | public class Startup 7 | { 8 | public void ConfigureServices(IServiceCollection services) 9 | { 10 | services.AddSignalR(); 11 | } 12 | 13 | public void Configure(IApplicationBuilder app) 14 | { 15 | app.UseStaticFiles(); 16 | 17 | app.UseWebSockets(); 18 | app.UseSignalR(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.DotNetCore 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Core.PlatformServices; 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | using OpenMVVM.DotNetCore; 8 | using OpenMVVM.Samples.Basic.ViewModel; 9 | using OpenMVVM.Samples.Basic.ViewModel.Services; 10 | using OpenMVVM.WebView; 11 | 12 | public class ViewModelLocator : ViewModelLocatorBase 13 | { 14 | public ViewModelLocator() 15 | { 16 | var ioc = IocInstanceFactory.DefaultWeb; 17 | 18 | // Services 19 | ioc.RegisterType(); 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | ioc.RegisterType(); 25 | 26 | // ViewModels 27 | ioc.RegisterType(); 28 | ioc.RegisterType(); 29 | } 30 | 31 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 32 | 33 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 34 | 35 | public INavigationService NavigationService => InstanceFactory.GetInstance(); 36 | } 37 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/wwwroot/Views/DetailView.html: -------------------------------------------------------------------------------- 1 | 
2 |

3 | 4 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/wwwroot/Views/MainView.html: -------------------------------------------------------------------------------- 1 | 
2 |

3 | 4 |
5 |
16 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/wwwroot/css/style.css: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 10px; 3 | background: white; 4 | } 5 | 6 | /*a little bit of reset*/ 7 | #services-list, #services-list p, #services-list h3 { 8 | list-style: none; 9 | margin:0; padding:0; 10 | } 11 | 12 | #services-list > li{ 13 | margin-bottom: 20px; 14 | width: 200px; 15 | } 16 | 17 | #services-list > li > .image{ 18 | display:block; 19 | float:left; 20 | margin-right:10px; 21 | } 22 | 23 | /* 24 | this instructions are to force the dimensions of image and its container 25 | */ 26 | #services-list > li > .image, 27 | #services-list > li > .image > img{ 28 | width:64px; height:64px; 29 | } 30 | 31 | input[type="text"] { 32 | display: block; 33 | margin: 0; 34 | width: 300px; 35 | font-family: sans-serif; 36 | font-size: 18px; 37 | appearance: none; 38 | box-shadow: none; 39 | border-radius: none; 40 | } 41 | 42 | input[type="text"]:focus { 43 | outline: none; 44 | } 45 | 46 | .style-2 input[type="text"] { 47 | padding: 10px; 48 | border: solid 5px #c9c9c9; 49 | transition: border 0.3s; 50 | } 51 | .style-2 input[type="text"]:focus, 52 | .style-2 input[type="text"].focus { 53 | border: solid 5px #969696; 54 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/wwwroot/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Hello, World! 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.DotNetCore/wwwroot/platform/css/openmvvm.css: -------------------------------------------------------------------------------- 1 | html { 2 | background-color: black; 3 | } 4 | 5 | body { 6 | -moz-user-select: none; 7 | -webkit-user-select: none; 8 | -ms-user-select: none; 9 | user-select: none; 10 | -o-user-select: none; 11 | } 12 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/Info.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CFBundleDisplayName 6 | OpenMVVM.Samples.Basic.WebView.Ios 7 | CFBundleIdentifier 8 | com.companyname.OpenMVVM.Samples.Basic.WebView.Ios 9 | CFBundleShortVersionString 10 | 1.0 11 | CFBundleVersion 12 | 1.0 13 | LSRequiresIPhoneOS 14 | 15 | MinimumOSVersion 16 | 17 | UIDeviceFamily 18 | 19 | 1 20 | 2 21 | 22 | UILaunchStoryboardName 23 | LaunchScreen 24 | UIMainStoryboardFile 25 | Main 26 | UIMainStoryboardFile~ipad 27 | Main 28 | UIRequiredDeviceCapabilities 29 | 30 | armv7 31 | 32 | UISupportedInterfaceOrientations 33 | 34 | UIInterfaceOrientationPortrait 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | UISupportedInterfaceOrientations~ipad 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationPortraitUpsideDown 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/Main.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.Ios 2 | { 3 | using UIKit; 4 | 5 | public class Application 6 | { 7 | // This is the main entry point of the application. 8 | static void Main(string[] args) 9 | { 10 | // if you want to use a different Application Delegate class from "AppDelegate" 11 | // you can specify it here. 12 | UIApplication.Main(args, null, "AppDelegate"); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/Main.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 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.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("OpenMVVM.Samples.Basic.WebView.Ios")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.Samples.Basic.WebView.Ios")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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("9de88eda-0f71-4146-9e02-5afe0e36c237")] 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 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.Ios 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Core.PlatformServices; 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | using OpenMVVM.Ios.PlatformServices; 8 | using OpenMVVM.Samples.Basic.ViewModel; 9 | using OpenMVVM.Samples.Basic.ViewModel.Services; 10 | using OpenMVVM.WebView; 11 | 12 | public class ViewModelLocator : ViewModelLocatorBase 13 | { 14 | public ViewModelLocator() 15 | { 16 | var ioc = IocInstanceFactory.DefaultWeb; 17 | 18 | // Services 19 | ioc.RegisterType(); 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | ioc.RegisterType(); 25 | 26 | // ViewModels 27 | ioc.RegisterType(); 28 | ioc.RegisterType(); 29 | } 30 | 31 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 32 | 33 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/WebViewController.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.Ios 2 | { 3 | using System; 4 | 5 | public partial class WebViewController : OpenMVVM.WebView.Ios.WebViewController 6 | { 7 | public WebViewController(IntPtr handle) 8 | : base(handle, new ViewModelLocator()) 9 | { 10 | 11 | } 12 | 13 | public override void ViewDidLoad() 14 | { 15 | base.webView = this.WebView; 16 | base.ViewDidLoad(); 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/WebViewController.designer.cs: -------------------------------------------------------------------------------- 1 | // WARNING 2 | // 3 | // This file has been generated automatically to store outlets and 4 | // actions made in the UI designer. If it is removed, they will be lost. 5 | // Manual changes to this file may not be handled correctly. 6 | // 7 | 8 | namespace OpenMVVM.Samples.Basic.WebView.Ios 9 | { 10 | using System.CodeDom.Compiler; 11 | 12 | using Foundation; 13 | 14 | [Register ("WebViewController")] 15 | partial class WebViewController 16 | { 17 | [Outlet] 18 | [GeneratedCode ("iOS Designer", "1.0")] 19 | UIKit.UIWebView WebView { get; set; } 20 | 21 | void ReleaseDesignerOutlets () 22 | { 23 | if (this.WebView != null) { 24 | this.WebView.Dispose (); 25 | this.WebView = null; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/www/Views/DetailView.html: -------------------------------------------------------------------------------- 1 | 
2 |

3 | 4 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/www/Views/MainView.html: -------------------------------------------------------------------------------- 1 | 
2 |

3 | 4 |
5 |
16 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/www/css/style.css: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 10px; 3 | background: white; 4 | } 5 | 6 | /*a little bit of reset*/ 7 | #services-list, #services-list p, #services-list h3 { 8 | list-style: none; 9 | margin:0; padding:0; 10 | } 11 | 12 | #services-list > li{ 13 | margin-bottom: 20px; 14 | width: 200px; 15 | } 16 | 17 | #services-list > li > .image{ 18 | display:block; 19 | float:left; 20 | margin-right:10px; 21 | } 22 | 23 | /* 24 | this instructions are to force the dimensions of image and its container 25 | */ 26 | #services-list > li > .image, 27 | #services-list > li > .image > img{ 28 | width:64px; height:64px; 29 | } 30 | 31 | input[type="text"] { 32 | display: block; 33 | margin: 0; 34 | width: 300px; 35 | font-family: sans-serif; 36 | font-size: 18px; 37 | appearance: none; 38 | box-shadow: none; 39 | border-radius: none; 40 | } 41 | 42 | input[type="text"]:focus { 43 | outline: none; 44 | } 45 | 46 | .style-2 input[type="text"] { 47 | padding: 10px; 48 | border: solid 5px #c9c9c9; 49 | transition: border 0.3s; 50 | } 51 | .style-2 input[type="text"]:focus, 52 | .style-2 input[type="text"].focus { 53 | border: solid 5px #969696; 54 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.Ios/www/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Hello, World! 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/OpenMVVM.Samples.Basic.WebView.UWP_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/OpenMVVM.Samples.Basic.WebView.UWP_TemporaryKey.pfx -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.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("OpenMVVM.Samples.Basic.WebView.UWP")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.Samples.Basic.WebView.UWP")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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)] -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.UWP 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Core.PlatformServices; 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | using OpenMVVM.Samples.Basic.ViewModel; 8 | using OpenMVVM.Samples.Basic.ViewModel.Services; 9 | using OpenMVVM.UWP.PlatformServices; 10 | using OpenMVVM.WebView; 11 | using OpenMVVM.WebView.UWP; 12 | 13 | public class ViewModelLocator : ViewModelLocatorBase 14 | { 15 | public ViewModelLocator() 16 | { 17 | var ioc = IocInstanceFactory.DefaultWeb; 18 | 19 | // Services 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | ioc.RegisterType(); 25 | ioc.RegisterType(); 26 | 27 | // ViewModels 28 | ioc.RegisterType(); 29 | ioc.RegisterType(); 30 | } 31 | 32 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 33 | 34 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/www/Views/DetailView.html: -------------------------------------------------------------------------------- 1 | 
2 |

3 | 4 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/www/Views/MainView.html: -------------------------------------------------------------------------------- 1 | 
2 |

3 | 4 |
5 |
16 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/www/css/style.css: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 10px; 3 | background: white; 4 | } 5 | 6 | /*a little bit of reset*/ 7 | #services-list, #services-list p, #services-list h3 { 8 | list-style: none; 9 | margin:0; padding:0; 10 | } 11 | 12 | #services-list > li{ 13 | margin-bottom: 20px; 14 | width: 200px; 15 | } 16 | 17 | #services-list > li > .image{ 18 | display:block; 19 | float:left; 20 | margin-right:10px; 21 | } 22 | 23 | /* 24 | this instructions are to force the dimensions of image and its container 25 | */ 26 | #services-list > li > .image, 27 | #services-list > li > .image > img{ 28 | width:64px; height:64px; 29 | } 30 | 31 | input[type="text"] { 32 | display: block; 33 | margin: 0; 34 | width: 300px; 35 | font-family: sans-serif; 36 | font-size: 18px; 37 | appearance: none; 38 | box-shadow: none; 39 | border-radius: none; 40 | } 41 | 42 | input[type="text"]:focus { 43 | outline: none; 44 | } 45 | 46 | .style-2 input[type="text"] { 47 | padding: 10px; 48 | border: solid 5px #c9c9c9; 49 | transition: border 0.3s; 50 | } 51 | .style-2 input[type="text"]:focus, 52 | .style-2 input[type="text"].focus { 53 | border: solid 5px #969696; 54 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.UWP/www/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Hello, World! 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.WPF 2 | { 3 | using System; 4 | using System.Windows; 5 | 6 | using OpenMVVM.Core; 7 | using OpenMVVM.Core.PlatformServices.Navigation; 8 | using OpenMVVM.WebView.WPF; 9 | 10 | public partial class App : Application 11 | { 12 | 13 | private bool isActivated = false; 14 | 15 | protected override void OnActivated(EventArgs e) 16 | { 17 | base.OnActivated(e); 18 | 19 | if (!this.isActivated) 20 | { 21 | this.isActivated = true; 22 | 23 | WebViewPage webViewPage = new WebViewPage(new ViewModelLocator()); 24 | webViewPage.AppReady += this.CurrentContentAppReady; 25 | App.Current.MainWindow.Content = webViewPage; 26 | } 27 | } 28 | 29 | private void CurrentContentAppReady(object sender, EventArgs e) 30 | { 31 | var navigationService = ViewModelLocatorBase.InstanceFactory.GetInstance(); 32 | navigationService.NavigateTo("MainView"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.WPF 2 | { 3 | using System.Windows; 4 | 5 | public partial class MainWindow : Window 6 | { 7 | public MainWindow() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace OpenMVVM.Samples.Basic.WebView.WPF.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.WebView.WPF 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Core.PlatformServices; 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | using OpenMVVM.Samples.Basic.ViewModel; 8 | using OpenMVVM.Samples.Basic.ViewModel.Services; 9 | using OpenMVVM.WebView; 10 | using OpenMVVM.WPF.PlatformServices; 11 | 12 | public class ViewModelLocator : ViewModelLocatorBase 13 | { 14 | public ViewModelLocator() 15 | { 16 | var ioc = IocInstanceFactory.DefaultWeb; 17 | 18 | // Services 19 | ioc.RegisterType(); 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | ioc.RegisterType(); 25 | 26 | // ViewModels 27 | ioc.RegisterType(); 28 | ioc.RegisterType(); 29 | } 30 | 31 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 32 | 33 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/www/Views/DetailView.html: -------------------------------------------------------------------------------- 1 |  2 |
3 |

4 | 5 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/www/Views/MainView.html: -------------------------------------------------------------------------------- 1 |  2 |
3 |

4 | 5 |
6 |
17 |
-------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/www/css/style.css: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 10px; 3 | background: white; 4 | } 5 | 6 | /*a little bit of reset*/ 7 | #services-list, #services-list p, #services-list h3 { 8 | list-style: none; 9 | margin:0; padding:0; 10 | } 11 | 12 | #services-list > li{ 13 | margin-bottom: 20px; 14 | width: 200px; 15 | } 16 | 17 | #services-list > li > .image{ 18 | display:block; 19 | float:left; 20 | margin-right:10px; 21 | } 22 | 23 | /* 24 | this instructions are to force the dimensions of image and its container 25 | */ 26 | #services-list > li > .image, 27 | #services-list > li > .image > img{ 28 | width:64px; height:64px; 29 | } 30 | 31 | input[type="text"] { 32 | display: block; 33 | margin: 0; 34 | width: 300px; 35 | font-family: sans-serif; 36 | font-size: 18px; 37 | appearance: none; 38 | box-shadow: none; 39 | border-radius: none; 40 | } 41 | 42 | input[type="text"]:focus { 43 | outline: none; 44 | } 45 | 46 | .style-2 input[type="text"] { 47 | padding: 10px; 48 | border: solid 5px #c9c9c9; 49 | transition: border 0.3s; 50 | } 51 | .style-2 input[type="text"]:focus, 52 | .style-2 input[type="text"].focus { 53 | border: solid 5px #969696; 54 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.WebView.WPF/www/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Hello, World! 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.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 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms.Droid 2 | { 3 | using global::Android.App; 4 | using global::Android.Content.PM; 5 | using global::Android.OS; 6 | 7 | using OpenMVVM.Samples.Basic.XamarinForms; 8 | 9 | [Activity(Label = "HelloWorld.App.XamarinForms", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 10 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 11 | { 12 | protected override void OnCreate(Bundle bundle) 13 | { 14 | TabLayoutResource = Resource.Layout.Tabbar; 15 | ToolbarResource = Resource.Layout.Toolbar; 16 | 17 | base.OnCreate(bundle); 18 | 19 | global::Xamarin.Forms.Forms.Init(this, bundle); 20 | 21 | LoadApplication(new App(()=>{ var vmLocator = new ViewModelLocator(); })); 22 | } 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.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("OpenMVVM.Samples.Basic.XamarinForms.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("OpenMVVM.Samples.Basic.XamarinForms.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 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/drawable/icon.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/layout/Tabbar.axml: -------------------------------------------------------------------------------- 1 | 2 | 12 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/layout/Toolbar.axml: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 26 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.Android/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms.Droid 2 | { 3 | using OpenMVVM.Android.PlatformServices; 4 | using OpenMVVM.Core; 5 | using OpenMVVM.Core.PlatformServices; 6 | using OpenMVVM.Core.PlatformServices.Lifecycle; 7 | using OpenMVVM.Core.PlatformServices.Navigation; 8 | using OpenMVVM.Samples.Basic.ViewModel; 9 | using OpenMVVM.Samples.Basic.ViewModel.Services; 10 | using OpenMVVM.Samples.Basic.XamarinForms; 11 | using OpenMVVM.XamarinForms; 12 | 13 | public class ViewModelLocator : ViewModelLocatorBase 14 | { 15 | public ViewModelLocator() 16 | { 17 | var ioc = IocInstanceFactory.Default; 18 | 19 | // Services 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | ioc.RegisterType(); 25 | ioc.RegisterType(); 26 | 27 | // ViewModels 28 | ioc.RegisterType(); 29 | ioc.RegisterType(); 30 | 31 | ioc.RegisterInstanceByKey("MainView"); 32 | ioc.RegisterInstanceByKey("DetailView"); 33 | } 34 | 35 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 36 | 37 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms.UWP 2 | { 3 | public sealed partial class MainPage 4 | { 5 | public MainPage() 6 | { 7 | this.InitializeComponent(); 8 | 9 | this.LoadApplication(new XamarinForms.App(() => { var vmLocator = new ViewModelLocator(); })); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/OpenMVVM.Samples.Basic.XamarinForms.UWP_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/OpenMVVM.Samples.Basic.XamarinForms.UWP_TemporaryKey.pfx -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.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("OpenMVVM.Samples.Basic.XamarinForms.UWP")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.Samples.Basic.XamarinForms.UWP")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 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)] -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.UWP/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms.UWP 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Core.PlatformServices; 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | using OpenMVVM.Samples.Basic.ViewModel; 8 | using OpenMVVM.Samples.Basic.ViewModel.Services; 9 | using OpenMVVM.UWP.PlatformServices; 10 | 11 | public class ViewModelLocator : ViewModelLocatorBase 12 | { 13 | public ViewModelLocator() 14 | { 15 | var ioc = IocInstanceFactory.Default; 16 | 17 | // Services 18 | ioc.RegisterType(); 19 | ioc.RegisterType(); 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | 25 | // ViewModels 26 | ioc.RegisterType(); 27 | ioc.RegisterType(); 28 | 29 | ioc.RegisterInstanceByKey("MainView"); 30 | ioc.RegisterInstanceByKey("DetailView"); 31 | } 32 | 33 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 34 | 35 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms.iOS 2 | { 3 | using Foundation; 4 | 5 | using OpenMVVM.Samples.Basic.XamarinForms; 6 | 7 | using UIKit; 8 | 9 | // The UIApplicationDelegate for the application. This class is responsible for launching the 10 | // User Interface of the application, as well as listening (and optionally responding) to 11 | // application events from iOS. 12 | [Register("AppDelegate")] 13 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 14 | { 15 | // 16 | // This method is invoked when the application has loaded and is ready to run. In this 17 | // method you should instantiate the window, load the UI into it and then make the window 18 | // visible. 19 | // 20 | // You have 17 seconds to return from this method, or iOS will terminate your application. 21 | // 22 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 23 | { 24 | global::Xamarin.Forms.Forms.Init(); 25 | this.LoadApplication(new App(() => { var vmLocator = new ViewModelLocator(); })); 26 | 27 | return base.FinishedLaunching(app, options); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms.iOS 2 | { 3 | using UIKit; 4 | 5 | public class Application 6 | { 7 | // This is the main entry point of the application. 8 | static void Main(string[] args) 9 | { 10 | // if you want to use a different Application Delegate class from "AppDelegate" 11 | // you can specify it here. 12 | UIApplication.Main(args, null, "AppDelegate"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.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("OpenMVVM.Samples.Basic.XamarinForms.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OpenMVVM.Samples.Basic.XamarinForms.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 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-60@2x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-60@3x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-76.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-76@2x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small-40.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small-40@2x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small-40@3x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small@2x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/Resources/Icon-Small@3x.png -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms.iOS 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Core.PlatformServices; 5 | using OpenMVVM.Core.PlatformServices.Lifecycle; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | using OpenMVVM.Ios.PlatformServices; 8 | using OpenMVVM.Samples.Basic.ViewModel; 9 | using OpenMVVM.Samples.Basic.ViewModel.Services; 10 | using OpenMVVM.XamarinForms.Ios; 11 | 12 | public class ViewModelLocator : ViewModelLocatorBase 13 | { 14 | public ViewModelLocator() 15 | { 16 | var ioc = IocInstanceFactory.Default; 17 | 18 | // Services 19 | ioc.RegisterType(); 20 | ioc.RegisterType(); 21 | ioc.RegisterType(); 22 | ioc.RegisterType(); 23 | ioc.RegisterType(); 24 | ioc.RegisterType(); 25 | 26 | // ViewModels 27 | ioc.RegisterType(); 28 | ioc.RegisterType(); 29 | 30 | ioc.RegisterInstanceByKey("MainView"); 31 | ioc.RegisterInstanceByKey("DetailView"); 32 | } 33 | 34 | public MainViewModel MainViewModel => InstanceFactory.GetInstance(); 35 | 36 | public DetailViewModel DetailViewModel => InstanceFactory.GetInstance(); 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/iTunesArtwork: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/iTunesArtwork -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/iTunesArtwork@2x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms.iOS/iTunesArtwork@2x -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms 2 | { 3 | using System; 4 | 5 | using OpenMVVM.Core; 6 | using OpenMVVM.Core.PlatformServices.Navigation; 7 | using OpenMVVM.XamarinForms; 8 | 9 | using Xamarin.Forms; 10 | 11 | public partial class App : Application 12 | { 13 | public App(Action action) 14 | { 15 | this.InitializeComponent(); 16 | 17 | this.MainPage = new RootNavigationPage(new LandingView()); 18 | action(); 19 | } 20 | 21 | protected override void OnStart() 22 | { 23 | // Handle when your app starts 24 | ViewModelLocatorBase.InstanceFactory.GetInstance().NavigateTo("MainView"); 25 | } 26 | 27 | protected override void OnSleep() 28 | { 29 | // Handle when your app sleeps 30 | } 31 | 32 | protected override void OnResume() 33 | { 34 | // Handle when your app resumes 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms/DetailView.xaml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms/DetailView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Samples.Basic.ViewModel; 5 | 6 | using Xamarin.Forms; 7 | using Xamarin.Forms.Xaml; 8 | 9 | [XamlCompilation(XamlCompilationOptions.Compile)] 10 | public partial class DetailView : ContentPage 11 | { 12 | public DetailView() 13 | { 14 | this.InitializeComponent(); 15 | this.BindingContext = ViewModelLocatorBase.InstanceFactory.GetInstance(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms/LandingView.xaml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms/LandingView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms 2 | { 3 | using Xamarin.Forms; 4 | using Xamarin.Forms.Xaml; 5 | 6 | [XamlCompilation(XamlCompilationOptions.Compile)] 7 | public partial class LandingView : ContentPage 8 | { 9 | public LandingView() 10 | { 11 | this.InitializeComponent(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms/MainView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Samples.Basic.XamarinForms 2 | { 3 | using OpenMVVM.Core; 4 | using OpenMVVM.Samples.Basic.ViewModel; 5 | 6 | using Xamarin.Forms; 7 | using Xamarin.Forms.Xaml; 8 | 9 | [XamlCompilation(XamlCompilationOptions.Compile)] 10 | public partial class MainView : ContentPage 11 | { 12 | public MainView() 13 | { 14 | this.InitializeComponent(); 15 | this.BindingContext = ViewModelLocatorBase.InstanceFactory.GetInstance(); 16 | } 17 | 18 | private void ListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 19 | { 20 | ((MainViewModel)this.BindingContext).NavigateToItemCommand.Execute(e.SelectedItem); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Samples/Basic/OpenMVVM.Samples.Basic.XamarinForms/OpenMVVM.Samples.Basic.XamarinForms.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Tests/WebViewUnitTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("WebViewUnitTests")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("WebViewUnitTests")] 10 | [assembly: AssemblyCopyright("Copyright © 2017")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("85a2865f-263e-4ee6-8cd1-f028806bd819")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /src/Tests/WebViewUnitTests/TestBridge.cs: -------------------------------------------------------------------------------- 1 | namespace WebViewUnitTests 2 | { 3 | using System; 4 | 5 | using OpenMVVM.WebView; 6 | 7 | public class TestBridge : Bridge 8 | { 9 | public Action Action { get; set; } 10 | 11 | public override void SendMessage(BridgeMessage message) 12 | { 13 | this.Action(message); 14 | } 15 | 16 | public void OnReceiveMessage(BridgeMessage bridgeMessage) 17 | { 18 | this.OnMessageReceived(bridgeMessage); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Tests/WebViewUnitTests/TestViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace WebViewUnitTests 2 | { 3 | using OpenMVVM.Core; 4 | 5 | public class TestViewModel : ObservableObject 6 | { 7 | private string title; 8 | 9 | public string Title 10 | { 11 | get 12 | { 13 | return this.title; 14 | } 15 | set 16 | { 17 | this.Set(ref this.title, value); 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Tests/WebViewUnitTests/TestViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | namespace WebViewUnitTests 2 | { 3 | using OpenMVVM.Core; 4 | 5 | public class TestViewModelLocator : ViewModelLocatorBase 6 | { 7 | public TestViewModelLocator() 8 | { 9 | var ioc = IocInstanceFactory.Default; 10 | 11 | ioc.RegisterType(); 12 | } 13 | 14 | public TestViewModel TestViewModel 15 | { 16 | get 17 | { 18 | return IocInstanceFactory.Default.GetInstance(); 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Tests/WebViewUnitTests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Utils/OpenMVVM.Utils.HttpClient/IHttpClient.cs: -------------------------------------------------------------------------------- 1 | namespace OpenMVVM.Web 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Net; 6 | using System.Net.Http; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | public interface IHttpClient 11 | { 12 | Task GetRawAsync(string url, CancellationToken cancellationToken); 13 | 14 | Task> GetJsonAsync(string url, CancellationToken cancellationToken); 15 | 16 | Task GetXmlAsync(string url, CancellationToken cancellationToken); 17 | 18 | Task> CallAsync( 19 | string verb, 20 | string url, 21 | IEnumerable> headers, 22 | IEnumerable> content, 23 | CancellationToken cancellationToken); 24 | 25 | Task> PostJsonAsync( 26 | string url, 27 | IEnumerable> headers, 28 | TData data, 29 | CancellationToken cancellationToken); 30 | 31 | Task> CallJsonAsync( 32 | string verb, 33 | string url, 34 | IEnumerable> headers, 35 | HttpContent content, 36 | CancellationToken cancellationToken); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Utils/OpenMVVM.Utils.HttpClient/OpenMVVM.Utils.HttpClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/lib/jsbridge/JsBridge.iOS.Unified.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BananaBytes/openmvvm/da603fcbef3b2f0a8103a6c8c7ff676f9a79721e/src/lib/jsbridge/JsBridge.iOS.Unified.dll --------------------------------------------------------------------------------