| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using GalaSoft.MvvmLight.Messaging;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Infrastructure.Interfaces;
- using Muchinfo.MTPClient.Infrastructure.MessengerArgs;
- using System.Windows.Controls;
- using Muchinfo.MTPClient.Infrastructure.Helpers;
- namespace Muchinfo.MTPClient.Infrastructure.Windows
- {
- /// <summary>
- /// ContentWindow类
- /// </summary>
- public abstract class ContentWindow : UserControl, IWindow
- {
- #region Properties
- #region Public Properties
- /// <summary>
- /// 窗口所属工具栏类型
- /// </summary>
- public virtual ToolbarButtonType ToolbarType
- {
- get
- {
- return ToolbarButtonType.Default;
- }
- }
- public WindowItem WindowItem
- {
- get;
- set;
- }
- #endregion Public Properties
- #endregion Properties
- /// <summary>
- /// Initializes a new instance of the <see cref="ContentWindow"/> class.
- /// </summary>
- /// <param name="item">The item.</param>
- protected ContentWindow(WindowItem item)
- {
- WindowItem = item;
- this.Unloaded += ContentWindow_Unloaded;
- }
- #region Methods
- #region Public Methods
- /// <summary>
- /// 显示窗口
- /// </summary>
- public virtual void ShowWindow()
- {
- MessengerHelper.DefaultSend(new AddContentPageArgs(WindowItem, this), MessengerTokens.AddContentPage);
- }
- /// <summary>
- /// 刷新窗体
- /// </summary>
- public abstract void Refresh();
- /// <summary>
- /// 刷新窗体
- /// </summary>
- /// <param name="item"></param>
- public virtual void Refresh(WindowItem item) { }
- #endregion Public Methods
- /// <summary>
- /// 窗口Unload事件
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
- protected virtual void ContentWindow_Unloaded(object sender, System.Windows.RoutedEventArgs e)
- {
- //取消本窗口注册的消息
- MessengerHelper.DefaultUnregister(this);
- }
- #endregion Methods
- }
- }
|