30 lines
910 B
C#
30 lines
910 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Linq;
|
|||
|
using System.Runtime.CompilerServices;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace sikFtpClient.ViewModel
|
|||
|
{
|
|||
|
public abstract class BaseViewModel : INotifyPropertyChanged
|
|||
|
{
|
|||
|
public event PropertyChangedEventHandler PropertyChanged;
|
|||
|
|
|||
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
|||
|
{
|
|||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|||
|
}
|
|||
|
protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = "")
|
|||
|
{
|
|||
|
if (EqualityComparer<T>.Default.Equals(storage, value))
|
|||
|
return false;
|
|||
|
storage = value;
|
|||
|
this.OnPropertyChanged(propertyName);
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|