修改快捷键和提示文件
提取菜单栏按钮
public static List<ButtonToolImpl> GetButtonImpls(this MenuToolImpl mtl)
{
List<ButtonToolImpl> rtns = new List<ButtonToolImpl>();
foreach (ITool item in mtl.Tools)
{
if (item is MenuToolImpl)
{
var btns = (item as MenuToolImpl).GetButtonImpls();
if (btns.Count > 0) rtns.AddRange(btns);
}
else if (item is ButtonToolImpl)
{
rtns.Add(item as ButtonToolImpl);
}
}
return rtns;
}
查看代码
var cbm = CommandBarManager.Instance;
var mainMenus = cbm.MenuBar;
var btns = new List<ButtonToolImpl>();
foreach (ITool item in mainMenus.Tools)
{
if (item is MenuToolImpl)
btns.AddRange((item as MenuToolImpl).GetButtonImpls());
}
if (btns.Count > 0)
{
//btns.SaveDataToCSVFile(@"c:\123.csv");
var saveClaim = btns.FirstOrDefault(b => b.Key == "AVEVA.Marine.UI.Button.GeneralFileSaveAndUnclaim");
saveClaim.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftS;
saveClaim.Tooltip = "一键保存以及释放";
cbm.Style = CommandBarStyle.ScenicRibbon;
cbm.SaveLayout();
}