Example #1
0
 private string GetTimelineUrl(Timeline timeline)
 {
     // handle invalid friend username case for single friend timeline??
     // NOTE: this logic was moved from the Timeline class to centralize the generation of URLs
     // probably needs revisited
     switch (timeline.ThisTimelineType)
     {
         case TimelineType.SingleFriend:
             if( string.IsNullOrEmpty(timeline.FriendUsername)){ timeline.ThisTimelineType = TimelineType.AllFriends;}
             break;
         default:
             break;
     }
     return GetTimelineUrl(timeline.ThisTimelineType);
 }
Example #2
0
        public List<Status> GetTimeline(Timeline timeline, DateTime since)
        {
            List<Status> list = null;

            switch (TwitterApi)
            {
                case ApiType.XML:
                    {
                        XmlDocument document = new XmlDocument();
                        document.LoadXml(SendRequest(MethodType.Get, GetTimelineUrl(timeline), since));
                        list = Status.LoadStatusList(document);
                        break;
                    }
                case ApiType.JSON:
                    {
                        list = Status.FromJsonList(SendRequest(MethodType.Get, GetTimelineUrl(timeline), since));
                        break;
                    }
            }

            return list;
        }
Example #3
0
 public List<Status> GetTimeline(Timeline timeline)
 {
     return GetTimeline(timeline, DateTime.MinValue);
 }
Example #4
0
 public List<Status> GetTimeline(Timeline timeline)
 {
     StringBuilder output = new StringBuilder();
     return TwitterManager.Instance().GetTimeline(timeline);
 }
Example #5
0
        private void SetContent(string output, string container, Timeline timeLine)
        {
            //webBrowser1.Document.InvokeScript("setContents", new object[] {output, container});

            if (_hasUpdates)
            {
                _hasUpdates = false;
            }
        }
Example #6
0
        private void InitControls()
        {
            try
            {
                // Setting default to XML. I think the JSON stuff is having issues periodically.
                TwitterManager.Instance().TwitterApi = (ApiType)Properties.Settings.Default.ApiType;
            }
            catch
            {
            }
            TwitterManager.Instance().Username = Properties.Settings.Default.UserName;
            TwitterManager.Instance().Password = Properties.Settings.Default.Password;

            // Setup the text box
            _controller.UserNameChanged +=new BrowserController.UserNameChangedHandler(_controller_UserNameChanged);

            // Initialize the timelines we'll be tracking.
            Timeline t = new Timeline();
            t.TimelineName = "Friends";
            t.ThisTimelineType = TimelineType.AllFriends;
            t.HtmlContainerId = "tlcontainer";
            _timelines.Add(t);

            items = _controller.GetTimeline(t);
            current = items.Count-1;
            UpdateStatus(current);

            // Get the current tweets and set the refresher
            backgroundGetLatest.RunWorkerAsync();
            _timeRemaining = new TimeSpan(0, Settings.Default.RefreshDelay, 0);
            refreshTimer.Interval = 1000;
            refreshTimer.Enabled = true;

            // Setup the menu
            newStatusTextBox.TextChanged += new EventHandler(newStatusTextBox_TextChanged);
            newStatusTextBox.KeyDown += new KeyEventHandler(newStatusTextBox_Key);
            newStatusTextBox.KeyUp += new KeyEventHandler(newStatusTextBox_KeyUp);
            newStatusTextBox.KeyPress += new KeyPressEventHandler(newStatusTextBox_KeyPress);
            newStatusTextBox.MaxLength = 140;
            RefreshRemainingCharacters();
        }