프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / MarkusAutoUpdate / src / NetSparkle.Samples.Avalonia / MainWindow.xaml.cs @ d8f5045e

이력 | 보기 | 이력해설 | 다운로드 (1.73 KB)

1
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
}
클립보드 이미지 추가 (최대 크기: 500 MB)