コード例 #1
0
ファイル: UpdateViewModel.cs プロジェクト: rdeetz/QUnoDesktop
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            IUpdateService updateService = e.Argument as IUpdateService;

            string       version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            UpdateResult result  = updateService.CheckForUpdates(Settings.Default.ProductCode, version);

            e.Result = result;

            return;
        }
コード例 #2
0
        private async Task UpdatesCheck()
        {
            try
            {
                string?newUpdateUrl = await updateService.CheckForUpdates();

                if (newUpdateUrl != null)
                {
                    if (settingsProvider.Settings.EnableSilentUpdates)
                    {
                        DownloadUpdate();
                        statusBar.PublishNotification(new PlainNotification(NotificationType.Info, "Downloading update..."));
                    }
                    else
                    {
                        if (await messageBoxService.ShowDialog(new MessageBoxFactory <bool>()
                                                               .SetTitle("New update")
                                                               .SetMainInstruction("A new update is ready to be downloaded")
                                                               .SetContent("Do you want to download the update now?")
                                                               .WithYesButton(true)
                                                               .WithNoButton(false)
                                                               .SetIcon(MessageBoxIcon.Information)
                                                               .Build()))
                        {
                            DownloadUpdate();
                        }
                        else
                        {
                            statusBar.PublishNotification(new PlainNotification(NotificationType.Info,
                                                                                "New updates are ready to download. Click to download.",
                                                                                new DelegateCommand(DownloadUpdate)));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                statusBar.PublishNotification(new PlainNotification(NotificationType.Error, "Error while checking for the updates: " + e.Message));
            }
        }
コード例 #3
0
        private async Task UpdatesCheck()
        {
            try
            {
                string?newUpdateUrl = await updateService.CheckForUpdates();

                if (newUpdateUrl != null)
                {
                    statusBar.PublishNotification(new PlainNotification(NotificationType.Info,
                                                                        "New updates are ready to download. Click to download.",
                                                                        new DelegateCommand(() =>
                    {
                        statusBar.PublishNotification(
                            new PlainNotification(NotificationType.Info, "Downloading..."));
                        DownloadUpdate();
                    })));
                }
            }
            catch (Exception e)
            {
                statusBar.PublishNotification(new PlainNotification(NotificationType.Error, "Error while checking for the updates: " + e.Message));
            }
        }