IList <TwitterStatus> GenerateData()
        {
            if (_twitter.IsLiveContentOnDesignMode)
            {
                /*---- live mode---*/
                IList <TwitterStatus> statuses = null;
                var api = new TwitterAPI();
                switch (_twitter.Mode)
                {
                case TwitterMode.Profile:
                    statuses = api.GetProfile(_twitter.ScreenName, _twitter.Count,
                                              _twitter.IncludeRetweets, _twitter.IncludeReplies);
                    if (statuses != null && statuses.Count > 0)
                    {
                        var user = statuses[0].User;
                        _twitter.Title           = _twitter.Title ?? user.Name;
                        _twitter.Caption         = _twitter.Caption ?? user.ScreenName;
                        _twitter.ProfileImageUrl = _twitter.ProfileImageUrl ?? user.ProfileImageUrl;
                    }
                    break;

                default:
                    statuses = api.GetSearch(_twitter.Search, _twitter.Count);
                    break;
                }
                return(statuses);
            }

            /*---- fake mode --*/
            return(GenerateFakeData());
        }
예제 #2
0
        IList<TwitterStatus> GenerateData() {
            if(_twitter.IsLiveContentOnDesignMode) {
                /*---- live mode---*/
                IList<TwitterStatus> statuses = null;
                var api = new TwitterAPI();
                switch(_twitter.Mode) {
                    case TwitterMode.Profile:
                        statuses = api.GetProfile(_twitter.ScreenName, _twitter.Count,
                                                    _twitter.IncludeRetweets, _twitter.IncludeReplies);
                        if(statuses != null && statuses.Count > 0) {
                            var user = statuses[0].User;
                            _twitter.Title = _twitter.Title ?? user.Name;
                            _twitter.Caption = _twitter.Caption ?? user.ScreenName;
                            _twitter.ProfileImageUrl = _twitter.ProfileImageUrl ?? user.ProfileImageUrl;
                        }
                        break;
                    default:
                        statuses = api.GetSearch(_twitter.Search, _twitter.Count);
                        break;
                }
                return statuses;
            }

            /*---- fake mode --*/
            return GenerateFakeData();
        }