| Revision | 4df7778f41e192c70d9e7bedf1b90924361de49c (tree) |
|---|---|
| Time | 2011-01-22 20:44:57 |
| Author | azyobuzin <azyobuzin@user...> |
| Commiter | azyobuzin |
新着通知にバルーンを追加
| @@ -1,6 +1,6 @@ | ||
| 1 | -using System; | |
| 2 | -using System.Collections.Generic; | |
| 1 | +using System.Collections.Generic; | |
| 3 | 2 | using System.ComponentModel; |
| 3 | +using System.Linq; | |
| 4 | 4 | using System.Windows.Forms; |
| 5 | 5 | |
| 6 | 6 | namespace Azyobuzi.Twirunrun |
| @@ -108,7 +108,21 @@ namespace Azyobuzi.Twirunrun | ||
| 108 | 108 | this.Invoke((MethodInvoker)(() => |
| 109 | 109 | { |
| 110 | 110 | if (TabSettings.NotifyNewTweet) |
| 111 | - NotifyForm.ShowItems(newItems, this.FindForm()); | |
| 111 | + Settings.Instance.NotifyType.SelectCase() | |
| 112 | + .Case(NotifyTypes.NotifyForm, | |
| 113 | + () => NotifyForm.ShowItems(newItems, this.FindForm())) | |
| 114 | + .Case(NotifyTypes.Balloon, | |
| 115 | + () => this.GetMainForm().ShowBalloon( | |
| 116 | + Settings.Instance.NotifyFormShowTime * 1000, | |
| 117 | + TabSettings.Name + "の新着", | |
| 118 | + string.Join("\n", newItems.Select(item => | |
| 119 | + string.Format("{0}:{1}", Settings.Instance.NameType == NameTypes.Name ? | |
| 120 | + item.User.Name : item.User.Identifier.ScreenName, | |
| 121 | + item.Text) | |
| 122 | + )), | |
| 123 | + ToolTipIcon.Info | |
| 124 | + ) | |
| 125 | + ); | |
| 112 | 126 | })); |
| 113 | 127 | } |
| 114 | 128 | } |
| @@ -225,5 +225,10 @@ namespace Azyobuzi.Twirunrun | ||
| 225 | 225 | { |
| 226 | 226 | e.Cancel = e.CloseReason != CloseReason.UserClosing && !closing; |
| 227 | 227 | } |
| 228 | + | |
| 229 | + public void ShowBalloon(int timeout, string tipTitle, string tipText, ToolTipIcon tipIcon) | |
| 230 | + { | |
| 231 | + notifyIcon1.ShowBalloonTip(timeout, tipTitle, tipText, tipIcon); | |
| 232 | + } | |
| 228 | 233 | } |
| 229 | 234 | } |
| @@ -103,6 +103,7 @@ | ||
| 103 | 103 | this.Controls.Add(this.profileImg); |
| 104 | 104 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; |
| 105 | 105 | this.Name = "NotifyForm"; |
| 106 | + this.Opacity = 0.8D; | |
| 106 | 107 | this.ShowInTaskbar = false; |
| 107 | 108 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; |
| 108 | 109 | this.Text = "ついるんるん 通知画面"; |
| @@ -12,5 +12,6 @@ namespace Azyobuzi.Twirunrun | ||
| 12 | 12 | void ShowDetailStatus(StatusInfo status); |
| 13 | 13 | IEnumerable<TimelineTabPage> GetTabPages(); |
| 14 | 14 | void RefreshTimelines(IEnumerable<TimelineTabPage> tabs, bool first); |
| 15 | + void ShowBalloon(int timeout, string tipTitle, string tipText, ToolTipIcon tipIcon); | |
| 15 | 16 | } |
| 16 | 17 | } |
| @@ -615,7 +615,7 @@ namespace Azyobuzi.Twirunrun | ||
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | // |
| 618 | - //新着通知表示時間 | |
| 618 | + //新着通知 | |
| 619 | 619 | // |
| 620 | 620 | private int notifyFormShowTime = 7; |
| 621 | 621 | public int NotifyFormShowTime |
| @@ -633,6 +633,23 @@ namespace Azyobuzi.Twirunrun | ||
| 633 | 633 | return notifyFormShowTime; |
| 634 | 634 | } |
| 635 | 635 | } |
| 636 | + | |
| 637 | + private NotifyTypes notifyType = NotifyTypes.NotifyForm; | |
| 638 | + public NotifyTypes NotifyType | |
| 639 | + { | |
| 640 | + set | |
| 641 | + { | |
| 642 | + if (notifyType != value) | |
| 643 | + { | |
| 644 | + notifyType = value; | |
| 645 | + OnPropertyChanged("NotifyType"); | |
| 646 | + } | |
| 647 | + } | |
| 648 | + get | |
| 649 | + { | |
| 650 | + return notifyType; | |
| 651 | + } | |
| 652 | + } | |
| 636 | 653 | } |
| 637 | 654 | |
| 638 | 655 | public class FormSettings : IEquatable<FormSettings> |
| @@ -685,4 +702,10 @@ namespace Azyobuzi.Twirunrun | ||
| 685 | 702 | Name, |
| 686 | 703 | ScreenName |
| 687 | 704 | } |
| 705 | + | |
| 706 | + public enum NotifyTypes | |
| 707 | + { | |
| 708 | + NotifyForm, | |
| 709 | + Balloon | |
| 710 | + } | |
| 688 | 711 | } |