public void AddMoreTopics(string data)
        {
            TopicData topicData = new TopicData();
            MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(data));
            System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(topicData.GetType());
            topicData = serializer.ReadObject(ms) as TopicData;
            ms.Close();

            var coll = gspivotviewer.ItemsSource
                as ObservableCollection<Topic>;
            foreach (Topic topic in topicData.data)
            {
                switch (topic.style)
                {
                    case "problem":
                        topic.styleImage = StyleImages[0];
                        break;
                    case "idea":
                        topic.styleImage = StyleImages[1];
                        break;
                    case "question":
                        topic.styleImage = StyleImages[2];
                        break;
                    case "praise":
                        topic.styleImage = StyleImages[3];
                        break;
                    case "update":
                        topic.styleImage = StyleImages[4];
                        break;
                }
                coll.Add(topic);
            }
        }
        public void PassTopicData(string data)
        {
            TopicData topicData = new TopicData();
            MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(data));
            System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(topicData.GetType());
            topicData = serializer.ReadObject(ms) as TopicData;
            ms.Close();

            gspivotviewer.ItemAdornerStyle = this.Resources["topicAdorner"] as Style;

            gspivotviewer.PivotProperties.Clear();
            gspivotviewer.PivotProperties = new List<PivotViewerProperty>()
            {
                new PivotViewerNumericProperty()
                    {
                        Binding = new Binding("me_too_count"),
                        Id = "Me Too Count",
                        Options = PivotViewerPropertyOptions.CanFilter
                        | PivotViewerPropertyOptions.CanSearchText
                    },
                new PivotViewerStringProperty()
                    {
                        Binding = new Binding("style"),
                        Id = "Style",
                        Options = PivotViewerPropertyOptions.CanFilter
                        | PivotViewerPropertyOptions.CanSearchText
                    },
                new PivotViewerStringProperty()
                    {
                        Binding = new Binding("at_sfn"),
                        Id = "URL",
                        Options = PivotViewerPropertyOptions.CanFilter
                        | PivotViewerPropertyOptions.CanSearchText
                    },
                new PivotViewerStringProperty()
                    {
                        Binding = new Binding("content"),
                        Id = "Content",
                        Options = PivotViewerPropertyOptions.CanFilter
                        | PivotViewerPropertyOptions.CanSearchText
                    },
                new PivotViewerNumericProperty()
                    {
                        Binding = new Binding("reply_count"),
                        Id = "Reply Count",
                        Options = PivotViewerPropertyOptions.CanFilter
                        | PivotViewerPropertyOptions.CanSearchText
                    },
                new PivotViewerStringProperty()
                    {
                        Binding = new Binding("status"),
                        Id = "Status",
                        Options = PivotViewerPropertyOptions.CanFilter
                        | PivotViewerPropertyOptions.CanSearchText
                    },
                new PivotViewerStringProperty()
                    {
                        Binding = new Binding("subject"),
                        Id = "Subject",
                        Options = PivotViewerPropertyOptions.CanFilter
                        | PivotViewerPropertyOptions.CanSearchText
                    },
                new PivotViewerStringProperty()
                    {
                        Binding = new Binding("emotitag.face"),
                        Id = "Emotion",
                        Options = PivotViewerPropertyOptions.CanFilter
                        | PivotViewerPropertyOptions.CanSearchText
                    },
                new PivotViewerStringProperty()
                    {
                        Binding = new Binding("emotitag.feeling"),
                        Id = "Feeling",
                        Options = PivotViewerPropertyOptions.CanFilter
                        | PivotViewerPropertyOptions.CanSearchText
                    }
            };

            gspivotviewer.ItemTemplates = new PivotViewerItemTemplateCollection();
            gspivotviewer.ItemTemplates.Add((PivotViewerItemTemplate)Resources["topicsTemplate"]);

            gspivotviewer.ItemsSource = new ObservableCollection<Topic>();
            var coll = gspivotviewer.ItemsSource
                   as ObservableCollection<Topic>;
            coll.Clear();
            foreach (Topic topic in topicData.data)
            {
                switch (topic.style)
                {
                    case "problem":
                        topic.styleImage = StyleImages[0];
                        break;
                    case "idea":
                        topic.styleImage = StyleImages[1];
                        break;
                    case "question":
                        topic.styleImage = StyleImages[2];
                        break;
                    case "praise":
                        topic.styleImage = StyleImages[3];
                        break;
                    case "update":
                        topic.styleImage = StyleImages[4];
                        break;
                }
                coll.Add(topic);
            }
            if (topicData.total > 50)
            {
                for (int counter = 1; counter < 4; counter++)
                {
                    if (topicData.total > counter * 50)
                    {
                        string apiToCall = "/topics.json?sort=recently_active&limit=50&page=" + counter + "&callback=handlerMoreTopics";
                        HtmlPage.Window.Invoke("getMoreData", apiToCall, "People");
                    }
                }
            }
        }