using Muchinfo.MTPClient.Data.Enums; using Muchinfo.MTPClient.Data.Model; using Muchinfo.MTPClient.Infrastructure.Enums; using System; namespace Muchinfo.MTPClient.Infrastructure.Interfaces { /// /// IWindow接口 /// public interface IWindow { #region Properties /// /// Gets the type of the toolbar. /// ToolbarButtonType ToolbarType { get; } WindowItem WindowItem { get; } #endregion Properties #region Methods /// /// Shows the window. /// void ShowWindow(); #endregion Methods } /// /// WindowItem类 /// public abstract class WindowItem { #region Fields protected DateTime _createDateTime; #endregion Fields #region Constructors /// /// Initializes a new instance of the class. /// /// 窗体类型 /// 窗体标题 /// 窗体关键字 /// 其它附加信息 protected WindowItem(WindowType windowType, string title, string additionalInfo) { this.WindowType = windowType; this.Title = title; this.AdditionalInfo = additionalInfo; _createDateTime = DateTime.Now; } #endregion Constructors #region Properties #region Public Properties /// /// 获取和设置the additional info /// public string AdditionalInfo { get; set; } /// /// 获取和设置the content id - 供窗口反序列化用 /// public virtual string ContentId { get { return WindowType.ToString() + "_" + Title + "_" + AdditionalInfo; } } /// /// 获取和设置窗体标题 /// public string Title { get; set; } /// /// 获取和设置窗体关键字 /// public virtual string WindowKey { get { return WindowType.ToString() + "_" + _createDateTime.Ticks; } } /// /// Gets or sets the type of the window. /// public WindowType WindowType { get; set; } #endregion Public Properties #endregion Properties } /// /// QuoteWindowItem类 /// public class WindowItemWithCommandType : WindowItem { #region Constructors /// /// Initializes a new instance of the class. /// /// Type of the window. /// The title. /// Type of the menu command. /// The additional info. public WindowItemWithCommandType(WindowType windowType, string title, MenuCommandType menuCommandType, string additionalInfo) //: base(windowType, title, menuCommandType.ToString() + (string.IsNullOrWhiteSpace(additionalInfo) ? string.Empty : ":" + additionalInfo)) : base(windowType, title, additionalInfo) { this.MenuCommandType = menuCommandType; } #endregion Constructors #region Properties #region Public Properties /// /// 确定窗口类型 /// public MenuCommandType MenuCommandType { get; set; } /// /// 获取和设置the content id - 供窗口反序列化用 /// public override string ContentId { get { return WindowType.ToString() + "_" + Title + "_" + MenuCommandType.ToString() + (string.IsNullOrWhiteSpace(AdditionalInfo) ? string.Empty : ":" + AdditionalInfo); } } #endregion Public Properties #endregion Properties } public class ChartWindowItem : WindowItem { //additionalinfo为布局加载时用 public ChartWindowItem(string title, QuoteGoods goods, CycleType cycleType) : base(WindowType.QuoteChartView, title, goods.Symbol + ":" + cycleType.ToString()) { Goods = goods; CycleType = cycleType; } public QuoteGoods Goods { get; set; } public CycleType CycleType { get; set; } } /// /// AccountWindowItem类 /// public class AccountWindowItem : WindowItem { public AccountWindowItem(string title) : base(WindowType.AccountManagerView, title, string.Empty) { } /// /// 获取和设置窗体关键字 /// public override string WindowKey { get { return WindowType.ToString(); } } } public class NewsWindowItem : WindowItem { #region Constructors public NewsWindowItem(string title, string categoryCode, string newsId) : base(WindowType.NewsView, title, string.Empty) { this.CategoryCode = categoryCode; this.NewsId = newsId; } #endregion Constructors #region Properties #region Public Properties /// /// 新闻分类代码 /// public string CategoryCode { get; set; } /// /// 新闻Id /// public string NewsId { get; set; } /// /// 获取和设置the content id - 供窗口反序列化用 /// public override string ContentId { get { return WindowType.ToString() + "_" + Title + "_" + CategoryCode; } } #endregion Public Properties #endregion Properties } }