mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-15 03:59:15 +08:00
Add new version window
This commit is contained in:
parent
6c94c3aa7b
commit
3e5288836d
@ -203,7 +203,11 @@ namespace Wox
|
|||||||
Release release = new UpdateChecker().CheckUpgrade();
|
Release release = new UpdateChecker().CheckUpgrade();
|
||||||
if (release != null && !UserSettingStorage.Instance.DontPromptUpdateMsg)
|
if (release != null && !UserSettingStorage.Instance.DontPromptUpdateMsg)
|
||||||
{
|
{
|
||||||
ShowMsg(string.Format("New version {0} available!",release.version),string.Empty,string.Empty);
|
Dispatcher.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
NewVersionWindow newVersinoWindow = new NewVersionWindow();
|
||||||
|
newVersinoWindow.Show();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ namespace Wox
|
|||||||
Release newRelease = new UpdateChecker().CheckUpgrade();
|
Release newRelease = new UpdateChecker().CheckUpgrade();
|
||||||
if (newRelease != null)
|
if (newRelease != null)
|
||||||
{
|
{
|
||||||
Process.Start("http://www.getwox.com/release/" + newRelease.version);
|
Process.Start("http://www.getwox.com/release/version/" + newRelease.version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
Wox/Update/NewVersionWindow.xaml
Normal file
23
Wox/Update/NewVersionWindow.xaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<Window x:Class="Wox.Update.NewVersionWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Icon="..\Images\app.png"
|
||||||
|
Topmost="True"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Title="New Version Found" Height="120" Width="300">
|
||||||
|
<Grid Margin="10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="120"></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" HorizontalAlignment="Left" Text="Current Version"></TextBlock>
|
||||||
|
<TextBlock Grid.Column="1" Grid.Row="0" Margin="6" HorizontalAlignment="Left" x:Name="tbCurrentVersion" Text="1.0.0"></TextBlock>
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="1" Margin="6" HorizontalAlignment="Left" Text="New Version"></TextBlock>
|
||||||
|
<TextBlock Grid.Column="1" Grid.Row="1" Margin="6" HorizontalAlignment="Left" x:Name="tbNewVersion" Foreground="Blue" Cursor="Hand" MouseUp="tbNewVersion_MouseUp" Text="1.0.0"></TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
48
Wox/Update/NewVersionWindow.xaml.cs
Normal file
48
Wox/Update/NewVersionWindow.xaml.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace Wox.Update
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NewVersionWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class NewVersionWindow : Window
|
||||||
|
{
|
||||||
|
public NewVersionWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
tbCurrentVersion.Text = ConfigurationManager.AppSettings["version"];
|
||||||
|
Release newRelease = new UpdateChecker().CheckUpgrade();
|
||||||
|
if (newRelease == null)
|
||||||
|
{
|
||||||
|
tbNewVersion.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tbNewVersion.Text = newRelease.version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbNewVersion_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Release newRelease = new UpdateChecker().CheckUpgrade();
|
||||||
|
if (newRelease != null)
|
||||||
|
{
|
||||||
|
Process.Start("http://www.getwox.com/release/version/" + newRelease.version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -104,6 +104,9 @@
|
|||||||
<Reference Include="WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
<Reference Include="WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Update\NewVersionWindow.xaml.cs">
|
||||||
|
<DependentUpon>NewVersionWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Update\Release.cs" />
|
<Compile Include="Update\Release.cs" />
|
||||||
<Compile Include="Update\UpdateChecker.cs" />
|
<Compile Include="Update\UpdateChecker.cs" />
|
||||||
<Page Include="App.xaml">
|
<Page Include="App.xaml">
|
||||||
@ -237,6 +240,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<Page Include="Update\NewVersionWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
Loading…
Reference in New Issue
Block a user