Changed SettingsView and UpdatePrompt
This commit is contained in:
parent
de3bf385d6
commit
446cb60f40
6 changed files with 158 additions and 58 deletions
|
@ -6,7 +6,7 @@ namespace WeeXnes.Core
|
||||||
{
|
{
|
||||||
public class Information
|
public class Information
|
||||||
{
|
{
|
||||||
public const string Version = "4.0.3";
|
public const string Version = "4.0.4";
|
||||||
public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
|
public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
|
||||||
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,13 @@
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
|
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock Text="General Settings"
|
<TextBlock Text="General"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Foreground="White"/>
|
Foreground="White"/>
|
||||||
<ui:CardAction Icon="Play28"
|
<ui:CardAction Icon="Play28"
|
||||||
Name="ButtonCheckForUpdates"
|
Name="ButtonCheckForUpdates"
|
||||||
Click="ButtonCheckForUpdates_OnClick">
|
Click="ButtonCheckForUpdates_OnClick"
|
||||||
|
Margin="0,10,0,0">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="0,0,0,4"
|
Margin="0,0,0,4"
|
||||||
|
@ -25,10 +26,6 @@
|
||||||
/>
|
/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ui:CardAction>
|
</ui:CardAction>
|
||||||
<ui:Dialog Foreground="White"
|
|
||||||
Name="DialogUpdate"
|
|
||||||
ButtonLeftClick="DialogUpdate_OnButtonLeftClick"
|
|
||||||
ButtonRightClick="DialogUpdate_OnButtonRightClick"/>
|
|
||||||
<ui:CardAction Icon="LinkSquare20"
|
<ui:CardAction Icon="LinkSquare20"
|
||||||
Name="ButtonCreateStartMenuShortcut"
|
Name="ButtonCreateStartMenuShortcut"
|
||||||
Click="ButtonCreateStartMenuShortcut_OnClick"
|
Click="ButtonCreateStartMenuShortcut_OnClick"
|
||||||
|
@ -41,25 +38,51 @@
|
||||||
/>
|
/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ui:CardAction>
|
</ui:CardAction>
|
||||||
<TextBlock Text="Key Manager Settings"
|
<TextBlock Text="Key Manager"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Foreground="White"/>
|
Foreground="White"/>
|
||||||
<CheckBox Content="Censor Keys Visually"
|
<CheckBox Content="Censor Keys Visually"
|
||||||
Name="CheckboxCensorKeys"
|
Name="CheckboxCensorKeys"
|
||||||
Checked="CheckboxCensorKeys_OnChecked"
|
Checked="CheckboxCensorKeys_OnChecked"
|
||||||
Unchecked="CheckboxCensorKeys_OnUnchecked"/>
|
Unchecked="CheckboxCensorKeys_OnUnchecked"/>
|
||||||
<TextBlock Text="Discord Rich Presence"
|
<TextBlock Text="Discord RPC"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Foreground="White"/>
|
Foreground="White"/>
|
||||||
<StackPanel Orientation="Horizontal">
|
<Grid>
|
||||||
<Button Content="Enable RPC Autostart"
|
<Grid.ColumnDefinitions>
|
||||||
Name="ButtonEnableRPC"
|
<ColumnDefinition Width="*"/>
|
||||||
Click="ButtonEnableRPC_OnClick"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<Button Content="Disable RPC Autostart"
|
</Grid.ColumnDefinitions>
|
||||||
Margin="10,0,0,0"
|
|
||||||
Name="ButtonDisableRPC"
|
|
||||||
Click="ButtonDisableRPC_OnClick"/>
|
<ui:CardAction Icon="Empty"
|
||||||
</StackPanel>
|
Margin="0,10,5,10"
|
||||||
|
Click="ButtonEnableRPC_OnClick">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,0,0,4"
|
||||||
|
FontWeight="Medium"
|
||||||
|
Text="Enable RPC Autostart"
|
||||||
|
/>
|
||||||
|
</StackPanel>
|
||||||
|
</ui:CardAction>
|
||||||
|
<ui:CardAction Icon="Empty"
|
||||||
|
Margin="5,10,0,10"
|
||||||
|
Grid.Column="1"
|
||||||
|
Click="ButtonDisableRPC_OnClick">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,0,0,4"
|
||||||
|
FontWeight="Medium"
|
||||||
|
Text="Disable RPC Autostart"
|
||||||
|
/>
|
||||||
|
</StackPanel>
|
||||||
|
</ui:CardAction>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace WeeXnes.Views.Settings
|
||||||
public static class Data
|
public static class Data
|
||||||
{
|
{
|
||||||
public static INIFile settingsFile = new INIFile(Global.AppDataPath + "\\" + Global.SettingsFile, true);
|
public static INIFile settingsFile = new INIFile(Global.AppDataPath + "\\" + Global.SettingsFile, true);
|
||||||
public static GithubApiResponse updateResponse = null;
|
|
||||||
}
|
}
|
||||||
public SettingsView()
|
public SettingsView()
|
||||||
{
|
{
|
||||||
|
@ -39,45 +39,11 @@ namespace WeeXnes.Views.Settings
|
||||||
KeyManagerView.Data.censorKeys.Value = false;
|
KeyManagerView.Data.censorKeys.Value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DialogUpdate_OnButtonLeftClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Do Update");
|
|
||||||
if(Data.updateResponse == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (File.Exists(Data.updateResponse.assets[0].name))
|
|
||||||
{
|
|
||||||
File.Delete(Data.updateResponse.assets[0].name);
|
|
||||||
}
|
|
||||||
using(WebClient webClient = new WebClient())
|
|
||||||
{;
|
|
||||||
|
|
||||||
webClient.DownloadFile(
|
|
||||||
Data.updateResponse.assets[0].browser_download_url,
|
|
||||||
Data.updateResponse.assets[0].name
|
|
||||||
);
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string path = Application.StartupPath;
|
|
||||||
string fileName = Path.GetFileName(Application.ExecutablePath);
|
|
||||||
string pid = Process.GetCurrentProcess().Id.ToString();
|
|
||||||
Process updateProc = Process.Start("Update.exe", "\"" + path + "\"" + " " + "\"" + fileName + "\"" + " " + "\"" + pid + "\"" + " " + "\"" + Data.updateResponse.assets[0].name + "\"");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DialogUpdate_OnButtonRightClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
DialogUpdate.Hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCheckForUpdates_OnClick(object sender, RoutedEventArgs e)
|
private void ButtonCheckForUpdates_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using(WebClient webClient = new WebClient())
|
using(WebClient webClient = new WebClient())
|
||||||
|
@ -88,9 +54,8 @@ namespace WeeXnes.Views.Settings
|
||||||
GithubApiResponse apiResponseData = JsonConvert.DeserializeObject<GithubApiResponse>(downloadString);
|
GithubApiResponse apiResponseData = JsonConvert.DeserializeObject<GithubApiResponse>(downloadString);
|
||||||
if (apiResponseData.tag_name != Information.Version)
|
if (apiResponseData.tag_name != Information.Version)
|
||||||
{
|
{
|
||||||
Data.updateResponse = apiResponseData;
|
UpdateFoundView.Data.updateResponse = apiResponseData;
|
||||||
DialogUpdate.Content = apiResponseData.tag_name + " is avaiable";
|
NavigationService.Navigate(new Uri("/Views/Settings/UpdateFoundView.xaml",UriKind.Relative));
|
||||||
DialogUpdate.Show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,5 +104,6 @@ namespace WeeXnes.Views.Settings
|
||||||
MessageBox.Show(ex.Message);
|
MessageBox.Show(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
39
WeeXnes/Views/Settings/UpdateFoundView.xaml
Normal file
39
WeeXnes/Views/Settings/UpdateFoundView.xaml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<Page x:Class="WeeXnes.Views.Settings.UpdateFoundView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:WeeXnes.Views.Settings"
|
||||||
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="UpdateFoundView" Height="Auto" Width="Auto">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="74"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Orientation="Vertical"
|
||||||
|
HorizontalAlignment="Center">
|
||||||
|
|
||||||
|
<TextBlock Loaded="CurrentVersionNumberLoaded_OnLoaded"
|
||||||
|
Foreground="White"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
FontSize="20"/>
|
||||||
|
<TextBlock Loaded="VersionNumberLoaded_OnLoaded"
|
||||||
|
Foreground="White"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
FontSize="20"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ui:CardAction Icon="ArrowDownload24" Grid.Row="1"
|
||||||
|
Name="ButtonInstallUpdate"
|
||||||
|
Click="ButtonInstallUpdate_OnClick">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,0,0,4"
|
||||||
|
FontWeight="Medium"
|
||||||
|
Text="Install Update"
|
||||||
|
/>
|
||||||
|
</StackPanel>
|
||||||
|
</ui:CardAction>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
68
WeeXnes/Views/Settings/UpdateFoundView.xaml.cs
Normal file
68
WeeXnes/Views/Settings/UpdateFoundView.xaml.cs
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using WeeXnes.Core;
|
||||||
|
using Application = System.Windows.Forms.Application;
|
||||||
|
|
||||||
|
namespace WeeXnes.Views.Settings
|
||||||
|
{
|
||||||
|
|
||||||
|
public partial class UpdateFoundView : Page
|
||||||
|
{
|
||||||
|
public static class Data
|
||||||
|
{
|
||||||
|
public static GithubApiResponse updateResponse = null;
|
||||||
|
}
|
||||||
|
public UpdateFoundView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonInstallUpdate_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Do Update");
|
||||||
|
if(Data.updateResponse == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (File.Exists(Data.updateResponse.assets[0].name))
|
||||||
|
{
|
||||||
|
File.Delete(Data.updateResponse.assets[0].name);
|
||||||
|
}
|
||||||
|
using(WebClient webClient = new WebClient())
|
||||||
|
{;
|
||||||
|
|
||||||
|
webClient.DownloadFile(
|
||||||
|
Data.updateResponse.assets[0].browser_download_url,
|
||||||
|
Data.updateResponse.assets[0].name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string path = Application.StartupPath;
|
||||||
|
string fileName = Path.GetFileName(Application.ExecutablePath);
|
||||||
|
string pid = Process.GetCurrentProcess().Id.ToString();
|
||||||
|
Process updateProc = Process.Start("Update.exe", "\"" + path + "\"" + " " + "\"" + fileName + "\"" + " " + "\"" + pid + "\"" + " " + "\"" + Data.updateResponse.assets[0].name + "\"");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void VersionNumberLoaded_OnLoaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
TextBlock tb = (TextBlock)sender;
|
||||||
|
tb.Text = "New Version: " + Data.updateResponse.tag_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CurrentVersionNumberLoaded_OnLoaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
TextBlock tb = (TextBlock)sender;
|
||||||
|
tb.Text = "Current Version: " + Information.Version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<Version>4.0.3</Version>
|
<Version>4.0.4</Version>
|
||||||
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
|
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>WeeXnes</RootNamespace>
|
<RootNamespace>WeeXnes</RootNamespace>
|
||||||
|
@ -94,6 +94,9 @@
|
||||||
<Compile Include="Views\Settings\SettingsView.xaml.cs">
|
<Compile Include="Views\Settings\SettingsView.xaml.cs">
|
||||||
<DependentUpon>SettingsView.xaml</DependentUpon>
|
<DependentUpon>SettingsView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\Settings\UpdateFoundView.xaml.cs">
|
||||||
|
<DependentUpon>UpdateFoundView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Page Include="MainWindow.xaml">
|
<Page Include="MainWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
@ -117,6 +120,7 @@
|
||||||
<Page Include="Views\Home\HomeView.xaml" />
|
<Page Include="Views\Home\HomeView.xaml" />
|
||||||
<Page Include="Views\KeyManager\KeyManagerView.xaml" />
|
<Page Include="Views\KeyManager\KeyManagerView.xaml" />
|
||||||
<Page Include="Views\Settings\SettingsView.xaml" />
|
<Page Include="Views\Settings\SettingsView.xaml" />
|
||||||
|
<Page Include="Views\Settings\UpdateFoundView.xaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
|
Loading…
Add table
Reference in a new issue