void RedrawToolbars() { Core.Properties fullscreenProperties = PropertyService.Get("FanHai.Gui.Framework.Gui.FullscreenOptions", new Core.Properties()); bool hideInFullscreen = fullscreenProperties.Get("HideToolbars", true); bool toolBarVisible = PropertyService.Get("FanHai.Gui.Framework.Gui.ToolBarVisible", true); toolBarPanel.Visible = toolBarVisible && !(wbForm.FullScreen && hideInFullscreen); }
void RedrawMainMenu() { Core.Properties fullscreenProperties = PropertyService.Get("FanHai.Gui.Framework.Gui.FullscreenOptions", new Core.Properties()); bool hideInFullscreen = fullscreenProperties.Get("HideMainMenu", false); bool showOnMouseMove = fullscreenProperties.Get("ShowMainMenuOnMouseMove", true); mainMenuContainer.AutoHide = wbForm.FullScreen && hideInFullscreen; mainMenuContainer.ShowOnMouseDown = true; mainMenuContainer.ShowOnMouseMove = showOnMouseMove; }
internal static void InitializeService() { bindings = AddInTree.BuildItems <DisplayBindingDescriptor>(displayBindingPath, null, true); displayBindingServiceProperties = PropertyService.Get("DisplayBindingService", new Core.Properties()); foreach (ExternalProcessDisplayBinding binding in displayBindingServiceProperties.Get("ExternalProcesses", new ExternalProcessDisplayBinding[0])) { if (binding != null) { AddExternalProcessDisplayBindingInternal(binding); } } }
void RedrawStatusBar() { Core.Properties fullscreenProperties = PropertyService.Get("FanHai.Gui.Framework.Gui.FullscreenOptions", new Core.Properties()); bool hideInFullscreen = fullscreenProperties.Get("HideStatusBar", true); bool showOnMouseMove = fullscreenProperties.Get("ShowStatusBarOnMouseMove", true); bool statusBarVisible = PropertyService.Get("FanHai.Gui.Framework.Gui.StatusBarVisible", false); statusStripContainer.AutoHide = wbForm.FullScreen && hideInFullscreen; statusStripContainer.ShowOnMouseDown = true; statusStripContainer.ShowOnMouseMove = showOnMouseMove; statusStripContainer.Visible = statusBarVisible; }
void StoreMemento(IViewContent viewContent) { if (viewContent.PrimaryFileName == null) { return; } string key = GetMementoKeyName(viewContent); LoggingService.Debug("Saving memento of '" + viewContent.ToString() + "' to key '" + key + "'"); Core.Properties memento = ((IMementoCapable)viewContent).CreateMemento(); Core.Properties p = this.LoadOrCreateViewContentMementos(); p.Set(key, memento); FileUtility.ObservedSave(new NamedFileOperationDelegate(p.Save), this.ViewContentMementosFileName, FileErrorPolicy.Inform); }
public ErrorListPad() { instance = this; properties = PropertyService.Get("ErrorListPad", new Core.Properties()); RedrawContent(); toolStrip = ToolbarService.CreateToolStrip(this, "/FanHaiFramework/Pads/ErrorList/Toolbar"); toolStrip.Stretch = true; toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; contentPanel.Controls.Add(toolStrip); InternalShowResults(); }
public void ShowView(IViewContent content, bool switchToOpenedView) { CloseAllViews(); if (content == null) { throw new ArgumentNullException("content"); } if (content.WorkbenchWindow != null) { throw new ArgumentException("Cannot show view content that is already visible in another workbench window"); } if (layout == null) { throw new InvalidOperationException("No layout is attached."); } if (ViewContentCollection.Count >= maxViewContentCount)//如果超过3个则不能再打开。add by { MessageBox.Show(string.Format("视图界面数量最多只能为\"{0}\"个,请先关闭部分页面。", maxViewContentCount)); return; } primaryViewContentCollection.Add(content); if (PropertyService.Get("FanHai.Gui.Framework.LoadDocumentProperties", true) && content is IMementoCapable) { try { Core.Properties memento = GetStoredMemento(content); if (memento != null) { ((IMementoCapable)content).SetMemento(memento); } } catch (Exception e) { MessageService.ShowError(e, "Can't get/set memento"); } } layout.ShowView(content, switchToOpenedView); if (switchToOpenedView) { content.WorkbenchWindow.SelectWindow(); } OnViewOpened(new ViewContentEventArgs(content)); }
public void SetMemento(Core.Properties properties) { if (properties != null && properties.Contains("bounds")) { string[] bounds = properties["bounds"].Split(','); if (bounds.Length == 4) { Bounds = normalBounds = new Rectangle(int.Parse(bounds[0], NumberFormatInfo.InvariantInfo), int.Parse(bounds[1], NumberFormatInfo.InvariantInfo), int.Parse(bounds[2], NumberFormatInfo.InvariantInfo), int.Parse(bounds[3], NumberFormatInfo.InvariantInfo)); } defaultWindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), properties["defaultstate"]); FullScreen = properties.Get("fullscreen", false); WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), properties["windowstate"]); } }
public override bool StorePanelContents() { Core.Properties properties = PropertyService.Get(fullscreenProperty, new Core.Properties()); properties.Set("HideMainMenu", Get <CheckBox>("HideMainMenu").Checked); properties.Set("ShowMainMenuOnMouseMove", Get <CheckBox>("ShowMainMenuOnMouseMove").Checked); properties.Set("HideToolbars", Get <CheckBox>("HideToolbars").Checked); properties.Set("HideTabs", Get <CheckBox>("HideTabs").Checked); properties.Set("HideVerticalScrollbar", Get <CheckBox>("HideVerticalScrollbar").Checked); properties.Set("HideHorizontalScrollbar", Get <CheckBox>("HideHorizontalScrollbar").Checked); properties.Set("HideStatusBar", Get <CheckBox>("HideStatusBar").Checked); properties.Set("ShowStatusBarOnMouseMove", Get <CheckBox>("ShowStatusBarOnMouseMove").Checked); properties.Set("HideWindowsTaskbar", Get <CheckBox>("HideWindowsTaskbar").Checked); PropertyService.Set(fullscreenProperty, properties); return(true); }
// interface IMementoCapable public Core.Properties CreateMemento() { Core.Properties properties = new Core.Properties(); properties["bounds"] = normalBounds.X.ToString(NumberFormatInfo.InvariantInfo) + "," + normalBounds.Y.ToString(NumberFormatInfo.InvariantInfo) + "," + normalBounds.Width.ToString(NumberFormatInfo.InvariantInfo) + "," + normalBounds.Height.ToString(NumberFormatInfo.InvariantInfo); if (FullScreen || WindowState == FormWindowState.Minimized) { properties["windowstate"] = defaultWindowState.ToString(); } else { properties["windowstate"] = WindowState.ToString(); } properties["defaultstate"] = defaultWindowState.ToString(); return(properties); }
public override void LoadPanelContents() { SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("FanHai.Gui.Framework.Resources.FullscreenPanel.xfrm")); Core.Properties properties = PropertyService.Get(fullscreenProperty, new Core.Properties()); Get <CheckBox>("HideMainMenu").Checked = properties.Get("HideMainMenu", false); Get <CheckBox>("ShowMainMenuOnMouseMove").Checked = properties.Get("ShowMainMenuOnMouseMove", true); Get <CheckBox>("HideToolbars").Checked = properties.Get("HideToolbars", true); Get <CheckBox>("HideTabs").Checked = properties.Get("HideTabs", false); Get <CheckBox>("HideVerticalScrollbar").Checked = properties.Get("HideVerticalScrollbar", false); Get <CheckBox>("HideHorizontalScrollbar").Checked = properties.Get("HideHorizontalScrollbar", false); Get <CheckBox>("HideStatusBar").Checked = properties.Get("HideStatusBar", true); Get <CheckBox>("ShowStatusBarOnMouseMove").Checked = properties.Get("ShowStatusBarOnMouseMove", true); Get <CheckBox>("HideWindowsTaskbar").Checked = properties.Get("HideWindowsTaskbar", true); Get <CheckBox>("HideMainMenu").CheckedChanged += delegate { RefreshStatus(); }; Get <CheckBox>("HideStatusBar").CheckedChanged += delegate { RefreshStatus(); }; RefreshStatus(); }
public void Attach(IWorkbench workbench) { string file = AppDomain.CurrentDomain.BaseDirectory + "logo.ico"; wbForm = (DefaultWorkbench)workbench; wbForm.Icon = IconService.GetIcon(file); wbForm.ShowIcon = true; wbForm.SuspendLayout(); wbForm.Controls.Clear(); mainMenuContainer = new AutoHideMenuStripContainer(wbForm.TopMenu); mainMenuContainer.Dock = DockStyle.Left; wbForm.TopMenu.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; statusStripContainer = new AutoHideStatusStripContainer((StatusStrip)StatusBarService.Control); statusStripContainer.Dock = DockStyle.Bottom; toolBarPanel = new ToolStripPanel(); if (wbForm.ToolBars != null) { toolBarPanel.Controls.AddRange(wbForm.ToolBars); } toolBarPanel.Dock = DockStyle.Top; dockPanel = new DockPanel(); dockPanel.Dock = DockStyle.Fill; dockPanel.RightToLeftLayout = false; //navbar MyMent myMent = new MyMent(wbForm.TopMenu); NavBarControl navBarControl = myMent.CreateControl(); navBarControl.Dock = DockStyle.Left; DockPaneStripSkin dockPaneSkin = new DockPaneStripSkin(); // 244,247,252 163, 186, 239 dockPaneSkin.DocumentGradient.DockStripGradient.StartColor = System.Drawing.Color.FromArgb(251, 248, 240); dockPaneSkin.DocumentGradient.DockStripGradient.EndColor = System.Drawing.Color.FromArgb(251, 248, 240); // RGB: 217,234,250 dockPaneSkin.DocumentGradient.ActiveTabGradient.StartColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.GradientActiveCaption); dockPaneSkin.DocumentGradient.ActiveTabGradient.EndColor = dockPaneSkin.DocumentGradient.ActiveTabGradient.StartColor; //RGB:221,234,244 dockPaneSkin.DocumentGradient.InactiveTabGradient.StartColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.GradientInactiveCaption); dockPaneSkin.DocumentGradient.InactiveTabGradient.StartColor = System.Drawing.Color.FromArgb(251, 248, 240); dockPaneSkin.DocumentGradient.InactiveTabGradient.EndColor = dockPaneSkin.DocumentGradient.InactiveTabGradient.StartColor; dockPaneSkin.TextFont = new System.Drawing.Font(dockPaneSkin.TextFont.FontFamily, DOCKPANEL_FONT_SIZE); dockPanel.Skin.DockPaneStripSkin = dockPaneSkin; //dockPanel.DocumentStyle = DocumentStyle.DockingWindow; dockPanel.DocumentStyle = DocumentStyle.DockingSdi; wbForm.Controls.Add(dockPanel); //wbForm.Controls.Add(toolBarPanel); wbForm.Controls.Add(navBarControl); //wbForm.Controls.Add(statusStripContainer); // TODO 状态栏 //wbForm.MainMenuStrip = wbForm.TopMenu; // dock panel has to be added to the form before LoadLayoutConfiguration is called to fix SD2-463 LoadLayoutConfiguration(); ShowPads(); ShowViewContents(); RedrawAllComponents(); dockPanel.ActiveDocumentChanged += new EventHandler(ActiveMdiChanged); dockPanel.ActiveContentChanged += new EventHandler(ActiveContentChanged); ActiveMdiChanged(this, EventArgs.Empty); wbForm.FormBorderStyle = FormBorderStyle.Fixed3D; wbForm.ResumeLayout(false); Core.Properties fullscreenProperties = PropertyService.Get("FanHai.Gui.Framework.Gui.FullscreenOptions", new Core.Properties()); fullscreenProperties.PropertyChanged += TrackFullscreenPropertyChanges; }