public static MachineCollection LoadSettings(string path) { MachineCollection machineCollection; if (File.Exists(path)) { XmlSerializer deserializer = new XmlSerializer(typeof(MachineCollection)); using (TextReader textReader = new StreamReader(path)) { try { machineCollection = (MachineCollection)deserializer.Deserialize(textReader); machineCollection.Initialize(); } catch (System.Exception ex) { machineCollection = new MachineCollection(); Log.LogError("", ex); } } } else { machineCollection = new MachineCollection(); } return machineCollection; }
public SettingsForm(MachineCollection machineCollection) { InitializeComponent(); m_MachineCollection = machineCollection; }
private void LoadSettings() { m_MachineCollection = MachineCollection.LoadSettings(SettingsPath()); }
private void loadSettingsToolStripMenuItem_Click(object sender, EventArgs e) { if (DialogResult.OK == openFileDialog1.ShowDialog()) { m_MachineCollection = MachineCollection.LoadSettings(openFileDialog1.FileName); InitializeGrid(); } }