Пример #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     IrisConfig saveConfig = new IrisConfig();
     saveConfig.ViewPorts = (BindingList<ViewPort>)viewPorts.List;
     saveConfig.PollingInterval = loadedCfg.PollingInterval;
     Helpers.SaveConfig(saveConfig, configFile);
 }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            viewPorts = new BindingSource();
            windows = new BindingSource();
            viewPorts.DataSource = typeof(ViewPort);
            windows.DataSource = typeof(ViewPortForm);

            if (File.Exists(configFile))
            {
                loadedCfg = Helpers.LoadConfig(configFile);
                viewPorts.DataSource = (BindingList<ViewPort>)loadedCfg.ViewPorts;

            }
            else
            {// should move this to helper
                MessageBox.Show(configFile + " not found! Please create a config File", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1
                   , MessageBoxOptions.ServiceNotification);
                this.Close();
            }

            foreach (ViewPort vp in viewPorts)
            {
                ViewPortForm vpWindow = new ViewPortForm(vp);
                vpWindow.Size = new Size(vp.SizeX, vp.SizeY);
                vpWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                vpWindow.Text = vp.Name;
                vpWindow.Show();
                vpWindow.DesktopLocation = new Point(vp.ScreenPositionX, vp.ScreenPositionY);
                windows.Add(vpWindow);
            }

        }
Пример #3
0
        public static void SaveConfig(IrisConfig config, string fileName)
        {
            XmlSerializer ser = new XmlSerializer(typeof(IrisConfig), new Type[] { typeof(ViewPort) });

            using (var stream = File.Create(fileName))
            {
                ser.Serialize(stream, config);
            }
        }
        public static void SaveConfig(IrisConfig config, string fileName)
        {
            XmlSerializer ser = new XmlSerializer(typeof(IrisConfig), new Type[] { typeof(ViewPort) });

            using (var stream = File.Create(fileName))
            {
                ser.Serialize(stream, config);
            }
        }
Пример #5
0
 private void SaveConfig(string fileName)
 {
     IrisConfig saver = new IrisConfig();
     saver.PollingInterval = timer1.Interval;
     saver.ViewPorts = (BindingList<ViewPort>)viewPorts.List;
     MessageBox.Show("Items Saved");
 }