Skip to content

Commit 0f0465a

Browse files
committedFeb 18, 2020
Add sample app for .NET Core WPF
1 parent c4385fb commit 0f0465a

12 files changed

+180
-4
lines changed
 

‎NetSparkle.sln

+24-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSparkle.Tests", "src\Net
2222
EndProject
2323
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NetSparkle.Shared", "src\NetSparkle.Shared\NetSparkle.Shared.shproj", "{D9115E42-6ED7-452F-A623-81F70201578B}"
2424
EndProject
25-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSparkle.UI.WinForms", "src\NetSparkle.UI.WinForms\NetSparkle.UI.WinForms.csproj", "{45F5AADB-A39B-446F-8025-71647238BB89}"
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetSparkle.UI.WinForms", "src\NetSparkle.UI.WinForms\NetSparkle.UI.WinForms.csproj", "{45F5AADB-A39B-446F-8025-71647238BB89}"
2626
EndProject
27-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSparkle.UI.WPF", "src\NetSparkle.UI.WPF\NetSparkle.UI.WPF.csproj", "{6915843C-7947-4268-B569-6F5684651DF4}"
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetSparkle.UI.WPF", "src\NetSparkle.UI.WPF\NetSparkle.UI.WPF.csproj", "{6915843C-7947-4268-B569-6F5684651DF4}"
28+
EndProject
29+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetSparkle.Samples.NetCore.WPF", "src\NetSparkle.Samples.NetCore.WPF\NetSparkle.Samples.NetCore.WPF.csproj", "{4DD4076B-C086-4A11-B850-898CC9991D90}"
2830
EndProject
2931
Global
3032
GlobalSection(SharedMSBuildProjectFiles) = preSolution
@@ -217,6 +219,26 @@ Global
217219
{6915843C-7947-4268-B569-6F5684651DF4}.Release|x64.Build.0 = Release|Any CPU
218220
{6915843C-7947-4268-B569-6F5684651DF4}.Release|x86.ActiveCfg = Release|Any CPU
219221
{6915843C-7947-4268-B569-6F5684651DF4}.Release|x86.Build.0 = Release|Any CPU
222+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
223+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|Any CPU.Build.0 = Debug|Any CPU
224+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|ARM.ActiveCfg = Debug|Any CPU
225+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|ARM.Build.0 = Debug|Any CPU
226+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
227+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
228+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|x64.ActiveCfg = Debug|Any CPU
229+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|x64.Build.0 = Debug|Any CPU
230+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|x86.ActiveCfg = Debug|Any CPU
231+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Debug|x86.Build.0 = Debug|Any CPU
232+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|Any CPU.ActiveCfg = Release|Any CPU
233+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|Any CPU.Build.0 = Release|Any CPU
234+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|ARM.ActiveCfg = Release|Any CPU
235+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|ARM.Build.0 = Release|Any CPU
236+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
237+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|Mixed Platforms.Build.0 = Release|Any CPU
238+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|x64.ActiveCfg = Release|Any CPU
239+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|x64.Build.0 = Release|Any CPU
240+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|x86.ActiveCfg = Release|Any CPU
241+
{4DD4076B-C086-4A11-B850-898CC9991D90}.Release|x86.Build.0 = Release|Any CPU
220242
EndGlobalSection
221243
GlobalSection(SolutionProperties) = preSolution
222244
HideSolutionNode = FALSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="NetSparkle.Samples.NetCore.WPF.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:NetSparkle.Samples.NetCore.WPF"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace NetSparkle.Samples.NetCore.WPF
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Window x:Class="NetSparkle.Samples.NetCore.WPF.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:NetSparkle.Samples.NetCore.WPF"
7+
mc:Ignorable="d"
8+
Title="MainWindow"
9+
Height="350"
10+
Width="525"
11+
Icon="software-update-available.ico">
12+
<Grid>
13+
<Button Content="Manual Update Check"
14+
Height="23"
15+
HorizontalAlignment="Center"
16+
Margin="0"
17+
VerticalAlignment="Center"
18+
Width="146"
19+
Click="ManualUpdateCheck_Click" />
20+
</Grid>
21+
</Window>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace NetSparkle.Samples.NetCore.WPF
17+
{
18+
/// <summary>
19+
/// Interaction logic for MainWindow.xaml
20+
/// </summary>
21+
public partial class MainWindow : Window
22+
{
23+
private Sparkle _sparkle;
24+
25+
public MainWindow()
26+
{
27+
InitializeComponent();
28+
29+
// remove the netsparkle key from registry
30+
try
31+
{
32+
Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppNetCoreWPF");
33+
}
34+
catch { }
35+
36+
// set icon in project properties!
37+
string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName;
38+
var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName);
39+
_sparkle = new Sparkle("https://deadpikle.github.io/NetSparkle/files/sample-app/appcast.xml", icon)
40+
{
41+
UIFactory = new NetSparkle.UI.WPF.UIFactory(),
42+
ShowsUIOnMainThread = false
43+
//UseNotificationToast = true
44+
};
45+
// TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/)
46+
_sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12;
47+
_sparkle.StartLoop(true, true);
48+
}
49+
50+
private void ManualUpdateCheck_Click(object sender, RoutedEventArgs e)
51+
{
52+
_sparkle.CheckForUpdatesAtUserRequest();
53+
}
54+
}
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<UseWPF>true</UseWPF>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<None Remove="NetSparkle_DSA.pub" />
11+
<None Remove="software-update-available.ico" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<EmbeddedResource Include="NetSparkle_DSA.pub" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<ProjectReference Include="..\NetSparkle.UI.WPF\NetSparkle.UI.WPF.csproj" />
20+
<ProjectReference Include="..\NetSparkle\NetSparkle.csproj" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<Resource Include="software-update-available.ico" />
25+
</ItemGroup>
26+
27+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
<ItemGroup>
5+
<ApplicationDefinition Update="App.xaml">
6+
<SubType>Designer</SubType>
7+
</ApplicationDefinition>
8+
</ItemGroup>
9+
<ItemGroup>
10+
<Page Update="MainWindow.xaml">
11+
<SubType>Designer</SubType>
12+
</Page>
13+
</ItemGroup>
14+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<DSAKeyValue><P>2IX45gCGAGjNXBg3/spd03M2oMsmghmul/H5ePY9AN9URjAOYUcwfi3kQ/KM8i2eD1V/cBKkMJX4xx3kpt39n2Vt+7tyWfXjzMb+3qPapPHMMJL5DDS9cw6FgG3H0tT/LSm7Qn7JLA6w8FOiVIjC+x61u5WqFK0I0vFnc8T1YZs=</P><Q>xXaw/HrlbsRqg7WD5g1xlkVblys=</Q><G>P2bv3DOTGnyjVnDC5j6Pwd4U6VtRzhPsww9COnwlRWmyNFcf0F/3H5S9YJrO7P+CgIvef30eqUYPHUauLbZ2UK0rItwepz45SfysLvVUb6PU6z/j7gEYiGO/lKd13GfhxmL1mS+XasDSw5brRMxePidiom8H/AB7VVQgELcgutQ=</G><Y>mxJD6rwuJe532PpS9HKjlhvcY1ssBEOFf3HmiYot4d670y0+5nICF3YO8vLxndHA4RqgU/Hux9KtKKg/2hi7c/88j5YyTDWX86n8aPIxHWklKsreP24ul87uuktfhDlhltpfd8AlXxn2SpxQ1Fy/Ktid3E1+uDb64HKf9a35CwE=</Y><Seed>q/C5yP0VC0Y0ZUPzSD5+O5Rt5X8=</Seed><PgenCounter>sg==</PgenCounter></DSAKeyValue>
Binary file not shown.

‎src/NetSparkle.Samples.NetFramework.WPF/MainWindow.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public MainWindow()
2727
var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName);
2828
_sparkle = new Sparkle("https://deadpikle.github.io/NetSparkle/files/sample-app/appcast.xml", icon)
2929
{
30-
UIFactory = new NetSparkle.UI.NetFramework.WPF.UIFactory(),
30+
UIFactory = new NetSparkle.UI.WPF.UIFactory(),
3131
ShowsUIOnMainThread = false
3232
//UseNotificationToast = true
3333
};

‎src/NetSparkle.Samples.NetFramework.WinForms/Form1.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public Form1()
2222
var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName);
2323
_sparkleUpdateDetector = new Sparkle(appcastUrl, icon)
2424
{
25-
UIFactory = new NetSparkle.UI.NetFramework.WinForms.UIFactory(),
25+
UIFactory = new NetSparkle.UI.WinForms.UIFactory(),
2626
//ShowsUIOnMainThread = true,
2727
//UseNotificationToast = true
2828
};

0 commit comments

Comments
 (0)
Please sign in to comment.