예제 #1
0
 internal static void InvokeFormLoad(object sender, FormLoadEventArgs e)
 {
     if (FormLoad != null)
     {
         FormLoad(sender, e);
     }
 }
예제 #2
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);
        }