public NotificationSoundViewModel(ChooseSoundViewModel parent, NotificationSound notificationSound, bool selected) { _parent = parent; _notificationSound = notificationSound; _isSelected = selected; }
public void PlayNotification(NotificationSound notificationSound) { SystemSE sound; switch (notificationSound) { case NotificationSound.Success: #if KKS sound = SystemSE.ok_l; #else sound = SystemSE.result_single; #endif break; case NotificationSound.Error: sound = SystemSE.cancel; break; default: sound = SystemSE.result_end; break; } Utils.Sound.Play(sound); }
public void PlaySound(NotificationSound sound, bool forceCustom = false) { try { var focused = false; App.MainForm.Invoke(() => focused = App.MainForm.ContainsFocus); if (!focused) { SoundPlayer player = null; if (forceCustom || AppSettings.ChatCustomHighlightSound) { try { var fileInfo = new FileInfo(Path.Combine(Util.GetUserDataPath(), "Custom", "Ping.wav")); if (fileInfo.Exists) { if (fileInfo.LastWriteTime != highlightTimeStamp) { HighlightSound?.Dispose(); try { using (var stream = new FileStream(Path.Combine(Util.GetUserDataPath(), "Custom", "Ping.wav"), FileMode.Open)) { HighlightSound = new SoundPlayer(stream); HighlightSound.Load(); } player = HighlightSound; Console.WriteLine("loaded"); } catch { HighlightSound.Dispose(); } } } else { player = HighlightSound; } } catch { } } if (player == null) { player = defaultHighlightSound; } player.Play(); } } catch { } }
public static void PlaySound(NotificationSound sound) { IWavePlayer waveOutDevice; AudioFileReader audioFileReader; waveOutDevice = new WaveOut(); audioFileReader = new AudioFileReader("resources/sounds/message.mp3"); waveOutDevice.Init(audioFileReader); waveOutDevice.Play(); }
// play a notification sound every NOTIFYTIME seconds until signalled void IntervalNotify() { while (!NotifyBlocker.WaitOne(NOTIFYTIME)) // while not signalled { NotificationSound.Play(); } // reset signal for next notifyblock NotifyBlocker.Reset(); }
/// <summary> /// Plays the notification sound. /// </summary> /// <param name="notificationSound">The notification sound to play </param> /// <param name="guid">The plugin GUID. If provided will check the per-plugin config if sounds are enabled.</param> public void PlayNotificationSound(NotificationSound notificationSound, string guid = null) { if (!string.IsNullOrEmpty(guid)) { if (NotificationSoundsEnabled.TryGetValue(guid, out var soundEnabled) && !soundEnabled) { return; } } PlayNotification(notificationSound); }
NotificationSound GetSound() { switch (this.SelectedSoundType) { case "Default": return(NotificationSound.Default); //case "Priority" : return NotificationSound.Default; case "Custom": return(NotificationSound.FromCustom("notification.mp3")); default: return(NotificationSound.None); } }
private void ClientSocket_OnMessagereceived(SocketMessage e) { string dataString = e.GetValue("DataType") == null ? "" : e.GetValue("DataType").ToString(); Reply.ContentType dataType = (Reply.ContentType)Enum.Parse(typeof(Reply.ContentType), dataString); string[] urls = null; if (e.Data.ContainsKey("Links")) { urls = JsonConvert.DeserializeObject <string[]>(JsonConvert.SerializeObject(e.Data["Links"])); } MessageBlock block; if (dataType == Reply.ContentType.Picture && urls != null) { block = new MessageBlock(urls, e.GetValue("Message").ToString()); } else { block = new MessageBlock(); } string timeStamp = e.GetValue("TimeStamp").ToString(); timeStamp = DateTime.Parse(timeStamp).ToString("h:mm tt"); block.Message = e.GetValue("Message").ToString(); block.Sender = e.GetValue("Sender").ToString(); block.Date = timeStamp; block.MaximumSize = new Size(((InnerChatContainer.Width - 20) / 2) - 20, int.MaxValue); Invoke(new MethodInvoker(() => { block.FormatSize(); InnerChatContainer.Controls.Add(block); SelectedChat.LastMessage = e.GetValue("Message").ToString(); SelectedChat.TimeStamp = timeStamp; })); if ((DateTime.Now - lastNotification).TotalSeconds > 5 && block.Sender != CurrentUser.UserName && !Activated) { lastNotification = DateTime.Now; NotificationSound.Play(); } ResizeChat(); }
public void PlayNotification(NotificationSound notificationSound) { SoundPack.SystemSE sound; switch (notificationSound) { case NotificationSound.Success: sound = SoundPack.SystemSE.OK_L; break; case NotificationSound.Error: sound = SoundPack.SystemSE.Error; break; default: sound = SoundPack.SystemSE.Cancel; break; } Singleton <Resources> .Instance.SoundPack.Play(sound); }
public void PlayNotification(NotificationSound notificationSound) { SystemSE sound; switch (notificationSound) { case NotificationSound.Success: sound = SystemSE.ok_l; break; case NotificationSound.Error: sound = SystemSE.cancel; break; default: sound = SystemSE.ok_s; break; } Utils.Sound.Play(sound); }
private void SetNotificationSound(NotificationSound value) { Windows.Storage.ApplicationData.Current.LocalSettings.Values[NOTIFICATION_SOUND_STORAGE] = (int)value; }
private static void PlayNotificationSound(NotificationSound notificationSound) { GeBoAPI.Instance.PlayNotificationSound(notificationSound, GUID); }
void ShowCore(string rpTitle, string rpBody, NotificationSound rpSound, string rpCustomSoundFilename, string rpSecondLine = null) { var rBody = rpBody; if (rpSecondLine != null) rBody = $"{rBody}{Environment.NewLine}{rpSecondLine}"; r_NotifyIcon.ShowBalloonTip(1000, rpTitle, rBody, ToolTipIcon.None); if (rpSound == NotificationSound.SystemSound) NativeMethods.WinMM.PlaySoundW("SystemNotification", IntPtr.Zero, NativeEnums.SND.SND_ALIAS | NativeEnums.SND.SND_ASYNC); if (rpSound == NotificationSound.Custom) DispatcherUtil.UIDispatcher.BeginInvoke(new Action<string>(PlayCustomSound), rpCustomSoundFilename); }
public Notification() { icon = new NotificationIcon(); sound = new NotificationSound(); }
public PlayNotificationMessage(NotificationSound sound) { NotificationSound = sound; }
public FluentNotificationBuilder AddSound(NotificationSound sound) { notification.sound = sound; return(this); }
void Timer() { string periodLabel = ""; int periodTime = 0; bool isWorkPeriod = true, wasPaused = false, wasRestarted = false; DateTime currentTime, periodEndTime; while (Command != QUIT) { currentTime = DateTime.Now; if (wasPaused) { // do not reset label or time, use saved periodTime wasPaused = false; periodEndTime = currentTime.AddMilliseconds(periodTime); Console.WriteLine("[{0}] Resumed: {1} | End: {2} ({3})", periodLabel, currentTime.ToString("h:mm:ss tt"), periodEndTime.ToString("h:mm:ss tt"), (periodEndTime - currentTime).ToString(@"mm\:ss")); } else if (wasRestarted) { // do not reset label or time, use existing or modified periodTime wasRestarted = false; periodEndTime = currentTime.AddMilliseconds(periodTime); Console.WriteLine("[{0}] Restarted: {1} | End: {2} ({3})", periodLabel, currentTime.ToString("h:mm:ss tt"), periodEndTime.ToString("h:mm:ss tt"), (periodEndTime - currentTime).ToString(@"mm\:ss")); } else // normal flow { if (isWorkPeriod) { periodLabel = "WORK"; periodTime = WORKTIME; } else { periodLabel = "REST"; periodTime = RESTTIME; } periodEndTime = currentTime.AddMilliseconds(periodTime); Console.WriteLine("[{0}] Start: {1} | End: {2} ({3})", periodLabel, currentTime.ToString("h:mm:ss tt"), periodEndTime.ToString("h:mm:ss tt"), (periodEndTime - currentTime).ToString(@"mm\:ss")); } // block thread for periodTime if (TimerBlocker.WaitOne(periodTime)) // if signalled { // manually signalled, reset signal for next timerblock TimerBlocker.Reset(); // handle commands if (Command == PAUSE) { TimeSpan remainingPeriod = periodEndTime - DateTime.Now; periodTime = (int)remainingPeriod.TotalMilliseconds; Console.Write("Period paused, press enter to resume "); WaitForReadLineInput(); wasPaused = true; } else if (Command == NEXT) { isWorkPeriod = !isWorkPeriod; } else if (Command.Contains(RESTART)) { wasRestarted = true; // checking if "MM:SS" setting option present MatchCollection numsInCommand = new Regex(@"\d+").Matches(Command); if (numsInCommand.Count >= 2) { int minsTemp = Int32.Parse(numsInCommand[0].Value); int secsTemp = Int32.Parse(numsInCommand[1].Value); // converting to milliseconds minsTemp *= 60000; secsTemp *= 1000; periodTime = minsTemp + secsTemp; } else { // else restart with normal period time periodTime = isWorkPeriod ? WORKTIME : RESTTIME; } } // else Command == "quit" -> do nothing, while condition will handle it } else // if not signalled (timeout) { isWorkPeriod = !isWorkPeriod; PeriodEndSound.Play(); Thread notifyThread = new Thread(IntervalNotify); notifyThread.Start(); Console.WriteLine("Period end, press Insert to resume"); // blocks until Insert is pressed InterceptKeys.Start(KeyPressCallback); // end notifyThread NotifyBlocker.Set(); // play a confirmation NotificationSound.Play(); } } }
public void PlaySound(NotificationSound sound, bool forceCustom = false) { }
public void PlaySound(NotificationSound sound, bool forceCustom = false) { throw new NotImplementedException(); }
public void PlaySound(NotificationSound sound) { //throw new NotImplementedException(); }
public void Notify(NotificationSound type) { }