Merge branch 'master' of https://github.com/dotnet/eShopOnContainers
This commit is contained in:
commit
afc5dffc2a
@ -1,4 +1,5 @@
|
||||
using eShopOnContainers.Services;
|
||||
using eShopOnContainers.Core.Helpers;
|
||||
using eShopOnContainers.Services;
|
||||
using eShopOnContainers.ViewModels.Base;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
@ -25,7 +26,7 @@ namespace eShopOnContainers
|
||||
|
||||
private void InitApp()
|
||||
{
|
||||
UseMockServices = true;
|
||||
UseMockServices = Settings.UseMocks;
|
||||
|
||||
ViewModelLocator.Instance.UpdateDependencies(UseMockServices);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
public GlobalSetting()
|
||||
{
|
||||
AuthToken = "INSERT AUTHENTICATION TOKEN";
|
||||
BaseEndpoint = "http://10.106.144.28";
|
||||
BaseEndpoint = "http://13.88.8.119";
|
||||
}
|
||||
|
||||
public static GlobalSetting Instance
|
||||
|
@ -1,3 +1,4 @@
|
||||
using eShopOnContainers.ViewModels.Base;
|
||||
using Plugin.Settings;
|
||||
using Plugin.Settings.Abstractions;
|
||||
|
||||
@ -22,8 +23,12 @@ namespace eShopOnContainers.Core.Helpers
|
||||
|
||||
private const string AccessToken = "access_token";
|
||||
private const string IdToken = "id_token";
|
||||
private const string IdUseMocks = "use_mocks";
|
||||
private const string IdUrlBase = "url_base";
|
||||
private static readonly string AccessTokenDefault = string.Empty;
|
||||
private static readonly string IdTokenDefault = string.Empty;
|
||||
private static readonly bool UseMocksDefault = ViewModelLocator.Instance.UseMockService;
|
||||
private static readonly string UrlBaseDefault = GlobalSetting.Instance.BaseEndpoint;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -51,5 +56,30 @@ namespace eShopOnContainers.Core.Helpers
|
||||
AppSettings.AddOrUpdateValue<string>(IdToken, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static bool UseMocks
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppSettings.GetValueOrDefault<bool>(IdUseMocks, UseMocksDefault);
|
||||
}
|
||||
set
|
||||
{
|
||||
AppSettings.AddOrUpdateValue<bool>(IdUseMocks, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static string UrlBase
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppSettings.GetValueOrDefault<string>(IdUrlBase, UrlBaseDefault);
|
||||
}
|
||||
set
|
||||
{
|
||||
AppSettings.AddOrUpdateValue<string>(IdUrlBase, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,13 +9,6 @@ using eShopOnContainers.Core.Services.Basket;
|
||||
using eShopOnContainers.Core.Services.Identity;
|
||||
using eShopOnContainers.Core.Services.Order;
|
||||
using eShopOnContainers.Core.Services.User;
|
||||
using Xamarin.Forms;
|
||||
using System.Collections.Generic;
|
||||
using eShopOnContainers.Core.Models.Basket;
|
||||
using eShopOnContainers.Core.Models.Catalog;
|
||||
using eShopOnContainers.Core.ViewModels.Base;
|
||||
using eShopOnContainers.Core.Helpers;
|
||||
using eShopOnContainers.Core;
|
||||
|
||||
namespace eShopOnContainers.ViewModels.Base
|
||||
{
|
||||
|
@ -9,7 +9,6 @@ using System.Windows.Input;
|
||||
using System.Linq;
|
||||
using eShopOnContainers.Core.Services.Basket;
|
||||
using eShopOnContainers.Core.Helpers;
|
||||
using System;
|
||||
using eShopOnContainers.Core.Services.User;
|
||||
|
||||
namespace eShopOnContainers.Core.ViewModels
|
||||
@ -121,6 +120,7 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
|
||||
private void AddCatalogItem(CatalogItem catalogItem)
|
||||
{
|
||||
// Add new item to Basket
|
||||
MessagingCenter.Send(this, MessengerKeys.AddProduct, catalogItem);
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
|
||||
IsBusy = true;
|
||||
|
||||
// Filter
|
||||
// Filter catalog products
|
||||
MessagingCenter.Send(this, MessengerKeys.Filter);
|
||||
Products = await _productsService.FilterAsync(Brand.Id, Type.Id);
|
||||
|
||||
|
@ -4,7 +4,6 @@ using eShopOnContainers.Core.Services.Identity;
|
||||
using eShopOnContainers.Core.Services.OpenUrl;
|
||||
using eShopOnContainers.Core.Services.User;
|
||||
using eShopOnContainers.Core.Validations;
|
||||
using eShopOnContainers.Core.ViewModels.Base;
|
||||
using eShopOnContainers.ViewModels.Base;
|
||||
using IdentityModel.Client;
|
||||
using System;
|
||||
@ -40,8 +39,7 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
_userName = new ValidatableObject<string>();
|
||||
_password = new ValidatableObject<string>();
|
||||
|
||||
IsMock = ViewModelLocator.Instance.UseMockService;
|
||||
|
||||
InvalidateMock();
|
||||
AddValidations();
|
||||
}
|
||||
|
||||
@ -214,7 +212,7 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
LoginUrl = logoutRequest;
|
||||
}
|
||||
|
||||
if(ViewModelLocator.Instance.UseMockService)
|
||||
if(Settings.UseMocks)
|
||||
{
|
||||
Settings.AuthAccessToken = string.Empty;
|
||||
Settings.AuthIdToken = string.Empty;
|
||||
@ -266,5 +264,10 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
_userName.Validations.Add(new IsNotNullOrEmptyRule<string> { ValidationMessage = "Username should not be empty" });
|
||||
_password.Validations.Add(new IsNotNullOrEmptyRule<string> { ValidationMessage = "Password should not be empty" });
|
||||
}
|
||||
|
||||
public void InvalidateMock()
|
||||
{
|
||||
IsMock = Settings.UseMocks;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,14 +3,11 @@ using eShopOnContainers.ViewModels.Base;
|
||||
using eShopOnContainers.Core.Models.Navigation;
|
||||
using Xamarin.Forms;
|
||||
using eShopOnContainers.Core.ViewModels.Base;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace eShopOnContainers.Core.ViewModels
|
||||
{
|
||||
public class MainViewModel : ViewModelBase
|
||||
{
|
||||
public ICommand SettingsCommand => new Command(Settings);
|
||||
|
||||
public override Task InitializeAsync(object navigationData)
|
||||
{
|
||||
IsBusy = true;
|
||||
@ -24,10 +21,5 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
|
||||
return base.InitializeAsync(navigationData);
|
||||
}
|
||||
|
||||
private void Settings()
|
||||
{
|
||||
NavigationService.NavigateToAsync<SettingsViewModel>();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
using System.Threading.Tasks;
|
||||
using eShopOnContainers.Core.Helpers;
|
||||
|
||||
namespace eShopOnContainers.Core.ViewModels
|
||||
{
|
||||
@ -14,7 +15,7 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
|
||||
public SettingsViewModel()
|
||||
{
|
||||
UseAzureServices = !ViewModelLocator.Instance.UseMockService;
|
||||
UseAzureServices = !Settings.UseMocks;
|
||||
}
|
||||
|
||||
public string Title
|
||||
@ -43,6 +44,9 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
set
|
||||
{
|
||||
_useAzureServices = value;
|
||||
|
||||
// Save use mocks services to local storage
|
||||
Settings.UseMocks = !_useAzureServices;
|
||||
RaisePropertyChanged(() => UseAzureServices);
|
||||
}
|
||||
}
|
||||
@ -75,7 +79,7 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
{
|
||||
UpdateInfo();
|
||||
|
||||
Endpoint = GlobalSetting.Instance.BaseEndpoint;
|
||||
Endpoint = Settings.UrlBase;
|
||||
|
||||
return base.InitializeAsync(navigationData);
|
||||
}
|
||||
@ -89,15 +93,15 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
Title = "Use Azure Services";
|
||||
Description = "Azure Services are real objects that required a valid internet connection";
|
||||
Title = "Use Microservices/Containers from eShopOnContainers";
|
||||
Description = "When enabling the use of microservices/containers the Xamarin.Forms app will try to use real services deployed as Docker containers in the specified base IP that will need to be reachable through the network";
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEndpoint(string endpoint)
|
||||
{
|
||||
// Update remote endpoint
|
||||
GlobalSetting.Instance.BaseEndpoint = endpoint;
|
||||
// Update remote endpoint (save to local storage)
|
||||
Settings.UrlBase = endpoint;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,286 +5,334 @@
|
||||
xmlns:animations="clr-namespace:eShopOnContainers.Core.Animations;assembly=eShopOnContainers.Core"
|
||||
xmlns:triggers="clr-namespace:eShopOnContainers.Core.Triggers;assembly=eShopOnContainers.Core"
|
||||
xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core">
|
||||
<ContentPage.Title>
|
||||
<OnPlatform
|
||||
x:TypeArguments="x:String"
|
||||
iOS="eShop on Containers"
|
||||
WinPhone="eShop on Containers"/>
|
||||
</ContentPage.Title>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<ContentPage.Title>
|
||||
<OnPlatform
|
||||
x:TypeArguments="x:String"
|
||||
iOS="eShop on Containers"
|
||||
WinPhone="eShop on Containers"/>
|
||||
</ContentPage.Title>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<Style x:Key="TitleLabelStyle"
|
||||
TargetType="{x:Type Label}">
|
||||
<Setter Property="FontFamily"
|
||||
Value="{StaticResource MontserratRegular}" />
|
||||
<Setter Property="FontAttributes"
|
||||
Value="Bold" />
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource MediumSize}" />
|
||||
<Setter Property="HorizontalOptions"
|
||||
Value="Center" />
|
||||
<Setter Property="Margin"
|
||||
Value="0, 12" />
|
||||
</Style>
|
||||
<Style x:Key="TitleLabelStyle"
|
||||
TargetType="{x:Type Label}">
|
||||
<Setter Property="FontFamily"
|
||||
Value="{StaticResource MontserratRegular}" />
|
||||
<Setter Property="FontAttributes"
|
||||
Value="Bold" />
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource MediumSize}" />
|
||||
<Setter Property="HorizontalOptions"
|
||||
Value="Center" />
|
||||
<Setter Property="Margin"
|
||||
Value="0, 12" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="HeaderLabelStyle"
|
||||
TargetType="{x:Type Label}">
|
||||
<Setter Property="FontFamily"
|
||||
Value="{StaticResource MontserratRegular}" />
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource LittleSize}" />
|
||||
<Setter Property="TextColor"
|
||||
Value="{StaticResource GreenColor}" />
|
||||
<Setter Property="HorizontalOptions"
|
||||
Value="Start" />
|
||||
</Style>
|
||||
<Style x:Key="HeaderLabelStyle"
|
||||
TargetType="{x:Type Label}">
|
||||
<Setter Property="FontFamily"
|
||||
Value="{StaticResource MontserratRegular}" />
|
||||
<Setter Property="FontSize"
|
||||
Value="{StaticResource LittleSize}" />
|
||||
<Setter Property="TextColor"
|
||||
Value="{StaticResource GreenColor}" />
|
||||
<Setter Property="HorizontalOptions"
|
||||
Value="Start" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="LoginButtonStyle"
|
||||
TargetType="{x:Type Label}">
|
||||
<Setter Property="FontFamily"
|
||||
Value="{StaticResource MontserratRegular}" />
|
||||
<Setter Property="TextColor"
|
||||
Value="{StaticResource WhiteColor}" />
|
||||
<Setter Property="HorizontalOptions"
|
||||
Value="Center" />
|
||||
<Setter Property="VerticalOptions"
|
||||
Value="Center" />
|
||||
</Style>
|
||||
<Style x:Key="LoginButtonStyle"
|
||||
TargetType="{x:Type Label}">
|
||||
<Setter Property="FontFamily"
|
||||
Value="{StaticResource MontserratRegular}" />
|
||||
<Setter Property="TextColor"
|
||||
Value="{StaticResource WhiteColor}" />
|
||||
<Setter Property="HorizontalOptions"
|
||||
Value="Center" />
|
||||
<Setter Property="VerticalOptions"
|
||||
Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="LoginPanelStyle"
|
||||
TargetType="{x:Type Grid}">
|
||||
<Setter Property="HeightRequest"
|
||||
Value="60" />
|
||||
<Setter Property="BackgroundColor"
|
||||
Value="{StaticResource LightGreenColor}" />
|
||||
<Setter Property="HorizontalOptions"
|
||||
Value="FillAndExpand" />
|
||||
<Setter Property="VerticalOptions"
|
||||
Value="FillAndExpand" />
|
||||
</Style>
|
||||
<Style x:Key="LoginPanelStyle"
|
||||
TargetType="{x:Type Grid}">
|
||||
<Setter Property="HeightRequest"
|
||||
Value="60" />
|
||||
<Setter Property="BackgroundColor"
|
||||
Value="{StaticResource LightGreenColor}" />
|
||||
<Setter Property="HorizontalOptions"
|
||||
Value="FillAndExpand" />
|
||||
<Setter Property="VerticalOptions"
|
||||
Value="FillAndExpand" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RegisterPanelStyle"
|
||||
TargetType="{x:Type Grid}"
|
||||
BasedOn="{StaticResource LoginPanelStyle}">
|
||||
<Setter Property="BackgroundColor"
|
||||
Value="{StaticResource BlackColor}" />
|
||||
</Style>
|
||||
<Style x:Key="RegisterPanelStyle"
|
||||
TargetType="{x:Type Grid}"
|
||||
BasedOn="{StaticResource LoginPanelStyle}">
|
||||
<Setter Property="BackgroundColor"
|
||||
Value="{StaticResource GreenColor}" />
|
||||
</Style>
|
||||
|
||||
<animations:StoryBoard
|
||||
x:Key="LoginAnimation"
|
||||
Target="{x:Reference LoginPanel}">
|
||||
<animations:FadeInAnimation
|
||||
Direction="Up"
|
||||
Duration="1500" />
|
||||
</animations:StoryBoard>
|
||||
<Style x:Key="SettingsPanelStyle"
|
||||
TargetType="{x:Type Grid}"
|
||||
BasedOn="{StaticResource LoginPanelStyle}">
|
||||
<Setter Property="BackgroundColor"
|
||||
Value="{StaticResource BlackColor}" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Triggers>
|
||||
<EventTrigger
|
||||
Event="Appearing">
|
||||
<triggers:BeginAnimation
|
||||
Animation="{StaticResource LoginAnimation}" />
|
||||
</EventTrigger>
|
||||
</ContentPage.Triggers>
|
||||
<Grid
|
||||
<Style x:Key="SettingsImageStyle"
|
||||
TargetType="{x:Type Image}">
|
||||
<Setter Property="Margin"
|
||||
Value="12" />
|
||||
</Style>
|
||||
|
||||
<animations:StoryBoard
|
||||
x:Key="LoginAnimation"
|
||||
Target="{x:Reference LoginPanel}">
|
||||
<animations:FadeInAnimation
|
||||
Direction="Up"
|
||||
Duration="1500" />
|
||||
</animations:StoryBoard>
|
||||
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Triggers>
|
||||
<EventTrigger
|
||||
Event="Appearing">
|
||||
<triggers:BeginAnimation
|
||||
Animation="{StaticResource LoginAnimation}" />
|
||||
</EventTrigger>
|
||||
</ContentPage.Triggers>
|
||||
<Grid
|
||||
BackgroundColor="{StaticResource BackgroundColor}">
|
||||
<!-- MOCK AUTH -->
|
||||
<Grid
|
||||
x:Name="LoginPanel"
|
||||
IsVisible="{Binding IsMock}"
|
||||
Padding="0"
|
||||
ColumnSpacing="0"
|
||||
RowSpacing="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="60" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- LOGIN / REGISTER -->
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Margin="48, 24">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackLayout
|
||||
Grid.Column="0"
|
||||
Orientation="Horizontal"
|
||||
HorizontalOptions="Center">
|
||||
<Label
|
||||
Text="["
|
||||
TextColor="{StaticResource LightGreenColor}"/>
|
||||
<Label
|
||||
Text="LOGIN"
|
||||
FontAttributes="Bold"/>
|
||||
<Label
|
||||
Text="]"
|
||||
TextColor="{StaticResource LightGreenColor}"/>
|
||||
</StackLayout>
|
||||
<!-- MOCK AUTH -->
|
||||
<Grid
|
||||
Grid.Column="1"
|
||||
HorizontalOptions="Center">
|
||||
<Label
|
||||
Text="REGISTER"
|
||||
TextColor="Gray"/>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding RegisterCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
x:Name="LoginPanel"
|
||||
IsVisible="{Binding IsMock}"
|
||||
Padding="0"
|
||||
ColumnSpacing="0"
|
||||
RowSpacing="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="60" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- LOGIN / REGISTER / SETTINGS -->
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Margin="48, 24">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackLayout
|
||||
Grid.Column="0"
|
||||
Orientation="Horizontal"
|
||||
HorizontalOptions="Center">
|
||||
<Label
|
||||
Text="["
|
||||
TextColor="{StaticResource LightGreenColor}"/>
|
||||
<Label
|
||||
Text="LOGIN"
|
||||
FontAttributes="Bold"/>
|
||||
<Label
|
||||
Text="]"
|
||||
TextColor="{StaticResource LightGreenColor}"/>
|
||||
</StackLayout>
|
||||
<Grid
|
||||
Grid.Column="1"
|
||||
HorizontalOptions="Center">
|
||||
<Label
|
||||
Text="REGISTER"
|
||||
TextColor="Gray"/>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding RegisterCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
<StackLayout
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal"
|
||||
HorizontalOptions="Center">
|
||||
<Label
|
||||
Text="SETTINGS"/>
|
||||
<StackLayout.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding SettingsCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</StackLayout.GestureRecognizers>
|
||||
</StackLayout>
|
||||
</Grid>
|
||||
<!-- INFO -->
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="ARE YOU REGISTERED?"
|
||||
Style="{StaticResource TitleLabelStyle}"/>
|
||||
<!-- LOGIN FORM -->
|
||||
<StackLayout
|
||||
Grid.Row="2"
|
||||
Margin="24">
|
||||
<Label
|
||||
Text="User name or email"
|
||||
Style="{StaticResource HeaderLabelStyle}"/>
|
||||
<Entry
|
||||
Text="{Binding UserName.Value, Mode=TwoWay}">
|
||||
<Entry.Style>
|
||||
<OnPlatform x:TypeArguments="Style"
|
||||
iOS="{StaticResource EntryStyle}"
|
||||
Android="{StaticResource EntryStyle}"
|
||||
WinPhone="{StaticResource UwpEntryStyle}"/>
|
||||
</Entry.Style>
|
||||
</Entry>
|
||||
<Label
|
||||
Text="Password"
|
||||
Style="{StaticResource HeaderLabelStyle}"/>
|
||||
<Entry
|
||||
IsPassword="True"
|
||||
Text="{Binding Password.Value, Mode=TwoWay}"
|
||||
Style="{StaticResource EntryStyle}">
|
||||
<Entry.Style>
|
||||
<OnPlatform x:TypeArguments="Style"
|
||||
iOS="{StaticResource EntryStyle}"
|
||||
Android="{StaticResource EntryStyle}"
|
||||
WinPhone="{StaticResource UwpEntryStyle}"/>
|
||||
</Entry.Style>
|
||||
</Entry>
|
||||
</StackLayout>
|
||||
<!-- LOGIN BUTTON -->
|
||||
<Grid
|
||||
BackgroundColor="{StaticResource LightGreenColor}"
|
||||
Grid.Row="3"
|
||||
Padding="0"
|
||||
ColumnSpacing="0"
|
||||
RowSpacing="0">
|
||||
<Label
|
||||
Text="[ LOGIN ]"
|
||||
Style="{StaticResource LoginButtonStyle}"/>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding MockSignInCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<!-- INFO -->
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="ARE YOU REGISTERED?"
|
||||
Style="{StaticResource TitleLabelStyle}"/>
|
||||
<!-- LOGIN FORM -->
|
||||
<StackLayout
|
||||
Grid.Row="2"
|
||||
Margin="24">
|
||||
<Label
|
||||
Text="User name or email"
|
||||
Style="{StaticResource HeaderLabelStyle}"/>
|
||||
<Entry
|
||||
Text="{Binding UserName.Value, Mode=TwoWay}">
|
||||
<Entry.Style>
|
||||
<OnPlatform x:TypeArguments="Style"
|
||||
iOS="{StaticResource EntryStyle}"
|
||||
Android="{StaticResource EntryStyle}"
|
||||
WinPhone="{StaticResource UwpEntryStyle}"/>
|
||||
</Entry.Style>
|
||||
</Entry>
|
||||
<Label
|
||||
Text="Password"
|
||||
Style="{StaticResource HeaderLabelStyle}"/>
|
||||
<Entry
|
||||
IsPassword="True"
|
||||
Text="{Binding Password.Value, Mode=TwoWay}"
|
||||
Style="{StaticResource EntryStyle}">
|
||||
<Entry.Style>
|
||||
<OnPlatform x:TypeArguments="Style"
|
||||
iOS="{StaticResource EntryStyle}"
|
||||
Android="{StaticResource EntryStyle}"
|
||||
WinPhone="{StaticResource UwpEntryStyle}"/>
|
||||
</Entry.Style>
|
||||
</Entry>
|
||||
</StackLayout>
|
||||
<!-- LOGIN BUTTON -->
|
||||
<Grid
|
||||
BackgroundColor="{StaticResource LightGreenColor}"
|
||||
Grid.Row="3"
|
||||
Padding="0"
|
||||
ColumnSpacing="0"
|
||||
RowSpacing="0">
|
||||
<Label
|
||||
Text="[ LOGIN ]"
|
||||
Style="{StaticResource LoginButtonStyle}"/>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding MockSignInCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
<!-- AUTH -->
|
||||
<Grid
|
||||
ColumnSpacing="0"
|
||||
RowSpacing="0"
|
||||
IsVisible="{Binding IsMock, Converter={StaticResource InverseBoolConverter}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="60" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="64" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- BANNER -->
|
||||
<Image
|
||||
x:Name="Banner"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Aspect="AspectFill">
|
||||
<Image.Source>
|
||||
<OnPlatform
|
||||
x:TypeArguments="ImageSource"
|
||||
Android="banner.png"
|
||||
iOS="banner.png"
|
||||
WinPhone="Assets\banner.png"/>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
BackgroundColor="{StaticResource BlackColor}"
|
||||
Opacity="0.5"/>
|
||||
<!-- LOG IN BUTTON -->
|
||||
<Grid
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource LoginPanelStyle}">
|
||||
<Label
|
||||
Text="[ LOGIN ]"
|
||||
Style="{StaticResource LoginButtonStyle}"/>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding SignInCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
<!-- REGISTER BUTTON -->
|
||||
<Grid
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource RegisterPanelStyle}">
|
||||
<Label
|
||||
Text="[ REGISTER ]"
|
||||
Style="{StaticResource LoginButtonStyle}"/>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding RegisterCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
<!-- SETTINGS -->
|
||||
<Grid
|
||||
Grid.Column="2"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource SettingsPanelStyle}">
|
||||
<Image
|
||||
Style="{StaticResource SettingsImageStyle}">
|
||||
<Image.Source>
|
||||
<OnPlatform
|
||||
x:TypeArguments="ImageSource"
|
||||
WinPhone="Assets/app_settings.png"
|
||||
Android="app_settings"
|
||||
iOS="app_settings"/>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding SettingsCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
<!-- WEBVIEW -->
|
||||
<AbsoluteLayout
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
IsVisible="{Binding IsLogin}">
|
||||
<WebView
|
||||
Source="{Binding LoginUrl}"
|
||||
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
|
||||
AbsoluteLayout.LayoutFlags="All">
|
||||
<WebView.Behaviors>
|
||||
<behaviors:WebViewNavigationBehavior
|
||||
NavigateCommand="{Binding NavigateCommand}"/>
|
||||
</WebView.Behaviors>
|
||||
</WebView>
|
||||
</AbsoluteLayout>
|
||||
</Grid>
|
||||
<!-- INDICATOR -->
|
||||
<ActivityIndicator
|
||||
Color="{StaticResource LightGreenColor}"
|
||||
IsRunning="{Binding IsBusy}"
|
||||
IsVisible="{Binding IsBusy}"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform
|
||||
x:TypeArguments="x:Double"
|
||||
iOS="100"
|
||||
Android="100"
|
||||
WinPhone="400" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
</ActivityIndicator>
|
||||
</Grid>
|
||||
<!-- AUTH -->
|
||||
<Grid
|
||||
ColumnSpacing="0"
|
||||
RowSpacing="0"
|
||||
IsVisible="{Binding IsMock, Converter={StaticResource InverseBoolConverter}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="60" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- BANNER -->
|
||||
<Image
|
||||
x:Name="Banner"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Aspect="AspectFill">
|
||||
<Image.Source>
|
||||
<OnPlatform
|
||||
x:TypeArguments="ImageSource"
|
||||
Android="banner.png"
|
||||
iOS="banner.png"
|
||||
WinPhone="Assets\banner.png"/>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
BackgroundColor="{StaticResource BlackColor}"
|
||||
Opacity="0.5"/>
|
||||
<!-- LOG IN BUTTON -->
|
||||
<Grid
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource LoginPanelStyle}">
|
||||
<Label
|
||||
Text="[ LOGIN ]"
|
||||
Style="{StaticResource LoginButtonStyle}"/>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding SignInCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
<!-- REGISTER BUTTON -->
|
||||
<Grid
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource RegisterPanelStyle}">
|
||||
<Label
|
||||
Text="[ REGISTER ]"
|
||||
Style="{StaticResource LoginButtonStyle}"/>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding RegisterCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
<!-- WEBVIEW -->
|
||||
<AbsoluteLayout
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
IsVisible="{Binding IsLogin}">
|
||||
<WebView
|
||||
Source="{Binding LoginUrl}"
|
||||
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
|
||||
AbsoluteLayout.LayoutFlags="All">
|
||||
<WebView.Behaviors>
|
||||
<behaviors:WebViewNavigationBehavior
|
||||
NavigateCommand="{Binding NavigateCommand}"/>
|
||||
</WebView.Behaviors>
|
||||
</WebView>
|
||||
</AbsoluteLayout>
|
||||
</Grid>
|
||||
<!-- INDICATOR -->
|
||||
<ActivityIndicator
|
||||
Color="{StaticResource LightGreenColor}"
|
||||
IsRunning="{Binding IsBusy}"
|
||||
IsVisible="{Binding IsBusy}"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center">
|
||||
<ActivityIndicator.WidthRequest>
|
||||
<OnPlatform
|
||||
x:TypeArguments="x:Double"
|
||||
iOS="100"
|
||||
Android="100"
|
||||
WinPhone="400" />
|
||||
</ActivityIndicator.WidthRequest>
|
||||
</ActivityIndicator>
|
||||
</Grid>
|
||||
</ContentPage>
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using eShopOnContainers.Core.ViewModels;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
@ -22,6 +23,13 @@ namespace eShopOnContainers.Core.Views
|
||||
|
||||
_animate = true;
|
||||
await AnimateIn();
|
||||
|
||||
var vm = BindingContext as LoginViewModel;
|
||||
|
||||
if(vm != null)
|
||||
{
|
||||
vm.InvalidateMock();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDisappearing()
|
||||
|
@ -13,19 +13,6 @@
|
||||
iOS="eShop on Containers"
|
||||
WinPhone="eShop on Containers"/>
|
||||
</TabbedPage.Title>
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem
|
||||
Command="{Binding SettingsCommand}"
|
||||
Text="Settings">
|
||||
<ToolbarItem.Icon>
|
||||
<OnPlatform
|
||||
x:TypeArguments="FileImageSource"
|
||||
WinPhone="Assets/app_settings.png"
|
||||
Android="app_settings"
|
||||
iOS="app_settings"/>
|
||||
</ToolbarItem.Icon>
|
||||
</ToolbarItem>
|
||||
</ContentPage.ToolbarItems>
|
||||
<!-- CATALOG -->
|
||||
<views:CatalogView
|
||||
x:Name="HomeView">
|
||||
|
@ -16,7 +16,7 @@
|
||||
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
|
||||
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
|
||||
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
|
||||
<AndroidStoreUncompressedFileExtensions />
|
||||
|
@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTitle("eShopOnContainers.UWP")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("eShopOnContainers.UWP")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyCopyright("Copyright Microsoft © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user