Beispiel #1
0
 // callback to invoke UI update, updating UI in UI thread by Dispatcher.BeginInvoke()
 private void parseTopic(EntryModel data)
 {
     if (data == null)
     {
     }
     else {
     rootTopic = data;
     ((App)App.Current).RootFrame.Dispatcher.BeginInvoke(new Action<List<EntryModel>,EntryModel>(parseTopicView), data.Children,null);
     }
 }
Beispiel #2
0
        private void parseTopicView(List<EntryModel> data,EntryModel item=null)
        {
            if (data != null)
            {
                if (item == null)
                {
                    this.Items.Clear();
                    if (this.Topic != "Main")
                        this.Items.Add(allTopics);
                }
                foreach (EntryModel topic in data)
                {
                    if (!topic.Hide)
                    {
                        if (topic.Kind == "Topic") {
                            if (item == null)
                            {
                                this.Items.Add(topic);
                                allTopics.subItems.Add(topic);
                            }
                            else
                            {
                                item.subItems.Add(topic);
                            }
                        }
                        else if (topic.Kind == "Video")
                        {
                            if (item == null)
                            {
                                if (this.Items.Count == 1) // if no sub topics. ONLY "All"=> all vidoes
                                {
                                    EntryModel tmpTopic = new EntryModel();
                                    tmpTopic.Title = parentTopic.Replace('-', ' ');
                                    allTopics.subItems.Add(topic);
                                    //LoadVideoData(topic.Id);
                                }
                            }
                            else
                            {
                                item.subItems.Add(topic);
                            }

                        }
                    }
                }
                isDataLoaded = true;  // this will trigger page status update logic (e.g. progressBar invisible)
            }
        }
Beispiel #3
0
 public void loadSubItem(EntryModel item)
 {
     if (item.subItems.Count == 0)
     {
         KaApi apiCall = new KaApi();
         RestRequest request = new RestRequest(Constants.TopicUrl + item.Id + "/videos");
         //request.RootElement = "children";
         apiCall.ExecuteAsync<List<EntryModel>>(request, parseTopicTree);
     }
 }