Example #1
0
 private IDockContent GetContentFromPersistString(string persistString)
 {
     if (INI.Sections.Count > 1 && persistString == typeof(frmMonitor).ToString())
     {
         var        section = INI.Sections.ElementAt(m_ContentCount + 1);
         frmMonitor monitor = new frmMonitor(section);
         monitor.Start();
         m_ContentCount++;
         m_LoadedMonitor.Add(section.SectionName);
         return(monitor);
     }
     return(null);
 }
Example #2
0
        private void tsAdd_Click(object sender, EventArgs e)
        {
            tsSeparator1.Visible = tsSeparator2.Visible = tsIPLabel.Visible = tsIP.Visible = tsPortLabel.Visible = tsPort.Visible = tsIntervalLabel.Visible = tsInterval.Visible = tsAdd.Visible = false;
            tsDisplayAdd.Text    = nameof(RIGHT);

            int port, interval;

            int.TryParse(tsPort.Text, out port);
            int.TryParse(tsInterval.Text, out interval);
            frmMonitor mon = new frmMonitor(tsIP.Text, port, interval);

            mon.Show(dockPanel1);
            mon.Start();

            dockPanel1.SaveAsXml(LAYOUT);
        }
Example #3
0
        private void LoadLayout()
        {
            if (!File.Exists(LAYOUT))
            {
                foreach (var sec in INI.Sections)
                {
                    if (sec.SectionName == "SYSTEM")
                    {
                        continue;
                    }
                    frmMonitor mon = new frmMonitor(sec);
                    mon.Show(dockPanel1);
                    mon.Start();
                }
            }
            else
            {
                DeserializeDockContent ddContent = new DeserializeDockContent(GetContentFromPersistString);
                dockPanel1.LoadFromXml(LAYOUT, ddContent);

                for (int i = INI.Sections.Count - 1; i >= 0; i--)
                {
                    string section = INI.Sections.ElementAt(i).SectionName;
                    if (section == "SYSTEM")
                    {
                        continue;
                    }
                    //if (!m_LoadedMonitor.Contains(section))
                    //{
                    //    INI.Sections.RemoveSection(section);
                    //}
                }
                var parser = new FileIniDataParser();
                parser.WriteFile("Config.ini", INI);
            }
        }