public Value ( string title, string text ) : void | ||
title | string | |
text | string | |
return | void |
public void ShowBallon(NotifyFlashMessage flash) { if (flash == null) { return; } Tray.HideBalloonTip(); if (flash.Balloon != null && flash.Balloon.DisplayTime >= 500) { var balloon = new Balloon(); balloon.Value(flash.Balloon.TitleText, flash.Balloon.BodyText); Tray.ShowCustomBalloon(balloon, System.Windows.Controls.Primitives.PopupAnimation.Fade, flash.Balloon.DisplayTime); } if (!BasicTeraData.Instance.WindowData.MuteSound && flash.Sound != null) { Task.Run(() => flash.Sound.Play()); } }
public void ShowBallon(NotifyFlashMessage flash) { if (flash == null) return; Tray.HideBalloonTip(); if (flash.Balloon != null && flash.Balloon.DisplayTime >= 500) { var balloon = new Balloon(); balloon.Value(flash.Balloon.TitleText, flash.Balloon.BodyText); Tray.ShowCustomBalloon(balloon, System.Windows.Controls.Primitives.PopupAnimation.Fade, flash.Balloon.DisplayTime); } if (flash.Sound!=null) Task.Run(()=>flash.Sound.Play()); }
public void ShowBallon(Tuple <string, string> flash) { if (flash == null) { return; } Tray.HideBalloonTip(); if (BasicTeraData.Instance.WindowData.PopupDisplayTime >= 500) { var balloon = new Balloon(); balloon.Value(flash.Item1, flash.Item2); Tray.ShowCustomBalloon(balloon, System.Windows.Controls.Primitives.PopupAnimation.Fade, BasicTeraData.Instance.WindowData.PopupDisplayTime); } var file = Path.Combine(BasicTeraData.Instance.ResourceDirectory, "sound/", BasicTeraData.Instance.WindowData.NotifySound); if (!File.Exists(file)) { file = BasicTeraData.Instance.WindowData.NotifySound; if (!File.Exists(file)) { return; } } lock (_lock) { if (_needToStop) { return; } } try { _outputStream = new MediaFoundationReader(file); _volumeStream = new WaveChannel32(_outputStream); _volumeStream.Volume = BasicTeraData.Instance.WindowData.Volume; //Create WaveOutEvent since it works in Background and UI Threads _player = new WaveOutEvent(); //Init Player with Configured Volume Stream _player.Init(_volumeStream); _player.Play(); _needToStop = true; var timer = new System.Threading.Timer((obj) => { lock (_lock) { _needToStop = false; _player.Stop(); _player.Dispose(); _volumeStream.Dispose(); _outputStream.Dispose(); _outputStream = null; _player = null; _volumeStream = null; } }, null, BasicTeraData.Instance.WindowData.SoundNotifyDuration, System.Threading.Timeout.Infinite); } catch (Exception e) { // Get stack trace for the exception with source file information var st = new StackTrace(e, true); // Get the top stack frame var frame = st.GetFrame(0); // Get the line number from the stack frame var line = frame.GetFileLineNumber(); BasicTeraData.LogError("Sound ERROR test" + e.Message + Environment.NewLine + e.StackTrace + Environment.NewLine + e.InnerException + Environment.NewLine + e + Environment.NewLine + "filename:" + file + Environment.NewLine + "line:" + line, false, true); } }