private void BuildStandardMenuItems() { var exitItem = new MenuItem { Header = "Exit" }; exitItem.Click += ExitItem_Click; var launchItem = new MenuItem { Header = "Launch at Startup", IsCheckable = true, IsChecked = MenuItemHelper.GetStartupStatus() }; MenuItemHelper.SetStartup(launchItem.IsChecked); launchItem.Click += LaunchItem_Click; if (MenuItemHelper.CheckVersion()) { var newVersionItem = new MenuItem { Header = "Update available!", Icon = MenuItemHelper.GetImageFromResource( "pack://application:,,,/Resources/StatusWarning_256x.png") }; newVersionItem.Click += NewVersionItem_Click; _contextMenu.Items.Add(newVersionItem); } _contextMenu.Items.Add(launchItem); _contextMenu.Items.Add(exitItem); }
private void LaunchItem_Click(object sender, RoutedEventArgs e) { var menuItem = sender as MenuItem; MenuItemHelper.SetStartup(menuItem != null && menuItem.IsChecked); }