private void RemoveFromList(GUIListItem listItem, FilterMode mode) { GUIListControl listControl = allFilesListControl; List <GUIListItem> internalList = allItems; switch (mode) { case FilterMode.ALL: listControl = allFilesListControl; internalList = allItems; break; case FilterMode.PENDING: listControl = pendingFilesListControl; internalList = pendingItems; break; case FilterMode.COMPLETED: listControl = completedFileListControl; internalList = completedItems; break; } if (internalList.Contains(listItem)) { internalList.Remove(listItem); listControl.ListItems.Remove(listItem); } }
/// <summary> /// Get items from the list control /// </summary> /// <param name="list">list control</param> private void GetItemsFromListControl(GUIListControl list) { //make sure the list isn't in the progress of being filled (list count growing) int itemCount = 0; for (int i = 0; i < 20; i++) { Thread.Sleep(200); if (list.Count > 0 && list.Count == itemCount) { break; } itemCount = list.Count; } WifiRemote.LogMessage("Retrieving " + itemCount + " dialog list items: ", WifiRemote.LogType.Debug); List <GUIListItem> items = list.ListItems; for (int i = 0; i < itemCount; i++) { FacadeItem item = new FacadeItem(list[i]); //WifiRemote.LogMessage("Add dialog list items: " + item.Label, WifiRemote.LogType.Debug); ListItems.Add(item); } }
private void Sort(bool bSortAscending /*=true*/) { m_bSortAscending = bSortAscending; GUIListControl list = (GUIListControl)GetControl((int)Controls.CONTROL_LIST); list.Sort(this); }
/// <summary> /// Page gets loaded /// </summary> protected override void OnPageLoad() { //Stopwatch bClock = Stopwatch.StartNew(); //Log.Debug("TvMiniGuide: onpageload"); // following line should stay. Problems with OSD not // appearing are already fixed elsewhere //GUILayerManager.RegisterLayer(this, GUILayerManager.LayerType.MiniEPG); AllocResources(); ResetAllControls(); // make sure the controls are positioned relevant to the OSD Y offset lstChannels = getChannelList(); if (lstChannelsWithStateIcons != null) { lstChannelsWithStateIcons.Visible = false; } lstChannels.Visible = true; spinGroup.CycleItems = true; FillChannelList(); FillGroupList(); base.OnPageLoad(); //Log.Debug("TvMiniGuide: onpageload took {0} msec", bClock.ElapsedMilliseconds); }
/// <summary> /// Try to locate the list element in a collection of gui controls /// </summary> /// <param name="collection">The collection where we browse in</param> /// <returns>The list if found, null otherwise</returns> private GUIListControl GetListControl(GUIControlCollection collection) { if (collection != null && collection.Count > 0) { //Get the control that holds all the list items foreach (GUIControl c in collection) { if (c.GetType() == typeof(GUIListControl)) { GUIListControl list = (GUIListControl)c; return(list); } else if (c.GetType() == typeof(GUIGroup)) { GUIGroup group = (GUIGroup)c; //Control type group, can have child elements GUIListControl list = GetListControl(group.Children); if (list != null) { //Found list in group type group, return it return(list); } } } } return(null); }
public void Load(GUIFacadeControl facade, ImageSwapper backdrop, DBItem startupItem, bool launch, GUILabelControl showVideoPreviewControl, GUIListControl goodmergeList, GUIButtonControl detailsPlayButton) { this.facade = facade; this.goodmergeList = goodmergeList; this.backdrop = backdrop; this.showVideoPreviewControl = showVideoPreviewControl; this.detailsPlayButton = detailsPlayButton; clearGUIProperties(); currentLayout = -1; int prevWindow = GUIWindowManager.GetPreviousActiveWindow(); if (GUIWindowManager.ActiveWindow == prevWindow || prevWindow == (int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO) { launchStartupItem = false; Refresh(true); //Catch when MP is refreshing plugin after resizing/restoring and maintain current view } else { resetStartupItem(startupItem); this.launchStartupItem = launch; SortProperty = ListItemProperty.DEFAULT; //set skin property GUIPropertyManager.SetProperty("#Emulators2.sortenabled", "no"); currentView = ViewState.Items; setFacadeVisibility(true); loadStartupItems(0); } //resume import if previously paused resumeImporter(); }
public void GetItems(GUIListControl control, string tit, int pos, View curview) { Title = tit; Position = pos; CurrentView = curview; Items = control.ListItems.GetRange(0, control.ListItems.Count); }
private void SelectItemByIndex(int index, GUIListControl listControl) { while (index >= listControl.Count && index > 0) { index--; } GUIControl.SelectItemControl(GetID, listControl.GetID, index); }
private void AddRangeToList(GUIListControl listControl, List <GUIListItem> listItems) { listControl.Clear(); foreach (var item in listItems) { listControl.Add(item); } }
public override void Reset() { base.Reset(); ConflictingEpisodes = false; GUIListControl list = (GUIListControl)GetControl((int)Controls.LIST); if (list != null) { list.Clear(); } }
private int GetSelectedItemIndex(GUIListControl listControl) { if (listControl.Count > 0) { return(listControl.SelectedListItemIndex); } else { return(-1); } }
public GUIListItem FindItemByHash(GUIListControl list, Torrent torrent) { foreach (var i in list.ListItems) { if ((i.AlbumInfoTag as Torrent).Hash == torrent.Hash) { return(i); } } return(null); }
public void DoPlay(YouTubeEntry vid, bool fullscr, GUIListControl facade) { if (vid != null) { VideoInfo qa = SelectQuality(vid); if (qa.Quality == VideoQuality.Unknow) { return; } Youtube2MP.temp_player.Reset(); Youtube2MP.temp_player.RepeatPlaylist = true; Youtube2MP.temp_player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC_VIDEO; PlayList playlist = Youtube2MP.temp_player.GetPlaylist(PlayListType.PLAYLIST_MUSIC_VIDEO); playlist.Clear(); g_Player.PlayBackStopped += new g_Player.StoppedHandler(g_Player_PlayBackStopped); AddItemToPlayList(vid, ref playlist, qa); if (facade != null) { qa.Items = new Dictionary <string, string>(); int selected = facade.SelectedListItemIndex; for (int i = selected + 1; i < facade.ListItems.Count; i++) { AddItemToPlayList(facade.ListItems[i], ref playlist, new VideoInfo(qa)); } } PlayListPlayer.SingletonPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_NONE; Youtube2MP.player.CurrentPlaylistType = PlayListType.PLAYLIST_NONE; Youtube2MP.temp_player.Play(0); if (g_Player.Playing && fullscr) { if (_setting.ShowNowPlaying) { GUIWindowManager.ActivateWindow(29052); } else { g_Player.ShowFullScreenWindow(); } } if (!g_Player.Playing) { Err_message("Unable to playback the item ! "); } } }
private GUIListControl getChannelList() { GUIListControl lstChannels = null; if (TVHome.ShowChannelStateIcons() && lstChannelsWithStateIcons != null) { lstChannels = lstChannelsWithStateIcons; } else { lstChannels = lstChannelsNoStateIcons; } return(lstChannels); }
/// <summary> /// Retrieve items for this list and store it in the object /// </summary> public void RetrieveListItems() { for (int i = 0; i < 10; i++) { Thread.Sleep(200); GUIListControl list = GetListControl(menu.controlList); if (list != null) { //found the list control -> get list elements GetItemsFromListControl(list); break; } } }
/// <summary> /// Creates the element and retrieves all information from the control /// </summary> /// <param name="control">GUIControl</param> public ListElement(GUIControl control) : base(control) { _list = control as GUIListControl; if (_list != null) { _cursorX = _list.CursorX; _offset = _list.Offset; _listButtons = new List <ListButtonElement>(); _labelControls1 = new List <ListLabelElement>(); _labelControls2 = new List <ListLabelElement>(); _labelControls3 = new List <ListLabelElement>(); _cachedBitmaps = new Dictionary <String, Bitmap>(); AllocButtons(_list.SpinX, _list.SpinY); initializeLabels(); _verticalScrollBarElement = new VerticalScrollBarElement(_list.Scrollbar); _focus = _list.IsFocused; } }
public void AddConflictRecording(GUIListItem item) { string logo = MediaPortal.Util.Utils.GetCoverArt(Thumbs.TVChannel, item.Label3); if (!MediaPortal.Util.Utils.FileExistsInCache(logo)) { logo = "defaultVideoBig.png"; } item.ThumbnailImage = logo; item.IconImageBig = logo; item.IconImage = logo; item.OnItemSelected += OnListItemSelected; GUIListControl list = (GUIListControl)GetControl((int)Controls.LIST); if (list != null) { list.Add(item); } }
private void InitializeChannelListControl() { if (_channelsListControlWithStateIcons != null && TvHome.ShowChannelStateIcons) { _channelsListControl = _channelsListControlWithStateIcons; _channelsListControlNoStateIcons.Visible = false; _showStateIcons = true; } else { _channelsListControl = _channelsListControlNoStateIcons; if (_channelsListControlWithStateIcons != null) { _channelsListControlWithStateIcons.Visible = false; } _showStateIcons = false; } _channelsListControl.Visible = true; }
public void InsertTVProgs(ref GUIListControl lcProgramList, DateTime start, DateTime stop) { IList list = PersonalTVGuideMap.ListAll(); foreach (PersonalTVGuideMap map in list) { Program prog = Program.Retrieve(map.IdProgram); if ((prog.StartTime >= start) && (prog.StartTime < stop)) { GUIListItem item = new GUIListItem(); item.Label = prog.Title; if (prog.EpisodeNum != String.Empty) { item.Label += "\n" + prog.EpisodeNum; } item.Label2 = String.Format("{0} {1} - {2}", Utils.GetShortDayString(prog.StartTime), prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); string strLogo = Utils.GetCoverArt(Thumbs.TVChannel, prog.ReferencedChannel().Name); if (!System.IO.File.Exists(strLogo)) { strLogo = "defaultVideoBig.png"; } item.ThumbnailImage = strLogo; item.IconImage = strLogo; item.IconImageBig = strLogo; //item.PinImage = RecordingIconStr(prog); item.DVDLabel = prog.Description; item.TVTag = prog; item.MusicTag = map; //item.Rating = Ranking; //item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnProgItemSelected); lcProgramList.Add(item); } } }
public bool GetDialogInfo(GUIWindow.Window dialogWindow, ref string DialogTitle, ref string DialogHighlightedItem) { GUIListControl control = null; bool focus = false; switch (dialogWindow) { case GUIWindow.Window.WINDOW_DIALOG_YES_NO: case GUIWindow.Window.WINDOW_DIALOG_TVNOTIFYYESNO: { GUIDialogYesNo window = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)dialogWindow); DialogTitle = string.Empty; foreach (object obj16 in window.controlList) { if (obj16.GetType() == typeof(GUIFadeLabel)) { GUIFadeLabel label3 = obj16 as GUIFadeLabel; if (DialogTitle == string.Empty) { if (label3.Label != string.Empty) { DialogTitle = label3.Label; } } else if (label3.Label != string.Empty) { DialogTitle = DialogTitle + " - " + label3.Label; } } if (obj16.GetType() == typeof(GUILabelControl)) { GUILabelControl control14 = obj16 as GUILabelControl; if (DialogTitle == string.Empty) { if (control14.Label != string.Empty) { DialogTitle = control14.Label; } } else if (control14.Label != string.Empty) { DialogTitle = DialogTitle + " - " + control14.Label; } } if (obj16.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control15 = obj16 as GUIButtonControl; if (!control15.Focus) { continue; } DialogHighlightedItem = control15.Description; } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_PROGRESS: { GUIDialogProgress progress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)dialogWindow); foreach (object obj6 in progress.controlList) { if (obj6.GetType() == typeof(GUILabelControl)) { GUILabelControl control6 = obj6 as GUILabelControl; if (control6.GetID == 1) { DialogTitle = control6.Label; } } } foreach (object obj7 in progress.controlList) { if (obj7.GetType() == typeof(GUIProgressControl)) { GUIProgressControl control7 = obj7 as GUIProgressControl; DialogHighlightedItem = "Progress: " + control7.Percentage.ToString() + "%"; } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_SELECT: { GUIDialogSelect select = (GUIDialogSelect)GUIWindowManager.GetWindow((int)dialogWindow); control = null; focus = false; foreach (object obj9 in select.controlList) { if (obj9.GetType() == typeof(GUIListControl)) { control = obj9 as GUIListControl; focus = control.Focus; } } if ((control != null) & focus) { string strLabel = string.Empty; string str5 = string.Empty; string strThumb = string.Empty; string strIndex = string.Empty; control.GetSelectedItem(ref strLabel, ref str5, ref strThumb, ref strIndex); DialogHighlightedItem = strLabel; } else { foreach (object obj10 in select.controlList) { if (obj10.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control10 = obj10 as GUIButtonControl; if (control10.Focus) { DialogHighlightedItem = control10.Description; } } } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_OK: { GUIDialogOK gok = (GUIDialogOK)GUIWindowManager.GetWindow((int)dialogWindow); foreach (object obj5 in gok.controlList) { if (obj5.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control4 = obj5 as GUIButtonControl; if (control4.Focus) { DialogHighlightedItem = control4.Description; Settings.Instance.LogInfo( "MiniDisplay.GetDialogInfo(): found WINDOW_DIALOG_OK buttoncontrol ID = {0} Label = \"{1}\" Desc = \"{2}\"", control4.GetID, control4.Label, control4.Description); } } if (obj5.GetType() == typeof(GUIFadeLabel)) { GUIFadeLabel label = obj5 as GUIFadeLabel; if (DialogTitle == string.Empty) { if (label.Label != string.Empty) { DialogTitle = label.Label; } } else if (label.Label != string.Empty) { DialogTitle = DialogTitle + " - " + label.Label; } } if (obj5.GetType() == typeof(GUILabelControl)) { GUILabelControl control5 = obj5 as GUILabelControl; if (DialogTitle == string.Empty) { if (control5.Label != string.Empty) { DialogTitle = control5.Label; } continue; } if (control5.Label != string.Empty) { DialogTitle = DialogTitle + " - " + control5.Label; } } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_SELECT2: { GUIDialogSelect2 select2 = (GUIDialogSelect2)GUIWindowManager.GetWindow((int)dialogWindow); control = null; focus = false; foreach (object obj11 in select2.controlList) { if (obj11.GetType() == typeof(GUIListControl)) { control = obj11 as GUIListControl; focus = control.Focus; } } if ((control != null) & focus) { string str7 = string.Empty; string str8 = string.Empty; string str9 = string.Empty; string strIndex = string.Empty; control.GetSelectedItem(ref str7, ref str8, ref str9, ref strIndex); DialogHighlightedItem = str7; } else { foreach (object obj12 in select2.controlList) { if (obj12.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control11 = obj12 as GUIButtonControl; if (control11.Focus) { DialogHighlightedItem = control11.Description; } } } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_MENU: { GUIDialogMenu menu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)dialogWindow); foreach (object obj13 in menu.controlList) { if (obj13.GetType() == typeof(GUILabelControl)) { GUILabelControl control12 = obj13 as GUILabelControl; if (!control12.Label.Trim().ToLowerInvariant().Equals("menu")) { DialogTitle = control12.Label; } } } control = null; focus = false; foreach (object obj14 in menu.controlList) { if (obj14.GetType() == typeof(GUIListControl)) { control = obj14 as GUIListControl; focus = control.Focus; } } if ((control != null) & focus) { string str10 = string.Empty; string str11 = string.Empty; string str12 = string.Empty; string strIndex = string.Empty; control.GetSelectedItem(ref str10, ref str11, ref str12, ref strIndex); DialogHighlightedItem = str10; } else { foreach (object obj15 in menu.controlList) { if (obj15.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control13 = obj15 as GUIButtonControl; if (control13.Focus) { DialogHighlightedItem = control13.Description; } } } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_RATING: { GUIDialogSetRating rating = (GUIDialogSetRating)GUIWindowManager.GetWindow((int)dialogWindow); DialogTitle = string.Empty; foreach (object obj8 in rating.controlList) { if (obj8.GetType() == typeof(GUIFadeLabel)) { GUIFadeLabel label2 = obj8 as GUIFadeLabel; if (DialogTitle == string.Empty) { if (label2.Label != string.Empty) { DialogTitle = label2.Label; } } else if (label2.Label != string.Empty) { DialogTitle = DialogTitle + " - " + label2.Label; } } if (obj8.GetType() == typeof(GUILabelControl)) { GUILabelControl control8 = obj8 as GUILabelControl; if (DialogTitle == string.Empty) { if (control8.Label != string.Empty) { DialogTitle = control8.Label; } } else if (control8.Label != string.Empty) { DialogTitle = DialogTitle + " - " + control8.Label; } } if (obj8.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control9 = obj8 as GUIButtonControl; if (!control9.Focus) { continue; } DialogHighlightedItem = control9.Description; } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_MENU_BOTTOM_RIGHT: { GUIDialogMenuBottomRight right = (GUIDialogMenuBottomRight)GUIWindowManager.GetWindow((int)dialogWindow); DialogTitle = string.Empty; foreach (object obj2 in right.controlList) { if (obj2.GetType() == typeof(GUILabelControl)) { GUILabelControl control2 = obj2 as GUILabelControl; if (!control2.Label.Trim().ToLowerInvariant().Equals("menu") && (control2.Label != string.Empty)) { if (DialogTitle == string.Empty) { DialogTitle = control2.Label; } else { DialogTitle = DialogTitle + " - " + control2.Label; } } } } control = null; focus = false; foreach (object obj3 in right.controlList) { if (obj3.GetType() == typeof(GUIListControl)) { control = obj3 as GUIListControl; focus = control.Focus; } } if ((control != null) & focus) { string str = string.Empty; string str2 = string.Empty; string str3 = string.Empty; string strIndex = string.Empty; control.GetSelectedItem(ref str, ref str2, ref str3, ref strIndex); DialogHighlightedItem = str; } else { foreach (object obj4 in right.controlList) { if (obj4.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control3 = obj4 as GUIButtonControl; if (control3.Focus) { DialogHighlightedItem = control3.Description; } } } } return(true); } } return(false); }
public NavigationObject(GUIListControl control, string tit, int pos, View curview) { Items = new List <GUIListItem>(); GetItems(control, tit, pos, curview); }
public static GUIControl Create(int dwParentId, XmlNode pControlNode, IDictionary <string, string> defines, string filename) { Type typeOfControlToCreate = GetControlType(pControlNode); if (typeOfControlToCreate == null) { return(null); } object[] ctorParams = { dwParentId }; GUIControl control = (GUIControl) Activator.CreateInstance(typeOfControlToCreate, ctorParams); try { // if(control is ISupportInitialize) ((ISupportInitialize)control).BeginInit(); XmlNode referenceNode = (XmlNode)m_referenceNodesByControlType[typeOfControlToCreate]; if (referenceNode != null) { UpdateControlWithXmlData(control, typeOfControlToCreate, referenceNode, defines, filename); } XmlAttribute styleAttribute = pControlNode.Attributes["Style"]; if (styleAttribute != null) { XmlNode styleNode = _cachedStyleNodes[styleAttribute.Value]; if (styleNode != null) { UpdateControlWithXmlData(control, typeOfControlToCreate, styleNode, defines, filename); } } UpdateControlWithXmlData(control, typeOfControlToCreate, pControlNode, defines, filename); control.ScaleToScreenResolution(); AddSubitemsToControl(pControlNode, control); control.FinalizeConstruction(); if (control is IAddChild) { foreach (XmlNode subControlNode in pControlNode.SelectNodes("control")) { ((IAddChild)control).AddChild(Create(dwParentId, subControlNode, defines, filename)); } } if (typeOfControlToCreate == typeof(GUIFacadeControl)) { GUIFacadeControl facade = (GUIFacadeControl)control; XmlNodeList nodeList = pControlNode.SelectNodes("control"); foreach (XmlNode subControlNode in nodeList) { GUIControl subControl = Create(dwParentId, subControlNode, defines, filename); if (subControl is GUIPlayListItemListControl) { GUIPlayListItemListControl list = subControl as GUIPlayListItemListControl; facade.PlayListLayout = list; } else if (subControl is GUIListControl) { GUIListControl list = subControl as GUIListControl; if (list.SubType == "album") { facade.AlbumListLayout = list; } else { facade.ListLayout = list; } } if (subControl is GUIThumbnailPanel) { facade.ThumbnailLayout = subControl as GUIThumbnailPanel; } if (subControl is GUIFilmstripControl) { facade.FilmstripLayout = subControl as GUIFilmstripControl; } if (subControl is GUICoverFlow) { facade.CoverFlowLayout = subControl as GUICoverFlow; } //UpdateControlWithXmlData(subControl, subControl.GetType(), subControlNode, defines); } } // if(control is ISupportInitialize) ((ISupportInitialize)control).EndInit(); } catch (Exception e) { Log.Info("GUIControlFactory.Create: {0}\r\n\r\n{1}\r\n\r\n", e.Message, e.StackTrace); Log.Info("Parent: {0} Id: {1}", dwParentId, control.GetID); } return(control); }
private GUIListItem GetItem(int index, GUIListControl listControl) { return(listControl[index]); }