public override void PerformRestore(DockingManager dm) { // Use the existing DockingManager method that will create a Window appropriate for // this Content and then add a new Zone for hosting the Window. It will always place // the Zone at the inner most level dm.AddContentWithState(_content, _state); }
public override void PerformRestore(DockingManager dm) { // Grab a list of all floating forms Form[] owned = dm.Container.FindForm().OwnedForms; FloatingForm target = null; // Find the match to one of our best friends foreach(Form f in owned) { FloatingForm ff = f as FloatingForm; if (ff != null) { if (ZoneHelper.ContentNames(ff.Zone).Contains(_best)) { target = ff; break; } } } // If no friends then try associates as second best option if (target == null) { // Find the match to one of our best friends foreach(Form f in owned) { FloatingForm ff = f as FloatingForm; if (ff != null) { if (ZoneHelper.ContentNames(ff.Zone).Contains(_associates)) { target = ff; break; } } } } // If we found a friend/associate, then restore to it if (target != null) { // We should have a child and be able to restore to its Zone _child.PerformRestore(target.Zone); } else { // Restore its location/size _content.DisplayLocation = _location; _content.DisplaySize = _size; // Use the docking manage method to create us a new Floating Window at correct size/location dm.AddContentWithState(_content, State.Floating); } }
// public ObjectMonitorClass ObjectMonitor // { // get // { // return objMonitor; // } // } public SharpClientForm() { // // Required for Windows Form Designer support // try { if(!Convert.ToBoolean(IsUserAnAdmin())) { if(DialogResult.No==MessageBox.Show("ProfileSharp has detected that you are running the profiler in a non-administrative account.\nThis can make the profiler unreponsive.Do you still want to continue?" ,"Non-Administrator",MessageBoxButtons.YesNo,MessageBoxIcon.Warning)) { System.Diagnostics.Process.GetCurrentProcess().Kill(); } } } catch {} try { if(IsProfilerAlreadyRunning()) { // if(objMonitor!=null) // { // try // { // Marshal.ReleaseComObject(objMonitor); // objMonitor=null; // } // catch{} // } MessageBox.Show("ProfileSharp could not be initialized on your system.\nPlease contact SoftProdigy for support on this issue." ,"ProfileSharp Error!",MessageBoxButtons.OK,MessageBoxIcon.Stop); System.Diagnostics.Process.GetCurrentProcess().Kill(); return; } } catch(Exception except){ MessageBox.Show("An Exception occured\n"+except.Message ,"ProfileSharp Error!.",MessageBoxButtons.OK,MessageBoxIcon.Stop); System.Diagnostics.Process.GetCurrentProcess().Kill(); return; } finally { // if(objMonitor!=null) // { // try // { // Marshal.ReleaseComObject(objMonitor); // objMonitor=null; // } // catch{} // } } Application.DoEvents(); InitializeComponent(); if(SharpClientForm.scInstance ==null) { SharpClientForm.scInstance=this; } sharpClientMDITab.Appearance=SharpClient.UI.Controls.TabControl.VisualAppearance.MultiDocument; subscribersTable=new Hashtable(); subscribersMenuTable =new Hashtable (); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); codeTabControl=new SharpClient.UI.Controls.TabControl(); this.Controls.Add(codeTabControl); _manager=new DockingManager(this,SharpClient.UI.Common.VisualStyle.IDE); this.codeTabControl.Appearance = SharpClient.UI.Controls.TabControl.VisualAppearance.MultiDocument; this.codeTabControl.BackColor = System.Drawing.SystemColors.ActiveCaptionText; this.codeTabControl.ButtonActiveColor = System.Drawing.SystemColors.ActiveCaptionText; this.codeTabControl.ButtonInactiveColor = System.Drawing.SystemColors.InactiveCaptionText; this.codeTabControl.Dock = System.Windows.Forms.DockStyle.Fill; this.codeTabControl.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.codeTabControl.HideTabsMode = SharpClient.UI.Controls.TabControl.HideTabsModes.ShowAlways; this.codeTabControl.HotTextColor = System.Drawing.SystemColors.Desktop; this.codeTabControl.IDEPixelBorder = false; this.codeTabControl.Location = new System.Drawing.Point(0, 31); this.codeTabControl.Name = "codeTabControl"; this.codeTabControl.Size = new System.Drawing.Size(790, 484); this.codeTabControl.TabIndex = 4; this.codeTabControl.ClosePressed+=new EventHandler(codeTabControl_ClosePressed); _manager.InnerControl=sharpClientMDITab; _manager.OuterControl= psStatusBar; Content c=_manager.Contents.Add(codeTabControl,"Source Code",imageList1,4); _manager.AddContentWithState(c,SharpClient.UI.Docking.State.DockBottom); _manager.HideAllContents(); ///////////////Stack Control/////// /// _stackManager=new DockingManager(this,SharpClient.UI.Common.VisualStyle.IDE); _stackManager.InnerControl=sharpClientMDITab; _stackManager.OuterControl= psStatusBar; // // TODO: Add any constructor code after InitializeComponent call // }