/// <summary> /// Used by a second instance of this application to sends a message to the first instance telling /// it to activate the window. /// </summary> public static void SendActivate() { const int HWND_BROADCAST = 0xffff; int message = WindowMessageHook.RegisterMessage(ButtonMessageName); SendMessage((IntPtr)HWND_BROADCAST, message, (int)TrayNotification.Activate, IntPtr.Zero); }
private void ShowTrayIcon() { // TODO: re-implement using solutions registry. // SystemSetting filterType = new SystemSetting("SystemSettings_Notifications_ShowIconsOnTaskbar", // new LoggerFactory().CreateLogger<SystemSetting>()); // var allNotificationIconsShown = (await filterType.GetValue() as bool? == true) ? TrayIcon.TrayIconLocationOption.NotificationTray : TrayIcon.TrayIconLocationOption.NextToNotificationTry; WindowMessageHook windowMessageHook = WindowMessageHook.GetGlobalMessageHook(); MorphicHybridTrayIcon trayIcon = new MorphicHybridTrayIcon(); trayIcon = new MorphicHybridTrayIcon(); trayIcon.Click += this.OnTrayIconClicked; trayIcon.SecondaryClick += this.OnTrayIconRightClicked; trayIcon.Icon = Client.Properties.Resources.Icon; trayIcon.Text = "Morphic"; //trayIcon.TrayIconLocation = allNotificationIconsShown; trayIcon.TrayIconLocation = MorphicHybridTrayIcon.TrayIconLocationOption.NextToNotificationTray; trayIcon.Visible = true; _trayIcon = trayIcon; this.App.Exit += (sender, args) => { _trayIcon.Visible = false; _trayIcon.Dispose(); _trayIcon = null; }; }
private async void ShowTrayButton() { // TODO: re-implement using solutions registry. // SystemSetting filterType = new SystemSetting("SystemSettings_Notifications_ShowIconsOnTaskbar", // new LoggerFactory().CreateLogger<SystemSetting>()); // bool allNotificationIconsShown = await filterType.GetValue() as bool? == true; WindowMessageHook windowMessageHook = WindowMessageHook.GetGlobalMessageHook(); this.trayButton = new TrayButton(windowMessageHook); this.trayButton.Click += this.OnTrayButtonClicked; this.trayButton.SecondaryClick += this.OnTrayButtonRightClicked; this.trayButton.DoubleClick += this.OnTrayButtonDoubleClicked; this.trayButton.Icon = Client.Properties.Resources.Icon; this.trayButton.Text = "Morphic"; //this.trayButton.UseNotificationIcon = allNotificationIconsShown; this.trayButton.Visible = true; this.App.Exit += (sender, args) => { this.trayButton.Visible = false; this.trayButton.Dispose(); this.trayButton = null !; }; }