changed the UpdateAPI and set animation easeinout
This commit is contained in:
parent
dfc72ed8c7
commit
dbc99c429c
7 changed files with 78 additions and 50 deletions
|
@ -2,6 +2,8 @@
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using WeeXnes.Core;
|
using WeeXnes.Core;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using WeeXnes.Misc;
|
||||||
using Application = System.Windows.Forms.Application;
|
using Application = System.Windows.Forms.Application;
|
||||||
|
|
||||||
namespace WeeXnes
|
namespace WeeXnes
|
||||||
|
|
|
@ -1,30 +1,37 @@
|
||||||
namespace WeeXnes.Core
|
using System.Collections;
|
||||||
{
|
using System.Collections.Generic;
|
||||||
public class ApiResponse
|
|
||||||
{
|
|
||||||
public string download_url { get; set; }
|
|
||||||
public string file_name { get; set; }
|
|
||||||
public string tag_name { get; set; }
|
|
||||||
public string name { get; set; }
|
|
||||||
public string description { get; set; }
|
|
||||||
public ApiResponse(string _download_url, string _file_name, string _tag_name, string _name, string _description)
|
|
||||||
{
|
|
||||||
this.download_url = _download_url;
|
|
||||||
this.file_name = _file_name;
|
|
||||||
this.tag_name = _tag_name;
|
|
||||||
this.name = _name;
|
|
||||||
this.description = _description;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
namespace WeeXnes.Core
|
||||||
|
{
|
||||||
|
public class GithubApiResponse
|
||||||
|
{
|
||||||
|
public string tag_name { get; set; }
|
||||||
|
public IList<GithubAsset> assets { get; set; }
|
||||||
|
|
||||||
|
public GithubApiResponse(string tag_name, IList<GithubAsset> assets)
|
||||||
|
{
|
||||||
|
this.tag_name = tag_name;
|
||||||
|
this.assets = assets;
|
||||||
|
}
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
string returnval =
|
return this.tag_name + " with " + this.assets.Count;
|
||||||
"download_url: " + this.download_url + "\n" +
|
}
|
||||||
"file_name: " + this.file_name + "\n" +
|
}
|
||||||
"tag_name: " + this.tag_name + "\n" +
|
|
||||||
"name: " + this.name + "\n" +
|
public class GithubAsset
|
||||||
"description: " + this.description;
|
{
|
||||||
return returnval;
|
public string browser_download_url { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
|
||||||
|
public GithubAsset(string browser_download_url, string name)
|
||||||
|
{
|
||||||
|
this.browser_download_url = browser_download_url;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return this.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,10 +16,10 @@ namespace WeeXnes.Core
|
||||||
public static string encryptionKey = "8zf5#RdyQ]$4x4_";
|
public static string encryptionKey = "8zf5#RdyQ]$4x4_";
|
||||||
public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WeeXnes");
|
public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WeeXnes");
|
||||||
public static string SettingsFileName = "settings.ini";
|
public static string SettingsFileName = "settings.ini";
|
||||||
public static string version = "3.6.6";
|
public static string version = "3.6.7";
|
||||||
public static bool info_isRpcRunning = false;
|
public static bool info_isRpcRunning = false;
|
||||||
public static bool info_RpcAutoStart;
|
public static bool info_RpcAutoStart;
|
||||||
public static string apiUrl = "http://weexnes.com:5169/";
|
public static string apiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
|
||||||
|
|
||||||
public static UpdateVar<bool> settings_alwaysOnTop = new UpdateVar<bool>();
|
public static UpdateVar<bool> settings_alwaysOnTop = new UpdateVar<bool>();
|
||||||
public static UpdateVar<bool> settings_osxStyleControlls = new UpdateVar<bool>();
|
public static UpdateVar<bool> settings_osxStyleControlls = new UpdateVar<bool>();
|
||||||
|
|
|
@ -282,23 +282,27 @@ namespace WeeXnes.MVVM.View
|
||||||
|
|
||||||
private void CheckForUpdateBtn_OnClick(object sender, RoutedEventArgs e)
|
private void CheckForUpdateBtn_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
WebClient client = new WebClient();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string downloadString = client.DownloadString(Globals.apiUrl);
|
using(WebClient webClient = new WebClient())
|
||||||
ApiResponse GitHub = JsonConvert.DeserializeObject<ApiResponse>(downloadString);
|
{;
|
||||||
if (GitHub.tag_name != Globals.version)
|
webClient.Headers.Add("Authorization", "Basic :x-oauth-basic");
|
||||||
{
|
webClient.Headers.Add("User-Agent","lk-github-clien");
|
||||||
Misc.UpdateMessage updateMessage = new UpdateMessage(
|
var downloadString = webClient.DownloadString(Globals.apiUrl);
|
||||||
GitHub,
|
GithubApiResponse ApiResponseData = JsonConvert.DeserializeObject<GithubApiResponse>(downloadString);
|
||||||
"Update Found");
|
if (ApiResponseData.tag_name != Globals.version)
|
||||||
updateMessage.Show();
|
{
|
||||||
}
|
Misc.UpdateMessage updateMessage = new UpdateMessage(
|
||||||
else
|
ApiResponseData,
|
||||||
{
|
"Update Found");
|
||||||
Misc.Message msg = new Misc.Message("No Updates found");
|
updateMessage.Show();
|
||||||
msg.Show();
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
Misc.Message msg = new Misc.Message("No Updates found");
|
||||||
|
msg.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -306,6 +310,10 @@ namespace WeeXnes.MVVM.View
|
||||||
error.Show();
|
error.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebClient client = new WebClient();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,12 @@
|
||||||
Storyboard.TargetName="NavigationBorder"
|
Storyboard.TargetName="NavigationBorder"
|
||||||
Storyboard.TargetProperty="(Border.Width)"
|
Storyboard.TargetProperty="(Border.Width)"
|
||||||
To="200" Duration="0:0:00.4" AutoReverse="False"
|
To="200" Duration="0:0:00.4" AutoReverse="False"
|
||||||
/>
|
|
||||||
|
>
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<CircleEase EasingMode="EaseInOut"/>
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</EventTrigger>
|
</EventTrigger>
|
||||||
|
@ -83,7 +88,12 @@
|
||||||
Storyboard.TargetName="NavigationBorder"
|
Storyboard.TargetName="NavigationBorder"
|
||||||
Storyboard.TargetProperty="(Border.Width)"
|
Storyboard.TargetProperty="(Border.Width)"
|
||||||
To="50" Duration="0:0:00.4" AutoReverse="False"
|
To="50" Duration="0:0:00.4" AutoReverse="False"
|
||||||
/>
|
>
|
||||||
|
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<CircleEase EasingMode="EaseInOut"/>
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</EventTrigger>
|
</EventTrigger>
|
||||||
|
|
|
@ -11,8 +11,8 @@ namespace WeeXnes.Misc
|
||||||
{
|
{
|
||||||
public partial class UpdateMessage : Window
|
public partial class UpdateMessage : Window
|
||||||
{
|
{
|
||||||
public static ApiResponse GitHub;
|
public static GithubApiResponse GitHub;
|
||||||
public UpdateMessage(ApiResponse _GitHub, string _title = "Message")
|
public UpdateMessage(GithubApiResponse _GitHub, string _title = "Message")
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
string content = "Your Version: " + Globals.version + "\n" +
|
string content = "Your Version: " + Globals.version + "\n" +
|
||||||
|
@ -26,13 +26,14 @@ namespace WeeXnes.Misc
|
||||||
{
|
{
|
||||||
checkForFile();
|
checkForFile();
|
||||||
WebClient client = new WebClient();
|
WebClient client = new WebClient();
|
||||||
client.DownloadFile(GitHub.download_url, GitHub.file_name);
|
client.DownloadFile(GitHub.assets[0].browser_download_url, GitHub.assets[0].name);
|
||||||
|
client.Dispose();
|
||||||
}
|
}
|
||||||
private static void checkForFile()
|
private static void checkForFile()
|
||||||
{
|
{
|
||||||
if (File.Exists(GitHub.file_name))
|
if (File.Exists(GitHub.assets[0].name))
|
||||||
{
|
{
|
||||||
File.Delete(GitHub.file_name);
|
File.Delete(GitHub.assets[0].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OkButton_OnClick(object sender, RoutedEventArgs e)
|
private void OkButton_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
@ -43,7 +44,7 @@ namespace WeeXnes.Misc
|
||||||
string path = Application.StartupPath;
|
string path = Application.StartupPath;
|
||||||
string fileName = Path.GetFileName(Application.ExecutablePath);
|
string fileName = Path.GetFileName(Application.ExecutablePath);
|
||||||
string pid = Process.GetCurrentProcess().Id.ToString();
|
string pid = Process.GetCurrentProcess().Id.ToString();
|
||||||
Process updateProc = Process.Start("Update.exe", "\"" + path + "\"" + " " + "\"" + fileName + "\"" + " " + "\"" + pid + "\"" + " " + "\"" + GitHub.file_name + "\"");
|
Process updateProc = Process.Start("Update.exe", "\"" + path + "\"" + " " + "\"" + fileName + "\"" + " " + "\"" + pid + "\"" + " " + "\"" + GitHub.assets[0].name + "\"");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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>3.6.6</Version>
|
<Version>3.6.7</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>
|
||||||
|
|
Loading…
Add table
Reference in a new issue