Linked register website with mobile apps
This commit is contained in:
parent
e631701ff3
commit
b9223b34c2
@ -0,0 +1,7 @@
|
||||
namespace eShopOnContainers.Core
|
||||
{
|
||||
public static class GlobalSetting
|
||||
{
|
||||
public const string RegisterWebsite = "http://104.40.62.65/Account/Register";
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace eShopOnContainers.Core.Services.OpenUrl
|
||||
{
|
||||
public interface IOpenUrlService
|
||||
{
|
||||
void OpenUrl(string url);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace eShopOnContainers.Core.Services.OpenUrl
|
||||
{
|
||||
public class OpenUrlService : IOpenUrlService
|
||||
{
|
||||
public void OpenUrl(string url)
|
||||
{
|
||||
Device.OpenUri(new Uri(url));
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using eShopOnContainers.Core.ViewModels;
|
||||
using eShopOnContainers.Services;
|
||||
using System;
|
||||
using eShopOnContainers.Core.Services.Catalog;
|
||||
using eShopOnContainers.Core.Services.OpenUrl;
|
||||
|
||||
namespace eShopOnContainers.ViewModels.Base
|
||||
{
|
||||
@ -28,6 +29,7 @@ namespace eShopOnContainers.ViewModels.Base
|
||||
// services
|
||||
_unityContainer.RegisterType<IDialogService, DialogService>();
|
||||
RegisterSingleton<INavigationService, NavigationService>();
|
||||
_unityContainer.RegisterType<IOpenUrlService, OpenUrlService>();
|
||||
_unityContainer.RegisterType<ICatalogService, CatalogMockService>();
|
||||
_unityContainer.RegisterType<IOrdersService, OrdersMockService>();
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using eShopOnContainers.Core.Validations;
|
||||
using eShopOnContainers.Core.Services.OpenUrl;
|
||||
using eShopOnContainers.Core.Validations;
|
||||
using eShopOnContainers.ViewModels.Base;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
@ -14,8 +15,12 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
private ValidatableObject<string> _password;
|
||||
private bool _isValid;
|
||||
|
||||
public LoginViewModel()
|
||||
private IOpenUrlService _openUrlService;
|
||||
|
||||
public LoginViewModel(IOpenUrlService openUrlService)
|
||||
{
|
||||
_openUrlService = openUrlService;
|
||||
|
||||
_userName = new ValidatableObject<string>();
|
||||
_password = new ValidatableObject<string>();
|
||||
|
||||
@ -63,6 +68,8 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
|
||||
public ICommand SignInCommand => new Command(SignInAsync);
|
||||
|
||||
public ICommand RegisterCommand => new Command(Register);
|
||||
|
||||
private async void SignInAsync()
|
||||
{
|
||||
IsBusy = true;
|
||||
@ -97,6 +104,11 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
IsBusy = false;
|
||||
}
|
||||
|
||||
private void Register()
|
||||
{
|
||||
_openUrlService.OpenUrl(GlobalSetting.RegisterWebsite);
|
||||
}
|
||||
|
||||
private bool Validate()
|
||||
{
|
||||
bool isValidUser = _userName.Validate();
|
||||
|
@ -104,6 +104,11 @@
|
||||
<Label
|
||||
Text="REGISTER"
|
||||
TextColor="Gray"/>
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
Command="{Binding RegisterCommand}"
|
||||
NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<!-- INFO -->
|
||||
|
@ -54,6 +54,7 @@
|
||||
<Compile Include="Converters\ToUpperConverter.cs" />
|
||||
<Compile Include="Effects\LineColorEffect.cs" />
|
||||
<Compile Include="Extensions\AnimationExtension.cs" />
|
||||
<Compile Include="GlobalSettings.cs" />
|
||||
<Compile Include="Helpers\EasingHelper.cs" />
|
||||
<Compile Include="Models\Orders\Order.cs" />
|
||||
<Compile Include="Models\Orders\OrderItem.cs" />
|
||||
@ -65,6 +66,8 @@
|
||||
<Compile Include="Services\Dialog\IDialogService.cs" />
|
||||
<Compile Include="Services\Navigation\INavigationService.cs" />
|
||||
<Compile Include="Services\Navigation\NavigationService.cs" />
|
||||
<Compile Include="Services\OpenUrl\IOpenUrlService.cs" />
|
||||
<Compile Include="Services\OpenUrl\OpenUrlService.cs" />
|
||||
<Compile Include="Services\Orders\OrdersMockService.cs" />
|
||||
<Compile Include="Services\Orders\IOrdersService.cs" />
|
||||
<Compile Include="Services\Catalog\CatalogMockService.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user