Exemple #1
0
        public void SetSearchSection(string category, string[] searchResults)
        {
            var groups           = new List <string>(searchResults.Length);
            var groupsExpandable = new List <bool>(searchResults.Length);
            var groupToChildren  = new Dictionary <string, List <string> >();

            var itemsSource = new List <SearchMenuListItem>();

            foreach (var str in searchResults)
            {
                var jObject = JObject.Parse(str);
                var item    = new SearchMenuListItem();
                item.Name    = jObject["name"].Value <string>();
                item.Details = jObject["details"].Value <string>();

                JToken iconStringToken;
                var    iconString = jObject.TryGetValue("icon", out iconStringToken) ? iconStringToken.Value <string>() : "misc";
                item.Icon = new System.Windows.Media.Imaging.BitmapImage(ViewHelpers.MakeUriForImage(string.Format("icon1_{0}.png", iconString)));
                itemsSource.Add(item);

                groups.Add(str);
                groupsExpandable.Add(false);
                groupToChildren.Add(str, new List <string>());
            }


            m_resultListAdapter.SetData(itemsSource, groups, groupsExpandable, groupToChildren);

            m_resultsSpinner.Visibility     = Visibility.Hidden;
            m_resultsClearButton.Visibility = Visibility.Visible;
            m_searchArrow.Visibility        = Visibility.Visible;
            m_resultsSeparator.Visibility   = Visibility.Visible;

            m_searchInFlight = false;
        }
Exemple #2
0
        protected override void RefreshListData(List <string> groups, List <bool> groupsExpandable, Dictionary <string, List <string> > groupToChildrenMap)
        {
            var itemsSource = new List <SubMenuListItem>();

            foreach (var groupToChildren in groupToChildrenMap)
            {
                itemsSource.AddRange(groupToChildren.Value.Select(childListEntry => new SubMenuListItem(childListEntry, 0)));
            }

            m_adapter.SetData(itemsSource, groups, groupsExpandable, groupToChildrenMap);
        }
Exemple #3
0
        public void SetSearchSection(string category, string[] searchResults)
        {
            var groups           = new List <string>(searchResults.Length);
            var groupsExpandable = new List <bool>(searchResults.Length);
            var groupToChildren  = new Dictionary <string, List <string> >();

            var itemsSource = new List <SearchMenuListItem>();

            foreach (var str in searchResults)
            {
                var jObject = JObject.Parse(str);
                var item    = new SearchMenuListItem();
                item.Name    = jObject["name"] != null ? jObject["name"].Value <string>() : string.Empty;
                item.Details = jObject["details"] != null ? jObject["details"].Value <string>() : string.Empty;

                JToken iconStringToken;
                var    iconCategoryName = jObject.TryGetValue("icon", out iconStringToken) ? iconStringToken.Value <string>() : "";
                item.Icon = SearchMenuResultIconProvider.GetIconForCategory(iconCategoryName);
                itemsSource.Add(item);

                groups.Add(str);
                groupsExpandable.Add(false);

                if (!groupToChildren.ContainsKey(str))
                {
                    groupToChildren.Add(str, new List <string>());
                }
            }


            m_resultListAdapter.SetData(itemsSource, groups, groupsExpandable, groupToChildren);

            m_resultsSpinner.Visibility     = Visibility.Hidden;
            m_resultsClearButton.Visibility = Visibility.Visible;
            m_searchArrow.Visibility        = Visibility.Visible;
            m_resultsSeparator.Visibility   = Visibility.Visible;

            m_searchInFlight = false;
        }
 protected override void RefreshListData(List <string> groups, List <bool> groupsExpandable, Dictionary <string, List <string> > groupToChildrenMap)
 {
     m_adapter.SetData(m_list.ItemsSource, groups, groupsExpandable, groupToChildrenMap);
 }
Exemple #5
0
 protected override void RefreshListData(List <string> groups, List <bool> groupsExpandable, Dictionary <string, List <string> > groupToChildrenMap)
 {
     m_adapter.SetData(m_list.ItemsSource, groups, groupsExpandable, groupToChildrenMap);
     m_resultsOptionsView.MaxHeight = CalcResultOptionsViewMaxHeight();
 }