private void LoadConfig(string fileName) { IrisConfig loader = Helpers.LoadConfig(fileName); timer1.Interval = loader.PollingInterval; viewPorts.DataSource = (BindingList <ViewPort>)loader.ViewPorts; }
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); } }
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); }
private void SaveConfig(string fileName) { IrisConfig saver = new IrisConfig(); saver.PollingInterval = timer1.Interval; saver.ViewPorts = (BindingList <ViewPort>)viewPorts.List; MessageBox.Show("Items Saved"); }
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.MinimumSize = new Size(16, 16); 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); if (vp.Name == "Background") { // This is the special case viewport used for the background to avoid us // having to set a desktop background and remove all of the icons vpWindow.SendToBack(); vpWindow.BackColor = System.Drawing.Color.FromArgb(0x5b, 0x7e, 0x96); } windows.Add(vpWindow); } // Minimize the parent form. this.WindowState = FormWindowState.Minimized; }