public void AddDockableWindow(IDockableWindow window, DockWindowState state) { if (_application != null) { _application.AddDockableWindow(window, state); } }
/// <summary> /// Method for setting the docking and position of dockable window /// </summary> private void ApplyDockWindowState() { if (_dockWindowState == null) { // This can be a case in which the persistence xml file is deleted/ xml // corruption etc. Even if we docking state info does not exist, we will // still like the dialog to open with some resaonable position/ docked state _dockWindowState = new DockWindowState(); SetDefaultDockingInfo(); } if (_dockWindowState.Floating) { _dockWindow.Float( _dockWindowState.FloatState.Rect.Left, _dockWindowState.FloatState.Rect.Top, _dockWindowState.FloatState.Rect.Right, _dockWindowState.FloatState.Rect.Bottom); } else { _dockWindow.Dock( _dockWindowState.DockState.Position, _dockWindowState.DockState.CX, _dockWindowState.DockState.CY); if (_dockWindowState.DockState.Pinned) { _dockWindow.Pin(); } } }
/// <summary> /// Method for setting some resaonable position/ docked state /// </summary> private void SetDefaultDockingInfo() { if (_dockWindowState == null) { _dockWindowState = new DockWindowState(); } _dockWindowState.Floating = false; _dockWindowState.DockState.Position = DockPosition.PositionRight; _dockWindowState.DockState.CX = 300; _dockWindowState.DockState.CY = 225; _dockWindowState.Visible = true; _dockWindowState.DockState.Pinned = false; }
virtual public void AddDockableWindow(IDockableWindow window, DockWindowState state) { if (window != null) { foreach (IDockableWindow win in _dockWindows) { if (win == window) { return; } } window.DockableWindowState = state; _dockWindows.Add(window); } if (DockWindowAdded != null) { DockWindowAdded(window, ""); } }
/// <summary> /// Method for getting the Docking state related information /// </summary> private DockWindowState getDockWindowState() { if (_dockWindowState == null) { _dockWindowState = new DockWindowState(); } // store float state _dockWindowState.Floating = _dockWindow.Floating; // store float size/location _dockWindow.FloatSize( ref _dockWindowState.FloatState.Rect.Left, ref _dockWindowState.FloatState.Rect.Top, ref _dockWindowState.FloatState.Rect.Right, ref _dockWindowState.FloatState.Rect.Bottom); // store dock position _dockWindowState.DockState.Position = _dockWindow.DockPosition; // store docked pinned state _dockWindowState.DockState.Pinned = _dockWindow.Pinned; // store docked size _dockWindowState.DockState.CX = _dockWindow.DockSizeCX; _dockWindowState.DockState.CY = _dockWindow.DockSizeCY; return(_dockWindowState); }
/// <summary> /// Method for setting some resaonable position/ docked state /// </summary> private void SetDefaultDockingInfo() { if (_dockWindowState == null) { _dockWindowState = new DockWindowState(); } _dockWindowState.Floating = false; _dockWindowState.DockState.Position = DockPosition.PositionRight; _dockWindowState.DockState.CX = 300; _dockWindowState.DockState.CY = 225; _dockWindowState.Visible = true; _dockWindowState.DockState.Pinned = false; }
/// <summary> /// Load the dock window state from the xml file /// It uses mutexes to synchronize the threads accessing /// the xml file /// </summary> private void LoadDockWindowStateFromFile() { string sErr = string.Empty; // Wait until safe to read from file _controllerMutex.WaitOne(); // Try to read the xml file XmlDocument xmlDoc = new XmlDocument(); try { // Load the xml file xmlDoc.Load(sDockInfoXMLFile); //Get the docking related information _dockWindowState = new DockWindowState(); //All Docking related information is in "DockWindowState" node and its child nodes XmlNodeList xmlNodeList = xmlDoc.GetElementsByTagName(STR_DOCK_WINDOW_STATE); XmlNode dockWinStateNode = xmlNodeList[0]; if (dockWinStateNode == null || dockWinStateNode.Attributes[STR_TYPE] == null) throw new XmlException(Properties.Resources.ERR_INVALID_XML); if (dockWinStateNode.Attributes[STR_TYPE].Value.CompareTo(STR_FLOATING) == 0) { // The dialog was floating the last time the application was closed _dockWindowState.Floating = true; XmlNode FloatStateRectNode = dockWinStateNode.ChildNodes[0]; if (FloatStateRectNode == null) throw new XmlException(Properties.Resources.ERR_INVALID_XML); _dockWindowState.FloatState.Rect.Top = Convert.ToInt32(FloatStateRectNode.Attributes[STR_TOP].Value); _dockWindowState.FloatState.Rect.Left = Convert.ToInt32(FloatStateRectNode.Attributes[STR_LEFT].Value); _dockWindowState.FloatState.Rect.Right = Convert.ToInt32(FloatStateRectNode.Attributes[STR_RIGHT].Value); _dockWindowState.FloatState.Rect.Bottom = Convert.ToInt32(FloatStateRectNode.Attributes[STR_BOTTOM].Value); _dockWindowState.DockState.Position = DockPosition.PositionFloat; } else if (dockWinStateNode.Attributes[STR_TYPE].Value.CompareTo(STR_DOCKED) == 0) { // The dialog was docked the last time the application was closed _dockWindowState.Floating = false; XmlNode dockStateNode = dockWinStateNode.ChildNodes[0]; if (dockStateNode == null) throw new XmlException(Properties.Resources.ERR_INVALID_XML); _dockWindowState.DockState.Position = (DockPosition)Enum.Parse(typeof(DockPosition), dockStateNode.Attributes["Position"].Value); _dockWindowState.DockState.Pinned = Convert.ToBoolean(dockStateNode.Attributes[STR_PINNED].Value); _dockWindowState.DockState.CX = Convert.ToInt32(dockStateNode.Attributes[STR_CX].Value); _dockWindowState.DockState.CY = Convert.ToInt32(dockStateNode.Attributes[STR_CY].Value); } } catch (System.Xml.XPath.XPathException ex) { sErr = ex.Message; } catch (XmlException ex) { sErr = ex.Message; } catch (ArgumentException ex) { sErr = ex.Message; } catch (FileNotFoundException ex) { sErr = ex.Message; sErr = string.Empty; } catch (Exception ex) { sErr = ex.Message; } finally { if (sErr != string.Empty) { MessageBox.Show(sErr); } _controllerMutex.ReleaseMutex(); } }
/// <summary> /// Method for getting the Docking state related information /// </summary> private DockWindowState getDockWindowState() { if (_dockWindowState == null) { _dockWindowState = new DockWindowState(); } // store float state _dockWindowState.Floating = _dockWindow.Floating; // store float size/location _dockWindow.FloatSize( ref _dockWindowState.FloatState.Rect.Left, ref _dockWindowState.FloatState.Rect.Top, ref _dockWindowState.FloatState.Rect.Right, ref _dockWindowState.FloatState.Rect.Bottom); // store dock position _dockWindowState.DockState.Position = _dockWindow.DockPosition; // store docked pinned state _dockWindowState.DockState.Pinned = _dockWindow.Pinned; // store docked size _dockWindowState.DockState.CX = _dockWindow.DockSizeCX; _dockWindowState.DockState.CY = _dockWindow.DockSizeCY; return _dockWindowState; }
/// <summary> /// Method for setting the docking and position of dockable window /// </summary> private void ApplyDockWindowState() { if (_dockWindowState == null) { // This can be a case in which the persistence xml file is deleted/ xml // corruption etc. Even if we docking state info does not exist, we will // still like the dialog to open with some resaonable position/ docked state _dockWindowState = new DockWindowState(); SetDefaultDockingInfo(); } if (_dockWindowState.Floating) { _dockWindow.Float( _dockWindowState.FloatState.Rect.Left, _dockWindowState.FloatState.Rect.Top, _dockWindowState.FloatState.Rect.Right, _dockWindowState.FloatState.Rect.Bottom); } else { _dockWindow.Dock( _dockWindowState.DockState.Position, _dockWindowState.DockState.CX, _dockWindowState.DockState.CY); if (_dockWindowState.DockState.Pinned) { _dockWindow.Pin(); } } }
/// <summary> /// Load the dock window state from the xml file /// It uses mutexes to synchronize the threads accessing /// the xml file /// </summary> private void LoadDockWindowStateFromFile() { string sErr = string.Empty; // Wait until safe to read from file _controllerMutex.WaitOne(); // Try to read the xml file XmlDocument xmlDoc = new XmlDocument(); try { // Load the xml file xmlDoc.Load(sDockInfoXMLFile); //Get the docking related information _dockWindowState = new DockWindowState(); //All Docking related information is in "DockWindowState" node and its child nodes XmlNodeList xmlNodeList = xmlDoc.GetElementsByTagName(STR_DOCK_WINDOW_STATE); XmlNode dockWinStateNode = xmlNodeList[0]; if (dockWinStateNode == null || dockWinStateNode.Attributes[STR_TYPE] == null) { throw new XmlException(Properties.Resources.ERR_INVALID_XML); } if (dockWinStateNode.Attributes[STR_TYPE].Value.CompareTo(STR_FLOATING) == 0) { // The dialog was floating the last time the application was closed _dockWindowState.Floating = true; XmlNode FloatStateRectNode = dockWinStateNode.ChildNodes[0]; if (FloatStateRectNode == null) { throw new XmlException(Properties.Resources.ERR_INVALID_XML); } _dockWindowState.FloatState.Rect.Top = Convert.ToInt32(FloatStateRectNode.Attributes[STR_TOP].Value); _dockWindowState.FloatState.Rect.Left = Convert.ToInt32(FloatStateRectNode.Attributes[STR_LEFT].Value); _dockWindowState.FloatState.Rect.Right = Convert.ToInt32(FloatStateRectNode.Attributes[STR_RIGHT].Value); _dockWindowState.FloatState.Rect.Bottom = Convert.ToInt32(FloatStateRectNode.Attributes[STR_BOTTOM].Value); _dockWindowState.DockState.Position = DockPosition.PositionFloat; } else if (dockWinStateNode.Attributes[STR_TYPE].Value.CompareTo(STR_DOCKED) == 0) { // The dialog was docked the last time the application was closed _dockWindowState.Floating = false; XmlNode dockStateNode = dockWinStateNode.ChildNodes[0]; if (dockStateNode == null) { throw new XmlException(Properties.Resources.ERR_INVALID_XML); } _dockWindowState.DockState.Position = (DockPosition)Enum.Parse(typeof(DockPosition), dockStateNode.Attributes["Position"].Value); _dockWindowState.DockState.Pinned = Convert.ToBoolean(dockStateNode.Attributes[STR_PINNED].Value); _dockWindowState.DockState.CX = Convert.ToInt32(dockStateNode.Attributes[STR_CX].Value); _dockWindowState.DockState.CY = Convert.ToInt32(dockStateNode.Attributes[STR_CY].Value); } } catch (System.Xml.XPath.XPathException ex) { sErr = ex.Message; } catch (XmlException ex) { sErr = ex.Message; } catch (ArgumentException ex) { sErr = ex.Message; } catch (FileNotFoundException ex) { sErr = ex.Message; sErr = string.Empty; } catch (Exception ex) { sErr = ex.Message; } finally { if (sErr != string.Empty) { MessageBox.Show(sErr); } _controllerMutex.ReleaseMutex(); } }
/// <summary> /// Method for setting some resaonable position/ docked state /// </summary> private void SetDefaultDockingInfo() { if (_dockWindowState == null) { _dockWindowState = new DockWindowState(); } _dockWindowState.Floating = true; //false _dockWindowState.DockState.Position = DockPosition.PositionLeft; _dockWindowState.DockState.CX = 300; _dockWindowState.DockState.CY = 225; _dockWindowState.DockState.Pinned = false; _dockWindowState.FloatState.Rect.Top = 200; _dockWindowState.FloatState.Rect.Bottom = 400; _dockWindowState.FloatState.Rect.Left = 200; _dockWindowState.FloatState.Rect.Right = 400; _dockWindowState.Visible = true; }