public MainWindow() { InitializeComponent(); this.AttachDevTools(); this.PropertyChanged += (s, e) => { if (e.Property == Control.DataContextProperty) { ctx = (MainWindowViewModel)e.NewValue !; ctx.OnUpdateAction = ManualUpdate_Click; } }; Closing += (sender, args) => MainViewClosing?.Invoke(sender, args); InputManager.Instance.PreProcess.OfType <RawInputEventArgs>() .Throttle(TimeSpan.FromMilliseconds(500)) .Subscribe( (_) => { if (_inactivityControlEnabled && _activityTimer != null) { _activityTimer.Stop(); _activityTimer.Start(); } }); _sparkle = new SparkleUpdater( "https://github.com/atomex-me/atomex.client.desktop/releases/latest/download/appcast.xml", new Ed25519Checker(SecurityMode.OnlyVerifySoftwareDownloads, "76FH2gIo7D5mpPPfnard5C9cVwq8TFaxpo/Wi2Iem/E=")) { UserInteractionMode = UserInteractionMode.DownloadNoInstall }; _sparkle.LogWriter = new SparkleLogger(); _sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12; _sparkle.StartLoop(false, false); CheckForUpdates(null, null); var checkUpdateReadyTimer = new Timer(TimeSpan.FromMinutes(5).TotalMilliseconds); checkUpdateReadyTimer.AutoReset = true; checkUpdateReadyTimer.Elapsed += CheckForUpdates; checkUpdateReadyTimer.Start(); _sparkle.DownloadStarted += (item, path) => { Console.WriteLine($"Updating download started {path}"); }; _sparkle.DownloadFinished += (item, path) => { Console.WriteLine($"Updating download finished ${path}"); ctx.UpdateDownloadProgress = 100; }; _sparkle.DownloadMadeProgress += (sender, item, args) => { ctx.UpdateDownloadProgress = (int)((double)args.BytesReceived / (double)args.TotalBytesToReceive * 100); }; }
public MainWindow() { InitializeComponent(); // remove the netsparkle key from registry try { Microsoft.Win32.Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\NetSparkle.TestAppWPF"); } catch { } // set icon in project properties! string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName; var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName); _sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(Enums.SecurityMode.Strict)) { UIFactory = new NetSparkleUpdater.UI.WPF.UIFactory(NetSparkleUpdater.UI.WPF.IconUtilities.ToImageSource(icon)), ShowsUIOnMainThread = false, //RelaunchAfterUpdate = true, //UseNotificationToast = true }; // TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/) _sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12; _sparkle.StartLoop(true, true); }
public UpdateManager() { _sparkle = new SparkleUpdater("https://timschneeberger.me/updates/galaxybudsclient/appcast.xml", new Ed25519Checker(SecurityMode.Unsafe)) { SecurityProtocolType = System.Net.SecurityProtocolType.Tls12 }; _sparkle.StartLoop(false, false); }
public MainWindow() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif // set icon in project properties! string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName; _sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(Enums.SecurityMode.Strict)) { UIFactory = new NetSparkleUpdater.UI.Avalonia.UIFactory(Icon), // Avalonia version doesn't support separate threads: https://github.com/AvaloniaUI/Avalonia/issues/3434#issuecomment-573446972 ShowsUIOnMainThread = true, //UseNotificationToast = false // Avalonia version doesn't yet support notification toast messages }; // TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/) _sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12; _sparkle.StartLoop(true, true); }
public Form1() { InitializeComponent(); var appcastUrl = "https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml"; // set icon in project properties! string manifestModuleName = System.Reflection.Assembly.GetEntryAssembly().ManifestModule.FullyQualifiedName; var icon = System.Drawing.Icon.ExtractAssociatedIcon(manifestModuleName); _sparkleUpdateDetector = new SparkleUpdater(appcastUrl, new DSAChecker(Enums.SecurityMode.Strict)) { UIFactory = new NetSparkleUpdater.UI.WinForms.UIFactory(icon), //RelaunchAfterUpdate = true, //ShowsUIOnMainThread = true, //UseNotificationToast = true }; // TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/) _sparkleUpdateDetector.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12; //_sparkleUpdateDetector.CloseApplication += _sparkleUpdateDetector_CloseApplication; _sparkleUpdateDetector.StartLoop(true, true); }