private void MainForm_Load(object sender, EventArgs e) { int index = 0; XmlSerializerFacade facade = new XmlSerializerFacade(typeof(Options), "options.config"); facade.Deserialize(); Options options = (Options)facade.Object; index = options.OS; toolStripComboBoxServerType.SelectedIndex = options.OS; }
private void toolStripComboBoxServerType_SelectedIndexChanged(object sender, EventArgs e) { int index = toolStripComboBoxServerType.SelectedIndex; switch (index) { case 0: osType = OSTypes.AIX; break; case 1: osType = OSTypes.HPUX; break; case 2: osType = OSTypes.Solaris; break; case 4: osType = OSTypes.Linux; break; case 5: osType = OSTypes.BSD; break; default: osType = OSTypes.AIX; break; } Options options = new Options(); options.OS = index; XmlSerializerFacade facade = new XmlSerializerFacade(typeof(Options), "options.config", options); facade.Serialize(); }