예제 #1
0
 internal static void UnRegisterWindow(DockWindow wnd)
 {
     if (wnd == null)
     {
         throw new ArgumentNullException("The window must not be null.");
     }
     if (listPanel.Contains(wnd.ControlContainer))
     {
         contList.Remove(wnd.ControlContainer);
         if (wnd.DockType == DockContainerType.Document)
         {
             listDocument.Remove(wnd.ControlContainer);
         }
         else if (wnd.DockType == DockContainerType.ToolWindow)
         {
             listTool.Remove(wnd.ControlContainer);
         }
     }
 }
예제 #2
0
 internal static void RegisterWindow(DockWindow wnd)
 {
     if (wnd == null)
     {
         throw new ArgumentNullException("The window must not be null.");
     }
     if (!listPanel.Contains(wnd.ControlContainer))
     {
         wnd.Disposed += new EventHandler(DockManager.ObjectDisposed);
         listPanel.Add(wnd.ControlContainer);
         if (wnd.DockType == DockContainerType.Document)
         {
             listDocument.Add(wnd.ControlContainer);
         }
         else if (wnd.DockType == DockContainerType.ToolWindow)
         {
             listTool.Add(wnd.ControlContainer);
         }
     }
 }
예제 #3
0
 public FormLoadEventArgs(System.Type type)
 {
     this.form   = null;
     this.type   = type;
     this.cancel = false;
 }
예제 #4
0
        internal bool ReadXml(XmlReader reader)
        {
            try
            {
                string str;
                int    width     = 100;
                int    height    = 100;
                string attribute = reader.GetAttribute("dock");
                if (attribute == null)
                {
                    goto Label_0093;
                }
                if (!(attribute == "Fill"))
                {
                    if (attribute == "Top")
                    {
                        goto Label_006B;
                    }
                    if (attribute == "Bottom")
                    {
                        goto Label_0075;
                    }
                    if (attribute == "Left")
                    {
                        goto Label_007F;
                    }
                    if (attribute == "Right")
                    {
                        goto Label_0089;
                    }
                    goto Label_0093;
                }
                this.Dock = DockStyle.Fill;
                goto Label_009B;
Label_006B:
                this.Dock = DockStyle.Top;
                goto Label_009B;
Label_0075:
                this.Dock = DockStyle.Bottom;
                goto Label_009B;
Label_007F:
                this.Dock = DockStyle.Left;
                goto Label_009B;
Label_0089:
                this.Dock = DockStyle.Right;
                goto Label_009B;
Label_0093:
                return(false);

Label_009B:
                str = reader.GetAttribute("width");
                if (str != null)
                {
                    width = int.Parse(str);
                }
                str = reader.GetAttribute("height");
                if (str != null)
                {
                    height = int.Parse(str);
                }
                str = reader.GetAttribute("type");
                if (str == null)
                {
                    return(false);
                }
                System.Type type = System.Type.GetType(str, true);
                if (type == null)
                {
                    return(false);
                }
                FormLoadEventArgs e = new FormLoadEventArgs(type);
                DockManager.InvokeFormLoad(this, e);
                DockWindow form = e.Form;
                if (e.Cancel)
                {
                    return(false);
                }
                if (form == null)
                {
                    ConstructorInfo constructor = type.GetConstructor(System.Type.EmptyTypes);
                    if (constructor == null)
                    {
                        return(false);
                    }
                    form = constructor.Invoke(new object[0]) as DockWindow;
                }
                base.Size = form.ControlContainer.Size;
                int count = form.ControlContainer.Controls.Count;
                if (count > 0)
                {
                    Control[] array = new Control[count];
                    form.ControlContainer.Controls.CopyTo(array, 0);
                    base.Controls.AddRange(array);
                }
                base.Size             = new Size(width, height);
                form.ControlContainer = this;
                this.form             = form;
                form.ShowFormAtOnLoad = false;
                form.Show();
                form.ShowFormAtOnLoad = true;
                if (form.HostContainer != null)
                {
                    form.Release();
                }
                form.ReadXml(reader);
            }
            catch (Exception exception)
            {
                Console.WriteLine("DockPanel.ReadXml: " + exception.Message);
            }
            return(true);
        }