Exemplo n.º 1
0
        public static void OpenPopOutForm(XElement element)
        {
            VariablePopOutForm form = new VariablePopOutForm();

            List <XElement>             subElements = element.Elements().ToList();
            List <WatchVariableControl> controls    = subElements
                                                      .ConvertAll(subElement => new WatchVariableControlPrecursor(subElement))
                                                      .ConvertAll(precursor => precursor.CreateWatchVariableControl());

            form.ShowForm();

            bool?borderless = ParsingUtilities.ParseBoolNullable(element.Attribute(XName.Get("borderless"))?.Value);

            if (borderless.HasValue && borderless.Value)
            {
                form.SetBorderless(borderless.Value);
            }

            bool?alwaysOnTop = ParsingUtilities.ParseBoolNullable(element.Attribute(XName.Get("alwaysOnTop"))?.Value);

            if (alwaysOnTop.HasValue && alwaysOnTop.Value)
            {
                form.SetAlwaysOnTop(alwaysOnTop.Value);
            }

            int?locationX = ParsingUtilities.ParseIntNullable(element.Attribute(XName.Get("locationX"))?.Value);
            int?locationY = ParsingUtilities.ParseIntNullable(element.Attribute(XName.Get("locationY"))?.Value);

            if (locationX.HasValue && locationY.HasValue)
            {
                form.Location = new System.Drawing.Point(locationX.Value, locationY.Value);
            }

            int?width = ParsingUtilities.ParseIntNullable(element.Attribute(XName.Get("width"))?.Value);

            if (width.HasValue)
            {
                form.Width = width.Value;
            }

            int?height = ParsingUtilities.ParseIntNullable(element.Attribute(XName.Get("height"))?.Value);

            if (height.HasValue)
            {
                form.Height = height.Value;
            }

            form.Initialize(controls);
        }