Set password basic ui
This commit is contained in:
parent
1acaaac597
commit
55f7522658
@ -0,0 +1,2 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=SafeMessageStorage_002EAnnotations/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@ -53,7 +53,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Xamarin.Forms" Version="4.3.0.908675" />
|
<PackageReference Include="Xamarin.Forms" Version="4.6.0.847" />
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
|
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -93,5 +93,5 @@
|
|||||||
<Name>SafeMessageStorage</Name>
|
<Name>SafeMessageStorage</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
@ -131,7 +131,7 @@
|
|||||||
<Reference Include="System.Numerics.Vectors" />
|
<Reference Include="System.Numerics.Vectors" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Xamarin.Forms" Version="4.3.0.908675" />
|
<PackageReference Include="Xamarin.Forms" Version="4.6.0.847" />
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
|
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using SafeMessageStorage.Pages;
|
||||||
|
using SafeMessageStorage.Services.AuthorizationService;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Xaml;
|
using Xamarin.Forms.Xaml;
|
||||||
namespace SafeMessageStorage
|
namespace SafeMessageStorage
|
||||||
@ -9,7 +11,7 @@ namespace SafeMessageStorage
|
|||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
MainPage = new AppShell();
|
MainPage = new NavigationPage(new AuthorizationPage(new AuthorizationServiceMOCK()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnStart()
|
protected override void OnStart()
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?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:d="http://xamarin.com/schemas/2014/forms/design"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
xmlns:pages="clr-namespace:SafeMessageStorage.Pages;assembly=SafeMessageStorage"
|
|
||||||
Title="SafeMessageStorage"
|
|
||||||
x:Class="SafeMessageStorage.AppShell">
|
|
||||||
<ShellItem>
|
|
||||||
<ShellContent Title="Authorize" ContentTemplate ="{DataTemplate pages:AuthorizationPage}"></ShellContent>
|
|
||||||
</ShellItem>
|
|
||||||
</Shell>
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace SafeMessageStorage
|
|
||||||
{
|
|
||||||
public partial class AppShell : Xamarin.Forms.Shell
|
|
||||||
{
|
|
||||||
public AppShell()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SafeMessageStorage.Models
|
||||||
|
{
|
||||||
|
public class Message
|
||||||
|
{
|
||||||
|
public Message(string title, string content, DateTimeOffset? timeOfCreation = null)
|
||||||
|
{
|
||||||
|
Title = title;
|
||||||
|
Content = content;
|
||||||
|
TimeOfCreation = timeOfCreation ?? DateTimeOffset.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Title { get; }
|
||||||
|
|
||||||
|
public string Content { get; }
|
||||||
|
|
||||||
|
public DateTimeOffset TimeOfCreation { get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -7,10 +7,14 @@
|
|||||||
x:Class="SafeMessageStorage.Pages.AuthorizationPage"
|
x:Class="SafeMessageStorage.Pages.AuthorizationPage"
|
||||||
Title="Authorize">
|
Title="Authorize">
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout>
|
<StackLayout VerticalOptions="CenterAndExpand" Padding="40">
|
||||||
<Label Text="Welcome to AuthorizationPage!"
|
<Label Text="Enter your security code"
|
||||||
VerticalOptions="CenterAndExpand"
|
FontSize="23"/>
|
||||||
HorizontalOptions="CenterAndExpand" />
|
<Entry IsPassword="True" Placeholder="Your hard code"/>
|
||||||
|
<Label x:Name="ErrorMessageLabel"
|
||||||
|
TextColor="#d22"
|
||||||
|
Margin="0,10" HorizontalOptions="Center"/>
|
||||||
|
<Button Text="Authorize" Command="{Binding AuthorizeCommand}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -3,7 +3,8 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using SafeMessageStorage.Services.AuthorizationService;
|
||||||
|
using SafeMessageStorage.ViewModels;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using Xamarin.Forms.Xaml;
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
@ -12,9 +13,40 @@ namespace SafeMessageStorage.Pages
|
|||||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
public partial class AuthorizationPage : ContentPage
|
public partial class AuthorizationPage : ContentPage
|
||||||
{
|
{
|
||||||
public AuthorizationPage()
|
private AuthorizationPageViewModel _viewModel => this.BindingContext as AuthorizationPageViewModel;
|
||||||
|
private IAuthorizationService _authorizationService;
|
||||||
|
public AuthorizationPage(IAuthorizationService authorizationService)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
BindingContext = new AuthorizationPageViewModel(authorizationService);
|
||||||
|
_authorizationService = authorizationService;
|
||||||
|
|
||||||
|
_viewModel.AuthorizationFailed += _viewModel_AuthorizationFailed;
|
||||||
|
_viewModel.AuthorizationSucceeded += _viewModel_AuthorizationSucceeded;
|
||||||
|
_viewModel.PasswordSetRequested += ViewModelOnPasswordSetRequested;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ViewModelOnPasswordSetRequested(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Navigation.PushModalAsync(new SetPasswordPage(_authorizationService));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
_viewModel.Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _viewModel_AuthorizationSucceeded(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void _viewModel_AuthorizationFailed(object sender, string e)
|
||||||
|
{
|
||||||
|
ErrorMessageLabel.Text = e;
|
||||||
|
await ErrorMessageLabel.FadeTo(1);
|
||||||
|
await Task.Delay(1000);
|
||||||
|
await ErrorMessageLabel.FadeTo(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?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:d="http://xamarin.com/schemas/2014/forms/design"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
x:Class="SafeMessageStorage.Pages.SetPasswordPage"
|
||||||
|
Title="Set password">
|
||||||
|
<ContentPage.Content>
|
||||||
|
<StackLayout VerticalOptions="CenterAndExpand" Padding="40">
|
||||||
|
<Label Text="Set password"/>
|
||||||
|
<Entry IsPassword="True" Text="{Binding Password}"/>
|
||||||
|
<Label Text="Repeat"/>
|
||||||
|
<Entry IsPassword="True" Text="{Binding RepeatPassword}"/>
|
||||||
|
<Label x:Name="ErrorMessageLabel"
|
||||||
|
TextColor="#d22"
|
||||||
|
Margin="0,10" HorizontalOptions="Center"/>
|
||||||
|
<Button Text="Set password" Command="{Binding SetPasswordCommand}"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</ContentPage>
|
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using SafeMessageStorage.Services.AuthorizationService;
|
||||||
|
using SafeMessageStorage.ViewModels;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Xaml;
|
||||||
|
|
||||||
|
namespace SafeMessageStorage.Pages
|
||||||
|
{
|
||||||
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||||
|
public partial class SetPasswordPage : ContentPage
|
||||||
|
{
|
||||||
|
private SetPasswordPageViewModel _viewModel => this.BindingContext as SetPasswordPageViewModel;
|
||||||
|
|
||||||
|
public SetPasswordPage(IAuthorizationService authorizationService)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
BindingContext = new SetPasswordPageViewModel(authorizationService);
|
||||||
|
|
||||||
|
_viewModel.PasswordSetFailed += _viewModel_PasswordSetFailed;
|
||||||
|
_viewModel.PasswordSetSucceeded += _viewModel_PasswordSetSucceeded;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _viewModel_PasswordSetSucceeded(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Navigation.PopModalAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void _viewModel_PasswordSetFailed(object sender, string e)
|
||||||
|
{
|
||||||
|
ErrorMessageLabel.Text = e;
|
||||||
|
await ErrorMessageLabel.FadeTo(1);
|
||||||
|
await Task.Delay(1000);
|
||||||
|
await ErrorMessageLabel.FadeTo(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,14 +6,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Xamarin.Forms" Version="4.3.0.908675" />
|
<PackageReference Include="Xamarin.Forms" Version="4.6.0.847" />
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
|
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Models\" />
|
|
||||||
<Folder Include="Services\" />
|
|
||||||
<Folder Include="ViewModels\" />
|
|
||||||
<Folder Include="Views\" />
|
<Folder Include="Views\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
@ -21,5 +18,8 @@
|
|||||||
<EmbeddedResource Update="Pages\AuthorizationPage.xaml">
|
<EmbeddedResource Update="Pages\AuthorizationPage.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Pages\SetPasswordPage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SafeMessageStorage.Services.AuthorizationService
|
||||||
|
{
|
||||||
|
public class AuthorizationServiceMOCK : IAuthorizationService
|
||||||
|
{
|
||||||
|
public bool IsAuthorized => false;
|
||||||
|
public bool IsPasswordSet => false;
|
||||||
|
public Task<bool> Authorize(string password)
|
||||||
|
{
|
||||||
|
return Task.FromResult(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> Deauthorize()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> ChangePassword(string currentPassword, string newPassword)
|
||||||
|
{
|
||||||
|
return Task.FromResult(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SafeMessageStorage.Services.AuthorizationService
|
||||||
|
{
|
||||||
|
public interface IAuthorizationService
|
||||||
|
{
|
||||||
|
bool IsAuthorized { get; }
|
||||||
|
|
||||||
|
bool IsPasswordSet { get; }
|
||||||
|
|
||||||
|
Task<bool> Authorize(string password);
|
||||||
|
|
||||||
|
Task<bool> Deauthorize();
|
||||||
|
|
||||||
|
Task<bool> ChangePassword(string currentPassword, string newPassword);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using SafeMessageStorage.Models;
|
||||||
|
|
||||||
|
namespace SafeMessageStorage.Services.MessageStorageService
|
||||||
|
{
|
||||||
|
public interface IMessageStorageService
|
||||||
|
{
|
||||||
|
Task<bool> IsStorageEmpty { get; }
|
||||||
|
|
||||||
|
Task<bool> SaveMessage(Message message);
|
||||||
|
|
||||||
|
Task<Message> ReadMessage();
|
||||||
|
|
||||||
|
Task<bool> DeleteMessage();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using SafeMessageStorage.Services.AuthorizationService;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace SafeMessageStorage.ViewModels
|
||||||
|
{
|
||||||
|
public class AuthorizationPageViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private readonly IAuthorizationService _authorizationService;
|
||||||
|
|
||||||
|
public AuthorizationPageViewModel(IAuthorizationService authorizationService)
|
||||||
|
{
|
||||||
|
_authorizationService = authorizationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<string> AuthorizationFailed;
|
||||||
|
public event EventHandler AuthorizationSucceeded;
|
||||||
|
public event EventHandler PasswordSetRequested;
|
||||||
|
|
||||||
|
private string _securityCode;
|
||||||
|
public string SecurityCode
|
||||||
|
{
|
||||||
|
get=>_securityCode;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_securityCode = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand AuthorizeCommand => new Command(async () => await Authorize(SecurityCode));
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
if(!_authorizationService.IsPasswordSet)
|
||||||
|
PasswordSetRequested?.Invoke(this,EventArgs.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Authorize(string code)
|
||||||
|
{
|
||||||
|
if (await _authorizationService.Authorize(code))
|
||||||
|
AuthorizationSucceeded?.Invoke(this, EventArgs.Empty);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AuthorizationFailed?.Invoke(this, "Invalid code");
|
||||||
|
SecurityCode = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using SafeMessageStorage.Services.AuthorizationService;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace SafeMessageStorage.ViewModels
|
||||||
|
{
|
||||||
|
public class SetPasswordPageViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private IAuthorizationService _authorizationService;
|
||||||
|
|
||||||
|
public SetPasswordPageViewModel(IAuthorizationService authorizationService)
|
||||||
|
{
|
||||||
|
_authorizationService = authorizationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _password;
|
||||||
|
public string Password
|
||||||
|
{
|
||||||
|
get { return _password; }
|
||||||
|
set { _password = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _repeatPassword;
|
||||||
|
public string RepeatPassword
|
||||||
|
{
|
||||||
|
get { return _repeatPassword; }
|
||||||
|
set { _repeatPassword = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler<string> PasswordSetFailed;
|
||||||
|
public event EventHandler PasswordSetSucceeded;
|
||||||
|
|
||||||
|
public ICommand SetPasswordCommand => new Command(()=>SetPassword(_password,_repeatPassword));
|
||||||
|
|
||||||
|
private async void SetPassword(string password, string repeatPassword)
|
||||||
|
{
|
||||||
|
if (!password.Equals(repeatPassword))
|
||||||
|
{
|
||||||
|
PasswordSetFailed?.Invoke(this,"Passwords are not equal");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(await _authorizationService.ChangePassword(null, password))
|
||||||
|
PasswordSetSucceeded?.Invoke(this,EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using SafeMessageStorage.Annotations;
|
||||||
|
|
||||||
|
namespace SafeMessageStorage.ViewModels
|
||||||
|
{
|
||||||
|
public abstract class ViewModelBase : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
[NotifyPropertyChangedInvocator]
|
||||||
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user