Skip to content

Commit 08a117e

Browse files
authoredOct 9, 2019
Merge pull request #3 from BaseflowIT/develop
Merge from remote
2 parents bf80527 + a69b438 commit 08a117e

13 files changed

+109
-5
lines changed
 

‎Samples/MaterialMvvmSample.Android/MainActivity.cs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ protected override void OnCreate(Bundle savedInstanceState)
1414
ToolbarResource = Resource.Layout.Toolbar;
1515

1616
base.OnCreate(savedInstanceState);
17+
Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);
1718
Xamarin.Forms.Forms.Init(this, savedInstanceState);
1819
Material.Init(this, savedInstanceState);
1920

‎Samples/MaterialMvvmSample.Android/MaterialMvvmSample.Android.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
<PackageReference Include="Xamarin.Forms">
6363
<Version>4.2.0.815419</Version>
6464
</PackageReference>
65+
<PackageReference Include="Rg.Plugins.Popup">
66+
<Version>1.2.0.223</Version>
67+
</PackageReference>
6568
</ItemGroup>
6669
<ItemGroup>
6770
<Compile Include="Core\PlatformContainer.cs" />

‎Samples/MaterialMvvmSample.Core/AppContainer.cs

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using MaterialMvvmSample.ViewModels;
77
using MaterialMvvmSample.Views;
88
using Xamarin.Forms;
9+
using XF.Material.Forms.UI;
910

1011
namespace MaterialMvvmSample.Core
1112
{
@@ -36,6 +37,10 @@ protected virtual void RegisterServices(ContainerBuilder containerBuilder)
3637
containerBuilder.RegisterType<SecondView>().Named<Page>(ViewNames.SecondView).As<SecondView>().InstancePerDependency();
3738

3839
containerBuilder.RegisterType<LandingView>().Named<Page>(ViewNames.LandingView).As<LandingView>().InstancePerDependency();
40+
containerBuilder.RegisterType<MaterialDialogsView>().Named<Page>(ViewNames.MaterialDialogsView).As<MaterialDialogsView>().InstancePerDependency();
41+
containerBuilder.RegisterType<CheckboxesView>().Named<Page>(ViewNames.CheckboxesView).As<CheckboxesView>().InstancePerDependency();
42+
43+
3944

4045
containerBuilder.RegisterType<MainViewModel>().InstancePerDependency();
4146
containerBuilder.RegisterType<SecondViewModel>().InstancePerDependency();

‎Samples/MaterialMvvmSample.iOS/AppDelegate.cs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public partial class AppDelegate : Xamarin.Forms.Platform.iOS.FormsApplicationDe
99
{
1010
public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
1111
{
12+
Rg.Plugins.Popup.Popup.Init();
1213
Xamarin.Forms.Forms.Init();
1314
XF.Material.iOS.Material.Init();
1415

‎Samples/MaterialMvvmSample.iOS/MaterialMvvmSample.iOS.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@
171171
<PackageReference Include="Xamarin.Forms">
172172
<Version>4.2.0.815419</Version>
173173
</PackageReference>
174+
<PackageReference Include="Rg.Plugins.Popup">
175+
<Version>1.2.0.223</Version>
176+
</PackageReference>
174177
</ItemGroup>
175178
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
176179
<ItemGroup>

‎Samples/MaterialMvvmSample/MaterialMvvmSample.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
<PackageReference Include="Autofac" Version="4.9.4" />
1414
<PackageReference Include="Autofac.Extras.CommonServiceLocator" Version="5.0.0" />
1515
<PackageReference Include="Xamarin.Forms" Version="4.2.0.815419" />
16+
<PackageReference Include="Rg.Plugins.Popup" Version="1.2.0.223" />
1617
</ItemGroup>
1718

1819
<ItemGroup>
1920
<ProjectReference Include="..\..\XF.Material\XF.Material.csproj" />
2021
</ItemGroup>
2122

2223
<ItemGroup>
23-
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
24+
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
2425
</ItemGroup>
2526

2627
</Project>

‎Samples/MaterialMvvmSample/ViewModels/LandingViewModel.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ namespace MaterialMvvmSample.ViewModels
77
{
88
public class LandingViewModel : BaseViewModel
99
{
10-
public LandingViewModel()
11-
{
10+
public ICommand GoToMaterialDialogsCommand => this.GoToCommand(ViewNames.MaterialDialogsView);
1211

13-
}
12+
public ICommand GoToChipFontSizeViewCommand => this.GoToCommand(ViewNames.ChipFontSizeView);
1413

15-
public ICommand GoToChipFontSizeViewCommand => new Command(() => this.Navigation.PushAsync(ViewNames.ChipFontSizeView));
14+
public ICommand GoToCheckboxesSampleCommand => this.GoToCommand(ViewNames.CheckboxesView);
15+
16+
17+
private ICommand GoToCommand(string name) => new Command(() => this.Navigation.PushAsync(name));
1618
}
1719
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:MaterialMvvmSample.Views"
5+
xmlns:material="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"
6+
x:Class="MaterialMvvmSample.Views.CheckboxesView">
7+
<ContentPage.Content>
8+
<StackLayout Orientation="Vertical">
9+
<material:MaterialCheckbox Text="My Material Checkbox" />
10+
</StackLayout>
11+
</ContentPage.Content>
12+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
using Xamarin.Forms;
5+
6+
namespace MaterialMvvmSample.Views
7+
{
8+
public partial class CheckboxesView : ContentPage
9+
{
10+
public CheckboxesView()
11+
{
12+
InitializeComponent();
13+
}
14+
}
15+
}

‎Samples/MaterialMvvmSample/Views/LandingView.xaml

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
Command="{Binding GoToChipFontSizeViewCommand}"
1212
Margin="10" />
1313

14+
<material:MaterialButton Text="Go To Material Dialogs sample"
15+
Command="{Binding GoToMaterialDialogsCommand}"
16+
Margin="10" />
17+
18+
<material:MaterialButton Text="Go To Checkboxes sample"
19+
Command="{Binding GoToCheckboxesSampleCommand}"
20+
Margin="10" />
21+
1422
<!-- New sample shortcuts should be added here (Button + Associated command in the LandingViewModel) -->
1523
</StackLayout>
1624
</ContentPage.Content>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<local:BaseMainView xmlns="http://xamarin.com/schemas/2014/forms"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:MaterialMvvmSample.Views"
5+
xmlns:material="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"
6+
x:Class="MaterialMvvmSample.Views.MaterialDialogsView">
7+
<ContentPage.Content>
8+
<StackLayout Orientation="Vertical">
9+
<material:MaterialButton Text="Open Dialog"
10+
x:Name="Opendialog" />
11+
12+
<material:MaterialLabel x:Name="DialogResult" />
13+
14+
</StackLayout>
15+
</ContentPage.Content>
16+
</local:BaseMainView>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Xamarin.Forms;
4+
using Xamarin.Forms.Xaml;
5+
using XF.Material.Forms.UI.Dialogs;
6+
7+
namespace MaterialMvvmSample.Views
8+
{
9+
[XamlCompilation(XamlCompilationOptions.Compile)]
10+
public partial class MaterialDialogsView : BaseMainView
11+
{
12+
public MaterialDialogsView()
13+
{
14+
InitializeComponent();
15+
16+
this.Opendialog.Clicked += Opendialog_Clicked;
17+
}
18+
19+
private async void Opendialog_Clicked(object sender, EventArgs e)
20+
{
21+
var choices = new List<string>
22+
{
23+
"choice 1",
24+
"choice 2",
25+
"choice 3",
26+
};
27+
28+
var choice = await MaterialDialog.Instance.SelectChoiceAsync("Select choices", choices);
29+
30+
this.DialogResult.Text = choices[choice];
31+
}
32+
}
33+
}

‎Samples/MaterialMvvmSample/Views/ViewNames.cs

+4
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@ public static class ViewNames
1010

1111
public const string LandingView = nameof(Views.LandingView);
1212

13+
public const string MaterialDialogsView = nameof(Views.MaterialDialogsView);
14+
15+
public const string CheckboxesView = nameof(Views.CheckboxesView);
16+
1317
}
1418
}

0 commit comments

Comments
 (0)