diff --git a/src/App/App.csproj b/src/App/App.csproj index d28f8056d..d1299c5a2 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -18,4 +18,10 @@ + + + + HomePage.xaml + + \ No newline at end of file diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index 87efdcf3e..b06c8b26e 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -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() diff --git a/src/App/MainPage.xaml b/src/App/MainPage.xaml deleted file mode 100644 index 88351115c..000000000 --- a/src/App/MainPage.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - diff --git a/src/App/Pages/Accounts/HomePage.xaml b/src/App/Pages/Accounts/HomePage.xaml new file mode 100644 index 000000000..3fb4e6dff --- /dev/null +++ b/src/App/Pages/Accounts/HomePage.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/src/App/MainPage.xaml.cs b/src/App/Pages/Accounts/HomePage.xaml.cs similarity index 63% rename from src/App/MainPage.xaml.cs rename to src/App/Pages/Accounts/HomePage.xaml.cs index b4b842ad8..d4868c2a6 100644 --- a/src/App/MainPage.xaml.cs +++ b/src/App/Pages/Accounts/HomePage.xaml.cs @@ -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(); } diff --git a/src/App/ViewModels/Accounts/HomeViewModel.cs b/src/App/ViewModels/Accounts/HomeViewModel.cs new file mode 100644 index 000000000..0505454e9 --- /dev/null +++ b/src/App/ViewModels/Accounts/HomeViewModel.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Bit.App.ViewModels +{ + public class HomeViewModel : BaseViewModel + { + + } +} diff --git a/src/App/ViewModels/BaseViewModel.cs b/src/App/ViewModels/BaseViewModel.cs new file mode 100644 index 000000000..5882da8b4 --- /dev/null +++ b/src/App/ViewModels/BaseViewModel.cs @@ -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(ref T backingStore, T value, [CallerMemberName]string propertyName = "", + Action onChanged = null) + { + if(EqualityComparer.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)); + } + } +}