Skip to content

Commit

Permalink
v0.3.2
Browse files Browse the repository at this point in the history
finished update notify
  • Loading branch information
chenguanzhou committed Feb 27, 2016
1 parent 14cbb0b commit 674d30f
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 45 deletions.
2 changes: 1 addition & 1 deletion LatestVersion.json
Original file line number Diff line number Diff line change
@@ -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"
}
Expand Down
4 changes: 2 additions & 2 deletions MarkDownEditor.Setup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?define MarkDownEditor_TargetDir=$(var.MarkDownEditor.TargetDir)?>
<Product Id="{CA7EEC8B-E67F-4C6C-B7E1-29EC71D11CFA}" Name="MarkDownEditor" Language="1033" Version="0.3.1" Manufacturer="Chen Guanzhou" UpgradeCode="5d30c639-0761-41c7-b4ef-e0c1b75eeb3f">
<Package Id="{E46D6CA0-5477-439F-BDEE-8B287F919383}" InstallerVersion="405" Compressed="yes" InstallScope="perMachine"/>
<Product Id="{5759D6A1-F473-4040-B9A4-597E3D3BA973}" Name="MarkDownEditor" Language="1033" Version="0.3.2" Manufacturer="Chen Guanzhou" UpgradeCode="5d30c639-0761-41c7-b4ef-e0c1b75eeb3f">
<Package Id="{B43EDB7A-D843-4514-A3DD-403A18BBF74E}" InstallerVersion="405" Compressed="yes" InstallScope="perMachine"/>

<MajorUpgrade Schedule="afterInstallInitialize"
DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
Expand Down
1 change: 1 addition & 0 deletions MarkDownEditor/MarkDownEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="alipay.jpg" />
<Content Include="css\Modest.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
4 changes: 2 additions & 2 deletions MarkDownEditor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
90 changes: 90 additions & 0 deletions MarkDownEditor/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions MarkDownEditor/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -510,4 +510,34 @@
<data name="OpenThisFolder" xml:space="preserve">
<value>Open This Folder</value>
</data>
<data name="CheckForUpdate" xml:space="preserve">
<value>Check for update</value>
</data>
<data name="CurrentVersion" xml:space="preserve">
<value>Current Version</value>
</data>
<data name="Donate" xml:space="preserve">
<value>Donate</value>
</data>
<data name="DoNotRemindForThisUpdate" xml:space="preserve">
<value>Don't remind for this update!</value>
</data>
<data name="DownloadNow" xml:space="preserve">
<value>Download Now</value>
</data>
<data name="LatestVersion" xml:space="preserve">
<value>Latest Version</value>
</data>
<data name="NewVersionIsReleased" xml:space="preserve">
<value>New version is released!</value>
</data>
<data name="Update" xml:space="preserve">
<value>Update</value>
</data>
<data name="UpdateFailed" xml:space="preserve">
<value>Fetch App update information failed!</value>
</data>
<data name="UpdateInfo" xml:space="preserve">
<value>Update Info</value>
</data>
</root>
30 changes: 30 additions & 0 deletions MarkDownEditor/Properties/Resources.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -510,4 +510,34 @@
<data name="OpenThisFolder" xml:space="preserve">
<value>打开该文件夹</value>
</data>
<data name="CheckForUpdate" xml:space="preserve">
<value>检查更新</value>
</data>
<data name="CurrentVersion" xml:space="preserve">
<value>当前版本</value>
</data>
<data name="Donate" xml:space="preserve">
<value>捐助</value>
</data>
<data name="DoNotRemindForThisUpdate" xml:space="preserve">
<value>此版本不再提醒</value>
</data>
<data name="DownloadNow" xml:space="preserve">
<value>现在下载</value>
</data>
<data name="LatestVersion" xml:space="preserve">
<value>最新版本</value>
</data>
<data name="NewVersionIsReleased" xml:space="preserve">
<value>新版本已发布!</value>
</data>
<data name="Update" xml:space="preserve">
<value>更新</value>
</data>
<data name="UpdateFailed" xml:space="preserve">
<value>获取升级信息失败</value>
</data>
<data name="UpdateInfo" xml:space="preserve">
<value>升级信息</value>
</data>
</root>
46 changes: 30 additions & 16 deletions MarkDownEditor/View/AboutControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,39 @@
xmlns:local="clr-namespace:MarkDownEditor.View"
mc:Ignorable="d"
d:DesignHeight="500" d:DesignWidth="400">
<StackPanel>
<Image Margin="50" Source="../MarkdownEditorLogo.png"></Image>
<StackPanel Margin="20">
<StackPanel.Resources>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="3"></Setter>
</Style>
</StackPanel.Resources>
<TextBlock Text="{Binding ApplicationName}" FontSize="25"></TextBlock>
<TextBlock Text="{Binding VersionNumber}" FontSize="16"></TextBlock>
<TextBlock FontSize="16">
<ScrollViewer>
<StackPanel>
<Image Margin="50" Source="../MarkdownEditorLogo.png"></Image>
<StackPanel Margin="20">
<StackPanel.Resources>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="3"></Setter>
</Style>
</StackPanel.Resources>
<TextBlock Text="{Binding ApplicationName}" FontSize="25"></TextBlock>
<TextBlock Text="{Binding VersionNumber}" FontSize="16"></TextBlock>
<TextBlock FontSize="16">
<Hyperlink Foreground="{DynamicResource WhiteBrush}" Command="{Binding ClickSourceCodeWebCommand}">
<TextBlock Text="{x:Static p:Resources.SourceCode}">
<TextBlock.Style>
<Style></Style>
</TextBlock.Style>
<TextBlock.Style>
<Style></Style>
</TextBlock.Style>
</TextBlock>
</Hyperlink>
</TextBlock>
</StackPanel>
</StackPanel>
<TextBlock FontSize="16">
<Hyperlink Foreground="{DynamicResource WhiteBrush}" Command="{Binding CheckForUpdateCommand}">
<TextBlock Text="{x:Static p:Resources.CheckForUpdate}">
<TextBlock.Style>
<Style></Style>
</TextBlock.Style>
</TextBlock>
</Hyperlink>
</TextBlock>
<Expander Margin="0,20,0,0" Header="{x:Static p:Resources.Donate}" FontSize="16">
<Image Source="/MarkDownEditor;component/alipay.jpg"></Image>
</Expander>
</StackPanel>
</StackPanel>
</ScrollViewer>
</UserControl>
47 changes: 23 additions & 24 deletions MarkDownEditor/ViewModel/AboutViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("\"", "");
Expand All @@ -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)
Expand All @@ -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);
}
Expand All @@ -116,7 +114,7 @@ private async void CheckForUpdate()
}
catch(Exception)
{
ViewModelLocator.Main.StatusBarText = "Fetch App update information failed!";
ViewModelLocator.Main.StatusBarText = Properties.Resources.UpdateFailed;
}
}

Expand Down Expand Up @@ -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)
Expand Down
Binary file added MarkDownEditor/alipay.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 674d30f

Please sign in to comment.