private void SaveExecute() { var handle = InputUtils.FocusedControlInActiveWindow(); var content = InputUtils.GetText(handle); try { var drawingGroup = SvgUtils.ConvertToDrawingGroup(content); if (drawingGroup.Children.Count < 1) { throw new XmlException(); } var dialog = new SaveFileDialog { Filter = "SVG|*.svg" }; if (!dialog.ShowDialog(Application.Current.MainWindow).Value) { return; } File.WriteAllText(dialog.FileName, content); this.notificationService.Show(new NotificationContent { Content = GetNotificationContent(LocalizationManager.GetLocalizationString(@"Main.SVGSaved"), drawingGroup), Title = AppTitle, Type = NotificationType.Success }); } catch (XmlException) { this.ShowInvalidSvgMessage(); } }
private void CopyXamlExecute() { var handle = InputUtils.FocusedControlInActiveWindow(); var content = InputUtils.GetText(handle); try { var drawingGroup = SvgUtils.ConvertToDrawingGroup(content); if (drawingGroup.Children.Count < 1) { throw new XmlException(); } if (ClipboardHelper.SetText(SvgUtils.ConvertToXaml(content))) { this.notificationService.Show(new NotificationContent { Content = GetNotificationContent(LocalizationManager.GetLocalizationString(@"Main.XAMLCopied"), drawingGroup), Title = AppTitle, Type = NotificationType.Success }); } } catch (XmlException) { this.ShowInvalidSvgMessage(); } }