Ejemplo n.º 1
0
        public Area(AreaStyle style)
        {
            InitializeComponent();
            _style = style;
            _drawing = new Drawing(new GDIPainter(webBrowser1));
            _webEventProvider = new WebEventProvider();
            Application.AddMessageFilter(this);

            Antigate.OnError += new Antigate.ErrorDel(Antigate_OnError);
            Antigate.OnRecognized += new Antigate.RecognizedDel(Antigate_OnRecognized);
        }
Ejemplo n.º 2
0
        public static AreaStyle LoadStyles(string fullPath)
        {
            List<string> lines = FileWorker.Load(fullPath);

            if (lines != null)
            {
                try
                {
                    AreaStyle styles = new AreaStyle();
                    styles.Maximized = GetValueFromfileStr(lines[0]) == "1" ? true : false;

                    string[] sizeP = GetValueFromfileStr(lines[1]).Split(',');
                    styles.Size = new Size(Int32.Parse(sizeP[0]), Int32.Parse(sizeP[1]));

                    string[] locationP = GetValueFromfileStr(lines[2]).Split(',');
                    styles.Location = new Point(Int32.Parse(locationP[0]), Int32.Parse(locationP[1]));

                    styles.BotPanelWidth = Int32.Parse(GetValueFromfileStr(lines[3]));
                    styles.PropertyPanelWidth = Int32.Parse(GetValueFromfileStr(lines[4]));
                    styles.HtmlWindowHeight = Int32.Parse(GetValueFromfileStr(lines[5]));
                    styles.BrowserHeight = Int32.Parse(GetValueFromfileStr(lines[6]));

                    return styles;
                }
                catch (Exception)
                {
                    return null;
                }
            }
            return null;
        }
Ejemplo n.º 3
0
        public static void SaveStyles(string fullPath, AreaStyle styles)
        {
            List<string> lines = new List<string>();

            lines.Add(string.Format("Maximized={0};", styles.Maximized ? 1 : 0));
            lines.Add(string.Format("Size={0},{1};", styles.Size.Width, styles.Size.Height));
            lines.Add(string.Format("Location={0},{1};", styles.Location.X, styles.Location.Y));
            lines.Add(string.Format("BotPanelWidth={0};", styles.BotPanelWidth));
            lines.Add(string.Format("PropertyPanelWidth={0};", styles.PropertyPanelWidth));
            lines.Add(string.Format("TagTreeHeight={0};", styles.HtmlWindowHeight));
            lines.Add(string.Format("BrowserHeight={0};", styles.BrowserHeight));

            FileWorker.Save(fullPath, lines, false);
        }
Ejemplo n.º 4
0
        private void Area_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.RemoveMessageFilter(this);

            AreaStyle.SaveStyles(Path.Combine(Application.StartupPath, "styles"), GetCurAreaStyle());
        }
Ejemplo n.º 5
0
 AreaStyle GetCurAreaStyle()
 {
     AreaStyle style = new AreaStyle();
     style.Maximized = this.WindowState == FormWindowState.Maximized ? true : false;
     style.Size = this.Size;
     style.Location = this.Location;
     style.BotPanelWidth = this.BotPanel.Width;
     style.PropertyPanelWidth = this.PropertyPanel.Width;
     style.BrowserHeight = this.splitContainer1.SplitterDistance;
     style.HtmlWindowHeight = splitContainer2.Height - this.splitContainer2.SplitterDistance;
     return style;
 }
Ejemplo n.º 6
0
 private void ApplyStyles(AreaStyle style)
 {
     this.WindowState = style.Maximized ? FormWindowState.Maximized : FormWindowState.Normal;
     this.Size = style.Size;
     this.Location = style.Location;
     this.BotPanel.Width = style.BotPanelWidth;
     this.PropertyPanel.Width = style.PropertyPanelWidth;
     this.splitContainer1.SplitterDistance = style.BrowserHeight > splitContainer1.Panel1MinSize ? style.BrowserHeight : splitContainer1.Panel1MinSize;
     this.splitContainer2.SplitterDistance = style.HtmlWindowHeight > splitContainer2.Panel1MinSize ? style.HtmlWindowHeight : splitContainer2.Panel1MinSize;
 }