diff --git a/LatestVersion.json b/LatestVersion.json index b64ea7d..0c751fe 100644 --- a/LatestVersion.json +++ b/LatestVersion.json @@ -1,7 +1,7 @@ { "AppName": "MarkDownEditor", "LatestVersion": { - "Version": "0.3.3.0", + "Version": "0.3.2.0", "UpdateTime": "2016/2/21", "Description": "1.Switch CSS Files\n2.Add Custom CSS Files" } diff --git a/MarkDownEditor.Setup/Product.wxs b/MarkDownEditor.Setup/Product.wxs index 5ea5eca..e638b70 100644 --- a/MarkDownEditor.Setup/Product.wxs +++ b/MarkDownEditor.Setup/Product.wxs @@ -2,8 +2,8 @@ - - + + diff --git a/MarkDownEditor/MarkDownEditor.csproj b/MarkDownEditor/MarkDownEditor.csproj index 1067fa3..39f47d1 100644 --- a/MarkDownEditor/MarkDownEditor.csproj +++ b/MarkDownEditor/MarkDownEditor.csproj @@ -274,6 +274,7 @@ + PreserveNewest diff --git a/MarkDownEditor/Properties/AssemblyInfo.cs b/MarkDownEditor/Properties/AssemblyInfo.cs index a65b5e0..5bb23c7 100644 --- a/MarkDownEditor/Properties/AssemblyInfo.cs +++ b/MarkDownEditor/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.3.1.0")] -[assembly: AssemblyFileVersion("0.3.1.0")] +[assembly: AssemblyVersion("0.3.2.0")] +[assembly: AssemblyFileVersion("0.3.2.0")] diff --git a/MarkDownEditor/Properties/Resources.Designer.cs b/MarkDownEditor/Properties/Resources.Designer.cs index 955e5cf..8bf25aa 100644 --- a/MarkDownEditor/Properties/Resources.Designer.cs +++ b/MarkDownEditor/Properties/Resources.Designer.cs @@ -114,6 +114,15 @@ public static string Characters { } } + /// + /// Looks up a localized string similar to Check for update. + /// + public static string CheckForUpdate { + get { + return ResourceManager.GetString("CheckForUpdate", resourceCulture); + } + } + /// /// Looks up a localized string similar to Close. /// @@ -168,6 +177,15 @@ public static string CopyCSS { } } + /// + /// Looks up a localized string similar to Current Version. + /// + public static string CurrentVersion { + get { + return ResourceManager.GetString("CurrentVersion", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cut. /// @@ -213,6 +231,24 @@ public static string Document { } } + /// + /// Looks up a localized string similar to Donate. + /// + public static string Donate { + get { + return ResourceManager.GetString("Donate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Don't remind for this update!. + /// + public static string DoNotRemindForThisUpdate { + get { + return ResourceManager.GetString("DoNotRemindForThisUpdate", resourceCulture); + } + } + /// /// Looks up a localized string similar to Don't save. /// @@ -222,6 +258,15 @@ public static string DoNotSave { } } + /// + /// Looks up a localized string similar to Download Now. + /// + public static string DownloadNow { + get { + return ResourceManager.GetString("DownloadNow", resourceCulture); + } + } + /// /// Looks up a localized string similar to Editing. /// @@ -537,6 +582,15 @@ public static string LanguageSwitch { } } + /// + /// Looks up a localized string similar to Latest Version. + /// + public static string LatestVersion { + get { + return ResourceManager.GetString("LatestVersion", resourceCulture); + } + } + /// /// Looks up a localized string similar to Lines. /// @@ -618,6 +672,15 @@ public static string NewDocumentCreated { } } + /// + /// Looks up a localized string similar to New version is released!. + /// + public static string NewVersionIsReleased { + get { + return ResourceManager.GetString("NewVersionIsReleased", resourceCulture); + } + } + /// /// Looks up a localized string similar to No CSS. /// @@ -1176,6 +1239,33 @@ public static string UntitledTitle { } } + /// + /// Looks up a localized string similar to Update. + /// + public static string Update { + get { + return ResourceManager.GetString("Update", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Fetch App update information failed!. + /// + public static string UpdateFailed { + get { + return ResourceManager.GetString("UpdateFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Update Info. + /// + public static string UpdateInfo { + get { + return ResourceManager.GetString("UpdateInfo", resourceCulture); + } + } + /// /// Looks up a localized string similar to Upload Images (Don't upload illegal images). /// diff --git a/MarkDownEditor/Properties/Resources.resx b/MarkDownEditor/Properties/Resources.resx index 60e3bc0..31d35c1 100644 --- a/MarkDownEditor/Properties/Resources.resx +++ b/MarkDownEditor/Properties/Resources.resx @@ -510,4 +510,34 @@ Open This Folder + + Check for update + + + Current Version + + + Donate + + + Don't remind for this update! + + + Download Now + + + Latest Version + + + New version is released! + + + Update + + + Fetch App update information failed! + + + Update Info + \ No newline at end of file diff --git a/MarkDownEditor/Properties/Resources.zh-CN.resx b/MarkDownEditor/Properties/Resources.zh-CN.resx index e7ae283..86eafa7 100644 --- a/MarkDownEditor/Properties/Resources.zh-CN.resx +++ b/MarkDownEditor/Properties/Resources.zh-CN.resx @@ -510,4 +510,34 @@ 打开该文件夹 + + 检查更新 + + + 当前版本 + + + 捐助 + + + 此版本不再提醒 + + + 现在下载 + + + 最新版本 + + + 新版本已发布! + + + 更新 + + + 获取升级信息失败 + + + 升级信息 + \ No newline at end of file diff --git a/MarkDownEditor/View/AboutControl.xaml b/MarkDownEditor/View/AboutControl.xaml index d8b44f6..a4f53f8 100644 --- a/MarkDownEditor/View/AboutControl.xaml +++ b/MarkDownEditor/View/AboutControl.xaml @@ -7,25 +7,39 @@ xmlns:local="clr-namespace:MarkDownEditor.View" mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="400"> - - - - - - - - - + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + diff --git a/MarkDownEditor/ViewModel/AboutViewModel.cs b/MarkDownEditor/ViewModel/AboutViewModel.cs index 57b5626..779146b 100644 --- a/MarkDownEditor/ViewModel/AboutViewModel.cs +++ b/MarkDownEditor/ViewModel/AboutViewModel.cs @@ -64,6 +64,12 @@ public bool ShowAboutControl public ICommand ShowAboutCommand => new RelayCommand(() => ShowAboutControl = true); public ICommand ClickSourceCodeWebCommand => new RelayCommand(() => Process.Start("https://github.com/chenguanzhou/MarkDownEditor")); + public ICommand CheckForUpdateCommand => new RelayCommand(()=> + { + Properties.Settings.Default.DoNotRemindUpdate = false; + Properties.Settings.Default.Save(); + CheckForUpdate(); + }); public string ApplicationName => Assembly.GetEntryAssembly().GetCustomAttributesData()[3].ConstructorArguments[0].ToString().Replace("\"", ""); @@ -80,7 +86,7 @@ private async void CheckForUpdate() using (var client = new WebClient()) { string jsonPath = Path.GetTempFileName() + ".json"; - await client.DownloadFileTaskAsync(new Uri("https://raw.githubusercontent.com/chenguanzhou/MarkDownEditor/develop/LatestVersion.json"), jsonPath); + await client.DownloadFileTaskAsync(new Uri(@"https://raw.githubusercontent.com/chenguanzhou/MarkDownEditor/master/LatestVersion.json"), jsonPath); JObject obj = JObject.Parse(File.ReadAllText(jsonPath)); if (obj["AppName"].ToString() != ApplicationName) @@ -92,22 +98,14 @@ private async void CheckForUpdate() LatestVersionNumber = latestVersionString; if (CompareVersion(latestVersionString, VersionNumber) >0) { - if (Properties.Settings.Default.DoNotRemindUpdate) + if (CompareVersion(latestVersionString, Properties.Settings.Default.LastLatestVersion) > 0) { - if (CompareVersion(latestVersionString, Properties.Settings.Default.LastLatestVersion) > 0) - { - Properties.Settings.Default.DoNotRemindUpdate = false; - Properties.Settings.Default.LastLatestVersion = latestVersionString; - Properties.Settings.Default.Save(); - - NotifyUpdate(latestVersionString, descriptionString); - } - else - { - return; - } + Properties.Settings.Default.DoNotRemindUpdate = false; + Properties.Settings.Default.LastLatestVersion = latestVersionString; + Properties.Settings.Default.Save(); } - else + + if (!Properties.Settings.Default.DoNotRemindUpdate) { NotifyUpdate(latestVersionString, descriptionString); } @@ -116,7 +114,7 @@ private async void CheckForUpdate() } catch(Exception) { - ViewModelLocator.Main.StatusBarText = "Fetch App update information failed!"; + ViewModelLocator.Main.StatusBarText = Properties.Resources.UpdateFailed; } } @@ -144,14 +142,15 @@ int CompareVersion(string left, string right) private async void NotifyUpdate(string latestVersionString, string descriptionString) { - var ret = await DialogCoordinator.Instance.ShowMessageAsync(ViewModelLocator.Main, "Update", $"New version {latestVersionString} is released!\n\nUpdate Info:\n{descriptionString}", - MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary, new MetroDialogSettings() - { - ColorScheme = MetroDialogColorScheme.Accented, - AffirmativeButtonText = "Download Now", - NegativeButtonText = Properties.Resources.Cancel, - FirstAuxiliaryButtonText = "Don't remind for this update!" - }); + var ret = await DialogCoordinator.Instance.ShowMessageAsync(ViewModelLocator.Main, Properties.Resources.Update, + $"{Properties.Resources.NewVersionIsReleased}\n\n{Properties.Resources.LatestVersion}: {latestVersionString}\n{Properties.Resources.CurrentVersion}: {VersionNumber}\n{Properties.Resources.UpdateInfo}:\n{descriptionString}", + MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary, new MetroDialogSettings() + { + ColorScheme = MetroDialogColorScheme.Accented, + AffirmativeButtonText = Properties.Resources.DownloadNow, + NegativeButtonText = Properties.Resources.Cancel, + FirstAuxiliaryButtonText = Properties.Resources.DoNotRemindForThisUpdate + }); if (ret == MessageDialogResult.Affirmative) Process.Start("https://github.com/chenguanzhou/MarkDownEditor/releases"); else if (ret == MessageDialogResult.FirstAuxiliary) diff --git a/MarkDownEditor/alipay.jpg b/MarkDownEditor/alipay.jpg new file mode 100644 index 0000000..506701d Binary files /dev/null and b/MarkDownEditor/alipay.jpg differ diff --git a/Readme.md b/Readme.md index 8a733e8..6680caa 100644 --- a/Readme.md +++ b/Readme.md @@ -80,3 +80,7 @@ For a WPF project, I recommand VS2015 Community Edition to build. - [Markdown CSS](https://github.com/simonlc/Markdown-CSS) - [github.css](https://gist.github.com/andyferra/2554919) - [分享一个Markdown css](http://www.oschina.net/question/124879_76399?fromerr=LWBSwh1E) + +# Donate + +![支付宝](MarkDownEditor/alipay.jpg)