Skip to content

Commit

Permalink
Merge pull request #60 from jellyfin/fix-it
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonylavado authored Apr 18, 2022
2 parents 8a8e817 + 9f30047 commit 48e9c9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Jellyfin.Windows.Tray/Jellyfin.Windows.Tray.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PackageReference Include="System.Resources.Extensions" Version="6.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406" />
Expand All @@ -54,6 +54,7 @@
<None Update="Resources\AppIcon.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<EmbeddedResource Include="Resources\JellyfinIcon.ico" />
</ItemGroup>

</Project>
8 changes: 6 additions & 2 deletions Jellyfin.Windows.Tray/TrayApplicationContext.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Security.Principal;
using System.ServiceProcess;
using System.Windows.Forms;
using System.Xml.Linq;
using System.Xml.XPath;
using Jellyfin.Windows.Tray.Properties;
using Microsoft.Win32;

namespace Jellyfin.Windows.Tray;
Expand All @@ -18,6 +19,7 @@ namespace Jellyfin.Windows.Tray;
/// </summary>
public class TrayApplicationContext : ApplicationContext
{
private const string TrayIconResourceName = "Jellyfin.Windows.Tray.Resources.JellyfinIcon.ico";
private readonly string _jellyfinServiceName = "JellyfinServer";
private readonly string _autostartKey = "JellyfinTray";
private string _configFile;
Expand Down Expand Up @@ -133,7 +135,8 @@ private void CreateTrayIcon()
contextMenu.Items.Add(_menuItemExit);

contextMenu.Opening += new CancelEventHandler(ContextMenuOnPopup);
_trayIcon = new NotifyIcon() { Icon = Resources.JellyfinIcon, ContextMenuStrip = contextMenu, Visible = true };
using var iconStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(TrayIconResourceName);
_trayIcon = new NotifyIcon() { Icon = new Icon(iconStream), ContextMenuStrip = contextMenu, Visible = true };
}

private void LoadJellyfinConfig()
Expand Down Expand Up @@ -244,6 +247,7 @@ private void Start(object sender, EventArgs e)
Process p = new Process();
p.StartInfo.FileName = _executableFile;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.Arguments = "--datadir \"" + _dataFolder + "\"";
p.Start();
}
Expand Down

0 comments on commit 48e9c9b

Please sign in to comment.