/* Main Constructor */ public FormMain() { InitializeComponent(); // Reads the settings file XMLSettings.ReadAll(); testControlsVisible(); //_InitializeSettings(); pictureBoxSatisfactoryIcon.BringToFront(); pictureBoxSatisfactoryIcon.SizeMode = PictureBoxSizeMode.StretchImage; pictureBoxSatisfactoryIcon.Image = Image.FromFile("../../Images/Satisfactory-original.png"); // Binds the data sources to their perspective datagridviews //dgvMachines.DataSource = bindingSource_Machines; //dgvUsage.DataSource = bindingSource_Recipes; // For each machine in XMLSettings.AllMachines Add the Machine to the drop down box XMLSettings.AllMachines.ForEach(m => comboBoxMachine.Items.Add(m.Name)); if (comboBoxMachine.Items.Count > 0) { comboBoxMachine.SelectedIndex = 0; } // loops through available materials and adds them to totals list XMLSettings.AllMaterials.ForEach(m => _AddedMachineTotals.Add(new TotalInOut(m))); _AddedMachineTotals_RefreshAll(); }
private void Button3_Click(object sender, EventArgs e) { List <Machine> machines = XMLSettings.AllMachines; foreach (Machine newMachine in _newMachines) { foreach (Machine machine in machines.FindAll(m => newMachine.Name == m.Name)) { string msg = string.Format("There is already a machine with the name: {0}\r\nWould you like to replace it?", machine.Name); if (DialogResult.Yes == MessageBox.Show(msg, "Duplicate Machine", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { machine.Replace(newMachine); _newMachines.Remove(newMachine); } } } machines.AddRange(_newMachines); XMLSettings.WriteToXmlFile("Config\\Machines.xml", machines); }
private void Button1_Click(object sender, EventArgs e) { XMLSettings.WriteToXmlFile <List <Machine> >("test.xml", _newMachines); }
private void ButtonWriteTest_Click(object sender, EventArgs e) { XMLSettings.WriteAll("Test"); }
private void ButtonReadTest_Click(object sender, EventArgs e) { XMLSettings.ReadAll("Test"); }
private void ButtonWriteConf_Click(object sender, EventArgs e) { XMLSettings.WriteAll(); }
private void ButtonReadConf_Click(object sender, EventArgs e) { XMLSettings.ReadAll(); }