Еще рефакторинга

This commit is contained in:
Danil Kislov
2019-03-15 18:07:54 +03:00
parent 1633240efa
commit 25b39a45f8
4 changed files with 17 additions and 13 deletions
+11
View File
@@ -0,0 +1,11 @@
using System.Windows.Forms;
namespace JiraTimeBotForm.UI
{
public interface ITrayMenu
{
NotifyIcon Create(frmMain form);
void Show();
void Hide();
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace JiraTimeBotForm.UI
{
public static class RestoreFromTray {
[DllImport( "user32.dll" )]
private static extern int ShowWindow( IntPtr hWnd, uint Msg );
private const uint SW_RESTORE = 0x09;
public static void Restore( this Form form )
{
if (form.WindowState == FormWindowState.Minimized)
{
ShowWindow(form.Handle, SW_RESTORE);
}
}
}
}
+1 -8
View File
@@ -48,14 +48,7 @@ namespace JiraTimeBotForm.UI
form.Visible = true;
form.Activate();
form.BringToFront();
Extensions.Extensions.Restore(form);
RestoreFromTray.Restore(form);
}
}
public interface ITrayMenu
{
NotifyIcon Create(frmMain form);
void Show();
void Hide();
}
}