mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Add About Page.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
$root = (split-path -parent $MyInvocation.MyCommand.Definition) + '\..\..'
|
$root = (split-path -parent $MyInvocation.MyCommand.Definition) + '\..\..'
|
||||||
Write-Host $root
|
Write-Host $root
|
||||||
$version = [System.Reflection.Assembly]::LoadFile("$root\Output\Release\Wox.Plugin.dll").GetName().Version
|
$version = [System.Reflection.Assembly]::LoadFile("$root\Output\Release\Wox.Plugin.dll").GetName().Version
|
||||||
$versionStr = "{0}.{1}.{2}" -f ($version.Major, $version.Minor, $version.Build)
|
$versionStr = "{0}.{1}.{2}.{3}" -f ($version.Major, $version.Minor, $version.Build, $version.Revision)
|
||||||
|
|
||||||
Write-Host "Setting .nuspec version tag to $versionStr"
|
Write-Host "Setting .nuspec version tag to $versionStr"
|
||||||
|
|
||||||
|
|||||||
@@ -309,5 +309,26 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem Header="About">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="80"></ColumnDefinition>
|
||||||
|
<ColumnDefinition></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="30"></RowDefinition>
|
||||||
|
<RowDefinition Height="30"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="0" Margin="6">Website:</TextBlock>
|
||||||
|
<TextBlock Grid.Column="1" Grid.Row="0" Margin="6" HorizontalAlignment="Left" Cursor="Hand" MouseUp="tbWebsite_MouseUp" x:Name="tbWebsite" Foreground="Blue" Text="http://www.getwox.com"></TextBlock>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="1" Margin="6">Version:</TextBlock>
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal">
|
||||||
|
<TextBlock Margin="6" HorizontalAlignment="Left" x:Name="tbVersion" Text="1.0.0"></TextBlock>
|
||||||
|
<TextBlock Margin="6" HorizontalAlignment="Left" Cursor="Hand" MouseUp="tbNewVersionAvailable_MouseUp" x:Name="tbNewVersionAvailable" Foreground="Blue" Text="1.1.0 Available"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -15,6 +16,7 @@ using Wox.Plugin;
|
|||||||
using Wox.Helper;
|
using Wox.Helper;
|
||||||
using Wox.Plugin.SystemPlugins;
|
using Wox.Plugin.SystemPlugins;
|
||||||
using Wox.PluginLoader;
|
using Wox.PluginLoader;
|
||||||
|
using Wox.Update;
|
||||||
using Application = System.Windows.Forms.Application;
|
using Application = System.Windows.Forms.Application;
|
||||||
using File = System.IO.File;
|
using File = System.IO.File;
|
||||||
using MessageBox = System.Windows.MessageBox;
|
using MessageBox = System.Windows.MessageBox;
|
||||||
@@ -221,6 +223,21 @@ namespace Wox
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region About
|
||||||
|
|
||||||
|
tbVersion.Text = ConfigurationManager.AppSettings["version"];
|
||||||
|
Release newRelease = new UpdateChecker().CheckUpgrade();
|
||||||
|
if (newRelease == null)
|
||||||
|
{
|
||||||
|
tbNewVersionAvailable.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tbNewVersionAvailable.Text = newRelease.version + " available";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
settingsLoaded = true;
|
settingsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,5 +715,19 @@ namespace Wox
|
|||||||
MessageBox.Show("Proxy connect failed.");
|
MessageBox.Show("Proxy connect failed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tbWebsite_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Process.Start("http://www.getwox.com");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbNewVersionAvailable_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Release newRelease = new UpdateChecker().CheckUpgrade();
|
||||||
|
if (newRelease != null)
|
||||||
|
{
|
||||||
|
Process.Start("http://www.getwox.com/release/" + newRelease.version);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,16 +13,19 @@ namespace Wox.Update
|
|||||||
{
|
{
|
||||||
public class UpdateChecker
|
public class UpdateChecker
|
||||||
{
|
{
|
||||||
private string updateURL = "https://api.getwox.com/release/latest/";
|
private const string updateURL = "https://api.getwox.com/release/latest/";
|
||||||
|
private static Release newRelease;
|
||||||
|
private static bool checkedUpdate = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If new release is available, then return the new release
|
/// If new release is available, then return the new release
|
||||||
/// otherwise, return null
|
/// otherwise, return null
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Release CheckUpgrade()
|
public Release CheckUpgrade(bool forceCheck = false)
|
||||||
{
|
{
|
||||||
Release release = null;
|
if (checkedUpdate && !forceCheck) return newRelease;
|
||||||
|
|
||||||
HttpWebResponse response = HttpRequest.CreateGetHttpResponse(updateURL, HttpProxy.Instance);
|
HttpWebResponse response = HttpRequest.CreateGetHttpResponse(updateURL, HttpProxy.Instance);
|
||||||
Stream s = response.GetResponseStream();
|
Stream s = response.GetResponseStream();
|
||||||
if (s != null)
|
if (s != null)
|
||||||
@@ -31,20 +34,20 @@ namespace Wox.Update
|
|||||||
string json = reader.ReadToEnd();
|
string json = reader.ReadToEnd();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
release = JsonConvert.DeserializeObject<Release>(json);
|
newRelease = JsonConvert.DeserializeObject<Release>(json);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsNewerThanCurrent(release))
|
if (!IsNewerThanCurrent(newRelease))
|
||||||
{
|
{
|
||||||
return null;
|
newRelease = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return release;
|
checkedUpdate = true;
|
||||||
|
return newRelease;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsNewerThanCurrent(Release release)
|
private bool IsNewerThanCurrent(Release release)
|
||||||
|
|||||||
Reference in New Issue
Block a user