| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Data.Model;
- using Muchinfo.MTPClient.Infrastructure.Enums;
-
- using System;
- namespace Muchinfo.MTPClient.Infrastructure.Interfaces
- {
- /// <summary>
- /// IWindow接口
- /// </summary>
- public interface IWindow
- {
- #region Properties
- /// <summary>
- /// Gets the type of the toolbar.
- /// </summary>
- ToolbarButtonType ToolbarType
- {
- get;
- }
- WindowItem WindowItem
- {
- get;
- }
- #endregion Properties
- #region Methods
- /// <summary>
- /// Shows the window.
- /// </summary>
- void ShowWindow();
- #endregion Methods
- }
- /// <summary>
- /// WindowItem类
- /// </summary>
- public abstract class WindowItem
- {
- #region Fields
- protected DateTime _createDateTime;
- #endregion Fields
- #region Constructors
- /// <summary>
- /// Initializes a new instance of the <see cref="WindowItem" /> class.
- /// </summary>
- /// <param name="windowType">窗体类型</param>
- /// <param name="title">窗体标题</param>
- /// <param name="key">窗体关键字</param>
- /// <param name="additionalInfo">其它附加信息</param>
- 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
- /// <summary>
- /// 获取和设置the additional info
- /// </summary>
- public string AdditionalInfo
- {
- get;
- set;
- }
- /// <summary>
- /// 获取和设置the content id - 供窗口反序列化用
- /// </summary>
- public virtual string ContentId
- {
- get
- {
- return WindowType.ToString() + "_" + Title + "_" + AdditionalInfo;
- }
- }
- /// <summary>
- /// 获取和设置窗体标题
- /// </summary>
- public string Title
- {
- get;
- set;
- }
- /// <summary>
- /// 获取和设置窗体关键字
- /// </summary>
- public virtual string WindowKey
- {
- get
- {
- return WindowType.ToString() + "_" + _createDateTime.Ticks;
- }
- }
- /// <summary>
- /// Gets or sets the type of the window.
- /// </summary>
- public WindowType WindowType
- {
- get;
- set;
- }
- #endregion Public Properties
- #endregion Properties
- }
- /// <summary>
- /// QuoteWindowItem类
- /// </summary>
- public class WindowItemWithCommandType : WindowItem
- {
- #region Constructors
- /// <summary>
- /// Initializes a new instance of the <see cref="WindowItemWithCommandType"/> class.
- /// </summary>
- /// <param name="windowType">Type of the window.</param>
- /// <param name="title">The title.</param>
- /// <param name="menuCommandType">Type of the menu command.</param>
- /// <param name="additionalInfo">The additional info.</param>
- 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
- /// <summary>
- /// 确定窗口类型
- /// </summary>
- public MenuCommandType MenuCommandType
- {
- get;
- set;
- }
- /// <summary>
- /// 获取和设置the content id - 供窗口反序列化用
- /// </summary>
- 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; }
- }
- /// <summary>
- /// AccountWindowItem类
- /// </summary>
- public class AccountWindowItem : WindowItem
- {
- public AccountWindowItem(string title)
- : base(WindowType.AccountManagerView, title, string.Empty)
- {
- }
- /// <summary>
- /// 获取和设置窗体关键字
- /// </summary>
- 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
- /// <summary>
- /// 新闻分类代码
- /// </summary>
- public string CategoryCode
- {
- get;
- set;
- }
- /// <summary>
- /// 新闻Id
- /// </summary>
- public string NewsId { get; set; }
- /// <summary>
- /// 获取和设置the content id - 供窗口反序列化用
- /// </summary>
- public override string ContentId
- {
- get
- {
- return WindowType.ToString() + "_" + Title + "_" + CategoryCode;
- }
- }
- #endregion Public Properties
- #endregion Properties
- }
- }
|