PersistentWindows/Ninjacrab.PersistentWindows.Solution/Ninjacrab.PersistentWindows.SystrayShell/SystrayForm.cs
Min Yong Kim a71ea99b8e 1. Adding missing files
2. Adding icon resources
3. Swapping WPF shell to being a class library
4. Formalling closing the NotifyIcon when the app is shutdown
2015-02-27 00:48:10 -05:00

40 lines
1,003 B
C#

using System;
using System.Windows.Forms;
using Ninjacrab.PersistentWindows.WpfShell;
namespace Ninjacrab.PersistentWindows.SystrayShell
{
public partial class SystrayForm : Form
{
public MainWindow MainView { get; set; }
public SystrayForm()
{
InitializeComponent();
}
private void DiagnosticsToolStripMenuItemClickHandler(object sender, EventArgs e)
{
bool shouldShow = false;
if (this.MainView == null ||
this.MainView.IsClosed)
{
this.MainView = new MainWindow();
shouldShow = true;
}
if (shouldShow)
{
this.MainView.Show();
}
}
private void ExitToolStripMenuItemClickHandler(object sender, EventArgs e)
{
this.notifyIconMain.Visible = false;
this.notifyIconMain.Icon = null;
Application.Exit();
}
}
}