mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-13 05:55:39 +02:00
2. Adding icon resources 3. Swapping WPF shell to being a class library 4. Formalling closing the NotifyIcon when the app is shutdown
40 lines
1,003 B
C#
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();
|
|
}
|
|
|
|
}
|
|
}
|