Changed Framework to Prism

This commit is contained in:
TheJoKlLa 2020-11-12 22:16:55 +01:00
parent a5559eebe6
commit 2f12b68671
46 changed files with 569 additions and 5419 deletions

View File

@ -53,7 +53,10 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1364" />
<PackageReference Include="Prism.DryIoc.Forms">
<Version>8.0.0.1909</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1687" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<ItemGroup>
@ -94,4 +97,9 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties TriggeredFromHotReload="False" />
</VisualStudio>
</ProjectExtensions>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Xamarin.Forms.4.8.0.1364\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.4.8.0.1364\build\Xamarin.Forms.props')" />
<Import Project="..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Borepin.GTK</RootNamespace>
<AssemblyName>Borepin.GTK</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
@ -42,6 +42,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\atk-sharp.dll</HintPath>
</Reference>
<Reference Include="DryIoc, Version=4.5.1.0, Culture=neutral, PublicKeyToken=dfbf2bd50fcf7768, processorArchitecture=MSIL">
<HintPath>..\..\packages\DryIoc.dll.4.5.1\lib\net45\DryIoc.dll</HintPath>
</Reference>
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\gdk-sharp.dll</HintPath>
@ -69,6 +72,15 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\GtkSharp\2.12\lib\gtk-sharp-2.0\pango-sharp.dll</HintPath>
</Reference>
<Reference Include="Prism, Version=8.0.0.1909, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\..\packages\Prism.Core.8.0.0.1909\lib\net47\Prism.dll</HintPath>
</Reference>
<Reference Include="Prism.DryIoc.Forms, Version=8.0.0.1909, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Prism.DryIoc.Forms.8.0.0.1909\lib\netstandard2.0\Prism.DryIoc.Forms.dll</HintPath>
</Reference>
<Reference Include="Prism.Forms, Version=8.0.0.1909, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Prism.Forms.8.0.0.1909\lib\netstandard2.0\Prism.Forms.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -77,20 +89,20 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1364\lib\netstandard2.0\Xamarin.Forms.Core.dll</HintPath>
<Reference Include="webkit-sharp, Version=1.1.15.0, Culture=neutral, PublicKeyToken=eaa1d335d2e19745, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1687\lib\net45\webkit-sharp.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1364\lib\netstandard2.0\Xamarin.Forms.Platform.dll</HintPath>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1687\lib\netstandard2.0\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1364\lib\netstandard2.0\Xamarin.Forms.Xaml.dll</HintPath>
<Reference Include="Xamarin.Forms.Platform, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1687\lib\netstandard2.0\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="webkit-sharp">
<HintPath>..\..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1364\lib\net45\webkit-sharp.dll</HintPath>
<Reference Include="Xamarin.Forms.Platform.GTK, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1687\lib\net45\Xamarin.Forms.Platform.GTK.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.GTK">
<HintPath>..\..\packages\Xamarin.Forms.Platform.GTK.4.8.0.1364\lib\net45\Xamarin.Forms.Platform.GTK.dll</HintPath>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1687\lib\netstandard2.0\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -110,5 +122,12 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Forms.4.8.0.1364\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.4.8.0.1364\build\Xamarin.Forms.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets'))" />
</Target>
<Import Project="..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets')" />
</Project>

View File

@ -6,6 +6,14 @@
<assemblyIdentity name="OpenTK" publicKeyToken="bad199fe84eb3df4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Prism" publicKeyToken="40ee6c3a2184dc59" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1909" newVersion="8.0.0.1909" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DryIoc" publicKeyToken="dfbf2bd50fcf7768" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.1.0" newVersion="4.5.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="OpenTK" version="3.2" targetFramework="net472" />
<package id="Xamarin.Forms" version="4.8.0.1364" targetFramework="net472" />
<package id="Xamarin.Forms.Platform.GTK" version="4.8.0.1364" targetFramework="net472" />
<package id="DryIoc.dll" version="4.5.1" targetFramework="net48" />
<package id="OpenTK" version="3.2" targetFramework="net48" />
<package id="Prism.Core" version="8.0.0.1909" targetFramework="net472" />
<package id="Prism.DryIoc.Forms" version="8.0.0.1909" targetFramework="net48" />
<package id="Prism.Forms" version="8.0.0.1909" targetFramework="net48" />
<package id="Xamarin.Forms" version="4.8.0.1687" targetFramework="net48" />
<package id="Xamarin.Forms.Platform.GTK" version="4.8.0.1687" targetFramework="net48" />
</packages>

View File

@ -143,7 +143,10 @@
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1560" />
<PackageReference Include="Prism.DryIoc.Forms">
<Version>8.0.0.1909</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1687" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.10" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>

View File

@ -164,7 +164,10 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1364" />
<PackageReference Include="Prism.DryIoc.Forms">
<Version>8.0.0.1909</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1687" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Xamarin.Forms.4.8.0.1364\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.4.8.0.1364\build\Xamarin.Forms.props')" />
<Import Project="..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props" Condition="Exists('..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -59,18 +59,30 @@
</XamMacArch>
</PropertyGroup>
<ItemGroup>
<Reference Include="DryIoc, Version=4.5.1.0, Culture=neutral, PublicKeyToken=dfbf2bd50fcf7768, processorArchitecture=MSIL">
<HintPath>..\..\packages\DryIoc.dll.4.5.1\lib\netstandard2.0\DryIoc.dll</HintPath>
</Reference>
<Reference Include="Prism, Version=8.0.0.1909, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\..\packages\Prism.Core.8.0.0.1909\lib\netstandard2.0\Prism.dll</HintPath>
</Reference>
<Reference Include="Prism.DryIoc.Forms, Version=8.0.0.1909, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Prism.DryIoc.Forms.8.0.0.1909\lib\netstandard2.0\Prism.DryIoc.Forms.dll</HintPath>
</Reference>
<Reference Include="Prism.Forms, Version=8.0.0.1909, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Prism.Forms.8.0.0.1909\lib\netstandard2.0\Prism.Forms.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1687\lib\Xamarin.Mac\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1687\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1687\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Mac" />
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1364\lib\Xamarin.Mac\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1364\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\..\packages\Xamarin.Forms.4.8.0.1364\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
@ -90,6 +102,7 @@
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<None Include="packages.config" />
@ -112,5 +125,12 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Forms.4.8.0.1364\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.4.8.0.1364\build\Xamarin.Forms.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.props'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets'))" />
</Target>
<Import Project="..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.4.8.0.1687\build\Xamarin.Forms.targets')" />
</Project>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Prism" publicKeyToken="40ee6c3a2184dc59" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1909" newVersion="8.0.0.1909" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DryIoc" publicKeyToken="dfbf2bd50fcf7768" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.1.0" newVersion="4.5.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Xamarin.Forms" version="4.8.0.1364" targetFramework="xamarinmac20" />
<package id="DryIoc.dll" version="4.5.1" targetFramework="xamarinmac20" />
<package id="Prism.Core" version="8.0.0.1909" targetFramework="xamarinmac20" />
<package id="Prism.DryIoc.Forms" version="8.0.0.1909" targetFramework="xamarinmac20" />
<package id="Prism.Forms" version="8.0.0.1909" targetFramework="xamarinmac20" />
<package id="System.Reflection.Emit.Lightweight" version="4.7.0" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms" version="4.8.0.1687" targetFramework="xamarinmac20" />
</packages>

View File

@ -1,8 +1,38 @@
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
<prism:PrismApplication xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com"
mc:Ignorable="d"
x:Class="Borepin.App">
<Application.Resources>
<ResourceDictionary Source="Styles/LightTheme.xaml" />
<Color x:Key="PrimaryColor">#7E7D81</Color>
<Color x:Key="AccentColor">#00A5F2</Color>
<Color x:Key="TextColor">White</Color>
<Style TargetType="TabbedPage">
<Setter Property="BarBackgroundColor" Value="{StaticResource PrimaryColor}" />
<Setter Property="BarTextColor" Value="{StaticResource TextColor}" />
<Setter Property="SelectedTabColor" Value="{StaticResource AccentColor}" />
<Setter Property="UnselectedTabColor" Value="{StaticResource PrimaryColor}" />
</Style>
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="{StaticResource PrimaryColor}" />
<Setter Property="BarTextColor" Value="{StaticResource TextColor}" />
</Style>
<Style TargetType="Button">
<Setter Property="BackgroundColor" Value="{StaticResource AccentColor}" />
<Setter Property="TextColor" Value="{StaticResource TextColor}" />
<Setter Property="CornerRadius" Value="15" />
</Style>
<Style TargetType="Button" x:Key="DarkButton">
<Setter Property="BackgroundColor" Value="{StaticResource PrimaryColor}" />
<Setter Property="TextColor" Value="{StaticResource TextColor}" />
<Setter Property="CornerRadius" Value="15" />
</Style>
</Application.Resources>
</Application>
</prism:PrismApplication>

View File

@ -1,37 +1,37 @@
using Borepin.Base;
using System;
using Prism.Ioc;
using Borepin.PageModel;
using Borepin.Service.Navigation;
using System;
using System.Threading.Tasks;
using Borepin.Page;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin
{
public partial class App : Application
public partial class App
{
public App()
{
}
protected override async void OnInitialized()
{
InitializeComponent();
var result = await NavigationService.NavigateAsync("MainPage/NavigationPage/ViewA");
if (!result.Success)
{
System.Diagnostics.Debugger.Break();
}
}
Task InitNavigation()
{
var navService = PageModelLocator.Resolve<INavigationService>();
return navService.NaviagteToAsync<BorpinMasterDetailPageModel>(null, true);
}
protected override async void OnStart()
{
await InitNavigation();
}
protected override void OnSleep()
{
}
protected override void OnResume()
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<NavigationPage>();
containerRegistry.RegisterForNavigation<MyTabbedPage>(nameof(TabbedPage));
containerRegistry.RegisterForNavigation<MainPage, MainPageViewModel>();
containerRegistry.RegisterForNavigation<ViewA>();
containerRegistry.RegisterForNavigation<ViewB>();
}
}
}

View File

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Borepin.Base
{
public class PageModelBase : BindableObject
{
public virtual Task InitializeAsync(object naviagitionData = null)
{
return Task.CompletedTask;
}
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
{
if(EqualityComparer<T>.Default.Equals(storage, value))
{
return false;
}
storage = value;
OnPropertyChanged(propertyName);
return true;
}
}
}

View File

@ -1,55 +0,0 @@
using Borepin.Page;
using Borepin.PageModel;
using Borepin.Service.Navigation;
using System;
using System.Collections.Generic;
using TinyIoC;
namespace Borepin.Base
{
public class PageModelLocator
{
private static TinyIoCContainer _Container;
private static Dictionary<Type, Type> _ViewLookUp;
static PageModelLocator()
{
_Container = new TinyIoCContainer();
_ViewLookUp = new Dictionary<Type, Type>();
// Register Pages and PageModels
Register<BorpinMasterDetailPageModel, BorpinMasterDetailPage>();
Register<BorpinMasterPageModel, BorpinMasterPage>();
Register<MachinesPageModel, MachinesPage>();
Register<SettingsPageModel, SettingsPage>();
Register<DashboardPageModel, DashboardPage>();
Register<LoginPageModel, LoginPage>();
// Register Services (Services are registered by Singeltons default)
_Container.Register<INavigationService, NavigationService>();
}
public static T Resolve<T>() where T : class
{
return _Container.Resolve<T>();
}
public static Xamarin.Forms.Page CreatePage(Type pageModelType)
{
Type pageType = _ViewLookUp[pageModelType];
Xamarin.Forms.Page page = (Xamarin.Forms.Page)Activator.CreateInstance(pageType);
object pageModel = _Container.Resolve(pageModelType);
page.BindingContext = pageModel;
return page;
}
static void Register<TPageModel, TPage>() where TPageModel : PageModelBase where TPage : Xamarin.Forms.Page
{
_ViewLookUp.Add(typeof(TPageModel), typeof(TPage));
_Container.Register<TPageModel>();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
using System;
using Xamarin.Forms;
namespace Borepin.Behaviour.Base
{
public class BehaviorBase<T> : Behavior<T> where T : BindableObject
{
public T AssociatedObject { get; private set; }
protected override void OnAttachedTo(T bindable)
{
base.OnAttachedTo(bindable);
AssociatedObject = bindable;
if (bindable.BindingContext != null)
BindingContext = bindable.BindingContext;
bindable.BindingContextChanged += OnBindingContextChanged;
}
protected override void OnDetachingFrom(T bindable)
{
base.OnDetachingFrom(bindable);
bindable.BindingContextChanged -= OnBindingContextChanged;
AssociatedObject = null;
}
void OnBindingContextChanged(object sender, EventArgs e)
{
OnBindingContextChanged();
}
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
BindingContext = AssociatedObject.BindingContext;
}
}
}

View File

@ -1,91 +0,0 @@
using Borepin.Behaviour.Base;
using System;
using System.Reflection;
using System.Windows.Input;
using Xamarin.Forms;
namespace Borepin.Behaviour
{
public class EventToCommandBehavior : BehaviorBase<VisualElement>
{
Delegate eventHandler;
public static readonly BindableProperty EventNameProperty = BindableProperty.Create("EventName", typeof(string), typeof(EventToCommandBehavior), null, propertyChanged: OnEventNameChanged);
public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(EventToCommandBehavior), null);
public string EventName
{
get { return (string)GetValue(EventNameProperty); }
set { SetValue(EventNameProperty, value); }
}
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
protected override void OnAttachedTo(VisualElement bindable)
{
base.OnAttachedTo(bindable);
RegisterEvent(EventName);
}
protected override void OnDetachingFrom(VisualElement bindable)
{
DeregisterEvent(EventName);
base.OnDetachingFrom(bindable);
}
static void OnEventNameChanged(BindableObject bindable, object oldValue, object newValue)
{
var behavior = (EventToCommandBehavior)bindable;
if (behavior.AssociatedObject == null) return;
string oldEventName = (string)oldValue;
string newEventName = (string)newValue;
behavior.DeregisterEvent(oldEventName);
behavior.RegisterEvent(newEventName);
}
void RegisterEvent(string name)
{
if (string.IsNullOrWhiteSpace(name)) return;
EventInfo eventInfo = AssociatedObject.GetType().GetRuntimeEvent(name);
if (eventInfo == null)
throw new ArgumentException(string.Format("EventToCommandBehavior: Can't register the '{0}' event.", EventName));
MethodInfo methodInfo = typeof(EventToCommandBehavior).GetTypeInfo().GetDeclaredMethod("OnEvent");
eventHandler = methodInfo.CreateDelegate(eventInfo.EventHandlerType, this);
eventInfo.AddEventHandler(AssociatedObject, eventHandler);
}
void DeregisterEvent(string name)
{
if (string.IsNullOrWhiteSpace(name) || eventHandler == null)
return;
EventInfo eventInfo = AssociatedObject.GetType().GetRuntimeEvent(name);
if (eventInfo == null)
throw new ArgumentException(string.Format("EventToCommandBehavior: Can't de-register the '{0}' event.", EventName));
eventInfo.RemoveEventHandler(AssociatedObject, eventHandler);
eventHandler = null;
}
void OnEvent(object sender, object eventArgs)
{
if (Command == null) return;
object resolvedParameter;
resolvedParameter = eventArgs;
if (Command.CanExecute(resolvedParameter))
Command.Execute(resolvedParameter);
}
}
}

View File

@ -20,19 +20,11 @@
<Warning Text="$(MSBuildProjectFile) is Multilingual build enabled, but the Multilingual App Toolkit is unavailable during the build. If building with Visual Studio, please check to ensure that toolkit is properly installed." />
</Target>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1364" />
<PackageReference Include="Prism.DryIoc.Forms" Version="8.0.0.1909" />
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1687" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<ItemGroup>
<Compile Update="Page\BorpinMasterDetailPage.xaml.cs">
<DependentUpon>BorpinMasterDetailPage.xaml</DependentUpon>
</Compile>
<Compile Update="Page\BorpinMasterPage.xaml.cs">
<DependentUpon>BorpinMasterPage.xaml</DependentUpon>
</Compile>
<Compile Update="Page\MachinesPage.xaml.cs">
<DependentUpon>MachinesPage.xaml</DependentUpon>
</Compile>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@ -48,22 +40,13 @@
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Page\BorpinMasterDetailPage.xaml">
<EmbeddedResource Update="Page\MainPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\MachinesPage.xaml">
<EmbeddedResource Update="Page\ViewA.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\BorpinMasterPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\DashboardPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\LoginPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\SettingsPage.xaml">
<EmbeddedResource Update="Page\ViewB.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
@ -78,4 +61,9 @@
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Base\" />
<Folder Include="Behaviour\" />
<Folder Include="Service\" />
</ItemGroup>
</Project>

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.MainPage">
<StackLayout BackgroundColor="#FFFFFFFF">
<Frame BackgroundColor="{DynamicResource SecondColor}" Padding="24" CornerRadius="0">
<Label Text="Welcome to FabAccess" HorizontalTextAlignment="Center" TextColor="{DynamicResource FirstColor}" FontSize="36"/>
</Frame>
<Label Text="Join now" FontSize="Title" Padding="30,10,30,10" />
<Label Text="Register a Card and start working." FontSize="16" Padding="30,0,30,0" TextColor="{DynamicResource FourthColor}"/>
<Label FontSize="16" Padding="30,24,30,0" TextColor="{DynamicResource FourthColor}">
<Label.FormattedText>
<FormattedString>
<FormattedString.Spans>
<Span Text="Learn more at "/>
<Span Text="https://fab-access.org" FontAttributes="Bold" TextColor="{DynamicResource ThirdColor}"/>
</FormattedString.Spans>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
</ContentPage>

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Borepin
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
}
}

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.BorpinMasterDetailPage"
xmlns:pages="clr-namespace:Borepin.Page">
<MasterDetailPage.Master>
<pages:BorpinMasterPage BindingContext="{Binding BorpinMasterPM}" />
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<pages:MachinesPage BindingContext="{Binding MachinePM}" />
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>

View File

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class BorpinMasterDetailPage : MasterDetailPage
{
public BorpinMasterDetailPage()
{
InitializeComponent();
}
}
}

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:behaviour="clr-namespace:Borepin.Behaviour"
x:Class="Borepin.Page.BorpinMasterPage"
Title="Master">
<StackLayout>
<ListView x:Name="MasterMenuListView"
SeparatorVisibility="None"
HasUnevenRows="true"
ItemsSource="{Binding MasterMenu}"
SelectedItem="{Binding MasterMenu_ItemSelected, Mode=TwoWay}">
<ListView.Behaviors>
<behaviour:EventToCommandBehavior EventName="ItemSelected" Command="{Binding ShowDetailPageAsyncCommand}" />
</ListView.Behaviors>
<ListView.Header>
<Grid BackgroundColor="#03A9F4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="80"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="10"/>
</Grid.RowDefinitions>
<Label
Grid.Column="1"
Grid.Row="2"
Text="FabAccess"
Style="{DynamicResource SubtitleStyle}"/>
</Grid>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="15,10" HorizontalOptions="FillAndExpand">
<Label VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center"
Text="{Binding Title}"
FontSize="24"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>

View File

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class BorpinMasterPage : ContentPage
{
public BorpinMasterPage()
{
InitializeComponent();
}
}
}

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class DashboardPage : ContentPage
{
public DashboardPage()
{
InitializeComponent();
}
}
}

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.MachinesPage"
Title="Machines">
<StackLayout Padding="10">
<Label Text="Site about the Machines"/>
</StackLayout>
</ContentPage>

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MachinesPage : ContentPage
{
public MachinesPage()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.MainPage"
Title="Main Page"
x:Name="page">
<MasterDetailPage.Master>
<ContentPage Title="Menu"
IconImageSource="{OnPlatform iOS='hamburger.png'}"
Padding="{OnPlatform Default='20', iOS='20,40'}">
<StackLayout>
<Label Text="Master Detail Demo"
FontSize="Large"
FontAttributes="Bold"
Margin="0,20"/>
<Button Text="View A"
Command="{Binding NavigateCommand}"
CommandParameter="ViewA" />
<Button Text="View B"
Command="{Binding NavigateCommand}"
CommandParameter="ViewB" />
<Button Text="TabbedPage"
Command="{Binding NavigateCommand}"
CommandParameter="TabbedPage?createTab=ViewA&amp;createTab=ViewB" />
<StackLayout Orientation="Horizontal">
<Switch IsToggled="{Binding IsPresentedAfterNavigation,Source={x:Reference page}}" />
<Label Text="Is Presented After Navigation" />
</StackLayout>
</StackLayout>
</ContentPage>
</MasterDetailPage.Master>
</MasterDetailPage>

View File

@ -0,0 +1,22 @@
using Prism.Navigation;
using Xamarin.Forms;
namespace Borepin.Page
{
public partial class MainPage : IMasterDetailPageOptions
{
public static readonly BindableProperty IsPresentedAfterNavigationProperty =
BindableProperty.Create(nameof(IsPresentedAfterNavigation), typeof(bool), typeof(MainPage), false);
public MainPage()
{
InitializeComponent();
}
public bool IsPresentedAfterNavigation
{
get => (bool)GetValue(IsPresentedAfterNavigationProperty);
set => SetValue(IsPresentedAfterNavigationProperty, value);
}
}
}

View File

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Borepin.Page
{
public class MasterMenuItem
{
public MasterMenuItem()
{
TargetType = typeof(MasterMenuItem);
}
public int Id { get; set; }
public string Title { get; set; }
public Type TargetType { get; set; }
}
}

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.SettingsPage"
Title="Settings">
<ContentPage.Content>
<StackLayout>
<Label Text="Site about the Settings"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.DashboardPage">
x:Class="Borepin.Page.ViewA">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
<Label Text="View A"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>

View File

@ -10,9 +10,9 @@ using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoginPage : ContentPage
public partial class ViewA : ContentPage
{
public LoginPage()
public ViewA()
{
InitializeComponent();
}

View File

@ -1,14 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.LoginPage"
Title="Login">
x:Class="Borepin.Page.ViewB">
<ContentPage.Content>
<StackLayout>
<Label Text="LoginPage"
<Label Text="View B"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
<Button Text="Sign In" Command="{Binding SignInCommand}"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -10,9 +10,9 @@ using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SettingsPage : ContentPage
public partial class ViewB : ContentPage
{
public SettingsPage()
public ViewB()
{
InitializeComponent();
}

View File

@ -1,48 +0,0 @@
using Borepin.Base;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Borepin.PageModel
{
public class BorpinMasterDetailPageModel : PageModelBase
{
public BorpinMasterDetailPageModel(BorpinMasterPageModel borpinMasterPM, MachinesPageModel machinesPM, SettingsPageModel settingsPM)
{
BorpinMasterPM = borpinMasterPM;
MachinesPM = machinesPM;
SettingsPM = settingsPM;
}
private BorpinMasterPageModel _BorpinMasterPM;
public BorpinMasterPageModel BorpinMasterPM
{
get => _BorpinMasterPM;
set => SetProperty(ref _BorpinMasterPM, value);
}
private MachinesPageModel _MachinesPM;
public MachinesPageModel MachinesPM
{
get => _MachinesPM;
set => SetProperty(ref _MachinesPM, value);
}
private SettingsPageModel _SettingsPM;
public SettingsPageModel SettingsPM
{
get => _SettingsPM;
set => SetProperty(ref _SettingsPM, value);
}
public override Task InitializeAsync(object navigationData)
{
return Task.WhenAny(
base.InitializeAsync(navigationData),
BorpinMasterPM.InitializeAsync(null),
MachinesPM.InitializeAsync(null),
SettingsPM.InitializeAsync(null));
}
}
}

View File

@ -1,76 +0,0 @@
using Borepin.Base;
using Borepin.Page;
using Borepin.Service.Navigation;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Xml.Schema;
using Xamarin.Forms;
namespace Borepin.PageModel
{
public class BorpinMasterPageModel : PageModelBase
{
private INavigationService _NavigationService;
public BorpinMasterPageModel(INavigationService navigationService)
{
_NavigationService = navigationService;
MasterMenu = new ObservableCollection<MasterMenuItem>()
{
new MasterMenuItem{ Id = 0, Title = "Machines" },
new MasterMenuItem{ Id = 1, Title = "Settings" }
};
_showDetailPageAsyncCommand = new Command(ShowDetailPageAsync);
}
private ObservableCollection<MasterMenuItem> _MasterMenu;
public ObservableCollection<MasterMenuItem> MasterMenu
{
get => _MasterMenu;
set => SetProperty(ref _MasterMenu, value);
}
private MasterMenuItem _MasterMenu_ItemSelected;
public MasterMenuItem MasterMenu_ItemSelected
{
get => _MasterMenu_ItemSelected;
set => SetProperty(ref _MasterMenu_ItemSelected, value);
}
private ICommand _showDetailPageAsyncCommand;
public ICommand ShowDetailPageAsyncCommand
{
get => _showDetailPageAsyncCommand;
set => SetProperty(ref _showDetailPageAsyncCommand, value);
}
private async void ShowDetailPageAsync()
{
switch (MasterMenu_ItemSelected.Title)
{
case "Machines":
await _NavigationService.NaviagteToAsync<MachinesPageModel>();
break;
case "Settings":
await _NavigationService.NaviagteToAsync<SettingsPageModel>();
break;
default:
break;
}
if (Application.Current.MainPage is MasterDetailPage masterDetailPage)
{
masterDetailPage.IsPresented = false;
}
else if (Application.Current.MainPage is NavigationPage navigationPage
&& navigationPage.CurrentPage is MasterDetailPage nestedMasterDetail)
{
nestedMasterDetail.IsPresented = false;
}
}
}
}

View File

@ -1,12 +0,0 @@
using Borepin.Base;
using System;
using System.Collections.Generic;
using System.Text;
namespace Borepin.PageModel
{
public class DashboardPageModel : PageModelBase
{
}
}

View File

@ -1,34 +0,0 @@
using Borepin.Base;
using Borepin.Page;
using Borepin.Service.Navigation;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using Xamarin.Forms;
namespace Borepin.PageModel
{
public class LoginPageModel : PageModelBase
{
private ICommand _signInCommand;
private INavigationService _NaviagtionService;
public ICommand SignInCommand
{
get => _signInCommand;
set => SetProperty(ref _signInCommand, value);
}
public LoginPageModel(INavigationService navigationService)
{
_NaviagtionService = navigationService;
SignInCommand = new Command(OnSignInAction);
}
private void OnSignInAction(object obj)
{
_NaviagtionService.NaviagteToAsync<DashboardPageModel>();
}
}
}

View File

@ -1,20 +0,0 @@
using Borepin.Base;
using Borepin.Service.Navigation;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using Xamarin.Forms;
namespace Borepin.PageModel
{
public class MachinesPageModel : PageModelBase
{
private INavigationService _NaviagtionService;
public MachinesPageModel(INavigationService navigationService)
{
_NaviagtionService = navigationService;
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Navigation;
namespace Borepin.PageModel
{
public class MainPageViewModel : BindableBase
{
private INavigationService _navigationService { get; }
public MainPageViewModel(INavigationService navigationService)
{
_navigationService = navigationService;
NavigateCommand = new DelegateCommand<string>(NavigateCommandExecuted);
}
public DelegateCommand<string> NavigateCommand { get; }
private async void NavigateCommandExecuted(string view)
{
var result = await _navigationService.NavigateAsync($"NavigationPage/{view}");
if(!result.Success)
{
System.Diagnostics.Debugger.Break();
}
}
}
}

View File

@ -0,0 +1,12 @@
using Xamarin.Forms;
namespace Borepin.PageModel
{
public class MyTabbedPage : TabbedPage
{
public MyTabbedPage()
{
Title = "Tabbed Page";
}
}
}

View File

@ -1,12 +0,0 @@
using Borepin.Base;
using System;
using System.Collections.Generic;
using System.Text;
namespace Borepin.PageModel
{
public class SettingsPageModel : PageModelBase
{
}
}

View File

@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Borepin.Service.Navigation
{
public interface INavigationService
{
/// <summary>
/// Navigatoin method to push onto the Navigaiton Stack
/// </summary>
/// <typeparam name="TPageModelBase"></typeparam>
/// <param name="navigationData"></param>
/// <param name="setRoot"></param>
/// <returns></returns>
Task NaviagteToAsync<TPageModelBase>(object navigationData = null, bool setRoot = false);
/// <summary>
/// Nagivation method to pop of Navigation Stack
/// </summary>
/// <returns></returns>
Task GoBackAsync();
}
}

View File

@ -1,59 +0,0 @@
using Borepin.Base;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Borepin.Service.Navigation
{
public class NavigationService : INavigationService
{
public Task GoBackAsync()
{
return App.Current.MainPage.Navigation.PopAsync();
}
public async Task NaviagteToAsync<TPageModelBase>(object navigationData = null, bool setRoot = false)
{
Xamarin.Forms.Page page = PageModelLocator.CreatePage(typeof(TPageModelBase));
if(setRoot)
{
if (page is TabbedPage tabbedPage)
{
App.Current.MainPage = tabbedPage;
}
else if(page is MasterDetailPage masterDetailPage)
{
App.Current.MainPage = masterDetailPage;
}
else
{
App.Current.MainPage = new NavigationPage(page);
}
}
else
{
if (App.Current.MainPage is MasterDetailPage masterDetailPage)
{
masterDetailPage.Detail = new NavigationPage(page);
}
if (App.Current.MainPage is NavigationPage navPage)
{
await navPage.PushAsync(page);
}
else
{
App.Current.MainPage = new NavigationPage(page);
}
}
if(page.BindingContext is PageModelBase pmBase)
{
await pmBase.InitializeAsync(navigationData);
}
}
}
}

View File

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />