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(); } }
public InfoWindowAdapter(Context context) { this.context = context; this.favManager = new FavoriteManager(context); bikeDrawable = SvgUtils.GetDrawableFromSvgRes(context.Resources, Resource.Raw.bike); lockDrawable = SvgUtils.GetDrawableFromSvgRes(context.Resources, Resource.Raw.ic_lock); starOnDrawable = SvgUtils.GetDrawableFromSvgRes(context.Resources, Resource.Raw.star_on); starOffDrawable = SvgUtils.GetDrawableFromSvgRes(context.Resources, Resource.Raw.star_off); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (targetType != typeof(Dictionary <string, string>)) { throw new InvalidOperationException("The target must be a Dictionary<string, string>"); } if (!(value is bool)) { throw new InvalidOperationException("The value must be a bool"); } return(SvgUtils.ReplaceStringMap((bool)value ? _trueColor : _falseColor, _replaceTitle, _replaceText)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (targetType != typeof(Dictionary <string, string>)) { throw new InvalidOperationException("The target must be a Dictionary<string, string>"); } if (!(value is Color color)) { throw new InvalidOperationException("The value must be a color"); } return(SvgUtils.ReplaceStringMap(color, replaceText: _replacementText)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (targetType != typeof(Dictionary <string, string>)) { throw new InvalidOperationException("The target must be a Dictionary<string, string>"); } if (!(value is Tier tier)) { throw new InvalidOperationException("The value must be a Tier"); } return(SvgUtils.ReplaceStringMap(tier.ToTierColor(), replaceText: "\"#00ff00\"")); }