From d3b9afef2f3895daf91056938a92d6f51c8c834b Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Mon, 4 Mar 2013 02:19:04 -0500 Subject: removed the clickonce assembly --- MediaBrowser.ClickOnce/ApplicationUpdateCheck.cs | 106 ----------------------- 1 file changed, 106 deletions(-) delete mode 100644 MediaBrowser.ClickOnce/ApplicationUpdateCheck.cs (limited to 'MediaBrowser.ClickOnce/ApplicationUpdateCheck.cs') diff --git a/MediaBrowser.ClickOnce/ApplicationUpdateCheck.cs b/MediaBrowser.ClickOnce/ApplicationUpdateCheck.cs deleted file mode 100644 index 72c42f586..000000000 --- a/MediaBrowser.ClickOnce/ApplicationUpdateCheck.cs +++ /dev/null @@ -1,106 +0,0 @@ -using MediaBrowser.Model.Updates; -using System; -using System.Deployment.Application; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.ClickOnce -{ - /// - /// Class ApplicationUpdateCheck - /// - public class ApplicationUpdateCheck - { - /// - /// The _task completion source - /// - private TaskCompletionSource _taskCompletionSource; - - /// - /// The _progress - /// - private IProgress _progress; - - /// - /// Checks for application update. - /// - /// The cancellation token. - /// The progress. - /// Task{CheckForUpdateCompletedEventArgs}. - /// Current deployment is not a ClickOnce deployment - public Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress) - { - if (!ApplicationDeployment.IsNetworkDeployed) - { - throw new InvalidOperationException("Current deployment is not network deployed."); - } - - _progress = progress; - - _taskCompletionSource = new TaskCompletionSource(); - - var deployment = ApplicationDeployment.CurrentDeployment; - - cancellationToken.Register(deployment.CheckForUpdateAsyncCancel); - - cancellationToken.ThrowIfCancellationRequested(); - - deployment.CheckForUpdateCompleted += deployment_CheckForUpdateCompleted; - deployment.CheckForUpdateProgressChanged += deployment_CheckForUpdateProgressChanged; - - deployment.CheckForUpdateAsync(); - - return _taskCompletionSource.Task; - } - - /// - /// To the result. - /// - /// The instance containing the event data. - /// CheckForUpdateResult. - private CheckForUpdateResult ToResult(CheckForUpdateCompletedEventArgs args) - { - return new CheckForUpdateResult - { - AvailableVersion = args.AvailableVersion, - IsUpdateAvailable = args.UpdateAvailable - }; - } - - /// - /// Handles the CheckForUpdateCompleted event of the deployment control. - /// - /// The source of the event. - /// The instance containing the event data. - void deployment_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e) - { - var deployment = ApplicationDeployment.CurrentDeployment; - - deployment.CheckForUpdateCompleted -= deployment_CheckForUpdateCompleted; - deployment.CheckForUpdateProgressChanged -= deployment_CheckForUpdateProgressChanged; - - if (e.Error != null) - { - _taskCompletionSource.SetException(e.Error); - } - else if (e.Cancelled) - { - _taskCompletionSource.SetCanceled(); - } - else - { - _taskCompletionSource.SetResult(ToResult(e)); - } - } - - /// - /// Handles the CheckForUpdateProgressChanged event of the deployment control. - /// - /// The source of the event. - /// The instance containing the event data. - void deployment_CheckForUpdateProgressChanged(object sender, DeploymentProgressChangedEventArgs e) - { - _progress.Report(e.ProgressPercentage); - } - } -} -- cgit v1.2.3