mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-31 23:42:09 +01:00
isolated clickonce dependancies
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
using System.Deployment.Application;
|
||||
using System.Net.Cache;
|
||||
using System.Windows.Media;
|
||||
using MediaBrowser.ApiInteraction;
|
||||
using MediaBrowser.ApiInteraction;
|
||||
using MediaBrowser.ClickOnce;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.IsoMounter;
|
||||
using MediaBrowser.Logging.Nlog;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Updates;
|
||||
using MediaBrowser.Model.Weather;
|
||||
using MediaBrowser.UI.Controller;
|
||||
using MediaBrowser.UI.Controls;
|
||||
using MediaBrowser.UI.Pages;
|
||||
using MediaBrowser.UI.Uninstall;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Cache;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace MediaBrowser.UI
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace MediaBrowser.UI
|
||||
/// Gets or sets the log file path.
|
||||
/// </summary>
|
||||
/// <value>The log file path.</value>
|
||||
private string LogFilePath { get; set; }
|
||||
public string LogFilePath { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when [property changed].
|
||||
@@ -916,24 +916,9 @@ namespace MediaBrowser.UI
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
@@ -1004,5 +989,36 @@ namespace MediaBrowser.UI
|
||||
RenderOptions.SetBitmapScalingMode(bitmap, BitmapScalingMode.Fant);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance can self update.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
||||
public bool CanSelfUpdate
|
||||
{
|
||||
get { return ClickOnceHelper.IsNetworkDeployed; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks for update.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <returns>Task{CheckForUpdateResult}.</returns>
|
||||
public Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
|
||||
{
|
||||
return new ApplicationUpdateCheck().CheckForApplicationUpdate(cancellationToken, progress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the application.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <returns>Task.</returns>
|
||||
public Task UpdateApplication(CancellationToken cancellationToken, IProgress<double> progress)
|
||||
{
|
||||
return new ApplicationUpdater().UpdateApplication(cancellationToken, progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
26
MediaBrowser.UI/Extensions/Extensions.cs
Normal file
26
MediaBrowser.UI/Extensions/Extensions.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace MediaBrowser.UI.Extensions
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Invokes an action after a specified delay
|
||||
/// </summary>
|
||||
/// <param name="dispatcher">The dispatcher.</param>
|
||||
/// <param name="action">The action.</param>
|
||||
/// <param name="delayMs">The delay ms.</param>
|
||||
public static void InvokeWithDelay(this Dispatcher dispatcher, Action action, long delayMs)
|
||||
{
|
||||
var timer = new DispatcherTimer(DispatcherPriority.Normal, dispatcher);
|
||||
timer.Interval = TimeSpan.FromMilliseconds(delayMs);
|
||||
timer.Tick += (sender, args) =>
|
||||
{
|
||||
timer.Stop();
|
||||
action();
|
||||
};
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using MediaBrowser.UI.Extensions;
|
||||
|
||||
namespace MediaBrowser.UI
|
||||
{
|
||||
|
||||
@@ -116,7 +116,6 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
@@ -153,6 +152,7 @@
|
||||
<Compile Include="Controls\NotificationMessage.xaml.cs">
|
||||
<DependentUpon>NotificationMessage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Extensions\Extensions.cs" />
|
||||
<Compile Include="HiddenWindow.xaml.cs">
|
||||
<DependentUpon>HiddenWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -300,6 +300,10 @@
|
||||
<Project>{921c0f64-fda7-4e9f-9e73-0cb0eedb2422}</Project>
|
||||
<Name>MediaBrowser.ApiInteraction</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.ClickOnce\MediaBrowser.ClickOnce.csproj">
|
||||
<Project>{cc96bf3e-0bda-4809-bc4b-bb6d418f4a84}</Project>
|
||||
<Name>MediaBrowser.ClickOnce</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
|
||||
<Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
|
||||
<Name>MediaBrowser.Common</Name>
|
||||
|
||||
Reference in New Issue
Block a user