Example #1
0
        public static void SetupTrayIcon()
        {
            var settingsItem = new MenuItem()
            {
                Header  = Properties.Strings.SettingsItem,
                ToolTip = Properties.Strings.SettingsItemDescription,
                Icon    = new SymbolIcon()
                {
                    Symbol = Symbol.Setting
                }
            };

            settingsItem.Click += (_, __) => FlyoutHandler.ShowSettingsWindow();

            var exitItem = new MenuItem()
            {
                Header  = Properties.Strings.ExitItem,
                ToolTip = Properties.Strings.ExitItemDescription,
                Icon    = new FontIcon()
                {
                    Glyph = CommonGlyphs.PowerButton
                }
            };

            exitItem.Click += (_, __) => FlyoutHandler.SafelyExitApplication();

            TaskbarIconContextMenu = new ContextMenu()
            {
                Items = { settingsItem, exitItem }
            };

            TaskbarIconToolTip = new ToolTip()
            {
                Content = Program.AppName
            };

            TaskbarIcon = new TaskbarIcon()
            {
                TrayToolTip = TaskbarIconToolTip,
                ContextMenu = TaskbarIconContextMenu
            };
            TaskbarIcon.TrayMouseDoubleClick += (_, __) => FlyoutHandler.ShowSettingsWindow();
        }
 private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     FlyoutHandler.SafelyExitApplication();
 }