private void saveConfig_Click(object sender, RoutedEventArgs e) { //MessageBox.Show("Save file!"); t.TestConfigString.QCConnect.Domain = strDomainName; t.TestConfigString.QCConnect.Project = strProjectName; t.TestConfigString.QCConnect.ServerAddr = qcServerAddr.Text; t.TestConfigString.QCConnect.LoginName = qcLoginName.Text; t.TestConfigString.QCConnect.Password = DesEncDec.Encrypt(qcLoginPassword.Text); if (System.IO.File.Exists(configFilePath.Text)) { switch (System.Windows.MessageBox.Show("Do you want to overwrite the config file?", "Please confirm", MessageBoxButton.YesNoCancel)) { case MessageBoxResult.Yes: //TestConfigFile tConfig = new TestConfigFile(); //tConfig = t.TestConfigString; t.Save(configFilePath.Text); break; case MessageBoxResult.No: break; case MessageBoxResult.Cancel: default: break; } } else { t.Save(configFilePath.Text); } }
private void loadConfig_Click(object sender, RoutedEventArgs e) { if (System.IO.File.Exists(configFilePath.Text)) { //bool success = tConfig.Load(configFilePath.Text); bool success = t.Load(configFilePath.Text); if (success) { tConfig = t.TestConfigString; qcServerAddr.Text = tConfig.QCConnect.ServerAddr; qcLoginName.Text = tConfig.QCConnect.LoginName; qcLoginPassword.Text = DesEncDec.Decrypt(tConfig.QCConnect.Password); strDomainName = tConfig.QCConnect.Domain; strProjectName = tConfig.QCConnect.Project; isAutoSelectDomain = true; qcDomain.Items.Clear(); qcDomain.Items.Add(strDomainName); //qcDomain.SelectedIndex = 0; qcDomain.SelectedItem = strDomainName; isAutoSelectDomain = false; isAutoSelectProject = true; qcProject.Items.Clear(); qcProject.Items.Add(strProjectName); //qcProject.SelectedIndex = 0; qcProject.SelectedItem = strProjectName; isAutoSelectProject = false; } else { System.Windows.MessageBox.Show("Can't serialize this XML file!"); } } else { System.Windows.MessageBox.Show("Can't load file!"); } //FileStream fs = new FileStream(); }