Files
wpf-notifyicon/Hardcodet.NotifyIcon.Wpf/Source/Sample Project/Tutorials/04 - ContextMenus/InlineContextMenuWindow.xaml.cs
Robin Krom 23186feefe Code modernising (#8)
* Applied some code conventions, used more current language features which should improve readability and making it easier to re-factor / modify. Also fixed some typos in documentation.
* Changes based on PR conversation for the SystemInfo
* Some modifications due to conversations on the PR, especially I removed the FlagsAttribute on the BalloonFlags.
* Removed Silverlight targeting in code.
2019-07-16 14:09:59 +02:00

37 lines
1.1 KiB
C#

using System.Windows;
namespace Samples.Tutorials.ContextMenus
{
/// <summary>
/// Interaction logic for InlineContextMenuWindow.xaml
/// </summary>
public partial class InlineContextMenuWindow : Window
{
public InlineContextMenuWindow()
{
InitializeComponent();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//clean up notifyicon (would otherwise stay open until application finishes)
MyNotifyIcon.Dispose();
base.OnClosing(e);
}
private void MyNotifyIcon_TrayContextMenuOpen(object sender, RoutedEventArgs e)
{
OpenEventCounter.Text = (int.Parse(OpenEventCounter.Text) + 1).ToString();
}
private void MyNotifyIcon_PreviewTrayContextMenuOpen(object sender, RoutedEventArgs e)
{
//marking the event as handled suppresses the context menu
e.Handled = (bool) SuppressContextMenu.IsChecked;
PreviewOpenEventCounter.Text = (int.Parse(PreviewOpenEventCounter.Text) + 1).ToString();
}
}
}