/// <summary> /// Handles the tray event if the active window responds to any of the flag /// Only one event should be passed in at a time! /// </summary> /// <param name="flags"></param> public void handleTrayEvent(TrayFlags.PopValues flag, User targUser = null, string keyword = null) { if (!SettingsManager.getMgr().isNotifyEnabled(flag)) { return; } foreach (Window w in activeWindow) { if (!TrayFlags.handlesEvent(w, flag)) { log.Info("Received event: " + flag.ToString() + ". Ignoring - " + activeWindow.ToString() + " does not accept event"); continue; } currEvent = flag; this.targUser = targUser; this.keyword = keyword; string message = TrayFlags.trayLang[currEvent]; message = message.Replace("#", targUser.Name); message = message.Replace("$", keyword); log.Info("Recieved tray event: " + flag.ToString() + ", with targUser: "******", message: " + message); kIcon.ShowBalloonTip("Kaillera Event", message, BalloonIcon.Info); return; } }
/// <summary> /// Sets/gets the active window for the tray manager. /// This will be expanded to multiple windows in the future /// </summary> public void addActiveWindow(Window value) { if (!TrayFlags.containsType(value.GetType())) { return; } activeWindow.Add(value); }
/// <summary> /// Handles the click on the tray button /// Maximizes current windows /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void handleTrayClick(object sender, RoutedEventArgs e) { //Fire tray click event if (trayClicked != null) { trayClicked(); } if (currEvent != TrayFlags.PopValues.None) { foreach (var wind in activeWindow) { if (TrayFlags.handlesEvent(wind, currEvent)) { wind.Visibility = Visibility.Visible; wind.WindowState = WindowState.Normal; wind.Show(); } } } currEvent = TrayFlags.PopValues.None; }