protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { base.OnClicked(controlId, control, actionType); // Default folder (select/deselect on click) - settings saved if (control == videosShareListcontrol) { OnSetDefaultFolder(); } // Add new folder if (control == btnAdd) { // reset menu position _selectedOption = -1; // reset folder browser ClearFolders(); // Clear folder info ClearFolderInfoData(); _userNetFolder = GUILocalizeStrings.Get(145); // Network // Show menu OnAddEditFolder(); // Define new folder GUIListItem item = new GUIListItem(); // Watch for last parameter (my version with selective thumbs will use that) ShareData shareData = new ShareData("", "", "", true); item.AlbumInfoTag = shareData; _shareFolderListItem = item; // Check new data CheckCurrentShareData(); if (_error) { _error = false; GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(257); dlgOk.SetLine(1, GUILocalizeStrings.Get(300053)); // Error in folder data dlgOk.SetLine(2, GUILocalizeStrings.Get(300054)); // Name or path couldn't be empty dlgOk.DoModal(GUIWindowManager.ActiveWindow); return; } // Prepare folder info data FolderInfo(_shareFolderListItem).DefaultLayout = SettingsSharesHelper.ProperLayoutFromDefault(_folderDefaultLayoutIndex); FolderInfo(_shareFolderListItem).Name = _folderName; FolderInfo(_shareFolderListItem).Folder = _folderPath; FolderInfo(_shareFolderListItem).CreateThumbs = _folderCreateThumbs; FolderInfo(_shareFolderListItem).EachFolderIsMovie = _folderEachFolderIsMovie; FolderInfo(_shareFolderListItem).PinCode = _folderPin; // Almost forgot this, needed for proper sort :) _shareFolderListItem.Label = _folderName; _shareFolderListItem.OnItemSelected += OnItemSelected; // Add new folder in list videosShareListcontrol.Add(_shareFolderListItem); GUIListItem newItem = _shareFolderListItem; Sort(); int index = videosShareListcontrol.ListItems.IndexOf(newItem); videosShareListcontrol.SelectedListItemIndex = index; } // Edit folder if (control == btnEdit) { string name = _folderName; string path = _folderPath; // reset menu position _selectedOption = -1; OnAddEditFolder(); // Check new data CheckCurrentShareData(); if (_error) { _error = false; GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(257); dlgOk.SetLine(1, GUILocalizeStrings.Get(300053)); // Error in folder data dlgOk.SetLine(2, GUILocalizeStrings.Get(300054)); // Name or path couldn't be empty dlgOk.DoModal(GUIWindowManager.ActiveWindow); _folderName = name; _folderPath = path; return; } // Update changes FolderInfo(_shareFolderListItem).Name = _folderName; _shareFolderListItem.Label = _folderName; FolderInfo(_shareFolderListItem).Folder = _folderPath; FolderInfo(_shareFolderListItem).PinCode = _folderPin; FolderInfo(_shareFolderListItem).CreateThumbs = _folderCreateThumbs; FolderInfo(_shareFolderListItem).EachFolderIsMovie = _folderEachFolderIsMovie; FolderInfo(_shareFolderListItem).DefaultLayout = SettingsSharesHelper.ProperLayoutFromDefault(_folderDefaultLayoutIndex); // Add changes to a listitem videosShareListcontrol.SelectedListItem.AlbumInfoTag = _shareFolderListItem.AlbumInfoTag; videosShareListcontrol.SelectedListItem.Label = _folderName; // Sort list GUIListItem newItem = _shareFolderListItem; Sort(); int index = videosShareListcontrol.ListItems.IndexOf(newItem); videosShareListcontrol.SelectedListItemIndex = index; } // Remove folder - settings saved if (control == btnRemove) { OnRemoveFolder(); } // Reset folders - settings saved if (control == btnReset) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); if (dlgYesNo != null) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(927)); // Warning dlgYesNo.SetLine(1, GUILocalizeStrings.Get(300055)); // this will delete folders dlgYesNo.DoModal(GetID); if (dlgYesNo.IsConfirmed) { OnResetFolders(); } } } }
/// <summary> /// Network share enumeration from netShare parameter resource /// </summary> /// <param name="netShare">Network resource</param> private void GetNetworkFolders(string netShare) { ArrayList netComputers = NetShareCollection.GetComputersOnNetwork(); if (netComputers == null || netComputers.Count == 0) { GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(GUILocalizeStrings.Get(1020)); dlgOk.SetLine(1, GUILocalizeStrings.Get(300056)); //No network resources found. dlgOk.SetLine(2, GUILocalizeStrings.Get(300057)); // Try manual search. dlgOk.DoModal(GetID); GetStringFromKeyboard(ref netShare, -1); } else { GUIDialogSelect dlg = (GUIDialogSelect)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_SELECT); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(924); // Menu dlg.EnableButton(true); dlg.SetButtonLabel(413); // manual // Add list to dlg menu foreach (string netWrkst in netComputers) { dlg.Add(netWrkst); } // Show dialog menu dlg.DoModal(GetID); if (dlg.IsButtonPressed) { GetStringFromKeyboard(ref netShare, -1); } else if (dlg.SelectedLabel == -1) { return; } else { netShare = dlg.SelectedLabelText; } } if (string.IsNullOrEmpty(netShare) || !netShare.StartsWith(@"\\") || (netShare.StartsWith(@"\\") && netShare.Length <= 2)) { netShare = GUILocalizeStrings.Get(145); return; } // Get selected network resource shared folders _userNetFolder = netShare; NetShareCollection netShares = NetShareCollection.GetShares(netShare); SetFolderHistory(); _folders.Clear(); GUIListItem goBack = new GUIListItem(); goBack.Label = ".."; goBack.Label2 = ".."; _folders.Add(goBack); foreach (NetShare share in netShares) { if (share.IsFileSystem && share.ShareType == ShareType.Disk) { GUIListItem netFolder = new GUIListItem(); string nFolder = Path.GetFileName(share.Root.FullName); netFolder.Label = nFolder.ToUpperInvariant(); netFolder.Label2 = share.Root.FullName; _folders.Add(netFolder); } } }
protected virtual void UpdateButtonStates() { // skip all this if we're not active window if (GUIWindowManager.ActiveWindow != GetID) { return; } if (handler != null) { GUIPropertyManager.SetProperty("#view", handler.LocalizedCurrentView); GUIPropertyManager.SetProperty("#itemtype", handler.LocalizedCurrentViewLevel); } if (facadeLayout == null) { return; } GUIControl.HideControl(GetID, facadeLayout.GetID); int iControl = facadeLayout.GetID; GUIControl.ShowControl(GetID, iControl); GUIControl.FocusControl(GetID, iControl); string strLine = string.Empty; Layout layout = CurrentLayout; switch (layout) { case Layout.List: strLine = GUILocalizeStrings.Get(101); break; case Layout.SmallIcons: strLine = GUILocalizeStrings.Get(100); break; case Layout.LargeIcons: strLine = GUILocalizeStrings.Get(417); break; case Layout.AlbumView: strLine = GUILocalizeStrings.Get(529); break; case Layout.Filmstrip: strLine = GUILocalizeStrings.Get(733); break; case Layout.Playlist: strLine = GUILocalizeStrings.Get(101); break; case Layout.CoverFlow: strLine = GUILocalizeStrings.Get(791); break; } GUIControl.SetControlLabel(GetID, btnLayouts.GetID, strLine); if (btnSortBy != null) { btnSortBy.IsAscending = CurrentSortAsc; } }
private void SetProperties() { GUIPropertyManager.SetProperty("#displayTimeout", _displayTimeout + " " + GUILocalizeStrings.Get(2999)); GUIPropertyManager.SetProperty("#zapDelay", _zapDelay + " " + GUILocalizeStrings.Get(2999)); GUIPropertyManager.SetProperty("#zapTimeout", _zapTimeout + " " + GUILocalizeStrings.Get(2999)); GUIPropertyManager.SetProperty("#zapKeyTimeout", _zapKeyTimeout + " " + GUILocalizeStrings.Get(2999)); }
private void LoadActivityTypes() { // clear facade GUIControl.ClearControl(GetID, Facade.GetID); string avatar = UserProfile.Avatar.LocalImageFilename(ArtworkType.Avatar); // add each type to the list var item = new GUIUserListItem(Translation.RecentWatchedEpisodes, (int)TraktGUIWindows.Network); item.IconImage = avatar; item.IconImageBig = avatar; item.ThumbnailImage = avatar; item.PinImage = "traktActivityWatched.png"; item.OnItemSelected += OnActivityTypeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); item = new GUIUserListItem(Translation.RecentWatchedMovies, (int)TraktGUIWindows.Network); item.IconImage = avatar; item.IconImageBig = avatar; item.ThumbnailImage = avatar; item.PinImage = "traktActivityWatched.png"; item.OnItemSelected += OnActivityTypeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); item = new GUIUserListItem(Translation.RecentAddedEpisodes, (int)TraktGUIWindows.Network); item.IconImage = avatar; item.IconImageBig = avatar; item.ThumbnailImage = avatar; item.PinImage = "traktActivityCollected.png"; item.OnItemSelected += OnActivityTypeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); item = new GUIUserListItem(Translation.RecentAddedMovies, (int)TraktGUIWindows.Network); item.IconImage = avatar; item.IconImageBig = avatar; item.ThumbnailImage = avatar; item.PinImage = "traktActivityCollected.png"; item.OnItemSelected += OnActivityTypeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); item = new GUIUserListItem(Translation.RecentShouts, (int)TraktGUIWindows.Network); item.IconImage = avatar; item.IconImageBig = avatar; item.ThumbnailImage = avatar; item.PinImage = "traktActivityShout.png"; item.OnItemSelected += OnActivityTypeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); item = new GUIUserListItem(Translation.Lists, (int)TraktGUIWindows.Network); item.IconImage = avatar; item.IconImageBig = avatar; item.ThumbnailImage = avatar; item.PinImage = "traktActivityList.png"; item.OnItemSelected += OnActivityTypeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); item = new GUIUserListItem(Translation.WatchListShows, (int)TraktGUIWindows.Network); item.IconImage = avatar; item.IconImageBig = avatar; item.ThumbnailImage = avatar; item.PinImage = "traktActivityWatchlist.png"; item.OnItemSelected += OnActivityTypeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); item = new GUIUserListItem(Translation.WatchListMovies, (int)TraktGUIWindows.Network); item.IconImage = avatar; item.IconImageBig = avatar; item.ThumbnailImage = avatar; item.PinImage = "traktActivityWatchlist.png"; item.OnItemSelected += OnActivityTypeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); item = new GUIUserListItem(Translation.WatchListEpisodes, (int)TraktGUIWindows.Network); item.IconImage = avatar; item.IconImageBig = avatar; item.ThumbnailImage = avatar; item.PinImage = "traktActivityWatchlist.png"; item.OnItemSelected += OnActivityTypeSelected; Utils.SetDefaultIcons(item); Facade.Add(item); Facade.SelectedListItemIndex = PreviousActivityTypeSelectedIndex; // Set Facade Layout Facade.SetCurrentLayout("List"); GUIControl.FocusControl(GetID, Facade.GetID); GUIUtils.SetProperty("#itemcount", Facade.Count.ToString()); GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", Facade.Count.ToString(), GUILocalizeStrings.Get(507))); }
internal void MyContextMenu() { try { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(924); //Play Menu Item GUIListItem pItem = new GUIListItem(); pItem.Label = Translation.View; pItem.ItemId = 1; dlg.Add(pItem); pItem = new GUIListItem(); pItem.Label = GUILocalizeStrings.Get(940); pItem.ItemId = 2; dlg.Add(pItem); pItem = new GUIListItem(); pItem.Label = Translation.Update; pItem.ItemId = 3; dlg.Add(pItem); //Show Dialog dlg.DoModal(Utils.ActiveWindow); if (dlg.SelectedLabel < 0) { return; } switch (dlg.SelectedId) { case 1: { PlayPictures(GUIWindowManager.GetWindow(Utils.ActiveWindow)); break; } case 2: { InfoPictures(); break; } case 3: { GetLatestPictures(); break; } } } catch (Exception ex) { logger.Error("MyContextMenu: " + ex.ToString()); } }
public override void FinalizeConstruction() { base.FinalizeConstruction(); m_Font = GUIFontManager.GetFont((m_strFont != "" && m_strFont != "-") ? m_strFont : "font18"); if (m_strTexture != "" && m_strTexture != "-") { m_imgTexture = new GUIImage(_parentControlId, 9998, _positionX, _positionY, this.Width, this.Height, m_strTexture, m_dwColorDiffuse); } if (m_strTextureFocused != "" && m_strTextureFocused != "-") { m_imgTextureFocused = new GUIImage(_parentControlId, 9999, _positionX, _positionY, this.Width, this.Height, m_strTextureFocused, m_dwColorDiffuse); } m_imgGuide = new GUIImage[2]; m_nBoardWidth = (m_nBoardWidth == -99999) ? this.Width : m_nBoardWidth; m_nBoardHeight = (m_nBoardHeight == -99999) ? this.Height : m_nBoardHeight; m_cyBlock = m_nBoardHeight / (Game.Height + 2); m_cxBlock = m_cyBlock; m_nBoardWidth = m_cxBlock * Game.Width; m_nBoardX = (m_nBoardX == -99999) ? _positionX + ((this.Width - (m_cxBlock * Game.Width)) / 2) : m_nBoardX; m_nBoardY = (m_nBoardY == -99999) ? _positionY + ((this.Height - (m_cyBlock * Game.Height)) / 2) : m_nBoardY; m_nBoardY = m_nBoardY - m_cyBlock; m_imgBlocks = new GUIImage[] { new GUIImage(_parentControlId, 10001, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_red.png", m_dwColorDiffuse), new GUIImage(_parentControlId, 10002, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_blue.png", m_dwColorDiffuse), new GUIImage(_parentControlId, 10003, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_gray.png", m_dwColorDiffuse), new GUIImage(_parentControlId, 10004, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_yellow.png", m_dwColorDiffuse), new GUIImage(_parentControlId, 10005, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_cyan.png", m_dwColorDiffuse), new GUIImage(_parentControlId, 10006, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_orange.png", m_dwColorDiffuse), new GUIImage(_parentControlId, 10007, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_green.png", m_dwColorDiffuse), }; m_imgBlocksGlow = new GUIImage[] { new GUIImage(_parentControlId, 10011, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_red_glow.png", m_dwColorDiffuse), new GUIImage(_parentControlId, 10012, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_blue_glow.png", m_dwColorDiffuse) , new GUIImage(_parentControlId, 10013, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_gray_glow.png", m_dwColorDiffuse) , new GUIImage(_parentControlId, 10014, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_yellow_glow.png", m_dwColorDiffuse), new GUIImage(_parentControlId, 10015, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_cyan_glow.png", m_dwColorDiffuse) , new GUIImage(_parentControlId, 10016, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_orange_glow.png", m_dwColorDiffuse), new GUIImage(_parentControlId, 10017, _positionX, _positionY, m_cxBlock, m_cyBlock, GUIGraphicsContext.Skin + @"\media\tetris\block_green_glow.png", m_dwColorDiffuse) , }; m_strStart = GUILocalizeStrings.Get(19010); m_strPaused = GUILocalizeStrings.Get(19011); m_strGameOver = GUILocalizeStrings.Get(19012); m_imgBlocksNext = new GUIImage[7]; if (m_strTextureO != "" && m_strTextureO != "-") { m_imgBlocksNext[0] = new GUIImage(_parentControlId, 10021, _positionX, _positionY, 0, 0, m_strTextureO, m_dwColorDiffuse); } if (m_strTextureI != "" && m_strTextureI != "-") { m_imgBlocksNext[1] = new GUIImage(_parentControlId, 10022, _positionX, _positionY, 0, 0, m_strTextureI, m_dwColorDiffuse); } if (m_strTextureS != "" && m_strTextureS != "-") { m_imgBlocksNext[2] = new GUIImage(_parentControlId, 10023, _positionX, _positionY, 0, 0, m_strTextureS, m_dwColorDiffuse); } if (m_strTextureZ != "" && m_strTextureZ != "-") { m_imgBlocksNext[3] = new GUIImage(_parentControlId, 10024, _positionX, _positionY, 0, 0, m_strTextureZ, m_dwColorDiffuse); } if (m_strTextureL != "" && m_strTextureL != "-") { m_imgBlocksNext[4] = new GUIImage(_parentControlId, 10025, _positionX, _positionY, 0, 0, m_strTextureL, m_dwColorDiffuse); } if (m_strTextureT != "" && m_strTextureT != "-") { m_imgBlocksNext[5] = new GUIImage(_parentControlId, 10026, _positionX, _positionY, 0, 0, m_strTextureT, m_dwColorDiffuse); } if (m_strTextureJ != "" && m_strTextureJ != "-") { m_imgBlocksNext[6] = new GUIImage(_parentControlId, 10027, _positionX, _positionY, 0, 0, m_strTextureJ, m_dwColorDiffuse); } if (m_imgBlocksNext != null) { foreach (GUIImage image in m_imgBlocksNext) { if (image != null) { image.ScaleToScreenResolution(); } } } if (m_strTextureLeft != "" && m_strTextureLeft != "-") { m_imgGuide[0] = new GUIImage(_parentControlId, 9996, _positionX, _positionY, 0, 0, m_strTextureLeft, m_dwColorDiffuse); } if (m_strTextureRight != "" && m_strTextureRight != "-") { m_imgGuide[1] = new GUIImage(_parentControlId, 9997, _positionX, _positionY, 0, 0, m_strTextureRight, m_dwColorDiffuse); } }