Skip to content

Commit 285ce1b

Browse files
author
Javier Suárez Ruiz
committed
Added iOS resources and renderers.
Created Settings view.
1 parent a158233 commit 285ce1b

43 files changed

Lines changed: 478 additions & 9 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@
112112
<Setter Property="FontFamily"
113113
Value="{StaticResource MontserratRegular}" />
114114
<Setter Property="TextColor"
115-
Value="{StaticResource WhiteColor}" />
115+
Value="{StaticResource BlackColor}" />
116116
<Setter Property="PlaceholderColor"
117-
Value="{StaticResource WhiteColor}" />
117+
Value="{StaticResource BlackColor}" />
118118
<Setter Property="FontSize"
119119
Value="{StaticResource LargeSize}" />
120120
<Setter Property="HorizontalOptions"

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Controls/BindablePicker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ namespace eShopOnContainers.Core.Controls
77
public class BindablePicker : Picker
88
{
99
public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource",
10-
typeof(IEnumerable), typeof(BindablePicker), null, propertyChanged: OnItemsSourceChanged);
10+
typeof(IEnumerable), typeof(BindablePicker), null, propertyChanged: OnItemsSourceChanged);
1111

1212
public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create("SelectedItem",
13-
typeof(object), typeof(BindablePicker), null, BindingMode.TwoWay, propertyChanged: OnSelectedItemChanged);
13+
typeof(object), typeof(BindablePicker), null, BindingMode.TwoWay, propertyChanged: OnSelectedItemChanged);
1414

1515
public BindablePicker()
1616
{
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Xamarin.Forms;
2+
3+
namespace eShopOnContainers.Core.Controls
4+
{
5+
public class CustomSwitch : Switch
6+
{
7+
public static readonly BindableProperty TextOnProperty = BindableProperty.Create("TextOn",
8+
typeof(string), typeof(CustomSwitch), string.Empty);
9+
10+
public static readonly BindableProperty TextOffProperty = BindableProperty.Create("TextOff",
11+
typeof(string), typeof(CustomSwitch), string.Empty);
12+
13+
public string TextOn
14+
{
15+
get { return (string)this.GetValue(TextOnProperty); }
16+
set { this.SetValue(TextOnProperty, value); }
17+
}
18+
19+
public string TextOff
20+
{
21+
get { return (string)this.GetValue(TextOffProperty); }
22+
set { this.SetValue(TextOffProperty, value); }
23+
}
24+
}
25+
}

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Navigation/NavigationService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ private void CreatePageViewModelMappings()
154154
_mappings.Add(typeof(MainViewModel), typeof(MainView));
155155
_mappings.Add(typeof(OrderDetailViewModel), typeof(OrderDetailView));
156156
_mappings.Add(typeof(ProfileViewModel), typeof(ProfileView));
157+
_mappings.Add(typeof(SettingsViewModel), typeof(SettingsView));
157158
}
158159
}
159160
}

src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/Base/ViewModelLocator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ protected ViewModelLocator()
4141
_unityContainer.RegisterType<MainViewModel>();
4242
_unityContainer.RegisterType<OrderDetailViewModel>();
4343
_unityContainer.RegisterType<ProfileViewModel>();
44+
_unityContainer.RegisterType<SettingsViewModel>();
4445
}
4546

4647
public T Resolve<T>()

src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/MainViewModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
using eShopOnContainers.Core.Models.Navigation;
44
using Xamarin.Forms;
55
using eShopOnContainers.Core.ViewModels.Base;
6+
using System.Windows.Input;
67

78
namespace eShopOnContainers.Core.ViewModels
89
{
910
public class MainViewModel : ViewModelBase
1011
{
12+
public ICommand SettingsCommand => new Command(Settings);
13+
1114
public override Task InitializeAsync(object navigationData)
1215
{
1316
IsBusy = true;
@@ -20,5 +23,10 @@ public override Task InitializeAsync(object navigationData)
2023

2124
return base.InitializeAsync(navigationData);
2225
}
26+
27+
private void Settings()
28+
{
29+
NavigationService.NavigateToAsync<SettingsViewModel>();
30+
}
2331
}
2432
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using eShopOnContainers.ViewModels.Base;
2+
3+
namespace eShopOnContainers.Core.ViewModels
4+
{
5+
public class SettingsViewModel : ViewModelBase
6+
{
7+
8+
}
9+
}

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/FiltersView.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
<Setter Property="HorizontalOptions"
2222
Value="Fill" />
2323
<Setter Property="VerticalOptions"
24-
Value="Fill" />
24+
Value="Fill" />
25+
<Setter Property="Margin"
26+
Value="0, 2" />
2527
</Style>
2628

2729
<Style x:Key="FilterButtonStyle"

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/MainView.xaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
BackgroundColor="{StaticResource BackgroundColor}"
99
BarTextColor="{StaticResource WhiteColor}"
1010
Title="eShop on Containers">
11+
<ContentPage.ToolbarItems>
12+
<ToolbarItem
13+
Command="{Binding SettingsCommand}"
14+
Text="Settings">
15+
<ToolbarItem.Icon>
16+
<OnPlatform
17+
x:TypeArguments="FileImageSource"
18+
WinPhone=""
19+
Android=""
20+
iOS=""/>
21+
</ToolbarItem.Icon>
22+
</ToolbarItem>
23+
</ContentPage.ToolbarItems>
1124
<views:CatalogView
1225
x:Name="HomeView">
1326
<views:CatalogView.Icon>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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+
x:Class="eShopOnContainers.Core.Views.SettingsView"
5+
xmlns:controls="clr-namespace:eShopOnContainers.Core.Controls;assembly=eShopOnContainers.Core"
6+
Title="Settings">
7+
<ContentPage.Resources>
8+
<ResourceDictionary>
9+
10+
<Style x:Key="SettingsTitleStyle"
11+
TargetType="{x:Type Label}">
12+
<Setter Property="FontFamily"
13+
Value="{StaticResource MontserratRegular}" />
14+
<Setter Property="FontSize"
15+
Value="{StaticResource MediumSize}" />
16+
<Setter Property="HorizontalOptions"
17+
Value="Start" />
18+
<Setter Property="VerticalOptions"
19+
Value="Center" />
20+
<Setter Property="Margin"
21+
Value="12, 0" />
22+
</Style>
23+
24+
<Style x:Key="SettingsDescriptionStyle"
25+
TargetType="{x:Type Label}"
26+
BasedOn="{StaticResource SettingsTitleStyle}">
27+
<Setter Property="FontSize"
28+
Value="{StaticResource LittleSize}" />
29+
</Style>
30+
31+
<Style x:Key="SettingsSwitchStyle"
32+
TargetType="{x:Type controls:CustomSwitch}">
33+
<Setter Property="VerticalOptions"
34+
Value="Center" />
35+
</Style>
36+
37+
</ResourceDictionary>
38+
</ContentPage.Resources>
39+
<Grid
40+
BackgroundColor="{StaticResource BackgroundColor}">
41+
<!-- SETTINGS -->
42+
<ScrollView>
43+
<StackLayout>
44+
<!-- MOCK SERVICES -->
45+
<Grid>
46+
<Grid.ColumnDefinitions>
47+
<ColumnDefinition Width="*" />
48+
<ColumnDefinition Width="Auto" />
49+
</Grid.ColumnDefinitions>
50+
<Grid.RowDefinitions>
51+
<RowDefinition Height="1" />
52+
<RowDefinition Height="Auto" />
53+
<RowDefinition Height="1" />
54+
</Grid.RowDefinitions>
55+
<Grid
56+
Grid.Row="0"
57+
Grid.Column="0"
58+
Grid.ColumnSpan="2"
59+
BackgroundColor="Gray"/>
60+
<StackLayout
61+
Grid.Column="0"
62+
Grid.Row="1">
63+
<Label
64+
Text="Use Mock Services"
65+
TextColor="{StaticResource GreenColor}"
66+
Style="{StaticResource SettingsTitleStyle}"/>
67+
<Label
68+
Text="Mock Services are simulated objects that mimic the behavior of real services in controlled ways"
69+
Style="{StaticResource SettingsDescriptionStyle}"/>
70+
</StackLayout>
71+
<controls:CustomSwitch
72+
TextOn="Mock"
73+
TextOff="Azure"
74+
Grid.Column="1"
75+
Grid.Row="1"
76+
Style="{StaticResource SettingsSwitchStyle}"/>
77+
<Grid
78+
Grid.Row="2"
79+
Grid.Column="0"
80+
Grid.ColumnSpan="2"
81+
BackgroundColor="Gray"/>
82+
</Grid>
83+
</StackLayout>
84+
</ScrollView>
85+
</Grid>
86+
</ContentPage>

0 commit comments

Comments
 (0)