1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-23 11:45:38 +01:00

home page

This commit is contained in:
Kyle Spearrin 2019-03-28 17:10:10 -04:00
parent 574c826036
commit 30dd2e993f
7 changed files with 93 additions and 28 deletions

View File

@ -18,4 +18,10 @@
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Pages\Accounts\HomePage.xaml.cs">
<DependentUpon>HomePage.xaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@ -1,4 +1,5 @@
using System;
using Bit.App.Pages;
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@ -10,8 +11,7 @@ namespace Bit.App
public App()
{
InitializeComponent();
MainPage = new MainPage();
MainPage = new HomePage();
}
protected override void OnStart()

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="Bit.App.MainPage">
<StackLayout>
<!-- Place new controls here -->
<Label Text="Welcome to Xamarin.Forms!"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
<Label Text="&#xf2b9;"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String"
Android="FontAwesome.ttf#FontAwesome"
iOS="FontAwesome" />
</Label.FontFamily>
</Label>
</StackLayout>
</ContentPage>

View File

@ -0,0 +1,31 @@
<?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="Bit.App.Pages.HomePage"
xmlns:vm="clr-namespace:Bit.App.ViewModels"
Title="{Binding Title}">
<ContentPage.BindingContext>
<vm:HomeViewModel />
</ContentPage.BindingContext>
<StackLayout>
<!-- Place new controls here -->
<Label
Text="Home Page!"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
<Label
Text="&#xf2b9;"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand">
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String"
Android="FontAwesome.ttf#FontAwesome"
iOS="FontAwesome" />
</Label.FontFamily>
</Label>
</StackLayout>
</ContentPage>

View File

@ -4,12 +4,13 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Bit.App
namespace Bit.App.Pages
{
public partial class MainPage : ContentPage
public partial class HomePage : ContentPage
{
public MainPage()
public HomePage()
{
InitializeComponent();
}

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Bit.App.ViewModels
{
public class HomeViewModel : BaseViewModel
{
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Bit.App.ViewModels
{
public abstract class BaseViewModel : INotifyPropertyChanged
{
private string _pageTitle = string.Empty;
public event PropertyChangedEventHandler PropertyChanged;
public string PageTitle
{
get => _pageTitle;
set => SetProperty(ref _pageTitle, value);
}
protected bool SetProperty<T>(ref T backingStore, T value, [CallerMemberName]string propertyName = "",
Action onChanged = null)
{
if(EqualityComparer<T>.Default.Equals(backingStore, value))
{
return false;
}
backingStore = value;
onChanged?.Invoke();
OnPropertyChanged(propertyName);
return true;
}
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}