markus / MarkusAutoUpdate / src / NetSparkle.Samples.Avalonia / MainWindow.xaml.cs @ 63946dd5
이력 | 보기 | 이력해설 | 다운로드 (1.73 KB)
1 | d8f5045e | taeseongkim | using Avalonia; |
---|---|---|---|
2 | using Avalonia.Controls; |
||
3 | using Avalonia.Interactivity; |
||
4 | using Avalonia.Markup.Xaml; |
||
5 | using Avalonia.Media.Imaging; |
||
6 | using NetSparkleUpdater.SignatureVerifiers; |
||
7 | using NetSparkleUpdater.UI.Avalonia; |
||
8 | using System.IO; |
||
9 | |||
10 | namespace NetSparkleUpdater.Samples.Avalonia |
||
11 | { |
||
12 | public class MainWindow : Window |
||
13 | { |
||
14 | private SparkleUpdater _sparkle; |
||
15 | |||
16 | public MainWindow() |
||
17 | { |
||
18 | InitializeComponent(); |
||
19 | #if DEBUG |
||
20 | this.AttachDevTools(); |
||
21 | #endif |
||
22 | // set icon in project properties! |
||
23 | string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName; |
||
24 | _sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(Enums.SecurityMode.Strict)) |
||
25 | { |
||
26 | UIFactory = new NetSparkleUpdater.UI.Avalonia.UIFactory(Icon), |
||
27 | // Avalonia version doesn't support separate threads: https://github.com/AvaloniaUI/Avalonia/issues/3434#issuecomment-573446972 |
||
28 | ShowsUIOnMainThread = true, |
||
29 | //UseNotificationToast = false // Avalonia version doesn't yet support notification toast messages |
||
30 | }; |
||
31 | // TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/) |
||
32 | _sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12; |
||
33 | _sparkle.StartLoop(true, true); |
||
34 | } |
||
35 | |||
36 | public async void ManualUpdateCheck_Click(object sender, RoutedEventArgs e) |
||
37 | { |
||
38 | await _sparkle.CheckForUpdatesAtUserRequest(); |
||
39 | } |
||
40 | |||
41 | private void InitializeComponent() |
||
42 | { |
||
43 | AvaloniaXamlLoader.Load(this); |
||
44 | } |
||
45 | } |
||
46 | } |