mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
home page
This commit is contained in:
parent
574c826036
commit
30dd2e993f
7 changed files with 93 additions and 28 deletions
|
@ -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>
|
|
@ -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()
|
||||
|
|
|
@ -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=""
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="CenterAndExpand">
|
||||
<Label.FontFamily>
|
||||
<OnPlatform x:TypeArguments="x:String"
|
||||
Android="FontAwesome.ttf#FontAwesome"
|
||||
iOS="FontAwesome" />
|
||||
</Label.FontFamily>
|
||||
</Label>
|
||||
</StackLayout>
|
||||
|
||||
</ContentPage>
|
31
src/App/Pages/Accounts/HomePage.xaml
Normal file
31
src/App/Pages/Accounts/HomePage.xaml
Normal 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=""
|
||||
HorizontalOptions="Center"
|
||||
VerticalOptions="CenterAndExpand">
|
||||
|
||||
<Label.FontFamily>
|
||||
<OnPlatform x:TypeArguments="x:String"
|
||||
Android="FontAwesome.ttf#FontAwesome"
|
||||
iOS="FontAwesome" />
|
||||
</Label.FontFamily>
|
||||
</Label>
|
||||
</StackLayout>
|
||||
|
||||
</ContentPage>
|
|
@ -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();
|
||||
}
|
11
src/App/ViewModels/Accounts/HomeViewModel.cs
Normal file
11
src/App/ViewModels/Accounts/HomeViewModel.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Bit.App.ViewModels
|
||||
{
|
||||
public class HomeViewModel : BaseViewModel
|
||||
{
|
||||
|
||||
}
|
||||
}
|
38
src/App/ViewModels/BaseViewModel.cs
Normal file
38
src/App/ViewModels/BaseViewModel.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue