/* To Function Features */
        public async void CheckUpdatesClick()
        {
            //UpdateInfo.Content = "Checking for updates...";
            UpdateInfo = await SparkleInst.CheckForUpdatesQuietly();

            // use _sparkle.CheckForUpdatesQuietly() if you don't want the user to know you are checking for updates!
            // if you use CheckForUpdatesAtUserRequest() and are using a UI, then handling things yourself is rather silly
            // as it will show a UI for things
            if (UpdateInfo != null)
            {
                switch (UpdateInfo.Status)
                {
                case UpdateStatus.UpdateAvailable:
                    //UpdateInfo.Content = "There's an update available!";
                    //DownloadUpdateButton.IsEnabled = true;
                    break;

                case UpdateStatus.UpdateNotAvailable:
                    //UpdateInfo.Content = "There's no update available :(";
                    //DownloadUpdateButton.IsEnabled = false;
                    break;

                case UpdateStatus.UserSkipped:
                    //UpdateInfo.Content = "The user skipped this update!";
                    //DownloadUpdateButton.IsEnabled = false;
                    break;

                case UpdateStatus.CouldNotDetermine:
                    //UpdateInfo.Content = "We couldn't tell if there was an update...";
                    //DownloadUpdateButton.IsEnabled = false;
                    break;
                }
            }
        }
        public async void DownloadUpdateClick()
        {
            await Task.Run(() => {
                CLog.Here().Information($"AppUpdaterService - DownloadUpdate : [ Download for Update... ]");
                AvailableUpdate?.ClosePopUp();

                // this is async so that it can grab the download file name from the server
                SparkleInst.DownloadStarted -= CBStartedDownloading;
                SparkleInst.DownloadStarted += CBStartedDownloading;

                SparkleInst.DownloadFinished -= CBFinishedDownloading;
                SparkleInst.DownloadFinished += CBFinishedDownloading;

                SparkleInst.DownloadHadError -= CBDownloadError;
                SparkleInst.DownloadHadError += CBDownloadError;

                SparkleInst.DownloadMadeProgress -= CBDownloadMadeProgress;
                SparkleInst.DownloadMadeProgress += CBDownloadMadeProgress;

                SparkleInst.DownloadCanceled -= CBDownloadCanceled;
                SparkleInst.DownloadCanceled += CBDownloadCanceled;
            });

            await SparkleInst.InitAndBeginDownload(UpdateInfo.Updates.First());

            // ok, the file is downloading now
        }
 public async void InstallUpdateClick()
 {
     await Task.Run(() => {
         CLog.Here().Information($"AppUpdaterService - InstallUpdate : [ Install for Update [{DownloadPath}] ]");
         SparkleInst.CloseApplication += CBCloseApplication;
         SparkleInst.InstallUpdate(UpdateInfo.Updates.First(), DownloadPath);
     });
 }
 public async void UpdateAutomaticallyClick()
 {
     SparkleInst.UserInteractionMode = UserInteractionMode.DownloadAndInstall;
     // TODO: RunFullUpdateUpdateStatusLabel.Text = "Checking for update...";
     SparkleInst.UpdateDetected   += CBFullUpdateUpdateDetected;
     SparkleInst.DownloadStarted  += CBFullUpdateStartedDownloading;
     SparkleInst.DownloadFinished += CBFullUpdateDownloadFileIsReady;
     SparkleInst.CloseApplication += CBFullUpdateCloseApplication;
     await SparkleInst.CheckForUpdatesQuietly();
 }
        /* To Function Features */
        public async void CheckUpdatesClick(SGCheckUpdate sgCheckUpdate                 = null,
                                            SGAvailableUpdate sgAvailableUpdate         = null,
                                            SGDownloadUpdate sgDownloadUpdate           = null,
                                            SGFinishedDownload sgFinishedDownload       = null,
                                            SGMessageNotification sgMessageNotification = null)
        {
            CheckUpdate         = sgCheckUpdate;
            AvailableUpdate     = sgAvailableUpdate;
            DownloadUpdate      = sgDownloadUpdate;
            FinishedDownload    = sgFinishedDownload;
            MessageNotification = sgMessageNotification;

            CLog.Here().Information($"AppUpdaterService - CheckUpdates : [ Checking for updates... ]");
            CheckUpdate?.OpenPopUp();
            UpdateInfo = await SparkleInst.CheckForUpdatesQuietly();

            await Task.Delay(1000);

            await Task.Run(() => {
                CheckUpdate?.ClosePopUp();
                // use _sparkle.CheckForUpdatesQuietly() if you don't want the user to know you are checking for updates!
                // if you use CheckForUpdatesAtUserRequest() and are using a UI, then handling things yourself is rather silly
                // as it will show a UI for things
                if (UpdateInfo != null)
                {
                    switch (UpdateInfo.Status)
                    {
                    case UpdateStatus.UpdateAvailable:
                        CLog.Here().Information($"AppUpdaterService - CheckUpdates : [ There's an update available! ]");
                        AvailableUpdate?.OpenPopUp(SparkleInst, UpdateInfo.Updates);
                        break;

                    case UpdateStatus.UpdateNotAvailable:
                        CLog.Here().Information($"AppUpdaterService - CheckUpdates : [ There's no update available :( ]");
                        MessageNotification?.OpenPopUp("There's no update available :(");
                        break;

                    case UpdateStatus.UserSkipped:
                        CLog.Here().Information($"AppUpdaterService - CheckUpdates : [ The user skipped this update! ]");
                        MessageNotification?.OpenPopUp("The user skipped this update!<br>You have elected to skip this version.");
                        break;

                    case UpdateStatus.CouldNotDetermine:
                        CLog.Here().Information($"AppUpdaterService - CheckUpdates : [ We couldn't tell if there was an update... ]");
                        MessageNotification?.OpenPopUp("We couldn't tell if there was an update...");
                        break;
                    }
                }
            });
        }
        public async void UpdateAutomaticallyClick()
        {
            await Task.Run(() => {
                // RunFullUpdateUpdateStatusLabel.Text = "Checking for update...";
                CLog.Here().Information($"AppUpdaterService - UpdateAutomatically : [ Checking for updates... ]");

                SparkleInst.UserInteractionMode = UserInteractionMode.DownloadAndInstall;
                SparkleInst.UpdateDetected     += CBFullUpdateUpdateDetected;
                SparkleInst.DownloadStarted    += CBFullUpdateStartedDownloading;
                SparkleInst.DownloadFinished   += CBFullUpdateDownloadFileIsReady;
                SparkleInst.CloseApplication   += CBFullUpdateCloseApplication;
            });

            await SparkleInst.CheckForUpdatesQuietly();
        }
        public async void DownloadUpdateClick()
        {
            // this is async so that it can grab the download file name from the server
            SparkleInst.DownloadStarted -= CBStartedDownloading;
            SparkleInst.DownloadStarted += CBStartedDownloading;

            SparkleInst.DownloadFinished -= CBFinishedDownloading;
            SparkleInst.DownloadFinished += CBFinishedDownloading;

            SparkleInst.DownloadHadError -= CBDownloadError;
            SparkleInst.DownloadHadError += CBDownloadError;

            SparkleInst.DownloadMadeProgress += CBDownloadMadeProgress;

            await SparkleInst.InitAndBeginDownload(UpdateInfo.Updates.First());

            // ok, the file is downloading now
        }
 public void InstallUpdateClick()
 {
     SparkleInst.CloseApplication += CBCloseApplication;
     SparkleInst.InstallUpdate(UpdateInfo.Updates.First(), DownloadPath);
 }