private void modifyAutosavesToolStripMenuItem_Click(object sender, EventArgs e) { frmAutosaves formAutosaves = new frmAutosaves(); formAutosaves.ShowDialog(); }
private void btnSaveProfile_Click(object sender, EventArgs e) { if (cbProfiles.Text == "") { MessageBox.Show("Please enter a profile name before attempting to save the profile."); cbProfiles.Focus(); return; } if (tbECID.Text.Length == 0) { MessageBox.Show("You must enter a device ECID before attempting to save the profile."); tbECID.Focus(); return; } if (chkSchedulingEnabled.Checked) { using (Microsoft.Win32.TaskScheduler.TaskService ts = new Microsoft.Win32.TaskScheduler.TaskService()) { Microsoft.Win32.TaskScheduler.Task t = ts.GetTask(frmAutosaves.taskName); if (t == null) { MessageBox.Show("You selected to automatically check and save blobs for this profile, but you haven't set up autochecking. If you would like to use the autocheck feature, please enable it now."); frmAutosaves formAutosaves = new frmAutosaves(); formAutosaves.ShowDialog(); } } } try { string identifier = ""; if (cbModel.Text.Length > 0) { identifier = cbModel.Text.Substring(cbModel.Text.IndexOf("(") + 1); identifier = identifier.Substring(0, identifier.LastIndexOf(")")); } StringBuilder sb = new StringBuilder(); sb.AppendLine("SchedulingEnabled:" + chkSchedulingEnabled.Checked); sb.AppendLine("ECID:" + tbECID.Text); sb.AppendLine("DeviceType:" + cbDevice.Text); sb.AppendLine("Identifier:" + identifier); sb.AppendLine("InternalName:" + cbBoardConfig.Text); sb.AppendLine("Apnonce:" + cbApnonce.Text); sb.Append("ApnonceList:"); for (int i = 0; i < cbApnonce.Items.Count; i++) { string apnonce = cbApnonce.GetItemText(cbApnonce.Items[i]); if (apnonce.Length == 0) { continue; } sb.Append(";" + apnonce); // Preceeding the apnonce with a semicolon will handle adding the first blank item automatically } File.WriteAllText(Path.Combine(pathProfiles, cbProfiles.Text + ".txt"), sb.ToString()); PopupNotifier popup = PopupHelper.GeneratePopup("The profile was saved successfully."); popup.Popup(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message + "\n\n" + ex.StackTrace); } RefreshProfiles(); }