private void NotifyEvent(Twitter.FormattedEvent ev)
{
//新着通知
if (BalloonRequired(ev))
{
NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
//if (SettingDialog.DispUsername) NotifyIcon1.BalloonTipTitle = tw.Username + " - "; else NotifyIcon1.BalloonTipTitle = "";
//NotifyIcon1.BalloonTipTitle += Application.ProductName + " [" + ev.Event.ToUpper() + "] by " + ((string)(!string.IsNullOrEmpty(ev.Username) ? ev.Username : ""), string);
StringBuilder title = new StringBuilder();
if (this._cfgCommon.DispUsername)
{
title.Append(tw.Username);
title.Append(" - ");
}
else
{
//title.Clear();
}
title.Append(Application.ProductName);
title.Append(" [");
title.Append(ev.Event.ToUpper(CultureInfo.CurrentCulture));
title.Append("] by ");
if (!string.IsNullOrEmpty(ev.Username))
{
title.Append(ev.Username);
}
else
{
//title.Append("");
}
string text;
if (!string.IsNullOrEmpty(ev.Target))
{
//NotifyIcon1.BalloonTipText = ev.Target;
text = ev.Target;
}
else
{
//NotifyIcon1.BalloonTipText = " ";
text = " ";
}
//NotifyIcon1.ShowBalloonTip(500);
if (this._cfgCommon.IsUseNotifyGrowl)
{
gh.Notify(GrowlHelper.NotifyType.UserStreamEvent,
ev.Id.ToString(), title.ToString(), text);
}
else
{
NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
NotifyIcon1.BalloonTipTitle = title.ToString();
NotifyIcon1.BalloonTipText = text;
NotifyIcon1.ShowBalloonTip(500);
}
}
//サウンド再生
string snd = this._cfgCommon.EventSoundFile;
if (!_initial && this._cfgCommon.PlaySound && !string.IsNullOrEmpty(snd))
{
if ((ev.Eventtype & this._cfgCommon.EventNotifyFlag) != 0 && IsMyEventNotityAsEventType(ev))
{
try
{
string dir = Application.StartupPath;
if (Directory.Exists(Path.Combine(dir, "Sounds")))
{
dir = Path.Combine(dir, "Sounds");
}
using (SoundPlayer player = new SoundPlayer(Path.Combine(dir, snd)))
{
player.Play();
}
}
catch (Exception)
{
}
}
}
}