mirror of
https://github.com/ckaczor/ProcessCpuUsageStatusWindow.git
synced 2026-01-14 01:25:41 -05:00
Attempt auto-update
This commit is contained in:
14
App.xaml.cs
14
App.xaml.cs
@@ -1,7 +1,9 @@
|
|||||||
using FloatingStatusWindowLibrary;
|
using FloatingStatusWindowLibrary;
|
||||||
using ProcessCpuUsageStatusWindow.Properties;
|
using ProcessCpuUsageStatusWindow.Properties;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using Squirrel;
|
||||||
|
|
||||||
namespace ProcessCpuUsageStatusWindow
|
namespace ProcessCpuUsageStatusWindow
|
||||||
{
|
{
|
||||||
@@ -9,6 +11,18 @@ namespace ProcessCpuUsageStatusWindow
|
|||||||
{
|
{
|
||||||
private WindowSource _windowSource;
|
private WindowSource _windowSource;
|
||||||
|
|
||||||
|
public static string UpdateUrl = "https://github.com/ckaczor/ProcessCpuUsageStatusWindow";
|
||||||
|
|
||||||
|
[STAThread]
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
SquirrelAwareApp.HandleEvents();
|
||||||
|
|
||||||
|
var application = new App();
|
||||||
|
application.InitializeComponent();
|
||||||
|
application.Run();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
|
|||||||
@@ -33,12 +33,16 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupObject>
|
||||||
|
</StartupObject>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Common.Native, Version=1.0.6626.19202, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Common.Native, Version=1.0.6627.16339, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Common.Native.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Common.Native.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Common.Wpf, Version=1.0.6626.19204, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Common.Wpf, Version=1.0.6627.16340, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Common.Wpf.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Common.Wpf.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DeltaCompressionDotNet, Version=1.1.0.0, Culture=neutral, PublicKeyToken=1d14d6e5194e7f4a, processorArchitecture=MSIL">
|
<Reference Include="DeltaCompressionDotNet, Version=1.1.0.0, Culture=neutral, PublicKeyToken=1d14d6e5194e7f4a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.dll</HintPath>
|
<HintPath>packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.dll</HintPath>
|
||||||
@@ -49,14 +53,14 @@
|
|||||||
<Reference Include="DeltaCompressionDotNet.PatchApi, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3e8888ee913ed789, processorArchitecture=MSIL">
|
<Reference Include="DeltaCompressionDotNet.PatchApi, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3e8888ee913ed789, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.PatchApi.dll</HintPath>
|
<HintPath>packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.PatchApi.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="FloatingStatusWindowLibrary, Version=1.0.0.8, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="FloatingStatusWindowLibrary, Version=1.0.0.9, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\FloatingStatusWindowLibrary.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\FloatingStatusWindowLibrary.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Microsoft.Expression.Interactions.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Microsoft.Expression.Interactions.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
@@ -86,7 +90,7 @@
|
|||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
@@ -98,29 +102,29 @@
|
|||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Xceed.Wpf.AvalonDock.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.DataGrid, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.DataGrid, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Xceed.Wpf.DataGrid.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.DataGrid.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.Toolkit, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.Toolkit, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\FloatingStatusWindow.1.0.0.8\lib\net45\Xceed.Wpf.Toolkit.dll</HintPath>
|
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ApplicationDefinition Include="App.xaml">
|
<Page Include="App.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</Page>
|
||||||
<Compile Include="App.xaml.cs">
|
<Compile Include="App.xaml.cs">
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
|
|||||||
@@ -53,3 +53,5 @@ using System.Windows;
|
|||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
||||||
|
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
||||||
9
Properties/Resources.Designer.cs
generated
9
Properties/Resources.Designer.cs
generated
@@ -114,5 +114,14 @@ namespace ProcessCpuUsageStatusWindow.Properties {
|
|||||||
return ResourceManager.GetString("ProcessLine", resourceCulture);
|
return ResourceManager.GetString("ProcessLine", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Updating application....
|
||||||
|
/// </summary>
|
||||||
|
internal static string Updating {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Updating", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,4 +136,7 @@
|
|||||||
<data name="ProcessLine" xml:space="preserve">
|
<data name="ProcessLine" xml:space="preserve">
|
||||||
<value>CPU: {1,4:f1}% - {0}</value>
|
<value>CPU: {1,4:f1}% - {0}</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Updating" xml:space="preserve">
|
||||||
|
<value>Updating application...</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
using System.Threading.Tasks;
|
using FloatingStatusWindowLibrary;
|
||||||
using System.Windows.Threading;
|
|
||||||
using FloatingStatusWindowLibrary;
|
|
||||||
using ProcessCpuUsageStatusWindow.Properties;
|
using ProcessCpuUsageStatusWindow.Properties;
|
||||||
|
using Squirrel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Squirrel;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace ProcessCpuUsageStatusWindow
|
namespace ProcessCpuUsageStatusWindow
|
||||||
{
|
{
|
||||||
@@ -14,6 +17,7 @@ namespace ProcessCpuUsageStatusWindow
|
|||||||
{
|
{
|
||||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||||
private readonly ProcessCpuUsageWatcher _processCpuUsageWatcher;
|
private readonly ProcessCpuUsageWatcher _processCpuUsageWatcher;
|
||||||
|
private readonly Dispatcher _dispatcher = Dispatcher.CurrentDispatcher;
|
||||||
|
|
||||||
internal WindowSource()
|
internal WindowSource()
|
||||||
{
|
{
|
||||||
@@ -22,19 +26,47 @@ namespace ProcessCpuUsageStatusWindow
|
|||||||
|
|
||||||
_processCpuUsageWatcher = new ProcessCpuUsageWatcher();
|
_processCpuUsageWatcher = new ProcessCpuUsageWatcher();
|
||||||
|
|
||||||
var dispatcher = Dispatcher.CurrentDispatcher;
|
Task.Factory.StartNew(UpdateApp);
|
||||||
Task.Factory.StartNew(() => _processCpuUsageWatcher.Initialize(Settings.Default.UpdateInterval, UpdateDisplay, dispatcher));
|
|
||||||
|
|
||||||
//CheckUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//private static async void CheckUpdate()
|
private async Task UpdateApp()
|
||||||
//{
|
{
|
||||||
// using (var updateManager = UpdateManager.GitHubUpdateManager("https://github.com/ckaczor/ProcessCpuUsageStatusWindow"))
|
try
|
||||||
// {
|
{
|
||||||
// await updateManager.Result.UpdateApp();
|
using (var updateManager = await UpdateManager.GitHubUpdateManager(App.UpdateUrl))
|
||||||
// }
|
{
|
||||||
//}
|
var updates = await updateManager.CheckForUpdate();
|
||||||
|
|
||||||
|
var lastVersion = updates?.ReleasesToApply?.OrderBy(releaseEntry => releaseEntry.Version).LastOrDefault();
|
||||||
|
|
||||||
|
if (lastVersion == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_dispatcher.Invoke(() => _floatingStatusWindow.SetText(Resources.Updating));
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
|
#if !DEBUGr
|
||||||
|
await updateManager.DownloadReleases(new[] { lastVersion });
|
||||||
|
await updateManager.ApplyReleases(updates);
|
||||||
|
await updateManager.UpdateApp();
|
||||||
|
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !DEBUGr
|
||||||
|
UpdateManager.RestartApp();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await Task.Factory.StartNew(() => _processCpuUsageWatcher.Initialize(Settings.Default.UpdateInterval, UpdateDisplay, _dispatcher));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
@@ -58,6 +90,14 @@ namespace ProcessCpuUsageStatusWindow
|
|||||||
|
|
||||||
public bool HasSettingsMenu => false;
|
public bool HasSettingsMenu => false;
|
||||||
public bool HasRefreshMenu => false;
|
public bool HasRefreshMenu => false;
|
||||||
|
public bool HasAboutMenu => true;
|
||||||
|
|
||||||
|
public void ShowAbout()
|
||||||
|
{
|
||||||
|
var version = Assembly.GetEntryAssembly().GetName().Version.ToString();
|
||||||
|
|
||||||
|
MessageBox.Show(version);
|
||||||
|
}
|
||||||
|
|
||||||
public string WindowSettings
|
public string WindowSettings
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="DeltaCompressionDotNet" version="1.1.0" targetFramework="net45" />
|
<package id="DeltaCompressionDotNet" version="1.1.0" targetFramework="net45" />
|
||||||
<package id="FloatingStatusWindow" version="1.0.0.8" targetFramework="net45" />
|
<package id="FloatingStatusWindow" version="1.0.0.9" targetFramework="net45" />
|
||||||
<package id="Mono.Cecil" version="0.9.6.1" targetFramework="net45" />
|
<package id="Mono.Cecil" version="0.9.6.1" targetFramework="net45" />
|
||||||
<package id="SharpCompress" version="0.17.1" targetFramework="net45" />
|
<package id="SharpCompress" version="0.17.1" targetFramework="net45" />
|
||||||
<package id="Splat" version="1.6.2" targetFramework="net45" />
|
<package id="Splat" version="1.6.2" targetFramework="net45" />
|
||||||
|
|||||||
Reference in New Issue
Block a user