/// <summary>
 /// Sorts the facadeView
 /// </summary>
 private void OnSort()
 {
     if (!_disableSorting)
     {
         btnSortBy.Disabled = false;
         facadeView.Sort(new VideoSort(CurrentSortMethod, CurrentSortAsc));
         UpdateButtonStates();
     }
     else
     {
         btnSortBy.Disabled = true;
     }
 }
Beispiel #2
0
        public void UpdateList()
        {
            int grabberIndex = 0;

            updateStationLogoTimer.Enabled = false;
            downloaQueue.Clear();
            GUIControl.ClearControl(GetID, listControl.GetID);
            if (grabber.Parent != null && grabber.Parent.Body.Count > 0)
            {
                GUIListItem item = new GUIListItem();
                // and add station name & bitrate
                item.Label           = "..";
                item.Label2          = "(" + grabber.Parent.Body.Count.ToString() + ")";
                item.OnItemSelected += item_OnItemSelected;
                item.IsFolder        = true;
                item.IconImage       = "defaultFolderBack.png";
                item.IconImageBig    = "DefaultFolderBackBig.png";
                item.MusicTag        = null;
                listControl.Add(item);
            }
            RadioTimeOutline selected = null;

            foreach (RadioTimeOutline body in grabber.Body)
            {
                if (null != grabber.Selected && null != body && null == selected &&
                    (
                        (null != body.Url && body.Url.Equals((string)grabber.Selected, StringComparison.InvariantCultureIgnoreCase)) ||
                        (!string.IsNullOrEmpty(body.GuidId) && ((string)grabber.Selected).ToUpperInvariant().Contains(body.GuidId.ToUpperInvariant()))
                    )
                    )
                {
                    selected = body;
                }
                GUIListItem item = new GUIListItem();
                // and add station name & bitrate
                item.Label           = body.Text;
                item.Label2          = body.Bitrate;
                item.ThumbnailImage  = GetStationLogoFileName(body);
                item.IconImage       = GetStationLogoFileName(body);
                item.IsFolder        = false;
                item.OnItemSelected += item_OnItemSelected;
                item.MusicTag        = body;
                listControl.Add(item);
                DownloadStationLogo(body);
                switch (body.Type)
                {
                case RadioTimeOutline.OutlineType.audio:
                    if (string.IsNullOrEmpty(item.IconImage))
                    {
                        item.IconImage    = "defaultMyRadio.png";
                        item.IconImageBig = "defaultMyRadioBig.png";
                    }
                    item.IsFolder = false;
                    item.Year     = ++grabberIndex;
                    break;

                case RadioTimeOutline.OutlineType.link:
                    if (string.IsNullOrEmpty(item.IconImage))
                    {
                        item.IconImage    = "defaultFolder.png";
                        item.IconImageBig = "defaultFolderBig.png";
                    }
                    item.IsFolder = true;
                    item.Year     = ++grabberIndex;
                    break;

                case RadioTimeOutline.OutlineType.unknow:
                {
                    item.IconImage    = "defaultFolder.png";
                    item.IconImageBig = "defaultFolderBig.png";
                }
                    item.IsFolder = true;
                    item.Year     = ++grabberIndex;
                    break;

                default:
                    break;
                }
            }

            updateStationLogoTimer.Enabled = true;
            //if (curSorting != StationSort.SortMethod.none)
            listControl.Sort(new StationSort(curSorting, mapSettings.SortAscending));

            int i = 0;

            foreach (GUIListItem item in listControl.ListLayout.ListItems)
            {
                if (item.MusicTag == selected)
                {
                    break;
                }
                i++;
            }
            listControl.SelectedListItemIndex = i;

            GUIPropertyManager.SetProperty("#itemcount", grabber.Body.Count + " " + Translation.Objects);
            //GUIPropertyManager.SetProperty("#header.label", grabber.Head.Title);
            GUIPropertyManager.SetProperty("#header.label", grabber.NavigationTitle);

            if (grabber.CurentUrl.Contains("id="))
            {
                randomButton.Disabled = false;
            }
            else
            {
                randomButton.Disabled = true;
            }

            ShowPanel();
        }