| Revision | fc38135a14e221e4a1f2ca8ea8e8364437735b94 (tree) |
|---|---|
| Time | 2011-01-18 18:59:13 |
| Author | azyobuzin <azyobuzin@user...> |
| Commiter | azyobuzin |
Ownerプロパティを廃止してGetMainFormメソッドを作成
| @@ -5,8 +5,8 @@ namespace Azyobuzi.Twirunrun | ||
| 5 | 5 | { |
| 6 | 6 | public class DirectMessagesTimelineTabPage : TimelineTabPage |
| 7 | 7 | { |
| 8 | - public DirectMessagesTimelineTabPage(TwirunrunTabControl owner, TabInfo tabsettings) | |
| 9 | - : base(owner, tabsettings) | |
| 8 | + public DirectMessagesTimelineTabPage(/*TwirunrunTabControl owner, */TabInfo tabsettings) | |
| 9 | + : base(/*owner, */tabsettings) | |
| 10 | 10 | { |
| 11 | 11 | RecentStatusesCollection.Instance.CollectionChanged += (sender, e) => |
| 12 | 12 | { |
| @@ -28,7 +28,7 @@ namespace Azyobuzi.Twirunrun | ||
| 28 | 28 | NotifyStarted(); |
| 29 | 29 | RecentStatusesCollection.Instance.AddRange( |
| 30 | 30 | new[] { DirectMessageType.SentTo, DirectMessageType.SentBy }.SelectMany(type => |
| 31 | - Owner.Owner.TwitterContext.DirectMessage.Where(dm => | |
| 31 | + this.GetMainForm().TwitterContext.DirectMessage.Where(dm => | |
| 32 | 32 | dm.Type == type && |
| 33 | 33 | dm.Page == page && |
| 34 | 34 | dm.Count == count |
| @@ -5,8 +5,8 @@ namespace Azyobuzi.Twirunrun | ||
| 5 | 5 | { |
| 6 | 6 | public class HomeTimelineTabPage : TimelineTabPage |
| 7 | 7 | { |
| 8 | - public HomeTimelineTabPage(TwirunrunTabControl owner, TabInfo tabsettings) | |
| 9 | - : base(owner, tabsettings) | |
| 8 | + public HomeTimelineTabPage(/*TwirunrunTabControl owner, */TabInfo tabsettings) | |
| 9 | + : base(/*owner, */tabsettings) | |
| 10 | 10 | { |
| 11 | 11 | RecentStatusesCollection.Instance.CollectionChanged += (sender, e) => |
| 12 | 12 | { |
| @@ -28,7 +28,7 @@ namespace Azyobuzi.Twirunrun | ||
| 28 | 28 | { |
| 29 | 29 | NotifyStarted(); |
| 30 | 30 | RecentStatusesCollection.Instance.AddRange( |
| 31 | - Owner.Owner.TwitterContext.Status.Where(tweet => | |
| 31 | + this.GetMainForm().TwitterContext.Status.Where(tweet => | |
| 32 | 32 | tweet.Type == StatusType.Home && |
| 33 | 33 | tweet.Page == page && |
| 34 | 34 | tweet.Count == count |
| @@ -6,8 +6,8 @@ namespace Azyobuzi.Twirunrun | ||
| 6 | 6 | { |
| 7 | 7 | public class MentionsTabPage : TimelineTabPage |
| 8 | 8 | { |
| 9 | - public MentionsTabPage(TwirunrunTabControl owner, TabInfo tabsettings) | |
| 10 | - : base(owner, tabsettings) | |
| 9 | + public MentionsTabPage(/*TwirunrunTabControl owner, */TabInfo tabsettings) | |
| 10 | + : base(/*owner, */tabsettings) | |
| 11 | 11 | { |
| 12 | 12 | var mentionCheckRegex = new Regex( |
| 13 | 13 | string.Format(@"[@@]{0}(\W|$)", Settings.Instance.MyScreenName.RegexEscape()), |
| @@ -36,7 +36,7 @@ namespace Azyobuzi.Twirunrun | ||
| 36 | 36 | { |
| 37 | 37 | NotifyStarted(); |
| 38 | 38 | RecentStatusesCollection.Instance.AddRange( |
| 39 | - Owner.Owner.TwitterContext.Status.Where(tweet => | |
| 39 | + this.GetMainForm().TwitterContext.Status.Where(tweet => | |
| 40 | 40 | tweet.Type == StatusType.Mentions && |
| 41 | 41 | tweet.Page == page && |
| 42 | 42 | tweet.Count == count |
| @@ -7,21 +7,21 @@ namespace Azyobuzi.Twirunrun | ||
| 7 | 7 | { |
| 8 | 8 | public abstract class TimelineTabPage : TabPage |
| 9 | 9 | { |
| 10 | - public TimelineTabPage(TwirunrunTabControl owner, TabInfo tabsettings) | |
| 10 | + public TimelineTabPage(/*TwirunrunTabControl owner, */TabInfo tabsettings) | |
| 11 | 11 | { |
| 12 | - Owner = owner; | |
| 12 | + //Owner = owner; | |
| 13 | 13 | TabSettings = tabsettings; |
| 14 | 14 | this.Text = TabSettings.Name; |
| 15 | 15 | Timeline.Dock = DockStyle.Fill; |
| 16 | 16 | this.Controls.Add(Timeline); |
| 17 | 17 | TabSettings.PropertyChanged += TabSettings_PropertyChanged; |
| 18 | 18 | Timeline.SelectedIndexChanged += (sender, e) => |
| 19 | - Owner.Owner.ShowDetailStatus(Timeline.Statuses[Timeline.SelectedIndex]); | |
| 19 | + this.GetMainForm().ShowDetailStatus(Timeline.Statuses[Timeline.SelectedIndex]); | |
| 20 | 20 | Timeline.DoubleClick += (sender, e) => |
| 21 | 21 | { |
| 22 | 22 | if (Timeline.SelectedIndex == -1) return; |
| 23 | 23 | var selecting = Timeline.Statuses[Timeline.SelectedIndex]; |
| 24 | - Owner.Owner.UpdateStatusPanel.SetReplyTo( | |
| 24 | + this.GetMainForm().UpdateStatusPanel.SetReplyTo( | |
| 25 | 25 | selecting.Type == StatusTypes.Retweet ? |
| 26 | 26 | selecting.Tweet.Retweet.ID : selecting.Id, |
| 27 | 27 | new[] { selecting.User.Identifier.ScreenName }, |
| @@ -30,7 +30,7 @@ namespace Azyobuzi.Twirunrun | ||
| 30 | 30 | }; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public TwirunrunTabControl Owner { private set; get; } | |
| 33 | + //public TwirunrunTabControl Owner { private set; get; } | |
| 34 | 34 | |
| 35 | 35 | public StatusesListBox Timeline = new StatusesListBox(); |
| 36 | 36 |
| @@ -57,7 +57,7 @@ namespace Azyobuzi.Twirunrun | ||
| 57 | 57 | { |
| 58 | 58 | refreshing = true; |
| 59 | 59 | this.Invoke((MethodInvoker)(() => this.Text = "更新中...")); |
| 60 | - Owner.Owner.StatusChange(TabSettings.Name + "を更新中"); | |
| 60 | + this.GetMainForm().StatusChange(TabSettings.Name + "を更新中"); | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /// <summary> |
| @@ -65,7 +65,7 @@ namespace Azyobuzi.Twirunrun | ||
| 65 | 65 | /// </summary> |
| 66 | 66 | protected void NotifyCompleted() |
| 67 | 67 | { |
| 68 | - Owner.Owner.StatusChange(TabSettings.Name + ":取得しました"); | |
| 68 | + this.GetMainForm().StatusChange(TabSettings.Name + ":取得しました"); | |
| 69 | 69 | refreshing = false; |
| 70 | 70 | this.Invoke((MethodInvoker)(() => this.Text = TabSettings.Name)); |
| 71 | 71 | } |
| @@ -9,6 +9,6 @@ namespace Azyobuzi.Twirunrun | ||
| 9 | 9 | { |
| 10 | 10 | public class TwirunrunTabControl : AnisTabControl |
| 11 | 11 | { |
| 12 | - public ITwirunrunMainForm Owner { get; set; } | |
| 12 | + //public ITwirunrunMainForm Owner { get; set; } | |
| 13 | 13 | } |
| 14 | 14 | } |
| @@ -3,13 +3,14 @@ using System.Collections; | ||
| 3 | 3 | using System.Collections.Generic; |
| 4 | 4 | using System.Collections.Specialized; |
| 5 | 5 | using System.Drawing; |
| 6 | +using System.IO; | |
| 6 | 7 | using System.Linq; |
| 7 | 8 | using System.Net; |
| 8 | 9 | using System.Text; |
| 9 | 10 | using System.Text.RegularExpressions; |
| 10 | 11 | using System.Web; |
| 12 | +using System.Windows.Forms; | |
| 11 | 13 | using System.Xml.Linq; |
| 12 | -using System.IO; | |
| 13 | 14 | |
| 14 | 15 | namespace Azyobuzi.Twirunrun |
| 15 | 16 | { |
| @@ -295,6 +296,11 @@ namespace Azyobuzi.Twirunrun | ||
| 295 | 296 | { |
| 296 | 297 | return source.RegexMatch(@"^https?://[\w\d/%#$&?()~_.=+-!]+$"); |
| 297 | 298 | } |
| 299 | + | |
| 300 | + public static ITwirunrunMainForm GetMainForm(this Control control) | |
| 301 | + { | |
| 302 | + return control.FindForm() as ITwirunrunMainForm; | |
| 303 | + } | |
| 298 | 304 | } |
| 299 | 305 | |
| 300 | 306 | //public class StringRegex |
| @@ -109,7 +109,6 @@ | ||
| 109 | 109 | this.timelineTabs.Dock = System.Windows.Forms.DockStyle.Fill; |
| 110 | 110 | this.timelineTabs.Location = new System.Drawing.Point(0, 104); |
| 111 | 111 | this.timelineTabs.Name = "timelineTabs"; |
| 112 | - this.timelineTabs.Owner = null; | |
| 113 | 112 | this.timelineTabs.SelectedIndex = 0; |
| 114 | 113 | this.timelineTabs.Size = new System.Drawing.Size(371, 156); |
| 115 | 114 | this.timelineTabs.SortTabDragDrop = true; |
| @@ -17,7 +17,7 @@ namespace Azyobuzi.Twirunrun | ||
| 17 | 17 | public MainForm() |
| 18 | 18 | { |
| 19 | 19 | InitializeComponent(); |
| 20 | - timelineTabs.Owner = this; | |
| 20 | + //timelineTabs.Owner = this; | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | private string statusBrowserUri = "file:///" + (Application.StartupPath + @"\html\resultPage.html").Replace('\\', '/'); |
| @@ -216,9 +216,9 @@ namespace Azyobuzi.Twirunrun | ||
| 216 | 216 | public TimelineTabPage CreateTabPage(TwirunrunTabControl tabControl) |
| 217 | 217 | { |
| 218 | 218 | return this.Type.SelectCase() |
| 219 | - .Case(TabTypes.Home, () => new HomeTimelineTabPage(tabControl, this)) | |
| 220 | - .Case(TabTypes.Mentions, () => new MentionsTabPage(tabControl, this)) | |
| 221 | - .Case(TabTypes.DirectMessages, () => new DirectMessagesTimelineTabPage(tabControl, this)) | |
| 219 | + .Case(TabTypes.Home, () => new HomeTimelineTabPage(/*tabControl, */this)) | |
| 220 | + .Case(TabTypes.Mentions, () => new MentionsTabPage(/*tabControl, */this)) | |
| 221 | + .Case(TabTypes.DirectMessages, () => new DirectMessagesTimelineTabPage(/*tabControl, */this)) | |
| 222 | 222 | .Result as TimelineTabPage; |
| 223 | 223 | //TODO |
| 224 | 224 | } |