private void muteSwicth_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (state != MuteState.MUTE_ON) { muteOn(); state = MuteState.MUTE_ON; updateNotifyIcon(); } } else if (e.Button == MouseButtons.Right) { if (state != MuteState.MUTE_OFF) { muteOff(); state = MuteState.MUTE_OFF; updateNotifyIcon(); } } else if (e.Button == MouseButtons.Middle) { Application.Exit(); } }
public DeviceInformation(MuteState muteState, string masterVolume, ZoneState mainZoneState, ZoneState zone2State, string subwooferLevel) { MuteState = muteState; MasterVolume = masterVolume; MainZoneState = mainZoneState; Zone2State = zone2State; SubwooferLevel = subwooferLevel; }
// Get current mute state private MuteState CreateCurrentMuteState(IGuildUser user) { var state = new MuteState(); state.Deaf = user.IsDeafened; state.Mute = user.IsMuted; return(state); }
private bool NeedMuteControl(IGuildUser user, MuteState before, MuteState after) { if (_config.MuteSpectator || _idConversionDict.Values.Contains(user.Id)) { if (!before.Equals(after)) { return(true); } } return(false); }
public NotificationItem( string key, MuteState state, DateTime now, bool isShowDesktopNotifications = false) { this.ID = key; this.MuteState = state; this.MuteTime = now; this.ShowDesktopNotifications = isShowDesktopNotifications; }
public void AddAlert( string imagePath, string title, string displayMsg, bool autoClose, int duration, MouseButtonEventHandler clickHandler, bool hideMute, string vmName, bool isCloudNotification, string package = "", bool isForceNotification = false, string id = "0", bool showOnlySettings = false) { if (!this.mIsPopupsEnabled) { return; } this.Dispatcher.Invoke((Delegate)(() => { MuteState muteState = NotificationManager.Instance.IsShowNotificationForKey(title, vmName); if (((muteState == MuteState.NotMuted ? 1 : (muteState == MuteState.AutoHide ? 1 : 0)) | (isForceNotification ? 1 : 0)) == 0 && !NotificationManager.Instance.IsDesktopNotificationToBeShown(title)) { return; } if (this.Visibility == Visibility.Collapsed || this.Visibility == Visibility.Hidden) { this.Show(); } string upper = (string.IsNullOrEmpty(package) ? title : package).ToUpper(CultureInfo.InvariantCulture); if (this.mDictPopups.ContainsKey(upper)) { this.RemovePopup(this.mDictPopups[upper]); } if (this.mDictPopups.Count >= 3) { this.RemovePopup((NotificationPopup)this.mStackPanel.Children[2]); } if (!isCloudNotification & isForceNotification) { autoClose = true; duration = 5000; } NotificationPopup notificationPopup = NotificationPopup.InitPopup(imagePath, title, displayMsg, autoClose, duration, clickHandler, hideMute, vmName, (MouseButtonEventHandler)null, (MouseButtonEventHandler)null, (MouseButtonEventHandler)null, false, string.Empty, id, showOnlySettings, package); this.mStackPanel.Children.Insert(0, (UIElement)notificationPopup); this.mDictPopups.Add(upper, notificationPopup); })); }
private MuteState CreateNextMuteState(IGuildUser user, MuteType muteType) { // set default state _logger.LogDebug($"{user.Username} mute conf"); var ms = new MuteState(_defaultVCProps[user.Id]); if (muteType == MuteType.Default) { return(ms); } _logger.LogDebug($"{user.Username} dead state set"); // Set dead state bool isDead = true; var cnvInfo = _idConversionDict.FirstOrDefault(u => u.Value == user.Id); if (cnvInfo.Value == user.Id) { try { _logger.LogDebug($"{user.Username} found in conversion list"); isDead = _isDead[cnvInfo.Key]; var name = _players[cnvInfo.Key].Client.Name; _logger.LogDebug($"Player => {name}({user.Username}) is dead: {isDead}"); } catch (Exception e) { LogStackTrace(e, "CreateNextMuteState"); } } else { _logger.LogInformation($"Spectator => {user.Username}"); } // Apply mute rule MuteConfig m = _config.TaskPhaseMuteRules; if (muteType == MuteType.MeetingPhase) { m = _config.MeetingPhaseMuteRules; } ms.Mute = isDead ? m.Mute.Dead : m.Mute.Alive; ms.Deaf = isDead ? m.Deaf.Dead : m.Deaf.Alive; return(ms); }
public AppNotificationsToggleButton( MainWindow window, string name, string imagePath, string packageName) { this.InitializeComponent(); this.ParentWindow = window; this.PackageName = packageName; this.mAppTitle.Text = name; this.mAppIcon.Source = (ImageSource)CustomPictureBox.GetBitmapImage(imagePath, "", true); if (NotificationManager.Instance.DictNotificationItems.Keys.Contains <string>(name)) { this.mBellNotificationStatus.BoolValue = NotificationManager.Instance.DictNotificationItems[name].MuteState != MuteState.MutedForever; if (NotificationManager.Instance.DictNotificationItems[name].ShowDesktopNotifications) { this.mDesktopNotificationStatus.BoolValue = true; } else { this.mDesktopNotificationStatus.BoolValue = false; } } else { MuteState defaultState = NotificationManager.Instance.GetDefaultState(this.ParentWindow?.mVmName); bool isShowDesktopNotifications = false; if (PostBootCloudInfoManager.Instance.mPostBootCloudInfo?.DesktopNotificationsChatPackages?.ChatApplicationPackages != null) { isShowDesktopNotifications = PostBootCloudInfoManager.Instance.mPostBootCloudInfo.DesktopNotificationsChatPackages.ChatApplicationPackages.IsPackageAvailable(this.PackageName); } NotificationManager.Instance.DictNotificationItems.Add(name, new NotificationItem(name, defaultState, DateTime.Now, isShowDesktopNotifications)); NotificationManager.Instance.UpdateNotificationsSettings(); this.mBellNotificationStatus.BoolValue = defaultState != MuteState.MutedForever; if (NotificationManager.Instance.DictNotificationItems[name].ShowDesktopNotifications) { this.mDesktopNotificationStatus.BoolValue = true; } else { this.mDesktopNotificationStatus.BoolValue = false; } } }
public void UpdateMuteState(MuteState state, string key, string vmName) { if (this.DictNotificationItems.ContainsKey(key)) { this.DictNotificationItems[key].MuteState = state; this.DictNotificationItems[key].MuteTime = DateTime.Now; } else { string packageName; bool appInfoFromAppName = new JsonParser(vmName).GetAppInfoFromAppName(key, out packageName, out string _, out string _); this.DictNotificationItems.Add(key, new NotificationItem(key, state, DateTime.Now, appInfoFromAppName && NotificationManager.Instance.ChatApplications.IsPackageAvailable(packageName))); } if (string.Equals(key, Strings.ProductDisplayName, StringComparison.InvariantCultureIgnoreCase)) { this.DictNotificationItems[key].MuteState = MuteState.NotMuted; this.DictNotificationItems[key].ShowDesktopNotifications = false; } this.UpdateNotificationsSettings(); }
public virtual void MuteOn() { _prevVolume = CurrentVolume; _volume = 0; _muteState = MuteState.MuteOn; }
public virtual void MuteOff() { _volume = _prevVolume; _muteState = MuteState.MuteOff; }
/// <summary> /// Manage which key is pressed and what action it activates /// </summary> protected virtual void KeyManager() { // Loop for the selection of an option by pressing enter switch (GameManager.Instance.Input.Key) { case ConsoleKey.DownArrow: { MoveCursor(ArrowDirection.Down); _redraw = true; break; } case ConsoleKey.UpArrow: { MoveCursor(ArrowDirection.Up); _redraw = true; break; } case ConsoleKey.Escape: { // Clear because we change the menu page Console.Clear(); // Get back to the main menu GameManager.Instance.CurrentMenu = GameManager.Instance.Menus[0]; _redraw = true; break; } case ConsoleKey.Enter: { // Clear because we change the menu page Console.Clear(); // Which button is selected for (int i = 0; i < MenuButtons.Count; i++) { // If the button is the selected one if (SelectedIndex == i) { switch (MenuButtons[i].Name) { case "QUIT": { Environment.Exit(0); break; } case "PLAY": case "RESUME": { // Run the game if (MenuButtons[i].Name.Equals("PLAY")) { GameManager.Instance.SetupMainGame(); } GameManager.Instance.WindowSize = new Vector2D(100, 50); GameManager.Instance.State = GameManager.GameManagerState.MainGame; break; } case "BACK": case "BACK TO MAIN MENU": { // Get back to the main menu GameManager.Instance.CurrentMenu = GameManager.Instance.Menus[0]; break; } case "SETTINGS": { // Go to the settings menu GameManager.Instance.CurrentMenu = GameManager.Instance.Menus[1]; break; } case "HIGHSCORE": { // Go to the highscore menu GameManager.Instance.CurrentMenu = GameManager.Instance.Menus[2]; break; } case "ABOUT": { // Go to the about menu GameManager.Instance.CurrentMenu = GameManager.Instance.Menus[3]; break; } case "MUTE : DISABLED": case "MUTE : ENABLED": { if (_muteState == MuteState.Disabled) { // Stop the sound _muteState = MuteState.Enabled; GameManager.Instance.MusicSound.Stop(); MenuButtons[i].Name = "MUTE : ENABLED"; } else { // Activate the sound _muteState = MuteState.Disabled; GameManager.Instance.MusicSound.PlayLooping(); MenuButtons[i].Name = "MUTE : DISABLED"; } break; } case "DIFFICULTY : EASY": { // Set the difficulty to hard GameManager.Instance.Difficulty = GameManager.GameDifficulty.Hard; MenuButtons[i].Name = "DIFFICULTY : HARD"; break; } case "DIFFICULTY : HARD": { // Set the difficulty to easy GameManager.Instance.Difficulty = GameManager.GameDifficulty.Easy; MenuButtons[i].Name = "DIFFICULTY : EASY"; break; } default: { break; } } } } _redraw = true; break; } default: { break; } } }
private bool NeedMuteControl(IGuildUser user, MuteState after) => NeedMuteControl(user, CreateCurrentMuteState(user), after);
public override void Decode(string msg) { Message = msg; if (Message.StartsWith(Identifier)) { string s = Message.Replace(Identifier, ""); MuteState = (MuteState)int.Parse(s); } else { throw new Exception("Invalid message format, expected " + Identifier + " Received " + Message); } }
public MuteStateResponse(MuteState muteState) { MuteState = muteState; }
public MuteState IsNotificationMutedForKey(string title, string vmName = "Android") { MuteState state = MuteState.AutoHide; if (this.DictNotificationItems.ContainsKey(title)) { if (this.DictNotificationItems[title].MuteState != MuteState.AutoHide) { if (this.DictNotificationItems[title].MuteState == MuteState.MutedForever) { state = MuteState.MutedForever; } else if (this.DictNotificationItems[title].MuteState == MuteState.NotMuted) { state = MuteState.NotMuted; } else if (this.DictNotificationItems[title].MuteState == MuteState.MutedFor1Hour) { if ((DateTime.Now - this.DictNotificationItems[title].MuteTime).Hours < 1) { state = MuteState.MutedForever; } else { this.DictNotificationItems.Remove(title); this.UpdateNotificationsSettings(); state = MuteState.AutoHide; } } else if (this.DictNotificationItems[title].MuteState == MuteState.MutedFor1Day) { if ((DateTime.Now - this.DictNotificationItems[title].MuteTime).Days < 1) { state = MuteState.MutedForever; } else { this.DictNotificationItems.Remove(title); this.UpdateNotificationsSettings(); state = MuteState.AutoHide; } } else if (this.DictNotificationItems[title].MuteState == MuteState.MutedFor1Week) { if ((DateTime.Now - this.DictNotificationItems[title].MuteTime).Days < 7) { state = MuteState.MutedForever; } else { this.DictNotificationItems.Remove(title); this.UpdateNotificationsSettings(); state = MuteState.AutoHide; } } } } else { if (this.DictNotificationItems.ContainsKey(this.ShowNotificationText)) { state = this.GetDefaultState(vmName); } else { state = MuteState.NotMuted; this.DictNotificationItems.Add(this.ShowNotificationText, new NotificationItem(this.ShowNotificationText, state, DateTime.Now, false)); } string packageName; bool appInfoFromAppName = new JsonParser(vmName).GetAppInfoFromAppName(title, out packageName, out string _, out string _); if (!this.DictNotificationItems.ContainsKey(title)) { this.DictNotificationItems.Add(title, new NotificationItem(title, state, DateTime.Now, appInfoFromAppName && NotificationManager.Instance.ChatApplications.IsPackageAvailable(packageName))); } } if (string.Equals(title, Strings.ProductDisplayName, StringComparison.InvariantCultureIgnoreCase)) { state = MuteState.NotMuted; this.UpdateMuteState(state, title, vmName); } else { this.UpdateNotificationsSettings(); } return(state); }
public Form1() { InitializeComponent(); state = MuteState.MUTE_UNKNOW; }