diff --git a/MarkDownEditor/Properties/Resources.Designer.cs b/MarkDownEditor/Properties/Resources.Designer.cs index 57ceca0..3663742 100644 --- a/MarkDownEditor/Properties/Resources.Designer.cs +++ b/MarkDownEditor/Properties/Resources.Designer.cs @@ -582,6 +582,15 @@ public static string InputLink { } } + /// + /// Looks up a localized string similar to Insert local image URL. + /// + public static string InsertLocalImage { + get { + return ResourceManager.GetString("InsertLocalImage", resourceCulture); + } + } + /// /// Looks up a localized string similar to International Settings. /// @@ -735,6 +744,15 @@ public static string NoCSS { } } + /// + /// Looks up a localized string similar to Online Image Storage Service. + /// + public static string OISS { + get { + return ResourceManager.GetString("OISS", resourceCulture); + } + } + /// /// Looks up a localized string similar to Online Image. /// @@ -1410,6 +1428,15 @@ public static string UploadLocalImage2Qiniu { } } + /// + /// Looks up a localized string similar to Upload Image To . + /// + public static string UploadToImageStorageService { + get { + return ResourceManager.GetString("UploadToImageStorageService", resourceCulture); + } + } + /// /// Looks up a localized string similar to Warning. /// diff --git a/MarkDownEditor/Properties/Resources.resx b/MarkDownEditor/Properties/Resources.resx index b15b776..5e032ff 100644 --- a/MarkDownEditor/Properties/Resources.resx +++ b/MarkDownEditor/Properties/Resources.resx @@ -582,4 +582,13 @@ QiniuUserScope + + Insert local image URL + + + Online Image Storage Service + + + Upload Image To + \ No newline at end of file diff --git a/MarkDownEditor/Properties/Resources.zh-CN.resx b/MarkDownEditor/Properties/Resources.zh-CN.resx index c719d6d..40ae7af 100644 --- a/MarkDownEditor/Properties/Resources.zh-CN.resx +++ b/MarkDownEditor/Properties/Resources.zh-CN.resx @@ -582,4 +582,13 @@ 七牛用户存储空间 + + 插入本地图片URL + + + 在线图片存储服务 + + + 上传至 + \ No newline at end of file diff --git a/MarkDownEditor/View/SettingsControl.xaml b/MarkDownEditor/View/SettingsControl.xaml index 110b91d..0b72921 100644 --- a/MarkDownEditor/View/SettingsControl.xaml +++ b/MarkDownEditor/View/SettingsControl.xaml @@ -66,7 +66,7 @@ - + diff --git a/MarkDownEditor/ViewModel/MainViewModel.cs b/MarkDownEditor/ViewModel/MainViewModel.cs index b3160ca..13a45f3 100644 --- a/MarkDownEditor/ViewModel/MainViewModel.cs +++ b/MarkDownEditor/ViewModel/MainViewModel.cs @@ -1,15 +1,11 @@ -using CefSharp; -using CefSharp.Wpf; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using ICSharpCode.AvalonEdit.Document; using Imgur.API.Authentication.Impl; using Imgur.API.Endpoints.Impl; using Imgur.API.Models; -using MahApps.Metro; using MahApps.Metro.Controls.Dialogs; using MarkDownEditor.Model; -using MarkDownEditor.View; using Microsoft.Practices.ServiceLocation; using Microsoft.Win32; using Qiniu.IO; @@ -17,7 +13,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Globalization; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -25,8 +20,6 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Media; namespace MarkDownEditor.ViewModel { @@ -1137,8 +1130,8 @@ public bool CanRedo { AffirmativeButtonText = Properties.Resources.OnlineImage, NegativeButtonText = Properties.Resources.Cancel, - FirstAuxiliaryButtonText = "Upload Image To " + currentImageStorageService, - SecondAuxiliaryButtonText = "Insert local image (maybe not avalible when exporting)", + FirstAuxiliaryButtonText = Properties.Resources.UploadToImageStorageService + currentImageStorageService, + SecondAuxiliaryButtonText = Properties.Resources.InsertLocalImage, ColorScheme = MetroDialogColorScheme.Accented }); @@ -1153,7 +1146,7 @@ public bool CanRedo } else if (ret == MessageDialogResult.FirstAuxiliary) //upload - { + { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = Properties.Resources.UploadImagesTitle; dlg.Filter = Properties.Resources.ImageFilter; @@ -1183,10 +1176,22 @@ public bool CanRedo await progress.CloseAsync(); await DialogCoordinator.Instance.ShowMessageAsync(this, Properties.Resources.Error, ex.Message, - MessageDialogStyle.Affirmative, new MetroDialogSettings(){ ColorScheme = MetroDialogColorScheme.Accented }); - } + MessageDialogStyle.Affirmative, new MetroDialogSettings() { ColorScheme = MetroDialogColorScheme.Accented }); + } } - } + } + else if (ret == MessageDialogResult.SecondAuxiliary) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Title = Properties.Resources.UploadImagesTitle; + dlg.Filter = Properties.Resources.ImageFilter; + if (dlg.ShowDialog() == true) + { + var uri = new Uri(dlg.FileName); + + insertUrl(uri.AbsoluteUri); + } + } }); public ICommand SeparateLineCommand => new RelayCommand(() =>