Skip to content

Instantly share code, notes, and snippets.

@roubachof
Last active April 13, 2016 08:03
Show Gist options
  • Save roubachof/21514f419df73d1ad57a9ddb397f5d3f to your computer and use it in GitHub Desktop.
Save roubachof/21514f419df73d1ad57a9ddb397f5d3f to your computer and use it in GitHub Desktop.
MvxForms MasterDetail
using MvvmCross.Forms.Presenter.Core;
using Stago.Mhp.Instr.Pocm.Core.Views;
using Xamarin.Forms;
namespace Stago.Mhp.Instr.Pocm.Core
{
public partial class App : MvxFormsApp
{
public App()
: base()
{
// The root page of your application
DependencyService.Register<AppContext>();
InitializeComponent();
MainPage = new MasterDetail();
}
protected override void OnParentSet()
{
}
protected override void OnStart()
{
base.OnStart();
// Handle when your app starts
// Initiate Navigation and navigate to the splashscreen
}
protected override void OnSleep()
{
base.OnSleep();
// Handle when your app sleeps
}
protected override void OnResume()
{
base.OnResume();
// Handle when your app resumes
}
}
}
<core:MvxFormsApp
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:Stago.Mhp.Instr.Pocm.Core.Controls;assembly=Stago.Mhp.Instr.Pocm.Core"
xmlns:converters="clr-namespace:Stago.Mhp.Instr.Pocm.Core.Converters;assembly=Stago.Mhp.Instr.Pocm.Core"
xmlns:forms9Patch="clr-namespace:Forms9Patch;assembly=Forms9Patch"
xmlns:core="clr-namespace:MvvmCross.Forms.Presenter.Core;assembly=MvvmCross.Forms.Presenter.Core"
x:Class="Stago.Mhp.Instr.Pocm.Core.App">
<Application.Resources>
<ResourceDictionary>
<Color x:Key="BlackC90">#414142</Color>
<Color x:Key="BlackC50">#939598</Color>
<Color x:Key="BlackC05">#F1F1F2</Color>
<Color x:Key="Black.20">#33000000</Color>
<Color x:Key="Blue">#008DA8</Color>
<Color x:Key="Red">#EE3524</Color>
<Color x:Key="Orange">#F6A01A</Color>
<Color x:Key="White">#F8F8F8</Color>
<x:String x:Key="HamburgerIcon">&#x0052;</x:String>
<x:String x:Key="HomeIcon">&#x0045;</x:String>
<x:String x:Key="NewAnalyseIcon">&#x005C;</x:String>
<x:String x:Key="InfoRoundIcon">&#x0049;</x:String>
<converters:StateToColorConverter x:Key="StateToColorConverter" />
<converters:IsNullOrEmptyToVisibleConverter x:Key="IsNullOrEmptyToVisibleConverter" />
<Style
x:Key="BoldText"
TargetType="controls:LabelEx">
<Setter Property="FontName" Value="Roboto-Bold" />
</Style>
<Style
x:Key="LightText"
TargetType="controls:LabelEx">
<Setter Property="FontName" Value="Roboto-Light" />
</Style>
<Style
x:Key="MediumText"
TargetType="controls:LabelEx">
<Setter Property="FontName" Value="Roboto-Medium" />
</Style>
<Style
x:Key="Symbol16Text"
TargetType="controls:LabelEx">
<Setter Property="FontName" Value="Icons-Sta4-16" />
</Style>
<Style
x:Key="Symbol24Text"
TargetType="controls:LabelEx">
<Setter Property="FontName" Value="Icons-Sta4-24" />
</Style>
<Style
x:Key="RoundButton"
TargetType="controls:ImageButton">
<Setter Property="BorderRadius" Value="200" />
<Setter Property="TextColor" Value="White" />
</Style>
<Style
x:Key="RoundImageButton"
BasedOn="{StaticResource RoundButton}"
TargetType="controls:ImageButton">
<Setter Property="FontName" Value="Icons-Sta4-16" />
<Setter Property="BorderWidth" Value="1" />
<Setter Property="BorderColor" Value="{StaticResource Black.20}" />
</Style>
<Style
x:Key="BlueRoundIconButton"
TargetType="controls:ImageButton">
<Setter Property="BorderRadius" Value="200" />
<Setter Property="BorderWidth" Value="1" />
<Setter Property="BorderColor" Value="{StaticResource Black.20}" />
<Setter Property="FontName" Value="Icons-Sta4-16" />
<Setter Property="BackgroundColor" Value="{StaticResource Blue}" />
<Setter Property="TextColor" Value="White" />
</Style>
<Style
x:Key="MenuBlueRoundIconButton"
BasedOn="{StaticResource BlueRoundIconButton}"
TargetType="controls:ImageButton">
<Style.Triggers>
<Trigger TargetType="Button" Property="IsEnabled" Value="False">
<Setter Property="TextColor" Value="{StaticResource White}" />
</Trigger>
</Style.Triggers>
</Style>
<Style
x:Key="BlueRoundImageButton"
TargetType="controls:ImageButton"
BasedOn="{StaticResource RoundImageButton}">
<Setter Property="BackgroundColor" Value="{StaticResource Blue}" />
</Style>
<Style
x:Key="RedRoundImageButton"
TargetType="controls:ImageButton"
BasedOn="{StaticResource RoundImageButton}">
<Setter Property="BackgroundColor" Value="{StaticResource Red}" />
</Style>
<Style
x:Key="DarkRoundButton"
TargetType="controls:ImageButton"
BasedOn="{StaticResource RoundImageButton}">
<Setter Property="BackgroundColor" Value="{StaticResource BlackC90}" />
</Style>
<Style
x:Key="DarkRoundImageButton"
TargetType="controls:ImageButton"
BasedOn="{StaticResource RoundImageButton}">
<Setter Property="BackgroundColor" Value="{StaticResource BlackC90}" />
</Style>
<Style TargetType="controls:Separator">
<Setter Property="Opacity" Value=".5" />
</Style>
<Style TargetType="forms9Patch:Frame">
<Setter Property="HasShadow" Value="True" />
<Setter Property="OutlineRadius" Value="5" />
<Setter Property="OutlineColor" Value="{StaticResource Black.20}" />
<Setter Property="OutlineWidth" Value="1" />
<Setter Property="BackgroundColor" Value="{StaticResource BlackC05}" />
</Style>
</ResourceDictionary>
</Application.Resources>
</core:MvxFormsApp>
using Android.App;
using Android.OS;
using Android.Content.PM;
using Xamarin.Forms.Platform.Android;
using Xamarin.Forms;
using MvvmCross.Platform;
using MvvmCross.Core.Views;
using MvvmCross.Forms.Presenter.Droid;
using MvvmCross.Core.ViewModels;
using Stago.Mhp.Instr.Pocm.Core;
namespace Stago.Mhp.Instr.Pocm.Droid.Prod
{
[Activity(Label = "MvxFormsApplicationActivity", ScreenOrientation = ScreenOrientation.Portrait)]
public class MvxFormsApplicationActivity : FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Forms.Init(this, bundle);
var mvxFormsApp = new App();
LoadApplication(mvxFormsApp);
var presenter = Mvx.Resolve<IMvxViewPresenter>() as MvxFormsDroidPagePresenter;
presenter.MvxFormsApp = mvxFormsApp;
Mvx.Resolve<IMvxAppStart>().Start();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment