Unnessary files removed. Login and Register pages created. RegistrationData added.

This commit is contained in:
Andrey Shabarshov 2021-12-16 17:19:25 +00:00
parent b9ef3f3317
commit de95d78a23
34 changed files with 288 additions and 533 deletions

View File

@ -1,10 +1,4 @@
using System; namespace QRBee.Core
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QRBee.Core
{ {
public class ClientCardData public class ClientCardData
{ {
@ -12,16 +6,16 @@ namespace QRBee.Core
public string CardNumber public string CardNumber
{ {
get; get;
init; set;
} }
public string ExpirationDateMMYY public string ExpirationDateMMYY
{ {
get; get;
init; set;
} }
public string? ValidFrom public string ValidFrom
{ {
get; get;
set; set;
@ -30,13 +24,13 @@ namespace QRBee.Core
public string CardHolderName public string CardHolderName
{ {
get; get;
init; set;
} }
public string CVC public string CVC
{ {
get; get;
init; set;
} }
public int? IssueNo public int? IssueNo

View File

@ -1,32 +1,26 @@
using System; namespace QRBee.Core.Data
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QRBee.Core.Data
{ {
public record ClientToMerchantResponse public record ClientToMerchantResponse
{ {
public MerchantToClientRequest Request public MerchantToClientRequest Request
{ {
get; get;
init; set;
} }
public string ClientId public string ClientId
{ {
get; get;
init; set;
} }
public DateTime TimeStampUTC public DateTime TimeStampUTC
{ {
get; get;
init; set;
} }
public string? ClientSignature public string ClientSignature
{ {
get; get;
set; set;
@ -35,7 +29,7 @@ namespace QRBee.Core.Data
public string EncryptedClientCardData public string EncryptedClientCardData
{ {
get; get;
init; set;
} }
public string AsString() => $"{Request.AsString()}|{ClientId}|{TimeStampUTC:O}"; public string AsString() => $"{Request.AsString()}|{ClientId}|{TimeStampUTC:O}";

View File

@ -1,38 +1,32 @@
using System; namespace QRBee.Core.Data
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QRBee.Core.Data
{ {
public record MerchantToClientRequest public record MerchantToClientRequest
{ {
public string TransactionId public string TransactionId
{ {
get; get;
init; set;
} }
public string Name public string Name
{ {
get; get;
init; set;
} }
public decimal Amount public decimal Amount
{ {
get; get;
init; set;
} }
public DateTime TimeStampUTC public DateTime TimeStampUTC
{ {
get; get;
init; set;
} }
public string? MerchantSignature public string MerchantSignature
{ {
get; get;
set; set;

View File

@ -1,10 +1,4 @@
using System; namespace QRBee.Core.Data
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QRBee.Core.Data
{ {
public record PaymentRequest public record PaymentRequest
{ {
@ -12,7 +6,7 @@ namespace QRBee.Core.Data
public ClientToMerchantResponse Request public ClientToMerchantResponse Request
{ {
get; get;
init; set;
} }
public string AsString() => Request.AsString(); public string AsString() => Request.AsString();

View File

@ -1,10 +1,4 @@
using System; namespace QRBee.Core.Data
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QRBee.Core.Data
{ {
public record PaymentResponse public record PaymentResponse
{ {
@ -12,13 +6,13 @@ namespace QRBee.Core.Data
public string ServerTransactionId public string ServerTransactionId
{ {
get; get;
init; set;
} }
public PaymentRequest PaymentRequest public PaymentRequest PaymentRequest
{ {
get; get;
init; set;
} }
public string AsString() => $"{ServerTransactionId}|{PaymentRequest.AsString()}"; public string AsString() => $"{ServerTransactionId}|{PaymentRequest.AsString()}";

View File

@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View 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;
}
}
}

View File

@ -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" <Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:QRBee.Views" xmlns:local="clr-namespace:QRBee.Views"
@ -32,7 +32,7 @@
<TabBar> <TabBar>
<!-- <ShellContent Title="About" Icon="icon_about.png" Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" /> --> <!-- <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="Browse" Icon="icon_feed.png" ContentTemplate="{DataTemplate local:ItemsPage}" /> -->
<ShellContent Title="MainPage" ContentTemplate="{DataTemplate local:MainPage}"/> <ShellContent Title="LoginPage" ContentTemplate="{DataTemplate local:LoginPage}"/>
</TabBar> </TabBar>
<!-- <!--
@ -40,8 +40,12 @@
await Shell.Current.GoToAsync("//LoginPage"); await Shell.Current.GoToAsync("//LoginPage");
--> -->
<TabBar> <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> </TabBar>
</Shell> </Shell>

View File

@ -10,10 +10,11 @@ namespace QRBee
{ {
public AppShell() public AppShell()
{ {
InitializeComponent(); InitializeComponent();
Routing.RegisterRoute(nameof(ItemDetailPage), typeof(ItemDetailPage)); Routing.RegisterRoute(nameof(LoginPage),typeof(LoginPage));
Routing.RegisterRoute(nameof(NewItemPage), typeof(NewItemPage)); Routing.RegisterRoute(nameof(RegisterPage), typeof(RegisterPage));
} }
} }
} }

View File

@ -12,6 +12,10 @@
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.4.1" /> <PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.4.1" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\QRBee.Core\QRBee.Core.csproj" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Views\ClientPage.xaml.cs"> <Compile Update="Views\ClientPage.xaml.cs">
<DependentUpon>ClientPage.xaml</DependentUpon> <DependentUpon>ClientPage.xaml</DependentUpon>
@ -22,6 +26,12 @@
</ItemGroup> </ItemGroup>
<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"> <EmbeddedResource Update="Views\MainPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
@ -31,5 +41,8 @@
<EmbeddedResource Update="Views\ClientPage.xaml"> <EmbeddedResource Update="Views\ClientPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Views\RegisterPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -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; }
}
}

View File

@ -51,4 +51,4 @@ namespace QRBee.ViewModels
} }
#endregion #endregion
} }
} }

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace QRBee.ViewModels
{
internal class ClientPageViewModel
{
}
}

View File

@ -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");
}
}
}
}

View File

@ -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}");
}
}
}

View File

@ -8,17 +8,31 @@ namespace QRBee.ViewModels
{ {
public class LoginViewModel : BaseViewModel public class LoginViewModel : BaseViewModel
{ {
public Command LoginCommand { get; } public Command LoginCommand
{
get;
}
public Command RegisterCommand
{
get;
}
public LoginViewModel() public LoginViewModel()
{ {
LoginCommand = new Command(OnLoginClicked); LoginCommand = new Command(OnLoginClicked);
RegisterCommand = new Command(OnRegisterClicked);
} }
private async void OnLoginClicked(object obj) private async void OnLoginClicked(object obj)
{ {
// Prefixing with `//` switches to a different navigation stack instead of pushing to the active one // 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)}");
} }
} }
} }

View File

@ -1,18 +1,12 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using QRBee.Views;
using Xamarin.Forms; using Xamarin.Forms;
using ZXing;
using ZXing.Common;
namespace QRBee.ViewModels namespace QRBee.ViewModels
{ {
internal class MerchantPageViewModel : BaseViewModel internal class MerchantPageViewModel : BaseViewModel
{ {
private string _name; private string _name;
private double _amount; private decimal _amount;
private string _qrCode; private string _qrCode;
public Command GenerateQrCommand { get; } public Command GenerateQrCommand { get; }
@ -27,14 +21,14 @@ namespace QRBee.ViewModels
get => _name; get => _name;
set set
{ {
if(_name==value) if (_name == value)
return; return;
_name= value; _name = value;
OnPropertyChanged(nameof(Name)); OnPropertyChanged(nameof(Name));
} }
} }
public double Amount public decimal Amount
{ {
get => _amount; get => _amount;
set set
@ -56,7 +50,7 @@ namespace QRBee.ViewModels
// _qrCode = $"{Amount}/{Name}"; // _qrCode = $"{Amount}/{Name}";
if (_qrCode == value) if (_qrCode == value)
return; return;
_qrCode = value; _qrCode = value;
OnPropertyChanged(nameof(QrCode)); OnPropertyChanged(nameof(QrCode));
} }
@ -70,4 +64,4 @@ namespace QRBee.ViewModels
} }
} }
} }

View File

@ -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("..");
}
}
}

View 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)}");
}
}
}

View File

@ -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>

View File

@ -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();
}
}
}

View File

@ -7,8 +7,11 @@
<!-- <Label Text="Hello this is a test page." --> <!-- <Label Text="Hello this is a test page." -->
<!-- VerticalOptions="CenterAndExpand" --> <!-- VerticalOptions="CenterAndExpand" -->
<!-- HorizontalOptions="CenterAndExpand" /> --> <!-- HorizontalOptions="CenterAndExpand" /> -->
<StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand"> <StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
<Label x:Name="QrCodeScanner" VerticalOptions="FillAndExpand" Text="Text to scan"/> <StackLayout Orientation="Vertical">
<Label x:Name="Name" VerticalOptions="FillAndExpand" Text="Merchant name: "/>
<Label x:Name="Amount" VerticalOptions="FillAndExpand" Text="Amount: "/>
</StackLayout>
</StackLayout> </StackLayout>
<StackLayout Orientation="Horizontal" VerticalOptions="End" Margin="0,0,0,10"> <StackLayout Orientation="Horizontal" VerticalOptions="End" Margin="0,0,0,10">

View File

@ -1,9 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QRBee.Services; using QRBee.Services;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
@ -26,7 +21,8 @@ namespace QRBee.Views
var result = await scanner.ScanQR(); var result = await scanner.ScanQR();
if (result != null) if (result != null)
{ {
QrCodeScanner.Text = result; Name.Text = result;
Amount.Text = result;
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -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>

View File

@ -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();
}
}
}

View File

@ -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>

View File

@ -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();
}
}
}

View File

@ -6,9 +6,21 @@
mc:Ignorable="d" mc:Ignorable="d"
x:Class="QRBee.Views.LoginPage" x:Class="QRBee.Views.LoginPage"
Shell.NavBarIsVisible="False"> Shell.NavBarIsVisible="False">
<ContentPage.Content> <ContentPage.Content>
<StackLayout Padding="10,0,10,0" VerticalOptions="Center"> <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="Login" Command="{Binding LoginCommand}"/>
<Button VerticalOptions="Center" Text="Register new user" Command="{Binding RegisterCommand}"/>
</StackLayout> </StackLayout>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>

View File

@ -11,13 +11,11 @@
<StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand"> <StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal"> <StackLayout Orientation="Vertical">
<Label Text="Enter your name: " Padding="5,10,0,0"/> <Label Text="Enter your name: " Padding="5,10,0,0"/>
<Entry Placeholder="Your name" HorizontalOptions="FillAndExpand" Text="{Binding Name}"/> <Entry Placeholder="Your name" HorizontalOptions="FillAndExpand" Text="{Binding Name}"/>
</StackLayout>
<StackLayout Orientation="Horizontal"> <Label Text="Enter sum: " Padding="5,0,0,0" />
<Label Text="Enter sum: " Padding="5,0,35,0" />
<Entry Placeholder="Amount" Keyboard="Numeric" HorizontalOptions="FillAndExpand" MaxLength="6" Text="{Binding Amount}"/> <Entry Placeholder="Amount" Keyboard="Numeric" HorizontalOptions="FillAndExpand" MaxLength="6" Text="{Binding Amount}"/>
</StackLayout> </StackLayout>

View File

@ -1,7 +1,4 @@
using System; using Xamarin.Forms.Xaml;
using Xamarin.Forms.Xaml;
using ZXing;
using System.Drawing;
using QRBee.ViewModels; using QRBee.ViewModels;
namespace QRBee.Views namespace QRBee.Views

View File

@ -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>

View File

@ -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();
}
}
}

View 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>

View 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();
}
}
}