private void CopyCommandExecuted(object sender, ExecutedRoutedEventArgs args) { args.Handled = true; try { string text = XmlSerialization.Serialize <LineD[]>(_lines); Clipboard.SetText(text); } catch (Exception e) { MessageDialog.Show(this, "An error occurred while attempting to copy\n" + "the current line set to the clipboard.", Strings.ClipboardCopyError, e, MessageBoxButton.OK, WindowsUtility.GetSystemBitmap(MessageBoxImage.Error)); } }
private void MessageDialogCommandExecuted(object sender, ExecutedRoutedEventArgs args) { args.Handled = true; string summary = "This is a brief summary of the message."; string details = "This is a detailed description of the message, " + "including perhaps a lengthy exception stack trace.\n\n" + "MessageDialog combines the standard MessageBox icons and buttons " + "with a scrollable text box for detailed information. " + "You can resize the dialog to increase the size of this scrollable text box."; ImageSource icon = WindowsUtility.GetSystemBitmap(MessageBoxImage.Information); MessageDialog.Show(this, summary, "Message Dialog", details, null, MessageBoxButton.OKCancel, icon); }
private void PasteCommandExecuted(object sender, ExecutedRoutedEventArgs args) { args.Handled = true; try { string text = Clipboard.GetText(); LineD[] lines = XmlSerialization.Deserialize <LineD[]>(text); DrawIntersections(lines); } catch (Exception e) { MessageDialog.Show(this, "An error occurred while attempting to\n" + "paste a new line set from the clipboard.", Strings.ClipboardPasteError, e, MessageBoxButton.OK, WindowsUtility.GetSystemBitmap(MessageBoxImage.Error)); } }