예제 #1
0
        /// <summary>
        /// This could get called from main thread or background thread.
        /// Remember to InvokeOnMainThread if required
        /// </summary>
        void PopulateData()
        {
            if (TwitterFeed.Count == 0)
            {
                var section = new Section("Network unavailable")
                {
                    new StyledStringElement("Twitter not available. Try again later.")
                };
                Root = new RootElement("Twitter")
                {
                    section
                };
            }
            else
            {
                Section section;
                UI.CustomElements.TweetElement twitterElement;

                // create a root element and a new section (MT.D requires at least one)
                Root    = new RootElement("Twitter");
                section = new Section();

                // for each tweet, add a custom TweetElement to the MT.D elements collection
                foreach (var tw in TwitterFeed)
                {
                    var currentTweet = tw;
                    twitterElement = new UI.CustomElements.TweetElement(currentTweet, splitView);
                    section.Add(twitterElement);
                }

                Root.Clear();
                // add the section to the root
                Root.Add(section);
            }
            base.StopLoadingScreen();                   // hide the 'loading' animation (from base)
            ReloadComplete();
        }
예제 #2
0
        /// <summary>
        /// This could get called from main thread or background thread.
        /// Remember to InvokeOnMainThread if required
        /// </summary>
        void PopulateData()
        {
            if (TwitterFeed.Count == 0) {
                var section = new Section ("Network unavailable") {
                    new StyledStringElement ("Twitter not available. Try again later.")
                };
                Root = new RootElement ("Twitter") { section };
            } else {
                Section section;
                UI.CustomElements.TweetElement twitterElement;

                // create a root element and a new section (MT.D requires at least one)
                Root = new RootElement ("Twitter");
                section = new Section();

                // for each tweet, add a custom TweetElement to the MT.D elements collection
                foreach (var tw in TwitterFeed) {
                    var currentTweet = tw;
                    twitterElement = new UI.CustomElements.TweetElement (currentTweet, splitView);
                    section.Add (twitterElement);
                }

                Root.Clear ();
                // add the section to the root
                Root.Add(section);
            }
            base.StopLoadingScreen();	// hide the 'loading' animation (from base)
            ReloadComplete ();
        }