internal void InitFacade(ref GUIFacadeControl facade) { if (Utils.UsedArgus) { if (Largusrh != null && Largusrh.FacadeCollection != null) { for (int i = 0; i < Largusrh.FacadeCollection.Count; i++) { GUIListItem _gc = Largusrh.FacadeCollection[i] as GUIListItem; // Utils.LoadImage(_gc.IconImage, ref Largusrh.imagesThumbs); facade.Add(_gc); } } } else { if (Ltvrh != null && Ltvrh.FacadeCollection != null) { for (int i = 0; i < Ltvrh.FacadeCollection.Count; i++) { GUIListItem _gc = Ltvrh.FacadeCollection[i] as GUIListItem; // Utils.LoadImage(_gc.IconImage, ref Ltvrh.imagesThumbs); facade.Add(_gc); } } } }
public void SetItems(GUIFacadeControl control) { foreach (GUIListItem item in Items) { control.Add(item); } }
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(); }
private void AddToFilmstrip(GUIFacadeControl facade, Latest latests, int x) { try { Utils.LoadImage(latests.Thumb, ref imagesThumbs); //Add to filmstrip GUIListItem item = new GUIListItem(); item.ItemId = x; item.IconImage = latests.Thumb; item.IconImageBig = latests.Thumb; item.ThumbnailImage = latests.Thumb; item.Label = latests.Title; item.Label2 = latests.Genre; item.Label3 = latests.DateAdded; item.IsFolder = false; item.DVDLabel = latests.Fanart; item.OnItemSelected += new GUIListItem.ItemSelectedHandler(item_OnItemSelected); if (facade != null) { facade.Add(item); } facadeCollection.Add(item); if (x == 1) { UpdateSelectedProperties(item); } } catch (Exception ex) { logger.Error("AddToFilmstrip: " + ex.ToString()); } }
public void setFilmstripImage(GUIFacadeControl facade) { #if MP11 facade.FilmstripView.InfoImageFileName = facade.SelectedListItem.ThumbnailImage; #else facade.FilmstripLayout.InfoImageFileName = facade.SelectedListItem.ThumbnailImage; #endif }
/// <summary> /// Gets a value indicating wether the item is selected in the facade /// </summary> /// <typeparam name="T"></typeparam> /// <param name="self"></param> /// <param name="item"></param> /// <returns>True if the item is selected</returns> public static bool IsSelected <T>(this GUIFacadeControl self, T item) where T : class { if (item != null & self.SelectedListItem != null && self.SelectedListItem.TVTag is T) { return(self.SelectedListItem.TVTag == item); } return(false); }
public MainPresenter(GUIFacadeControl facade, GUIImage[] stars, GUIImage bg_description, GUITextScrollUpControl text_description, GUIButtonControl button_view, GUILabelControl gamelabel_year, GUILabelControl gamelabel_genre, GUILabelControl gamelabel_company, GUILabelControl gamelabel_latestplay, GUILabelControl gamelabel_playcount) { this.facade = facade; this.stars = stars; this.bg_description = bg_description; this.text_description = text_description; this.button_view = button_view; this.gamelabel_year = gamelabel_year; this.gamelabel_genre = gamelabel_genre; this.gamelabel_company = gamelabel_company; this.gamelabel_latestplay = gamelabel_latestplay; this.gamelabel_playcount = gamelabel_playcount; }
/// <summary> /// Get all facade items of the currently shown facade /// </summary> /// <param name="windowId"></param> /// <param name="controlId"></param> /// <returns></returns> public static List <FacadeItem> GetFacadeItems(int windowId, int controlId) { List <FacadeItem> returnItems = new List <FacadeItem>(); int count = GUIFacadeControl.GetItemCount(GUIWindowManager.ActiveWindow, 50); for (int i = 0; i < count; i++) { GUIListItem item = GUIFacadeControl.GetListItem(GUIWindowManager.ActiveWindow, 50, i); returnItems.Add(new FacadeItem(item)); } return(returnItems); }
internal void ClearFacade(ref GUIFacadeControl facade) { Utils.ClearFacade(ref facade); if (Utils.UsedArgus) { Utils.UnLoadImages(ref Largusrh.images); Utils.UnLoadImages(ref Largusrh.imagesThumbs); } else { Utils.UnLoadImages(ref Ltvrh.images); Utils.UnLoadImages(ref Ltvrh.imagesThumbs); } }
public static List <GUIListItem> Items(this GUIFacadeControl self) { if (self.ListLayout() != null) { return(self.ListLayout().ListItems); } if (self.AlbumListLayout() != null) { return(self.AlbumListLayout().ListItems); } // if the skin does not implement the list control we are out of luck :( return(null); }
/// <summary> /// Selects the specified item in the facade /// </summary> /// <param name="self"></param> /// <param name="index">index of the item</param> public static void SelectIndex(this GUIFacadeControl self, int index) { if (index > self.Count) { index = 0; } if (index == self.Count) { index--; } GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECT, self.WindowId, 0, self.GetID, index, 0, null); GUIGraphicsContext.SendMessage(msg); }
/// <summary> /// Update the facade infor with the current values /// </summary> private void UpdateFacadeInfo() { try { GUIWindow currentPlugin = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow); Object o = currentPlugin.GetControl(50); if (o != null) { if (o.GetType() == typeof(GUIFacadeControl)) { GUIFacadeControl facade = (GUIFacadeControl)o; SelectedIndex = facade.SelectedListItemIndex; Visible = facade.VisibleFromSkinCondition; Count = facade.Count; ViewType = facade.CurrentLayout.ToString(); } else if (o.GetType() == typeof(GUIMenuControl)) { //TODO: also support home menu GUIMenuControl menu = (GUIMenuControl)o; SelectedIndex = menu.FocusedButton; Visible = false; Count = menu.ButtonInfos.Count; ViewType = "menu"; } else { SelectedIndex = 0; Visible = false; Count = 0; ViewType = null; } } else { SelectedIndex = 0; Visible = false; Count = 0; ViewType = null; } } catch (Exception ex) { WifiRemote.LogMessage("Error on updating facade info: " + ex.ToString(), WifiRemote.LogType.Error); } }
public void DoPlay(YouTubeEntry vid, bool fullscr, GUIFacadeControl facade) { if (Youtube2MP.PlayBegin) { return; } Youtube2MP.PlayBegin = true; PlayParams playParams = new PlayParams() { facade = facade, fullscr = fullscr, vid = vid }; BackGroundDoPlay(playParams); //BackgroundWorker playbackgroundWorker = new BackgroundWorker(); //playbackgroundWorker.DoWork += new DoWorkEventHandler(playbackgroundWorker_DoWork); //GUIWaitCursor.Init(); //GUIWaitCursor.Show(); //playbackgroundWorker.RunWorkerAsync(playParams); }
protected virtual void InitLayoutSelections() { btnLayouts.ClearMenu(); // Add the allowed layouts to choose from to the menu. int totalLayouts = Enum.GetValues(typeof(GUIFacadeControl.Layout)).Length; for (int i = 0; i < totalLayouts; i++) { string layoutName = Enum.GetName(typeof(GUIFacadeControl.Layout), i); GUIFacadeControl.Layout layout = GetLayoutNumber(layoutName); if (AllowLayout(layout)) { if (!facadeLayout.IsNullLayout(layout)) { btnLayouts.AddItem(GUIFacadeControl.GetLayoutLocalizedName(layout), (int)layout); } } } // Have the menu select the currently selected layout. btnLayouts.SetSelectedItemByValue((int)CurrentLayout); }
/// <summary> /// Sets the specified visible property on the facade and all children lists /// </summary> /// <param name="self"></param> /// <param name="value"></param> public static void Visible(this GUIFacadeControl self, bool value) { self.Visible = value; if (self.ListLayout() != null) { self.ListLayout().Visible = value; } if (self.ThumbnailLayout() != null) { self.ThumbnailLayout().Visible = value; } if (self.AlbumListLayout() != null) { self.AlbumListLayout().Visible = value; } if (self.FilmstripLayout() != null) { self.FilmstripLayout().Visible = value; } if (self.CoverFlowLayout != null) { self.CoverFlowLayout.Visible = value; } }
/// <summary> /// Performs clear on the facade and all children lists /// </summary> /// <param name="self"></param> public static void ClearAll(this GUIFacadeControl self) { self.Clear(); if (self.ListLayout() != null) { self.ListLayout().Clear(); } if (self.ThumbnailLayout() != null) { self.ThumbnailLayout().Clear(); } if (self.FilmstripLayout() != null) { self.FilmstripLayout().Clear(); } if (self.AlbumListLayout() != null) { self.AlbumListLayout().Clear(); } if (self.CoverFlowLayout != null) { self.CoverFlowLayout.Clear(); } }
/// <summary> /// Sets the facade and any defined layouts visibility to the visibility defined by the skin /// </summary> /// <param name="self"></param> public static void SetVisibleFromSkinCondition(this GUIFacadeControl self) { self.Visible = self.VisibleFromSkinCondition; if (self.FilmstripLayout != null) { self.FilmstripLayout.Visible = self.FilmstripLayout.VisibleFromSkinCondition; } if (self.CoverFlowLayout != null) { self.CoverFlowLayout.Visible = self.CoverFlowLayout.VisibleFromSkinCondition; } if (self.AlbumListLayout != null) { self.AlbumListLayout.Visible = self.AlbumListLayout.VisibleFromSkinCondition; } if (self.ThumbnailLayout != null) { self.ThumbnailLayout.Visible = self.ThumbnailLayout.VisibleFromSkinCondition; } if (self.ListLayout != null) { self.ListLayout.Visible = self.ListLayout.VisibleFromSkinCondition; } }
// triggered when a group header was selected on the facade private static void onGroupHeaderSelected(GUIListItem item, GUIControl parent) { // if this is not a message from the facade, exit GUIFacadeControl facade = Browser.Facade; if (!facade.IsRelated(parent) || facade.SelectedListItem != item) { return; } int newIndex = facade.SelectedListItemIndex; int oldIndex = Browser.SelectedIndex; int lastIndex = facade.Count - 1; logger.Debug("onGroupHeaderSelected CurrentIndex {0} OldIndex {1}", newIndex, oldIndex); if (newIndex < oldIndex && !(newIndex == 0 && oldIndex == lastIndex)) { // MOVE UP logger.Debug("Jumping Up"); if (newIndex == 0) { facade.SelectIndex(lastIndex); } else { facade.OnAction(new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_UP, 0, 0)); } } else { // MOVE DOWN logger.Debug("Jumping Down"); facade.OnAction(new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_DOWN, 0, 0)); } }
public void EncodeDisc(GUIFacadeControl facadeView, int getID) { GetID = getID; if (File.Exists(Config.GetFile(Config.Dir.Base, "lame_enc.dll"))) { // Release the drives first for CDDRIVE to be able to open them BassMusicPlayer.ReleaseCDDrives(); char[] Drives = CDDrive.GetCDDriveLetters(); for (int i = 1; i < facadeView.Count; ++i) { GUIListItem item = facadeView[i]; if ((!item.IsFolder) && (Array.IndexOf(Drives, item.Path[0]) > -1)) { TrackInfo trackInfo = new TrackInfo(); if ((MusicTag)item.MusicTag == null) { MusicTag musicTag = new MusicTag(); musicTag.Artist = "Unknown Artist"; musicTag.Album = "Unknown Album"; musicTag.Track = Convert.ToInt16(item.Label.Substring(5)); musicTag.Title = string.Format("Track {0:00}", musicTag.Track); item.MusicTag = musicTag; } trackInfo.MusicTag = (MusicTag)item.MusicTag; trackInfo.TrackCount = facadeView.Count - 1; trackInfo.Item = item; try { EncodeTrack(trackInfo); } catch {} } } } }
/// <summary> /// Selects the requested, or if not available the first, object of the specified type in the facade /// </summary> /// <typeparam name="T"></typeparam> /// <param name="self"></param> /// <param name="item">the object to select or null </param> /// <param name="selectedIndex">the index of the selection</param> /// <returns>selected object</returns> public static T SyncToFacade <T>(this GUIFacadeControl self, T item, out int selectedIndex) where T : class { lock (self) { object selectedItem = null; selectedIndex = -1; // no use in syncing when we got no items if (self.Count == 0) { return(null); } // Check if the current selected item already is the item we want // if so we don't have to do the routine check if (item != null & self.SelectedListItem != null && self.SelectedListItem.TVTag is T) { if (self.SelectedListItem.TVTag == item) { selectedItem = self.SelectedListItem.TVTag; selectedIndex = self.SelectedListItemIndex; } } // Find the item in the facade and mark the first item found if (selectedItem == null) { for (int i = 0; i < self.Count; i++) { if (self[i].TVTag is T) { // mark the first item found if (selectedIndex == -1) { selectedIndex = i; } // if we found the item or had no selection break the loop; if (item == null || item == self[i].TVTag) { selectedIndex = i; selectedItem = self[i].TVTag; break; } } } // if no item was found during the iteration we use the first item found if (selectedItem == null) { if (selectedIndex == -1) { return(null); } selectedItem = self[selectedIndex].TVTag; } // select the item in the facade if (self.SelectedListItemIndex != selectedIndex) { logger.Debug("SyncToFacade<{0}>: Index={1}, Item={2}", typeof(T).Name, selectedIndex, selectedItem); self.SelectIndex(selectedIndex); } } // return the (new) selected item return(selectedItem as T); } }
/// <summary> /// Selects the requested, or if not available the first, object of the specified type in the facade /// </summary> /// <typeparam name="T"></typeparam> /// <param name="self"></param> /// <param name="item">the object to select or null </param> /// <returns>selected object</returns> public static T SyncToFacade <T>(this GUIFacadeControl self, T item) where T : class { int i = 0; return(self.SyncToFacade <T>(item, out i)); }
/// <summary> /// Acts the same as the CurrentLayout / View property. /// </summary> /// <remarks>this extension method was added to allow backwards compatibility with MediaPortal 1.1</remarks> /// <param name="self"></param> /// <returns>instance of GUIListControl or null</returns> public static void SetCurrentLayout(this GUIFacadeControl self, string layout) { PropertyInfo property = GetPropertyInfo <GUIFacadeControl>("CurrentLayout", "View"); property.SetValue(self, Enum.Parse(property.PropertyType, layout), null); }
/// <summary> /// Acts the same as the AlbumListLayout / AlbumListView property. /// </summary> /// <remarks>this extension method was added to allow backwards compatibility with MediaPortal 1.1</remarks> /// <param name="self"></param> /// <returns>instance of GUIListControl or null</returns> public static GUIListControl AlbumListLayout(this GUIFacadeControl self) { PropertyInfo property = GetPropertyInfo <GUIFacadeControl>("AlbumListLayout", "AlbumListView"); return((GUIListControl)property.GetValue(self, null)); }
/// <summary> /// Acts the same as the ThumbnailLayout / ThumbnailView property. /// </summary> /// <remarks>this extension method was added to allow backwards compatibility with MediaPortal 1.1</remarks> /// <param name="self"></param> /// <returns>instance of GUIListControl or null</returns> public static GUIThumbnailPanel ThumbnailLayout(this GUIFacadeControl self) { PropertyInfo property = GetPropertyInfo <GUIFacadeControl>("ThumbnailLayout", "ThumbnailView"); return((GUIThumbnailPanel)property.GetValue(self, null)); }
/// <summary> /// Acts the same as the FilmstripLayout / FilmstripView property. /// </summary> /// <remarks>this extension method was added to allow backwards compatibility with MediaPortal 1.1</remarks> /// <param name="self"></param> /// <returns>instance of GUIListControl or null</returns> public static GUIFilmstripControl FilmstripLayout(this GUIFacadeControl self) { PropertyInfo property = GetPropertyInfo <GUIFacadeControl>("FilmstripLayout", "FilmstripView"); return((GUIFilmstripControl)property.GetValue(self, null)); }
/// <summary> /// Get a value indicating wether the given control is related to this facade /// </summary> /// <param name="self"></param> /// <param name="parent">GUIControl instance to check</param> /// <returns>True if the control is related</returns> public static bool IsRelated(this GUIFacadeControl self, GUIControl parent) { return(parent == self || parent == self.FilmstripLayout() || parent == self.CoverFlowLayout || parent == self.ThumbnailLayout() || parent == self.ListLayout() || parent == self.AlbumListLayout()); }
/// <summary> /// Handle the facade message /// </summary> /// <param name="message">Message sent from client</param> /// <param name="server">Instance of the socket server</param> /// <param name="client">Socket that sent the message (for return messages)</param> internal static void HandleFacadeMessage(Newtonsoft.Json.Linq.JObject message, SocketServer server, AsyncSocket client) { String action = (string)message["FacadeAction"]; GUIWindow currentPlugin = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow); if (action.Equals("get")) { MessageFacade returnMessage = new MessageFacade(); if (currentPlugin.GetType() == typeof(MediaPortal.GUI.Home.GUIHome)) { GUIMenuControl menu = (GUIMenuControl)currentPlugin.GetControl(50); List <FacadeItem> items = MpFacadeHelper.GetHomeItems(menu); returnMessage.FacadeItems = items; returnMessage.ViewType = "Home"; } else { GUIFacadeControl facade = (GUIFacadeControl)currentPlugin.GetControl(50); if (facade != null) { List <FacadeItem> items = MpFacadeHelper.GetFacadeItems(currentPlugin.GetID, 50); returnMessage.ViewType = facade.CurrentLayout.ToString(); returnMessage.FacadeItems = items; } } returnMessage.WindowId = currentPlugin.GetID; server.SendMessageToClient(returnMessage, client); } else if (action.Equals("setselected")) { if (currentPlugin.GetType() == typeof(MediaPortal.GUI.Home.GUIHome)) { } else { GUIFacadeControl facade = (GUIFacadeControl)currentPlugin.GetControl(50); int selected = (int)message["SelectedIndex"]; facade.SelectedListItemIndex = selected; } } else if (action.Equals("getselected")) { if (currentPlugin.GetType() == typeof(MediaPortal.GUI.Home.GUIHome)) { //TODO: find a way to retrieve the currently selected home button } else { GUIFacadeControl facade = (GUIFacadeControl)currentPlugin.GetControl(50); int selected = facade.SelectedListItemIndex; } } else if (action.Equals("getcount")) { if (currentPlugin.GetType() == typeof(MediaPortal.GUI.Home.GUIHome)) { GUIMenuControl menu = (GUIMenuControl)currentPlugin.GetControl(50); int count = menu.ButtonInfos.Count; } else { GUIFacadeControl facade = (GUIFacadeControl)currentPlugin.GetControl(50); int count = facade.Count; } } else if (action.Equals("select")) { int selected = (int)message["SelectedIndex"]; if (currentPlugin.GetType() == typeof(MediaPortal.GUI.Home.GUIHome)) { GUIMenuControl menu = (GUIMenuControl)currentPlugin.GetControl(50); MenuButtonInfo info = menu.ButtonInfos[selected]; GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, info.PluginID, 0, null); GUIWindowManager.SendThreadMessage(msg); } else { GUIFacadeControl facade = (GUIFacadeControl)currentPlugin.GetControl(50); //TODO: is there a better way to select a list item facade.SelectedListItemIndex = selected; new Communication().SendCommand("ok"); } } else if (action.Equals("context")) { int selected = (int)message["SelectedIndex"]; if (currentPlugin.GetType() == typeof(MediaPortal.GUI.Home.GUIHome)) { GUIMenuControl menu = (GUIMenuControl)currentPlugin.GetControl(50); MenuButtonInfo info = menu.ButtonInfos[selected]; GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, info.PluginID, 0, null); GUIWindowManager.SendThreadMessage(msg); } else { GUIFacadeControl facade = (GUIFacadeControl)currentPlugin.GetControl(50); //TODO: is there a better way to select a list item facade.SelectedListItemIndex = selected; new Communication().SendCommand("info"); } } }
protected virtual void OnShowLayouts() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(792); // Layouts menu int dlgItems = 0; int totalLayouts = Enum.GetValues(typeof(GUIFacadeControl.Layout)).Length; bool[] allowedLayouts = new bool[totalLayouts]; for (int i = 0; i < totalLayouts; i++) { string layoutName = Enum.GetName(typeof(GUIFacadeControl.Layout), i); GUIFacadeControl.Layout layout = GetLayoutNumber(layoutName); if (AllowLayout(layout)) { if (!facadeLayout.IsNullLayout(layout)) { dlg.Add(GUIFacadeControl.GetLayoutLocalizedName(layout)); dlgItems++; allowedLayouts[i] = true; } } } dlg.SelectedLabel = -1; for (int i = 0; i <= (int)CurrentLayout; i++) { if (allowedLayouts[i]) { dlg.SelectedLabel++; } } if (dlg.SelectedLabel >= dlgItems) { dlg.SelectedLabel = dlgItems; } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } int iSelectedLayout = dlg.SelectedLabel; int allowedItemsFound = -1; for (int i = 0; i < allowedLayouts.Length; i++) { if (allowedLayouts[i]) { iSelectedLayout = i; allowedItemsFound++; if (allowedItemsFound == dlg.SelectedLabel) { break; } } } CurrentLayout = (Layout)iSelectedLayout; SwitchLayout(); UpdateButtonStates(); }
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); }
public void BackGroundDoPlay(object param_) { PlayParams param = (PlayParams)param_; YouTubeEntry vid = param.vid; bool fullscr = param.fullscr; GUIFacadeControl facade = param.facade; if (vid != null) { GUIWaitCursor.Hide(); VideoInfo qa = SelectQuality(vid); if (qa.Quality == VideoQuality.Unknow) { Youtube2MP.PlayBegin = false; return; } GUIWaitCursor.Show(); 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 -= g_Player_PlayBackStopped; g_Player.PlayBackEnded -= g_Player_PlayBackEnded; g_Player.PlayBackStopped += g_Player_PlayBackStopped; g_Player.PlayBackEnded += g_Player_PlayBackEnded; int selected = 0; if (facade != null) { int dif = 0; qa.Items = new Dictionary <string, string>(); if (facade[0].IsFolder) { dif++; } selected = facade.SelectedListItemIndex - dif; for (int i = 0; i < facade.Count; i++) { try { AddItemToPlayList(facade[i], ref playlist, new VideoInfo(qa), false); } catch (Exception ex) { Log.Error(ex); } } } else { AddItemToPlayList(vid, ref playlist, qa, -1); Youtube2MP.temp_player.RepeatPlaylist = false; } PlayListPlayer.SingletonPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_NONE; Youtube2MP.player.CurrentPlaylistType = PlayListType.PLAYLIST_NONE; g_Player.Stop(); Youtube2MP.temp_player.Play(selected); GUIWaitCursor.Hide(); if (g_Player.Playing && fullscr) { if (_setting.ShowNowPlaying) { if (GUIWindowManager.ActiveWindow != 29052) { GUIWindowManager.ActivateWindow(29052); } } else { g_Player.ShowFullScreenWindow(); } } if (!g_Player.Playing) { Err_message("Unable to playback the item ! "); } } GUIWaitCursor.Hide(); Youtube2MP.PlayBegin = false; }