From 868a7ce9c8b50bd64c8b5ae33fec77abfd25ef7c Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Thu, 21 Feb 2013 23:23:06 -0500 Subject: isolated clickonce dependancies --- MediaBrowser.ServerApplication/App.xaml.cs | 56 ++++++++++++++-------- .../LibraryExplorer.xaml.cs | 2 +- .../MediaBrowser.ServerApplication.csproj | 5 +- 3 files changed, 41 insertions(+), 22 deletions(-) (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs index cc6367127..919898aa3 100644 --- a/MediaBrowser.ServerApplication/App.xaml.cs +++ b/MediaBrowser.ServerApplication/App.xaml.cs @@ -1,14 +1,14 @@ -using MediaBrowser.Common.Kernel; -using MediaBrowser.Common.Updates; +using MediaBrowser.ClickOnce; +using MediaBrowser.Common.Kernel; using MediaBrowser.Controller; using MediaBrowser.IsoMounter; using MediaBrowser.Logging.Nlog; using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Updates; using MediaBrowser.Server.Uninstall; using MediaBrowser.ServerApplication.Implementations; using Microsoft.Win32; using System; -using System.Deployment.Application; using System.Diagnostics; using System.IO; using System.Linq; @@ -71,7 +71,7 @@ namespace MediaBrowser.ServerApplication /// Gets or sets the log file path. /// /// The log file path. - private string LogFilePath { get; set; } + public string LogFilePath { get; private set; } /// /// Initializes a new instance of the class. @@ -235,24 +235,9 @@ namespace MediaBrowser.ServerApplication /// private void ConfigureClickOnceStartup() { - if (!ApplicationDeployment.IsNetworkDeployed) - { - return; - } - try { - var clickOnceHelper = new ClickOnceHelper(PublisherName, ProductName, SuiteName); - - if (Kernel.Configuration.RunAtStartup) - { - clickOnceHelper.UpdateUninstallParameters(UninstallerFileName); - clickOnceHelper.AddShortcutToStartup(); - } - else - { - clickOnceHelper.RemoveShortcutFromStartup(); - } + ClickOnceHelper.ConfigureClickOnceStartupIfInstalled(PublisherName, ProductName, SuiteName, Kernel.Configuration.RunAtStartup, UninstallerFileName); LastRunAtStartupValue = Kernel.Configuration.RunAtStartup; } @@ -469,5 +454,36 @@ namespace MediaBrowser.ServerApplication RenderOptions.SetBitmapScalingMode(bitmap, BitmapScalingMode.Fant); return bitmap; } + + /// + /// Gets or sets a value indicating whether this instance can self update. + /// + /// true if this instance can self update; otherwise, false. + public bool CanSelfUpdate + { + get { return ClickOnceHelper.IsNetworkDeployed; } + } + + /// + /// Checks for update. + /// + /// The cancellation token. + /// The progress. + /// Task{CheckForUpdateResult}. + public Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress) + { + return new ApplicationUpdateCheck().CheckForApplicationUpdate(cancellationToken, progress); + } + + /// + /// Updates the application. + /// + /// The cancellation token. + /// The progress. + /// Task. + public Task UpdateApplication(CancellationToken cancellationToken, IProgress progress) + { + return new ApplicationUpdater().UpdateApplication(cancellationToken, progress); + } } } diff --git a/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs b/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs index 9645b93dc..02dd6fb9c 100644 --- a/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs +++ b/MediaBrowser.ServerApplication/LibraryExplorer.xaml.cs @@ -41,7 +41,7 @@ namespace MediaBrowser.ServerApplication _logger = logger; InitializeComponent(); - lblVersion.Content = "Version: " + Kernel.Instance.DisplayVersion; + lblVersion.Content = "Version: " + Kernel.Instance.ApplicationVersion; foreach (var user in Kernel.Instance.Users) ddlProfile.Items.Add(user); ddlProfile.Items.Insert(0,new User {Name = "Physical"}); diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index ff8be69e4..2f9169123 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -138,7 +138,6 @@ ..\packages\System.Data.SQLite.1.0.84.0\lib\net45\System.Data.SQLite.Linq.dll - @@ -240,6 +239,10 @@ {07b509c0-0c28-4f3f-8963-5263281f7e3d} BDInfo + + {cc96bf3e-0bda-4809-bc4b-bb6d418f4a84} + MediaBrowser.ClickOnce + {9142eefa-7570-41e1-bfcc-468bb571af2f} MediaBrowser.Common -- cgit v1.2.3