Skip to content

Commit

Permalink
Fixed window not properly restoring from system tray
Browse files Browse the repository at this point in the history
  • Loading branch information
nint8835 committed Jul 20, 2019
1 parent 0c01bb9 commit 023a62f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Interop;
using iTunesLib;
using iTunesRichPresence_Rewrite.Properties;
using MahApps.Metro;
Expand Down Expand Up @@ -135,11 +136,17 @@ private void PopulateToolbox() {
}
}

[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

private void SetVisibility(bool visible) {
ShowInTaskbar = visible;
Visibility = visible ? Visibility.Visible : Visibility.Hidden;
_notifyIcon.Visible = !visible;
WindowState = visible ? WindowState.Normal : WindowState.Minimized;
if (visible) {
ShowWindow(new WindowInteropHelper(this).Handle, 9);
}
}

private void MetroWindow_StateChanged(object sender, EventArgs e) {
Expand Down
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[assembly: AssemblyDescription("Brings iTunes now playing information to Discord using Rich Presence")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("iTunesRichPresence-Rewrite")]
[assembly: AssemblyProduct("iTunesRichPresence")]
[assembly: AssemblyCopyright("Copyright © Riley Flynn 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.1.0")]
[assembly: AssemblyFileVersion("2.4.1.0")]
[assembly: AssemblyVersion("2.5.0.0")]
[assembly: AssemblyFileVersion("2.5.0.0")]

0 comments on commit 023a62f

Please sign in to comment.