예제 #1
0
 TimelineInfo(TwitterAccountManager mgr, TimelineBase owner, TwitterTimeLine timeline, string title)
     : base(owner, title)
 {
     _mgr = mgr;
     Statuses = timeline;
     timeline.CollectionChanged += new NotifyCollectionChangedEventHandler (Timeline_CollectionChanged);
 }
예제 #2
0
 public override void NoticeNewPost(TimelineBase source)
 {
     if (Owner != null)
         Owner.NoticeNewPost (source);
 }
예제 #3
0
 public TimelineInfo(TimelineBase owner, SearchStatuses search)
     : this(null, owner, search.Statuses, "Search \"" + search.Keyword + "\"")
 {
     Search = search;
     RestAccount = search.Account;
     RestUsage = search.RestInfo;
 }
예제 #4
0
 public TimelineInfo(TimelineBase owner, ListStatuses list)
     : this(null, owner, list.Statuses, "List \"" + list.List.FullName + "\"")
 {
     List = list;
     RestAccount = list.Account;
     RestUsage = list.RestInfo;
 }
예제 #5
0
 public virtual void Remove(TimelineBase tl)
 {
     TimeLines.Remove (tl);
 }
예제 #6
0
 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));
 }
예제 #7
0
 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);
 }
예제 #8
0
 public override void NoticeNewPost(TimelineBase source)
 {
 }
예제 #9
0
 protected TimelineBase(TimelineBase owner, string title)
 {
     Owner = owner;
     TimeLines = null;
     Title = title;
     BaseTitle = title;
 }
예제 #10
0
 public virtual void Add(TimelineBase tl)
 {
     Insert (TimeLines.Count, tl);
 }
예제 #11
0
 public override void NoticeNewPost(TimelineBase source)
 {
     if (source != SelectedItem && source.Title.Length == source.BaseTitle.Length)
         source.Title = source.BaseTitle + " (*)";
 }
예제 #12
0
 public override void Insert(int idx, TimelineBase tl)
 {
     base.Insert (idx, tl);
     SelectedItem = tl;
 }
예제 #13
0
 public TabInfo(TimelineBase owner, string title)
     : base(owner, title)
 {
     TimeLines = new ObservableCollection<TimelineBase> ();
 }
예제 #14
0
 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;
 }
예제 #15
0
 public abstract void NoticeNewPost(TimelineBase source);
예제 #16
0
 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);
         }
     }
 }
예제 #17
0
 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 ();
     }
 }