using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Configuration; using System.Reflection; using System.IO; using ICSharpCode.Core; using Mesnac.Core; using Mesnac.Core.Service; using Mesnac.PlugIn.Pad; using Mesnac.PlugIn.View; using Mesnac.PlugIn.Workbench; using Mesnac.Gui.PlugIn; namespace Mesnac.Gui.Workbench { /// /// 默认工作台类 /// public partial class DefaultWorkbench : Form , IWorkbench { #region 变量声明 private readonly string _mesnacPlugInPath = Path.Combine(Application.StartupPath, ConfigurationManager.AppSettings["MesnacPlugInPath"]); //自定义插件目录 private readonly static string _mainMenuPath = "/Mesnac/Workbench/MainMenu"; private readonly static string _toolStripPath = "/Mesnac/Workbench/Toolbar"; private readonly static string _padContentPath = "/Mesnac/Workbench/Pads"; private const string _BoundProperty = "FormBounds"; private const string _WindowIsMaximized = "WindowIsMaximized"; private const string _WindowIsFullScreen = "WindowIsFullScreen"; private Rectangle _NormalBounds; //窗体位置 private FormWindowState _WindowState = FormWindowState.Normal; private bool _fullScreen = false; private bool _closeFlag = false; private MenuStrip _topMenu = null; //顶层菜单 private ToolStrip _toolStrip = null; //工具栏 private IWorkbenchLayout _layout = null; //工作台布局管理器 private ToolStripItem[] _viewItem; //面板菜单项集合 private List _padContentCollection = new List(); //面板集合 private List _viewContentCollection = new List(); //视图窗口集合 private Dictionary _viewContentDic = new Dictionary(); //视图窗口集合 private List _plugInCollection = new List(); //自定义插件集合 private object _currentViewContent; //当前视图对象 #endregion #region 默认构造方法 public DefaultWorkbench() { InitializeComponent(); string app_title = StringParser.Parse(ResourceService.GetString("Mesnac_App_Title")); this.Text = app_title; this.Icon = null; this.StartPosition = FormStartPosition.CenterScreen; this._NormalBounds = PropertyService.Get(_BoundProperty, new Rectangle(60, 80, 640, 480)); this.Bounds = this._NormalBounds; bool bMax = PropertyService.Get(_WindowIsMaximized, false); if (bMax) { this._WindowState = FormWindowState.Maximized; this.WindowState = FormWindowState.Maximized; } this._fullScreen = PropertyService.Get(_WindowIsFullScreen, false); if (this._fullScreen) { this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; } this.AllowDrop = true; PadDescriptor.BringPadToFrontEvent += delegate(PadDescriptor padDesc) { foreach (PadDescriptor pd in PadContentCollection) { if (pd.Equals(padDesc)) { this._layout.ShowPad(padDesc, true); return; } } this.ShowPad(padDesc); }; } #endregion #region 初始化工作空间 /// /// 初始化工作空间 /// public void InitializeWorkspace() { MesnacServiceManager.Instance.LoggingService.Info("初始化工作区..."); //this.UpdateRenderer(); try { //从插件文件中获取面板集合 List pads = AddInTree.GetTreeNode(_padContentPath).BuildChildItems(this, null); this._padContentCollection.AddRange(pads); //还原布局配置文件中的面板布局 this._layout.LoadConfiguration(); //面板呈现 List padItems = new List(); foreach (PadDescriptor content in pads) { if (content != null) { if (content.IsVisible) { this.ShowPad(content); } padItems.Add(new MyMenuItem(content)); } } if (padItems.Count > 0) { this._viewItem = padItems.ToArray() as ToolStripItem[]; } } catch (Exception ex) { MesnacServiceManager.Instance.LoggingService.Error(ex.Message); } //添加工具栏 LoggingService.Info("创建主工具栏"); this.CreateMainToolStrip(); //创建主菜单 LoggingService.Info("创建主菜单"); this.CreateMainMenu(); //刷新插件 this.RefreshPlugIn(); //初始化工作完毕时触发完成事件 if (this.InitFinished != null) { this.InitFinished(this, EventArgs.Empty); } #region 工具栏状态处理 Application.Idle += delegate(object sender, EventArgs e) { Mesnac.Core.ToolbarService.UpdateToolbar(this._toolStrip); }; #endregion } #endregion #region 辅助方法 /// /// 创建主工具栏 /// public void CreateMainToolStrip() { if (this._toolStrip != null) { this._toolStrip.Items.Clear(); } this._toolStrip = Mesnac.Core.ToolbarService.CreateToolStrip(this, this._toolStrip, DefaultWorkbench._toolStripPath); if (this._toolStrip != null) { this._toolStrip.Parent = this; } } /// /// 创建主菜单 /// public void CreateMainMenu() { if (this._topMenu == null) { this._topMenu = new MenuStrip(); } this._topMenu.Items.Clear(); try { //解析菜单 Mesnac.Core.MenuService.AddItemsToMenu(this._topMenu.Items, this, DefaultWorkbench._mainMenuPath); //加载主菜单 if (this._viewItem != null) { string mnuWinText = StringParser.Parse(ResourceService.GetString("Mesnac_MainMenu_Window")); ToolStripMenuItem mnuPads = new Mesnac.Core.CustomerMenu("Mesnac_MainMenu_Window", mnuWinText); mnuPads.DropDownItems.AddRange(this._viewItem); this._topMenu.Items.Add(mnuPads); } this._topMenu.Parent = this; this.UpdateMenus(); } catch (TreePathNotFoundException ex) { MesnacServiceManager.Instance.LoggingService.Error(ex.Message); } } /// /// 更新菜单 /// private void UpdateMenus() { foreach (object o in this._topMenu.Items) { if (o is IStatusUpdate) { ((IStatusUpdate)o).UpdateStatus(); } } } /// /// 更新呈现 /// public void UpdateRenderer() { //bool pro = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.UseProfessionalRenderer", true); //if (pro) //{ // ToolStripManager.Renderer = new ToolStripProfessionalRenderer(); //} //else //{ // ProfessionalColorTable colorTable = new ProfessionalColorTable(); // colorTable.UseSystemColors = true; // ToolStripManager.Renderer = new ToolStripProfessionalRenderer(colorTable); //} //更新标题呈现 string app_title = StringParser.Parse(ResourceService.GetString("Mesnac_App_Title")); this.Text = app_title; //更新面板呈现 foreach (PadDescriptor pad in this._padContentCollection) { if (this._layout.ContentHash.ContainsKey(pad.Class)) { this._layout.ContentHash[pad.Class].Text = ICSharpCode.Core.StringParser.Parse(pad.Title); ; } } //更新工具栏呈现 if (this._toolStrip != null) { ToolbarService.UpdateToolbarText(this._toolStrip); } //更新菜单呈现 foreach (object o in this._topMenu.Items) { if (o is IStatusUpdate) { ((IStatusUpdate)o).UpdateText(); } //更新面板菜单项 ToolStripMenuItem mnu = o as ToolStripMenuItem; if (null != mnu) { if (mnu.Name == "Mesnac_MainMenu_Window") { string mnuWinText = StringParser.Parse(ResourceService.GetString("Mesnac_MainMenu_Window")); mnu.Text = mnuWinText; foreach (ToolStripMenuItem item in mnu.DropDownItems) { MyMenuItem mnuItem = item as MyMenuItem; if (null != mnuItem) { mnuItem.UpdateText(); } } } } } //触发刷新控制台界面事件 if (this.RefreshUI != null) { this.RefreshUI(this, System.EventArgs.Empty); } } #endregion #region 重写窗体类的方法 protected override void WndProc(ref Message m) { if (m.Msg == 0x0010)//WM_CLOSE { LoggingService.Debug(m.Msg); if (this.CloseFlag) { string caption = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_Caption")); string msg = StringParser.Parse(ResourceService.GetString("Dialog_MessageBox_ExtAsk")); DialogResult result = MessageBox.Show(msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { this.CloseFlag = false; this.Close(); } else { return; } //this.CloseFlag = true; //this.Close(); } } base.WndProc(ref m); } /// /// 系统关闭事件处理 /// /// protected override void OnClosing(CancelEventArgs e) { //触发系统关闭事件 if (this.ShutDown != null) { this.ShutDown(this, EventArgs.Empty); MesnacServiceManager.Instance.LoggingService.Info("触发Workbench关闭事件..."); } //重新设置窗体关闭,覆盖其他窗体的Cancel设置 MesnacServiceManager.Instance.LoggingService.Info("正在关闭...1"); //文档处理 this.CloseAllViews(); //布局处理 this._layout.Detach(); MesnacServiceManager.Instance.LoggingService.Info("正在关闭...2"); //面板处理 foreach (PadDescriptor padDescriptor in this._padContentCollection) { padDescriptor.Dispose(); } //全屏处理 if (this._fullScreen) { PropertyService.Set(_WindowIsFullScreen, true); if (this._WindowState == FormWindowState.Maximized) { PropertyService.Set(_WindowIsMaximized, true); } else { PropertyService.Set(_WindowIsMaximized, false); } } else { PropertyService.Set(_WindowIsFullScreen, false); if (this._WindowState == FormWindowState.Maximized) { PropertyService.Set(_WindowIsMaximized, true); } else { PropertyService.Set(_WindowIsMaximized, false); } } Application.ExitThread(); base.OnClosing(e); } #endregion #region 实现IWorkbench接口成员 #region 实现IWorkbench接口属性 /// /// 工作区主菜单 /// public MenuStrip TopMenu { get { return this._topMenu; } } /// /// 工作区工具栏 /// public ToolStrip ToolStrip { get { return this._toolStrip; } } /// /// 工作台布局 /// public IWorkbenchLayout WorkbenchLayout { get { return this._layout; } set { if (this._layout != null) { this._layout.Detach(); } this._layout = value; //this._layout.Owner = this; //设置布局所有者 //value.Attach(); } } /// /// 是否全屏 /// public bool FullScreen { get { return this._fullScreen; } set { if (this._fullScreen == value) return; this._fullScreen = value; if (this._fullScreen) { this._WindowState = this.WindowState; this._NormalBounds = this.Bounds; this.Visible = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; this.Visible = true; } else { this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable; this.Bounds = this._NormalBounds; this.WindowState = this._WindowState; } this._layout.SetFullScreenPads(!value); } } /// /// 关闭系统标识 /// public bool CloseFlag { get { return this._closeFlag; } set { this._closeFlag = value; } } /// /// 标题文本 /// public string Title { get { return this.Text; } set { this.Text = value; } } /// /// 面板集合 /// public List PadContentCollection { get { System.Diagnostics.Debug.Assert(this._padContentCollection != null); return this._padContentCollection; } } /// /// 视图窗口集合 /// public List ViewContentCollection { get { System.Diagnostics.Debug.Assert(this._viewContentCollection != null); return this._viewContentCollection; } } /// /// 视图窗口集合 /// public Dictionary ViewContentDic { get { System.Diagnostics.Debug.Assert(this._viewContentDic != null); return this._viewContentDic; } } /// /// 插件集合 /// public List PlugInCollection { get { System.Diagnostics.Debug.Assert(this._plugInCollection != null); return this._plugInCollection; } } /// /// 活动内容 /// public object ActiveContent { get { if (this._layout == null) { return null; } return this._layout.ActiveConent; } } /// /// 当前视图对象 /// public object CurrentViewContent { get { return this._currentViewContent; } set { this._currentViewContent = value; } } #endregion #region 实现IWorkbench接口方法 #region 显示面板 ShowPad(PadDescriptor content) /// /// 显示面板 /// /// 面板描述器对象 public virtual void ShowPad(PadDescriptor content) { this._padContentCollection.Add(content); if (this._layout != null) { this._layout.ShowPad(content); } } #endregion #region 获取面板描述器 PadDescriptor GetPad(Type type) /// /// 获取面板描述器 /// /// 面板类型 /// 返回对应类型的面板描述器对象 public virtual PadDescriptor GetPad(Type type) { foreach (PadDescriptor pad in this._padContentCollection) { if (pad.Class == type.FullName) { return pad; } } return null; } #endregion #region 显示视图内容 ShowView(IViewContent content) /// /// 显示视图内容 /// /// 要显示的视图对象 public virtual void ShowView(IViewContent content) { //System.Diagnostics.Debug.Assert(this._layout != null); //同类型的窗口只显示一个 bool flag = false; foreach (IViewContent c in this._viewContentCollection) { if (content.GetType().FullName == c.GetType().FullName) { content = c; flag = true; break; } } if (!flag) { this._viewContentCollection.Add(content); } this._layout.ShowView(content); if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).SelectWindow(); } this._currentViewContent = content; } #endregion #region 显示一个视图窗口 ShowView(IViewContent content, bool isAllowRepeat) /// /// 显示一个视图窗口 /// /// 视图内容 /// 是否允许重复保存 public virtual void ShowView(IViewContent content, bool isAllowRepeat) { if (isAllowRepeat) { //System.Diagnostics.Debug.Assert(this._layout != null); //同类型的窗口可以有多个 this._viewContentCollection.Add(content); this._layout.ShowView(content); if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).SelectWindow(); } } else { this.ShowView(content); } this._currentViewContent = content; } #endregion #region 显示一个视图窗口 ShowView(string key, IViewContent content) /// /// 显示一个视图窗口 /// /// 视图窗口标识 /// 视图内容 public virtual void ShowView(string key, IViewContent content) { if (!this._viewContentDic.ContainsKey(key)) { this._viewContentDic.Add(key, content); this._layout.ShowView(content); if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).SelectWindow(); } this._currentViewContent = content; } else { content = this._viewContentDic[key]; this._layout.ShowView(content); if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).TriggerReloadEvent(null); //触发重新加载事件 (content.MyOwner as IWorkbenchWindow).SelectWindow(); } this._currentViewContent = content; } } #endregion #region 显示一个视图窗口 ShowView(string key, IViewContent content, Mesnac.Docking.DockState dockState) /// /// 显示一个视图窗口 /// /// 视图窗口标识 /// 视图内容 /// 视图显示的停靠方式 public virtual void ShowView(string key, IViewContent content, Mesnac.Docking.DockState dockState) { if (!this._viewContentDic.ContainsKey(key)) { this._viewContentDic.Add(key, content); this._layout.ShowView(content, dockState); if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).SelectWindow(); } this._currentViewContent = content; } else { content = this._viewContentDic[key]; this._layout.ShowView(content, dockState); if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).TriggerReloadEvent(null); //触发重新加载事件 (content.MyOwner as IWorkbenchWindow).SelectWindow(); } this._currentViewContent = content; } } #endregion #region 获取视图窗口 GetViewByKey(string key) /// /// 获取视图窗口 /// /// 视图窗口标识 /// 返回对应视图标识的工作台窗口 public virtual IWorkbenchWindow GetViewByKey(string key) { if (this._viewContentDic.ContainsKey(key)) { return this._viewContentDic[key].MyOwner as IWorkbenchWindow; } else { return null; } } #endregion #region 获取视图窗口 GetViewByViewContentID(string viewContentID) /// /// 根据视图ID获取对应的工作台窗口 /// /// 视图ID /// 返回对应的工作台窗口 public virtual IWorkbenchWindow GetViewByViewContentID(string viewContentID) { foreach (IViewContent vc in this._viewContentCollection) { if (vc.ViewContentID == viewContentID) { return vc.MyOwner as IWorkbenchWindow; } } return null; } #endregion #region 根据视图类型,获取对应类型的所有视图窗口 GetViewByType(Type type) /// /// 根据视图类型,获取对应类型的所有视图窗口 /// /// 视图类型 /// 返回对应类型的工作台窗口 public virtual IWorkbenchWindow GetViewByType(Type type) { foreach (IViewContent vc in this._viewContentCollection) { if (vc.GetType() == type) { return vc.MyOwner as IWorkbenchWindow; } } return null; } #endregion #region 根据视图类型,获取对应类型的所有视图窗口 GetViewsByType(Type type) /// /// 根据视图类型,获取对应类型的所有视图窗口 /// /// 要获取的视图类型 /// 返回对应类型的视图(工作台窗口)的集合 public virtual List GetViewsByType(Type type) { List lst = new List(); foreach (IViewContent vc in this._viewContentCollection) { if (vc.GetType() == type) { lst.Add(vc.MyOwner as IWorkbenchWindow); } } return lst; } #endregion #region 获取自定义视图窗口集合 GetCustomerViews() /// /// 获取自定义视图窗口集合 /// /// 返回自定义视图窗口集合 public virtual List GetCustomerViews() { List lst = new List(); foreach (IViewContent vc in this._viewContentDic.Values) { lst.Add(vc.MyOwner as IWorkbenchWindow); } return lst; } #endregion #region 关闭某个视图窗口 CloseView(IViewContent content) /// /// 关闭某个视图窗口 /// /// 要关闭的视图对象 public virtual void CloseView(IViewContent content) { if (this._viewContentCollection.Contains(content)) { if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).CloseWindow(true); } this._viewContentCollection.Remove(content); } content.Dispose(); content = null; } #endregion #region 关闭一个视图窗口 CloseView(IViewContent content, bool isRealClose) /// /// 关闭一个视图窗口 /// /// 要关闭的视图对象 /// 是否真正关闭 public virtual void CloseView(IViewContent content, bool isRealClose) { if (isRealClose) { this.CloseView(content); } else { if (this._viewContentCollection.Contains(content)) { if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).CloseWindow(false); } } } } #endregion #region 关闭所有视图窗口 CloseAllViews() /// /// 关闭所有视图窗口 /// public virtual void CloseAllViews() { List fullList = new List(this._viewContentCollection); foreach (IViewContent content in fullList) { if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).CloseWindow(true); } } this._viewContentCollection.Clear(); string[] keys = new string[this._viewContentDic.Keys.Count]; this._viewContentDic.Keys.CopyTo(keys, 0); foreach (string key in keys) { IViewContent content = this._viewContentDic[key]; content.IsRealClose = true; if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).CloseWindow(true); } if (this._viewContentDic.ContainsKey(key)) { this._viewContentDic.Remove(key); } content.Dispose(); content = null; } } #endregion #region 关闭所有视图窗口 CloseAllViews(bool isRealClose) /// /// 关闭所有视图窗口 /// /// 是否真正关闭 public virtual void CloseAllViews(bool isRealClose) { if (isRealClose) { this.CloseAllViews(); } else { List fullList = new List(this._viewContentCollection); foreach (IViewContent content in fullList) { if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).CloseWindow(false); } } string[] keys = new string[this._viewContentDic.Keys.Count]; this._viewContentDic.Keys.CopyTo(keys, 0); foreach (string key in keys) { IViewContent content = this._viewContentDic[key]; content.IsRealClose = false; if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).CloseWindow(false); } } } } #endregion #region 根据键值关闭一个视图窗口 CloseViewByKey(string key) /// /// 根据键值关闭一个视图窗口 /// /// 要关闭的视图键值 public virtual void CloseViewByKey(string key) { if (this._viewContentDic.ContainsKey(key)) { IViewContent content = this._viewContentDic[key]; content.IsRealClose = true; if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).CloseWindow(true); } content.Dispose(); content = null; } } #endregion #region 根据键值关闭一个视图窗口 CloseViewByKey(string key, bool isRealClose) /// /// 根据键值关闭一个视图窗口 /// /// 要关闭的视图键值 /// 是否真正关闭 public virtual void CloseViewByKey(string key, bool isRealClose) { if (isRealClose) { this.CloseViewByKey(key); } else { if (this._viewContentDic.ContainsKey(key)) { IViewContent content = this._viewContentDic[key]; content.IsRealClose = false; if (content.MyOwner is IWorkbenchWindow) { (content.MyOwner as IWorkbenchWindow).CloseWindow(false); } } } } #endregion #region 关闭所有的键视图窗口 CloseAllKeysView() /// /// 关闭所有的键视图窗口 /// public virtual void CloseAllKeysView() { string[] keys = new string[this._viewContentDic.Keys.Count]; this._viewContentDic.Keys.CopyTo(keys, 0); foreach (string key in keys) { this.CloseViewByKey(key); } } #endregion #region 关闭所有的键视图窗口 CloseAllKeysView(bool isRealClose) /// /// 关闭所有的键视图窗口 /// /// 是否真正关闭 public virtual void CloseAllKeysView(bool isRealClose) { if (isRealClose) { this.CloseAllKeysView(); } else { string[] keys = new string[this._viewContentDic.Keys.Count]; this._viewContentDic.Keys.CopyTo(keys, 0); foreach (string key in keys) { this.CloseViewByKey(key, false); } } } #endregion #region 刷新自定义插件 RefreshPlugIn() /// /// 刷新插件 /// public virtual void RefreshPlugIn() { LoggingService.Info("刷新插件..."); this.CloseAllViews(); if (!Directory.Exists(this._mesnacPlugInPath)) { Directory.CreateDirectory(this._mesnacPlugInPath); } if (this._plugInCollection != null && this._plugInCollection.Count > 0) { foreach (PlugInDescriptor p in this._plugInCollection) { if (p.ViewContents != null && p.ViewContents.Count > 0) { foreach (IViewContent viewContent in p.ViewContents) { viewContent.Dispose(); } } } this._plugInCollection.Clear(); } this._plugInCollection = PlugInService.ScanPlugIn(this._mesnacPlugInPath); if (AfterRefreshPlugIn != null) { AfterRefreshPlugIn(this._plugInCollection, EventArgs.Empty); //触发事件 } } #endregion #region 重绘所有组件 RedrawAllComponents() /// /// 重绘所有组件 /// public virtual void RedrawAllComponents() { //顶层菜单处理 foreach (ToolStripItem item in this._topMenu.Items) { if (item is IStatusUpdate) ((IStatusUpdate)item).UpdateText(); } //面板处理 foreach (PadDescriptor content in this._padContentCollection) { content.RedrawConent(); } //视图窗口处理 foreach (IViewContent content in this._viewContentCollection) { content.RedrawContent(); } if (this._layout != null) { this._layout.RedrawAllComponents(); } } #endregion #region 退出系统方法 /// /// 退出系统方法 /// public void Exit() { this.Close(); } #endregion #endregion #region 实现IWorkbench接口事件 /// /// 刷新插件事件 /// public event EventHandler AfterRefreshPlugIn; /// /// 初始化完毕事件 /// public event EventHandler InitFinished; /// /// 刷新工作台界面事件 /// public event EventHandler RefreshUI; /// /// 系统即将关闭事件 /// public event EventHandler ShutDown; #endregion #endregion #region 内部自定义菜单项类 /// /// 内部自定义菜单项类,对应系统面板 /// class MyMenuItem : ToolStripMenuItem , IStatusUpdate { private PadDescriptor _padDescriptor; public MyMenuItem(PadDescriptor padDescriptor) : base() { this._padDescriptor = padDescriptor; this.Name = padDescriptor.ID; this.Text = StringParser.Parse(this._padDescriptor.Title); if (this._padDescriptor.Icon != null) { base.Image = MesnacServiceManager.Instance.IconService.GetBitmap(padDescriptor.Icon); } if (this._padDescriptor.Shortcut != null) { this.ShortcutKeys = Mesnac.Core.MenuCommand.ParseShortcut(padDescriptor.Shortcut); } } protected override void OnClick(EventArgs e) { base.OnClick(e); this._padDescriptor.BringPadToFront(); } public string ID { get { return this.Name; } } public void UpdateStatus() { } public void UpdateText() { this.Text = StringParser.Parse(this._padDescriptor.Title); } } #endregion } }