private void deleteRangeBtn_Click(object sender, System.EventArgs e) { // Show DeleteRangeForm as Dialog DeleteRange rangeDialog = new DeleteRange(); DialogResult dr = rangeDialog.ShowDialog(this); if (dr != DialogResult.OK) { return; } // Find all of the conferences we will delete (in an ineffecient manner) DateTime start = rangeDialog.StartDateTime; DateTime end = rangeDialog.EndDateTime; TreeNode[] confs = conferencesTreeView.GetConferencesInRange(start, end); // Check for no conferences found if (confs.Length == 0) { RtlAwareMessageBox.Show(this, Strings.InvalidRangeText, Strings.InvalidRangeTitle, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } else { // Are you sure? String areYouSure = String.Format(CultureInfo.CurrentCulture, Strings.ConfirmDeleteText, confs.Length, start.ToLongDateString(), start.ToShortTimeString(), end.ToLongDateString(), end.ToShortTimeString()); dr = RtlAwareMessageBox.Show(this, areYouSure, Strings.ConfirmDeleteTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); if (dr != DialogResult.Yes) { return; } // Display wait cursor Cursor.Current = Cursors.WaitCursor; // Delete the conferences conferencesTreeView.DeleteConferences(confs); // Return to normal cursor Cursor.Current = Cursors.Default; } }
private void deleteRangeBtn_Click(object sender, System.EventArgs e) { // Show DeleteRangeForm as Dialog DeleteRange rangeDialog = new DeleteRange(); DialogResult dr = rangeDialog.ShowDialog(this); if (dr != DialogResult.OK) { return; } // Find all of the conferences we will delete (in an ineffecient manner) DateTime start = rangeDialog.StartDateTime; DateTime end = rangeDialog.EndDateTime; TreeNode[] confs = conferencesTreeView.GetConferencesInRange(start, end); // Check for no conferences found if (confs.Length == 0) { MessageBox.Show(this, "No conferences were found during that time period.", "Invalid Range", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { // Are you sure? String areYouSure = String.Format( "Are you sure you want to delete {0} conferences\n" + "created from {1} at {2}\nto {3} at {4}?", confs.Length, start.ToLongDateString(), start.ToShortTimeString(), end.ToLongDateString(), end.ToShortTimeString()); dr = MessageBox.Show(this, areYouSure, "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr != DialogResult.Yes) { return; } // Display wait cursor Cursor.Current = Cursors.WaitCursor; // Delete the conferences conferencesTreeView.DeleteConferences(confs); // Return to normal cursor Cursor.Current = Cursors.Default; } }
private void deleteRangeBtn_Click(object sender, System.EventArgs e) { // Show DeleteRangeForm as Dialog DeleteRange rangeDialog = new DeleteRange(); DialogResult dr = rangeDialog.ShowDialog(this); if( dr != DialogResult.OK ) return; // Find all of the conferences we will delete (in an ineffecient manner) DateTime start = rangeDialog.StartDateTime; DateTime end = rangeDialog.EndDateTime; TreeNode[] confs = conferencesTreeView.GetConferencesInRange(start, end); // Check for no conferences found if( confs.Length == 0 ) { MessageBox.Show(this, "No conferences were found during that time period.", "Invalid Range", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { // Are you sure? String areYouSure = String.Format( "Are you sure you want to delete {0} conferences\n"+ "created from {1} at {2}\nto {3} at {4}?", confs.Length, start.ToLongDateString(), start.ToShortTimeString(), end.ToLongDateString(), end.ToShortTimeString()); dr = MessageBox.Show(this, areYouSure, "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if( dr != DialogResult.Yes ) return; // Display wait cursor Cursor.Current = Cursors.WaitCursor; // Delete the conferences conferencesTreeView.DeleteConferences(confs); // Return to normal cursor Cursor.Current = Cursors.Default; } }
private void deleteRangeBtn_Click(object sender, System.EventArgs e) { // Show DeleteRangeForm as Dialog DeleteRange rangeDialog = new DeleteRange(); DialogResult dr = rangeDialog.ShowDialog(this); if( dr != DialogResult.OK ) return; // Find all of the conferences we will delete (in an ineffecient manner) DateTime start = rangeDialog.StartDateTime; DateTime end = rangeDialog.EndDateTime; TreeNode[] confs = conferencesTreeView.GetConferencesInRange(start, end); // Check for no conferences found if( confs.Length == 0 ) { RtlAwareMessageBox.Show(this, Strings.InvalidRangeText, Strings.InvalidRangeTitle, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } else { // Are you sure? String areYouSure = String.Format(CultureInfo.CurrentCulture, Strings.ConfirmDeleteText, confs.Length, start.ToLongDateString(), start.ToShortTimeString(), end.ToLongDateString(), end.ToShortTimeString()); dr = RtlAwareMessageBox.Show(this, areYouSure, Strings.ConfirmDeleteTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); if( dr != DialogResult.Yes ) return; // Display wait cursor Cursor.Current = Cursors.WaitCursor; // Delete the conferences conferencesTreeView.DeleteConferences(confs); // Return to normal cursor Cursor.Current = Cursors.Default; } }