예제 #1
0
        public void GetTwitterFeedDetailsTest()
        {
            ITwitterFeedManager _TwitterFeedManager = new TwitterFeedManager();
            var twitterFeedDetails = _TwitterFeedManager.GetTwitterFeedDetails();

            Assert.IsNotNull(twitterFeedDetails);
        }
        void HandleUpdateFinished(object sender, EventArgs e)
        {
            TwitterFeedManager.UpdateFinished -= HandleUpdateFinished;
            var entries = TwitterFeedManager.GetTweets();

            IsUpdating = false;
            PopulateData(entries);
        }
        public void BeginUpdate(Dispatcher dispatcher)
        {
            _dispatcher = dispatcher;

            IsUpdating = true;

            ThreadPool.QueueUserWorkItem(delegate {
                var entries = TwitterFeedManager.GetTweets();
                PopulateData(entries);

                TwitterFeedManager.UpdateFinished += HandleUpdateFinished;
                TwitterFeedManager.Update();
            });

            OnPropertyChanged("IsUpdating");
            OnPropertyChanged("UpdatingVisibility");
        }
예제 #4
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.NavigationMode == System.Windows.Navigation.NavigationMode.New)
            {
                var vm = new TweetViewModel();

                if (NavigationContext.QueryString.ContainsKey("id"))
                {
                    var id    = int.Parse(NavigationContext.QueryString["id"]);
                    var tweet = TwitterFeedManager.GetTweet(id);
                    if (tweet != null)
                    {
                        vm.Update(tweet);
                    }
                }

                if (!string.IsNullOrEmpty(vm.Content))
                {
                    //
                    // Adapt to the theme
                    //
                    var bgColor = "black";
                    var color   = "white";
                    if ((Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible)
                    {
                        bgColor = "white";
                        color   = "black";
                    }

                    var accentColor = (Color)Application.Current.Resources["PhoneAccentColor"];
                    var linkColor   = "#" + accentColor.ToString().Substring(3);

                    //
                    // Show the text
                    //
                    var html = string.Format("<html><head><style>body{{background-color:{0};color:{1};}} a{{color:{2};}}</style></head><body>{3}</body></html>",
                                             bgColor, color, linkColor, vm.Content);

                    Browser.NavigateToString(html);
                }

                DataContext = vm;
            }
        }
예제 #5
0
        /// <summary>
        /// Get the twitter feed details and return as string
        /// </summary>
        /// <returns></returns>
        public string GetTwitterFeedDetails()
        {
            var twitterFeedManager = new TwitterFeedManager();

            return(twitterFeedManager.GetTwitterFeedDetails());
        }