refactor: 将Framework库和RT、UI放在同一个解决方案中。
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Aitex.Core.UI.MVVM;
|
||||
using Aitex.Core.Util;
|
||||
using Aitex.Core.Utilities;
|
||||
|
||||
namespace SicUI.Controls.Common
|
||||
{
|
||||
public class ViewModelControl : UserControl, INotifyPropertyChanged, IViewModelControl
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void SubscribeKeys(SubscriptionViewModelBase baseModel)
|
||||
{
|
||||
baseModel.SubscribeKeys(this);
|
||||
}
|
||||
|
||||
public void InvokePropertyChanged()
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
var ps = this.GetType().GetProperties();
|
||||
foreach (var p in ps)
|
||||
{
|
||||
if (!p.GetCustomAttributes(false).Any(attribute => attribute is IgnorePropertyChangeAttribute))
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(p.Name));
|
||||
|
||||
if (p.PropertyType == typeof(ICommand))
|
||||
{
|
||||
if (p.GetValue(this, null) is IDelegateCommand cmd)
|
||||
cmd.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user