public void UpdateRevertMenu(ToolStripDropDownButton button) { var layout = new DockingDesign(); SaveLayout(layout); var mwids = layout.GetMissingWidgets(m_dashboard.m_design); button.Text = Texts.Get("s_revert"); if (mwids.Count > 0) { button.Text += " (" + mwids.Count.ToString() + ")"; } button.DropDownItems.Clear(); var mb = new MenuBuilder(); mb.AddItem(null, "s_original_design", new MenuItemData { Weight = -1, GroupName = "revert", Callable = new ActionCallable(RevertDesign) }); foreach (var wid in mwids) { mb.AddItem(null, wid.Widget.PageTitle, new MenuItemData { Weight = 1, GroupName = "widget", Callable = new ActionCallable(wid.GetOpenWidgetCallback(this)), Image = wid.Widget.Image }); } mb.GetMenuItems(button.DropDownItems); }
public void LoadLayoutOrOverride(DockingDesign design) { if (!LoadLayoutOverride()) { LoadLayout(design); } }
private void SavePrivateLayout() { if (m_privateLayoutFile != null) { var design = new DockingDesign(); SaveLayout(design); design.SaveToFile(m_privateLayoutFile); } }
public bool LoadLayoutOverride() { if (m_privateLayoutFile != null && File.Exists(m_privateLayoutFile)) { var layout = new DockingDesign(); layout.LoadFromFile(m_privateLayoutFile); LoadLayout(layout); return(true); } return(false); }
public List <WidgetInfo> GetMissingWidgets(DockingDesign originalDesign) { var res = new List <WidgetInfo>(); foreach (XmlElement widget in originalDesign._Root.SelectNodes("Widget")) { string ps = widget.FindElement("PersistString").InnerText; var mywidget = _Root.SelectSingleNode("Widget[PersistString='" + ps + "']") as XmlElement; if (mywidget == null) { var item = new WidgetInfo(); try { item.LoadProperties(widget); res.Add(item); } catch { continue; } } } return(res); }
public void LoadLayout(DockingDesign design) { LoadLayout(design._Root); }
public void SaveLayout(DockingDesign design) { design.Clear(); SaveLayout(design._Root); }