Hello All,
I have the following code behind in my application, and I need to re-write it, so that it all is handled in the xaml. The reason is for design purposes, so could you please help out if you can?
Thank you!
Here is the code snippet:
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
this.WindowState = WindowState.Minimized;
Properties.Settings.Default.Save();
}
private void Window_Closed(object sender, EventArgs e)
{
this.WindowState = WindowState.Minimized;
this.ShowInTaskbar = false;
Properties.Settings.Default.Save();
}
protected override void OnStateChanged(EventArgs e)
{
if (WindowState == WindowState.Minimized)
{
this.Hide();
this.ShowInTaskbar = false;
}
}
private void Open_Click(object sender, EventArgs e)
{
this.Show();
this.WindowState = WindowState.Normal;
}
private void Close_Click(object sender, EventArgs e)
{
this.myNotifyIcon.Dispose();
this.myNotifyIcon = null;
Environment.Exit(0);
Properties.Settings.Default.Save();
}
private void myNotifyIcon_DoubleClick(object Sender, EventArgs e)
{
this.Show();
this.Focus();
this.WindowState = WindowState.Normal;
}