mirror of
https://github.com/NecroticBamboo/QRBee.git
synced 2025-12-21 12:11:53 +00:00
Unnessary files removed. Login and Register pages created. RegistrationData added.
This commit is contained in:
parent
b9ef3f3317
commit
de95d78a23
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QRBee.Core
|
||||
namespace QRBee.Core
|
||||
{
|
||||
public class ClientCardData
|
||||
{
|
||||
@ -12,16 +6,16 @@ namespace QRBee.Core
|
||||
public string CardNumber
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string ExpirationDateMMYY
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string? ValidFrom
|
||||
public string ValidFrom
|
||||
{
|
||||
get;
|
||||
set;
|
||||
@ -30,13 +24,13 @@ namespace QRBee.Core
|
||||
public string CardHolderName
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string CVC
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public int? IssueNo
|
||||
|
||||
@ -1,32 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QRBee.Core.Data
|
||||
namespace QRBee.Core.Data
|
||||
{
|
||||
public record ClientToMerchantResponse
|
||||
{
|
||||
public MerchantToClientRequest Request
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string ClientId
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public DateTime TimeStampUTC
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string? ClientSignature
|
||||
public string ClientSignature
|
||||
{
|
||||
get;
|
||||
set;
|
||||
@ -35,7 +29,7 @@ namespace QRBee.Core.Data
|
||||
public string EncryptedClientCardData
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string AsString() => $"{Request.AsString()}|{ClientId}|{TimeStampUTC:O}";
|
||||
|
||||
@ -1,38 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QRBee.Core.Data
|
||||
namespace QRBee.Core.Data
|
||||
{
|
||||
public record MerchantToClientRequest
|
||||
{
|
||||
public string TransactionId
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public decimal Amount
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public DateTime TimeStampUTC
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string? MerchantSignature
|
||||
public string MerchantSignature
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
||||
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QRBee.Core.Data
|
||||
namespace QRBee.Core.Data
|
||||
{
|
||||
public record PaymentRequest
|
||||
{
|
||||
@ -12,7 +6,7 @@ namespace QRBee.Core.Data
|
||||
public ClientToMerchantResponse Request
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string AsString() => Request.AsString();
|
||||
|
||||
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QRBee.Core.Data
|
||||
namespace QRBee.Core.Data
|
||||
{
|
||||
public record PaymentResponse
|
||||
{
|
||||
@ -12,13 +6,13 @@ namespace QRBee.Core.Data
|
||||
public string ServerTransactionId
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public PaymentRequest PaymentRequest
|
||||
{
|
||||
get;
|
||||
init;
|
||||
set;
|
||||
}
|
||||
|
||||
public string AsString() => $"{ServerTransactionId}|{PaymentRequest.AsString()}";
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
31
QRBee.Core/RegistrationData.cs
Normal file
31
QRBee.Core/RegistrationData.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace QRBee.Core
|
||||
{
|
||||
internal class RegistrationData
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string Email
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string DateOfBirth
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string CertificateRequest
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="clr-namespace:QRBee.Views"
|
||||
@ -32,7 +32,7 @@
|
||||
<TabBar>
|
||||
<!-- <ShellContent Title="About" Icon="icon_about.png" Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" /> -->
|
||||
<!-- <ShellContent Title="Browse" Icon="icon_feed.png" ContentTemplate="{DataTemplate local:ItemsPage}" /> -->
|
||||
<ShellContent Title="MainPage" ContentTemplate="{DataTemplate local:MainPage}"/>
|
||||
<ShellContent Title="LoginPage" ContentTemplate="{DataTemplate local:LoginPage}"/>
|
||||
</TabBar>
|
||||
|
||||
<!--
|
||||
@ -40,8 +40,12 @@
|
||||
await Shell.Current.GoToAsync("//LoginPage");
|
||||
-->
|
||||
<TabBar>
|
||||
<ShellContent Route="LoginPage" ContentTemplate="{DataTemplate local:LoginPage}" />
|
||||
<ShellContent Route="RegisterPage" ContentTemplate="{DataTemplate local:RegisterPage}" />
|
||||
</TabBar>
|
||||
|
||||
<TabBar>
|
||||
<ShellContent Route="MainPage" ContentTemplate="{DataTemplate local:MainPage}" />
|
||||
</TabBar>
|
||||
|
||||
|
||||
</Shell>
|
||||
</Shell>
|
||||
@ -10,10 +10,11 @@ namespace QRBee
|
||||
{
|
||||
public AppShell()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
Routing.RegisterRoute(nameof(ItemDetailPage), typeof(ItemDetailPage));
|
||||
Routing.RegisterRoute(nameof(NewItemPage), typeof(NewItemPage));
|
||||
Routing.RegisterRoute(nameof(LoginPage),typeof(LoginPage));
|
||||
Routing.RegisterRoute(nameof(RegisterPage), typeof(RegisterPage));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,10 @@
|
||||
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\QRBee.Core\QRBee.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\ClientPage.xaml.cs">
|
||||
<DependentUpon>ClientPage.xaml</DependentUpon>
|
||||
@ -22,6 +26,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="AppShell.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\LoginPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\MainPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
@ -31,5 +41,8 @@
|
||||
<EmbeddedResource Update="Views\ClientPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\RegisterPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Essentials;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace QRBee.ViewModels
|
||||
{
|
||||
public class AboutViewModel : BaseViewModel
|
||||
{
|
||||
public AboutViewModel()
|
||||
{
|
||||
Title = "About";
|
||||
OpenWebCommand = new Command(async () => await Browser.OpenAsync("https://aka.ms/xamarin-quickstart"));
|
||||
}
|
||||
|
||||
public ICommand OpenWebCommand { get; }
|
||||
}
|
||||
}
|
||||
@ -51,4 +51,4 @@ namespace QRBee.ViewModels
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
12
QRBee/QRBee/ViewModels/ClientPageViewModel.cs
Normal file
12
QRBee/QRBee/ViewModels/ClientPageViewModel.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace QRBee.ViewModels
|
||||
{
|
||||
|
||||
|
||||
internal class ClientPageViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
using QRBee.Models;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace QRBee.ViewModels
|
||||
{
|
||||
[QueryProperty(nameof(ItemId), nameof(ItemId))]
|
||||
public class ItemDetailViewModel : BaseViewModel
|
||||
{
|
||||
private string itemId;
|
||||
private string text;
|
||||
private string description;
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => text;
|
||||
set => SetProperty(ref text, value);
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get => description;
|
||||
set => SetProperty(ref description, value);
|
||||
}
|
||||
|
||||
public string ItemId
|
||||
{
|
||||
get
|
||||
{
|
||||
return itemId;
|
||||
}
|
||||
set
|
||||
{
|
||||
itemId = value;
|
||||
LoadItemId(value);
|
||||
}
|
||||
}
|
||||
|
||||
public async void LoadItemId(string itemId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var item = await DataStore.GetItemAsync(itemId);
|
||||
Id = item.Id;
|
||||
Text = item.Text;
|
||||
Description = item.Description;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Debug.WriteLine("Failed to Load Item");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
using QRBee.Models;
|
||||
using QRBee.Views;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace QRBee.ViewModels
|
||||
{
|
||||
public class ItemsViewModel : BaseViewModel
|
||||
{
|
||||
private Item _selectedItem;
|
||||
|
||||
public ObservableCollection<Item> Items { get; }
|
||||
public Command LoadItemsCommand { get; }
|
||||
public Command AddItemCommand { get; }
|
||||
public Command<Item> ItemTapped { get; }
|
||||
|
||||
public ItemsViewModel()
|
||||
{
|
||||
Title = "Browse";
|
||||
Items = new ObservableCollection<Item>();
|
||||
LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommand());
|
||||
|
||||
ItemTapped = new Command<Item>(OnItemSelected);
|
||||
|
||||
AddItemCommand = new Command(OnAddItem);
|
||||
}
|
||||
|
||||
async Task ExecuteLoadItemsCommand()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
try
|
||||
{
|
||||
Items.Clear();
|
||||
var items = await DataStore.GetItemsAsync(true);
|
||||
foreach (var item in items)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsBusy = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnAppearing()
|
||||
{
|
||||
IsBusy = true;
|
||||
SelectedItem = null;
|
||||
}
|
||||
|
||||
public Item SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectedItem, value);
|
||||
OnItemSelected(value);
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnAddItem(object obj)
|
||||
{
|
||||
await Shell.Current.GoToAsync(nameof(NewItemPage));
|
||||
}
|
||||
|
||||
async void OnItemSelected(Item item)
|
||||
{
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
// This will push the ItemDetailPage onto the navigation stack
|
||||
await Shell.Current.GoToAsync($"{nameof(ItemDetailPage)}?{nameof(ItemDetailViewModel.ItemId)}={item.Id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,17 +8,31 @@ namespace QRBee.ViewModels
|
||||
{
|
||||
public class LoginViewModel : BaseViewModel
|
||||
{
|
||||
public Command LoginCommand { get; }
|
||||
public Command LoginCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public Command RegisterCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public LoginViewModel()
|
||||
{
|
||||
LoginCommand = new Command(OnLoginClicked);
|
||||
RegisterCommand = new Command(OnRegisterClicked);
|
||||
}
|
||||
|
||||
private async void OnLoginClicked(object obj)
|
||||
{
|
||||
// Prefixing with `//` switches to a different navigation stack instead of pushing to the active one
|
||||
await Shell.Current.GoToAsync($"//{nameof(AboutPage)}");
|
||||
await Shell.Current.GoToAsync($"//{nameof(MainPage)}");
|
||||
}
|
||||
|
||||
private async void OnRegisterClicked(object obj)
|
||||
{
|
||||
await Shell.Current.GoToAsync($"{nameof(RegisterPage)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using QRBee.Views;
|
||||
using Xamarin.Forms;
|
||||
using ZXing;
|
||||
using ZXing.Common;
|
||||
|
||||
namespace QRBee.ViewModels
|
||||
{
|
||||
internal class MerchantPageViewModel : BaseViewModel
|
||||
{
|
||||
private string _name;
|
||||
private double _amount;
|
||||
private decimal _amount;
|
||||
private string _qrCode;
|
||||
|
||||
public Command GenerateQrCommand { get; }
|
||||
@ -27,14 +21,14 @@ namespace QRBee.ViewModels
|
||||
get => _name;
|
||||
set
|
||||
{
|
||||
if(_name==value)
|
||||
if (_name == value)
|
||||
return;
|
||||
_name= value;
|
||||
_name = value;
|
||||
OnPropertyChanged(nameof(Name));
|
||||
}
|
||||
}
|
||||
|
||||
public double Amount
|
||||
public decimal Amount
|
||||
{
|
||||
get => _amount;
|
||||
set
|
||||
@ -56,7 +50,7 @@ namespace QRBee.ViewModels
|
||||
// _qrCode = $"{Amount}/{Name}";
|
||||
if (_qrCode == value)
|
||||
return;
|
||||
|
||||
|
||||
_qrCode = value;
|
||||
OnPropertyChanged(nameof(QrCode));
|
||||
}
|
||||
@ -70,4 +64,4 @@ namespace QRBee.ViewModels
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
using QRBee.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace QRBee.ViewModels
|
||||
{
|
||||
public class NewItemViewModel : BaseViewModel
|
||||
{
|
||||
private string text;
|
||||
private string description;
|
||||
|
||||
public NewItemViewModel()
|
||||
{
|
||||
SaveCommand = new Command(OnSave, ValidateSave);
|
||||
CancelCommand = new Command(OnCancel);
|
||||
this.PropertyChanged +=
|
||||
(_, __) => SaveCommand.ChangeCanExecute();
|
||||
}
|
||||
|
||||
private bool ValidateSave()
|
||||
{
|
||||
return !String.IsNullOrWhiteSpace(text)
|
||||
&& !String.IsNullOrWhiteSpace(description);
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => text;
|
||||
set => SetProperty(ref text, value);
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get => description;
|
||||
set => SetProperty(ref description, value);
|
||||
}
|
||||
|
||||
public Command SaveCommand { get; }
|
||||
public Command CancelCommand { get; }
|
||||
|
||||
private async void OnCancel()
|
||||
{
|
||||
// This will pop the current page off the navigation stack
|
||||
await Shell.Current.GoToAsync("..");
|
||||
}
|
||||
|
||||
private async void OnSave()
|
||||
{
|
||||
Item newItem = new Item()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
Text = Text,
|
||||
Description = Description
|
||||
};
|
||||
|
||||
await DataStore.AddItemAsync(newItem);
|
||||
|
||||
// This will pop the current page off the navigation stack
|
||||
await Shell.Current.GoToAsync("..");
|
||||
}
|
||||
}
|
||||
}
|
||||
74
QRBee/QRBee/ViewModels/RegisterViewModel.cs
Normal file
74
QRBee/QRBee/ViewModels/RegisterViewModel.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using QRBee.Views;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace QRBee.ViewModels
|
||||
{
|
||||
internal class RegisterViewModel: BaseViewModel
|
||||
{
|
||||
private string _password1;
|
||||
private string _password2;
|
||||
public RegisterViewModel()
|
||||
{
|
||||
RegisterCommand = new Command(OnRegisterClicked);
|
||||
}
|
||||
|
||||
public Command RegisterCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string DateOfBirth { get; set; }
|
||||
public string CardNumber { get; set; }
|
||||
public string ValidFrom { get; set; }
|
||||
public string ExpirationDate { get; set; }
|
||||
public string CardHolderName { get; set; }
|
||||
public string CVC { get; set; }
|
||||
public string IssueNo { get; set; }
|
||||
|
||||
public Color Password1Color { get; set; }
|
||||
public Color Password2Color { get; set;}
|
||||
|
||||
public string Password1
|
||||
{
|
||||
get => _password1;
|
||||
set
|
||||
{
|
||||
if ( value == _password1)
|
||||
return;
|
||||
|
||||
_password1 = value;
|
||||
Password1Color = (string.IsNullOrWhiteSpace(_password1) || _password1.Length < 8 ) ? Color.Red : Color.Green;
|
||||
OnPropertyChanged(nameof(Password1));
|
||||
OnPropertyChanged(nameof(Password1Color));
|
||||
}
|
||||
}
|
||||
|
||||
public string Password2
|
||||
{
|
||||
get => _password2;
|
||||
set
|
||||
{
|
||||
if(value == _password2)
|
||||
return;
|
||||
|
||||
_password2 = value;
|
||||
Password2Color = (string.IsNullOrWhiteSpace(_password2) || _password2!=Password1) ? Color.Red : Color.Green;
|
||||
OnPropertyChanged(nameof(Password2));
|
||||
OnPropertyChanged(nameof(Password2Color));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void OnRegisterClicked(object obj)
|
||||
{
|
||||
await Shell.Current.GoToAsync($"//{nameof(MainPage)}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="QRBee.Views.AboutPage"
|
||||
xmlns:vm="clr-namespace:QRBee.ViewModels"
|
||||
Title="{Binding Title}">
|
||||
|
||||
<ContentPage.BindingContext>
|
||||
<vm:AboutViewModel />
|
||||
</ContentPage.BindingContext>
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<Color x:Key="Accent">#96d1ff</Color>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackLayout BackgroundColor="{StaticResource Accent}" VerticalOptions="FillAndExpand" HorizontalOptions="Fill">
|
||||
<StackLayout Orientation="Horizontal" HorizontalOptions="Center" VerticalOptions="Center">
|
||||
<ContentView Padding="0,40,0,40" VerticalOptions="FillAndExpand">
|
||||
<Image Source="xamarin_logo.png" VerticalOptions="Center" HeightRequest="64" />
|
||||
</ContentView>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
<ScrollView Grid.Row="1">
|
||||
<StackLayout Orientation="Vertical" Padding="30,24,30,24" Spacing="10">
|
||||
<Label Text="Start developing now" FontSize="Title"/>
|
||||
<Label Text="Make changes to your XAML file and save to see your UI update in the running app with XAML Hot Reload. Give it a try!" FontSize="16" Padding="0,0,0,0"/>
|
||||
<Label FontSize="16" Padding="0,24,0,0">
|
||||
<Label.FormattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.Spans>
|
||||
<Span Text="Learn more at "/>
|
||||
<Span Text="https://aka.ms/xamarin-quickstart" FontAttributes="Bold"/>
|
||||
</FormattedString.Spans>
|
||||
</FormattedString>
|
||||
</Label.FormattedText>
|
||||
</Label>
|
||||
<Button Margin="0,10,0,0" Text="Learn more"
|
||||
Command="{Binding OpenWebCommand}"
|
||||
BackgroundColor="{StaticResource Primary}"
|
||||
TextColor="White" />
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</Grid>
|
||||
|
||||
</ContentPage>
|
||||
@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace QRBee.Views
|
||||
{
|
||||
public partial class AboutPage : ContentPage
|
||||
{
|
||||
public AboutPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,8 +7,11 @@
|
||||
<!-- <Label Text="Hello this is a test page." -->
|
||||
<!-- VerticalOptions="CenterAndExpand" -->
|
||||
<!-- HorizontalOptions="CenterAndExpand" /> -->
|
||||
<StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand">
|
||||
<Label x:Name="QrCodeScanner" VerticalOptions="FillAndExpand" Text="Text to scan"/>
|
||||
<StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label x:Name="Name" VerticalOptions="FillAndExpand" Text="Merchant name: "/>
|
||||
<Label x:Name="Amount" VerticalOptions="FillAndExpand" Text="Amount: "/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
|
||||
<StackLayout Orientation="Horizontal" VerticalOptions="End" Margin="0,0,0,10">
|
||||
|
||||
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using QRBee.Services;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
@ -26,7 +21,8 @@ namespace QRBee.Views
|
||||
var result = await scanner.ScanQR();
|
||||
if (result != null)
|
||||
{
|
||||
QrCodeScanner.Text = result;
|
||||
Name.Text = result;
|
||||
Amount.Text = result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="QRBee.Views.ItemDetailPage"
|
||||
Title="{Binding Title}">
|
||||
|
||||
<StackLayout Spacing="20" Padding="15">
|
||||
<Label Text="Text:" FontSize="Medium" />
|
||||
<Label Text="{Binding Text}" FontSize="Small"/>
|
||||
<Label Text="Description:" FontSize="Medium" />
|
||||
<Label Text="{Binding Description}" FontSize="Small"/>
|
||||
</StackLayout>
|
||||
|
||||
</ContentPage>
|
||||
@ -1,15 +0,0 @@
|
||||
using QRBee.ViewModels;
|
||||
using System.ComponentModel;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace QRBee.Views
|
||||
{
|
||||
public partial class ItemDetailPage : ContentPage
|
||||
{
|
||||
public ItemDetailPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = new ItemDetailViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="QRBee.Views.ItemsPage"
|
||||
Title="{Binding Title}"
|
||||
xmlns:local="clr-namespace:QRBee.ViewModels"
|
||||
xmlns:model="clr-namespace:QRBee.Models"
|
||||
x:Name="BrowseItemsPage">
|
||||
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem Text="Add" Command="{Binding AddItemCommand}" />
|
||||
</ContentPage.ToolbarItems>
|
||||
<!--
|
||||
x:DataType enables compiled bindings for better performance and compile time validation of binding expressions.
|
||||
https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/data-binding/compiled-bindings
|
||||
-->
|
||||
<RefreshView x:DataType="local:ItemsViewModel" Command="{Binding LoadItemsCommand}" IsRefreshing="{Binding IsBusy, Mode=TwoWay}">
|
||||
<CollectionView x:Name="ItemsListView"
|
||||
ItemsSource="{Binding Items}"
|
||||
SelectionMode="None">
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackLayout Padding="10" x:DataType="model:Item">
|
||||
<Label Text="{Binding Text}"
|
||||
LineBreakMode="NoWrap"
|
||||
Style="{DynamicResource ListItemTextStyle}"
|
||||
FontSize="16" />
|
||||
<Label Text="{Binding Description}"
|
||||
LineBreakMode="NoWrap"
|
||||
Style="{DynamicResource ListItemDetailTextStyle}"
|
||||
FontSize="13" />
|
||||
<StackLayout.GestureRecognizers>
|
||||
<TapGestureRecognizer
|
||||
NumberOfTapsRequired="1"
|
||||
Command="{Binding Source={RelativeSource AncestorType={x:Type local:ItemsViewModel}}, Path=ItemTapped}"
|
||||
CommandParameter="{Binding .}">
|
||||
</TapGestureRecognizer>
|
||||
</StackLayout.GestureRecognizers>
|
||||
</StackLayout>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</RefreshView>
|
||||
</ContentPage>
|
||||
@ -1,32 +0,0 @@
|
||||
using QRBee.Models;
|
||||
using QRBee.ViewModels;
|
||||
using QRBee.Views;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace QRBee.Views
|
||||
{
|
||||
public partial class ItemsPage : ContentPage
|
||||
{
|
||||
ItemsViewModel _viewModel;
|
||||
|
||||
public ItemsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BindingContext = _viewModel = new ItemsViewModel();
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
_viewModel.OnAppearing();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,9 +6,21 @@
|
||||
mc:Ignorable="d"
|
||||
x:Class="QRBee.Views.LoginPage"
|
||||
Shell.NavBarIsVisible="False">
|
||||
|
||||
<ContentPage.Content>
|
||||
|
||||
<StackLayout Padding="10,0,10,0" VerticalOptions="Center">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label Text="Login: " Padding="5,10,0,0"/>
|
||||
<Entry HorizontalOptions="FillAndExpand" Keyboard="Text"/>
|
||||
|
||||
<Label Text="Password: " Padding="5,0,0,0" />
|
||||
<Entry HorizontalOptions="FillAndExpand" IsPassword="True"/>
|
||||
</StackLayout>
|
||||
|
||||
<Button VerticalOptions="Center" Text="Login" Command="{Binding LoginCommand}"/>
|
||||
<Button VerticalOptions="Center" Text="Register new user" Command="{Binding RegisterCommand}"/>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
|
||||
</ContentPage>
|
||||
@ -11,13 +11,11 @@
|
||||
|
||||
<StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
|
||||
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label Text="Enter your name: " Padding="5,10,0,0"/>
|
||||
<Entry Placeholder="Your name" HorizontalOptions="FillAndExpand" Text="{Binding Name}"/>
|
||||
</StackLayout>
|
||||
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="Enter sum: " Padding="5,0,35,0" />
|
||||
<Label Text="Enter sum: " Padding="5,0,0,0" />
|
||||
<Entry Placeholder="Amount" Keyboard="Numeric" HorizontalOptions="FillAndExpand" MaxLength="6" Text="{Binding Amount}"/>
|
||||
</StackLayout>
|
||||
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using Xamarin.Forms.Xaml;
|
||||
using ZXing;
|
||||
using System.Drawing;
|
||||
using Xamarin.Forms.Xaml;
|
||||
using QRBee.ViewModels;
|
||||
|
||||
namespace QRBee.Views
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="QRBee.Views.NewItemPage"
|
||||
Shell.PresentationMode="ModalAnimated"
|
||||
Title="New Item"
|
||||
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
|
||||
ios:Page.UseSafeArea="true">
|
||||
<ContentPage.Content>
|
||||
<StackLayout Spacing="3" Padding="15">
|
||||
<Label Text="Text" FontSize="Medium" />
|
||||
<Entry Text="{Binding Text, Mode=TwoWay}" FontSize="Medium" />
|
||||
<Label Text="Description" FontSize="Medium" />
|
||||
<Editor Text="{Binding Description, Mode=TwoWay}" AutoSize="TextChanges" FontSize="Medium" Margin="0" />
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button Text="Cancel" Command="{Binding CancelCommand}" HorizontalOptions="FillAndExpand"></Button>
|
||||
<Button Text="Save" Command="{Binding SaveCommand}" HorizontalOptions="FillAndExpand"></Button>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
|
||||
</ContentPage>
|
||||
@ -1,21 +0,0 @@
|
||||
using QRBee.Models;
|
||||
using QRBee.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace QRBee.Views
|
||||
{
|
||||
public partial class NewItemPage : ContentPage
|
||||
{
|
||||
public Item Item { get; set; }
|
||||
|
||||
public NewItemPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = new NewItemViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
54
QRBee/QRBee/Views/RegisterPage.xaml
Normal file
54
QRBee/QRBee/Views/RegisterPage.xaml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:viewmodels="clr-namespace:QRBee.ViewModels" x:DataType="viewmodels:RegisterViewModel"
|
||||
x:Class="QRBee.Views.RegisterPage">
|
||||
|
||||
<ContentPage.Content>
|
||||
<ScrollView>
|
||||
<StackLayout Padding="10,0,10,0" VerticalOptions="Center">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label Text="User information" />
|
||||
<Label Text="Name: " Padding="5,5,0,0" />
|
||||
<Entry HorizontalOptions="FillAndExpand" Keyboard="Text" Text="{Binding Name}"/>
|
||||
|
||||
<Label Text="Email address: " Padding="5,5,0,0" />
|
||||
<Entry HorizontalOptions="FillAndExpand" Keyboard="Email" Text="{Binding Email}"/>
|
||||
|
||||
<Label Text="Date of birth: " Padding="5,0,0,0" />
|
||||
<DatePicker MinimumDate="01/01/1940" MaximumDate="01/01/2050" HorizontalOptions="FillAndExpand" Date="{Binding DateOfBirth}"/>
|
||||
|
||||
<Label Text="Password: " Padding="5,5,0,0" />
|
||||
<Entry HorizontalOptions="FillAndExpand" IsPassword="True" Text="{Binding Password1}" TextColor="{Binding Password1Color}"/>
|
||||
|
||||
<Label Text="Confirm password: " Padding="5,5,0,0" />
|
||||
<Entry HorizontalOptions="FillAndExpand" IsPassword="True" Text="{Binding Password2}" TextColor="{Binding Password2Color}"/>
|
||||
</StackLayout>
|
||||
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label Text="Card information" />
|
||||
<Label Text="Card number: " Padding="5,5,0,0" />
|
||||
<Entry HorizontalOptions="FillAndExpand" Keyboard="Numeric" MaxLength="16" Text="{Binding CardNumber}"/>
|
||||
|
||||
<Label Text="Valid from: " Padding="5,5,0,0" />
|
||||
<DatePicker MinimumDate="01/01/1940" MaximumDate="01/01/2050" HorizontalOptions="FillAndExpand" Date="{Binding ValidFrom}"/>
|
||||
|
||||
<Label Text="Expiration date: " Padding="5,5,0,0" />
|
||||
<DatePicker MinimumDate="01/01/1940" MaximumDate="01/01/2050" HorizontalOptions="FillAndExpand" Date="{Binding ExpirationDate}"/>
|
||||
|
||||
<Label Text="Card holder name: " Padding="5,5,0,0" />
|
||||
<Entry HorizontalOptions="FillAndExpand" Keyboard="Text" Text="{Binding CardHolderName}"/>
|
||||
|
||||
<Label Text="CVC: " Padding="5,5,0,0" />
|
||||
<Entry HorizontalOptions="FillAndExpand" Keyboard="Numeric" MaxLength="3" Text="{Binding CVC}"/>
|
||||
|
||||
<Label Text="Issue No: " Padding="5,5,0,0" />
|
||||
<Entry HorizontalOptions="FillAndExpand" Keyboard="Numeric" MaxLength="2" Text="{Binding IssueNo}"/>
|
||||
</StackLayout>
|
||||
|
||||
<Button VerticalOptions="Center" Margin="0,0,0,10" Text="Register" Command="{Binding RegisterCommand}" />
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage.Content>
|
||||
|
||||
</ContentPage>
|
||||
21
QRBee/QRBee/Views/RegisterPage.xaml.cs
Normal file
21
QRBee/QRBee/Views/RegisterPage.xaml.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using QRBee.ViewModels;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace QRBee.Views
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class RegisterPage : ContentPage
|
||||
{
|
||||
public RegisterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.BindingContext = new RegisterViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user