TimelineInfo(TwitterAccountManager mgr, TimelineBase owner, TwitterTimeLine timeline, string title) : base(owner, title) { _mgr = mgr; Statuses = timeline; timeline.CollectionChanged += new NotifyCollectionChangedEventHandler (Timeline_CollectionChanged); }
public override void NoticeNewPost(TimelineBase source) { if (Owner != null) Owner.NoticeNewPost (source); }
public TimelineInfo(TimelineBase owner, SearchStatuses search) : this(null, owner, search.Statuses, "Search \"" + search.Keyword + "\"") { Search = search; RestAccount = search.Account; RestUsage = search.RestInfo; }
public TimelineInfo(TimelineBase owner, ListStatuses list) : this(null, owner, list.Statuses, "List \"" + list.List.FullName + "\"") { List = list; RestAccount = list.Account; RestUsage = list.RestInfo; }
public virtual void Remove(TimelineBase tl) { TimeLines.Remove (tl); }
public TimelineInfo(TwitterAccountManager mgr, TimelineBase owner, TwitterAccount account, TwitterTimeLine timeline) : this(mgr, owner, timeline, CreateTitle (account, timeline)) { RestAccount = account; RestUsage = (timeline == account.HomeTimeline ? account.RestHome : (timeline == account.Mentions ? account.RestMentions : account.RestDirectMessages)); }
public virtual void Insert(int idx, TimelineBase tl) { if (tl.Owner != null && tl.Owner.TimeLines != null) tl.Owner.Remove (tl); tl.Owner = this; TimeLines.Insert (idx, tl); }
public override void NoticeNewPost(TimelineBase source) { }
protected TimelineBase(TimelineBase owner, string title) { Owner = owner; TimeLines = null; Title = title; BaseTitle = title; }
public virtual void Add(TimelineBase tl) { Insert (TimeLines.Count, tl); }
public override void NoticeNewPost(TimelineBase source) { if (source != SelectedItem && source.Title.Length == source.BaseTitle.Length) source.Title = source.BaseTitle + " (*)"; }
public override void Insert(int idx, TimelineBase tl) { base.Insert (idx, tl); SelectedItem = tl; }
public TabInfo(TimelineBase owner, string title) : base(owner, title) { TimeLines = new ObservableCollection<TimelineBase> (); }
List<TimelineInfo> GetAllChildrenTimeLineInfo(TimelineBase root) { Queue<TimelineBase> queue = new Queue<TimelineBase> (); List<TimelineInfo> list = new List<TimelineInfo> (); queue.Enqueue (root); while (queue.Count > 0) { TimelineBase tl = queue.Dequeue (); if (tl.TimeLines != null) { for (int i = 0; i < tl.TimeLines.Count; i++) queue.Enqueue (tl.TimeLines[i]); } if (tl is TimelineInfo) list.Add ((TimelineInfo)tl); } return list; }
public abstract void NoticeNewPost(TimelineBase source);
void LoadConfigInternal(JsonArray array, TimelineBase timelines) { for (int i = 0; i < array.Length; i ++) { JsonObject obj = array[i] as JsonObject; if (obj != null) { TimelineBase info = null; switch ((obj.Value["type"] as JsonString).Value) { case "account": string subtype = (obj.Value["subtype"] as JsonString).Value; string name = (obj.Value["name"] as JsonString).Value; TwitterAccount account = null; foreach (TwitterAccount item in _mgr.Accounts) if (name.Equals (item.ScreenName)) { account = item; break; } if (account == null) continue; switch (subtype) { case "home": info = new TimelineInfo (_mgr, timelines, account, account.HomeTimeline); break; case "mentions": info = new TimelineInfo (_mgr, timelines, account, account.Mentions); break; case "directmessages": info = new TimelineInfo (_mgr, timelines, account, account.DirectMessages); break; } break; case "search": string keywords = (obj.Value["keywords"] as JsonString).Value; foreach (SearchStatuses search in _mgr.Searches) if (keywords.Equals (search.Keyword)) { info = new TimelineInfo (timelines, search); break; } break; case "tab": string title = (obj.Value["title"] as JsonString).Value; TabInfo tb = new TabInfo (timelines, title); LoadConfigInternal ((JsonArray)obj.Value["windows"], tb); info = tb; break; case "list": ulong id = (ulong)(obj.Value["id"] as JsonNumber).Value; foreach (ListStatuses list in _mgr.Lists) if (id == list.List.ID) { info = new TimelineInfo (timelines, list); break; } break; } if (info != null) timelines.TimeLines.Add (info); } } }
void SaveConfigInternal(JsonTextWriter writer, TimelineBase timelines) { foreach (object item in timelines.TimeLines) { writer.WriteStartObject (); writer.WriteKey ("type"); TimelineInfo tl = item as TimelineInfo; TabInfo tb = item as TabInfo; if (tl != null) { if (tl.Search != null) { writer.WriteString ("search"); writer.WriteKey ("keywords"); writer.WriteString (tl.Search.Keyword); } else if (tl.List != null) { writer.WriteString ("list"); writer.WriteKey ("id"); writer.WriteNumber (tl.List.List.ID); } else { writer.WriteString ("account"); writer.WriteKey ("subtype"); if (tl.Statuses == tl.RestAccount.HomeTimeline) writer.WriteString ("home"); else if (tl.Statuses == tl.RestAccount.Mentions) writer.WriteString ("mentions"); else if (tl.Statuses == tl.RestAccount.DirectMessages) writer.WriteString ("directmessages"); writer.WriteKey ("name"); writer.WriteString (tl.RestAccount.ScreenName); } } else if (tb != null) { writer.WriteString ("tab"); writer.WriteKey ("title"); writer.WriteString (tb.Title); writer.WriteKey ("windows"); writer.WriteStartArray (); SaveConfigInternal (writer, tb); writer.WriteEndArray (); } else { writer.WriteNull (); } writer.WriteEndObject (); } }