using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using HMI.Core.Api;
using HMI.UI;
using log4net;
namespace HMI.Base
{
///
/// PluginMaskControl.xaml 的交互逻辑
///
public partial class PluginMaskControl : UserControl, IPlugin, INotifyPropertyChanged
{
#region ...
public event PropertyChangedEventHandler PropertyChanged;
protected void Set([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
protected void Set(ref T old, T @new, [CallerMemberName] string propertyName = null)
{
old = @new;
if (propertyName != null)
{
Set(propertyName);
}
}
#endregion
static PluginMaskControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PluginMaskControl),
new FrameworkPropertyMetadata(typeof(PluginMaskControl)));
}
protected ILog log;
protected string BaseFolder;
public virtual void Active()
{
}
public virtual void DeActive()
{
}
public virtual void Init()
{
}
public virtual void OnTabChange(object sender, object args)
{
}
public virtual void SetBaseFolder(string folder)
{
BaseFolder = folder;
}
public virtual void SetLogger(ILog logger)
{
log = logger;
}
public virtual void InitFinish()
{
}
public virtual void OnClose(object sender, CancelEventArgs e)
{
}
public virtual void DoClose(object sender, EventArgs e)
{
}
public void ShowMask(Action action, Action reject = null, string title = null, string content = null)
{
MaskControl mask = this.Template.FindName("mask", this) as MaskControl;
if (mask != null)
{
mask.ShowMask(this, action, reject, title, content);
}
}
public virtual bool CanActive()
{
return true;
}
public virtual bool CanDeActive()
{
return true;
}
}
}