2020-04-02 10:10:36 -07:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.ComponentModel;
|
2016-05-23 22:08:13 +01:00
|
|
|
|
using System.Runtime.CompilerServices;
|
2020-04-02 10:10:36 -07:00
|
|
|
|
using System.Windows;
|
2016-05-23 22:08:13 +01:00
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Wox.Plugin
|
|
|
|
|
|
{
|
|
|
|
|
|
public class BaseModel : INotifyPropertyChanged
|
|
|
|
|
|
{
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
|
|
|
|
|
|
[NotifyPropertyChangedInvocator]
|
|
|
|
|
|
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
|
|
|
|
|
{
|
2020-04-02 10:10:36 -07:00
|
|
|
|
if (Application.Current.Dispatcher.CheckAccess())
|
|
|
|
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
|
else
|
|
|
|
|
|
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
|
}));
|
2016-05-23 22:08:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|