private void OnWishListClicked() { GUIListItem item = lcProgramList.SelectedListItem; if (item == null) { return; } GUIDialogSelect2 dlg = (GUIDialogSelect2)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_SELECT2); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(498)); // 498 = Actions if (item.PinImage == String.Empty) { dlg.Add(GUILocalizeStrings.Get(264)); // 264 = Record } else { dlg.Add(GUILocalizeStrings.Get(610)); // 610 = Don't Record } dlg.Add(GUILocalizeStrings.Get(2076)); // 2076 = Edit dlg.Add(GUILocalizeStrings.Get(4517)); // 4517 = Close dlg.DoModal(GetID); switch (dlg.SelectedLabel) { case 0: OnRecord(); break; case 1: OnEditWishItem(); break; default: break; } }
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { if (control == buttonReset) { labelCurrent.Label = DefaultSetting; SetCheckMarksBasedOnString(DefaultSetting); } else if (control == buttonAdd) { VirtualKeyboard vk = (VirtualKeyboard)GUIWindowManager.GetWindow((int)Window.WINDOW_VIRTUAL_KEYBOARD); vk.Reset(); vk.DoModal(GetID); string newStep = vk.Text; if (string.IsNullOrEmpty(newStep)) { return; } string error = verifySkipStep(newStep); if (error != null) { GUIDialogOK errDialog = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); errDialog.SetHeading(257); errDialog.SetLine(1, error); errDialog.DoModal(GetID); } else { AddStep(Convert.ToInt16(newStep)); // Already verifed, so no numberformatexception can occur } } else if (control == buttonRemove) { GUIDialogSelect2 dlgSel = (GUIDialogSelect2)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_SELECT2); dlgSel.Reset(); dlgSel.SetHeading(200040); // Remove skip step foreach (string token in labelCurrent.Label.Split(new char[] { ',', ';', ' ' })) { if (token == string.Empty) { continue; } dlgSel.Add(token); } dlgSel.DoModal(GetID); if (dlgSel.SelectedLabel != -1) { try { RemoveStep(Convert.ToInt16(dlgSel.SelectedLabelText)); } catch (Exception ex) { // Should never happen Log.Error("should never happen {0}", ex.Message); } } } else if (control is GUICheckMarkControl) { int stepSize = 5; if (control == checkMarkButtonStep1) { stepSize = 5; } else if (control == checkMarkButtonStep2) { stepSize = 15; } else if (control == checkMarkButtonStep3) { stepSize = 30; } else if (control == checkMarkButtonStep4) { stepSize = 45; } else if (control == checkMarkButtonStep5) { stepSize = 60; } else if (control == checkMarkButtonStep6) { stepSize = 180; } else if (control == checkMarkButtonStep7) { stepSize = 300; } else if (control == checkMarkButtonStep8) { stepSize = 420; } else if (control == checkMarkButtonStep9) { stepSize = 600; } else if (control == checkMarkButtonStep10) { stepSize = 900; } else if (control == checkMarkButtonStep11) { stepSize = 1800; } else if (control == checkMarkButtonStep12) { stepSize = 2700; } else if (control == checkMarkButtonStep13) { stepSize = 3600; } else if (control == checkMarkButtonStep14) { stepSize = 5400; } else if (control == checkMarkButtonStep15) { stepSize = 7200; } else if (control == checkMarkButtonStep16) { stepSize = 10800; } if (!((GUICheckMarkControl)control).Selected) { RemoveStep(stepSize); } else { AddStep(stepSize); } } if (control == btnTimeoutValue) { int number; string getNumber = _timeOutValue.ToString(); GetStringFromKeyboard(ref getNumber, -1); if (Int32.TryParse(getNumber, out number)) { _timeOutValue = number; } SetProperties(); } if (control == btnSkipValue) { int number; string getNumber = _skipValue.ToString(); GetStringFromKeyboard(ref getNumber, -1); if (Int32.TryParse(getNumber, out number)) { _skipValue = number; } SetProperties(); } if (control == btnRelative) { if (btnRelative.Selected) { btnConstant.Selected = false; } else { btnConstant.Selected = true; } } if (control == btnConstant) { if (btnConstant.Selected) { btnRelative.Selected = false; } else { btnRelative.Selected = true; } } base.OnClicked(controlId, control, actionType); }
public string ShowSelectDriveDialog(int parentId, bool DVDonly) { Log.Info("SelectDVDHandler: ShowSelectDVDDialog()"); //check if dvd is inserted List <GUIListItem> rootDrives = VirtualDirectories.Instance.Movies.GetRootExt(); for (int i = rootDrives.Count - 1; i >= 0; i--) { GUIListItem item = (GUIListItem)rootDrives[i]; if (Util.Utils.getDriveType(item.Path) == 5) //cd or dvd drive { string driverLetter = item.Path.Substring(0, 1); string fileName = DVDonly ? String.Format(@"{0}:\VIDEO_TS\VIDEO_TS.IFO", driverLetter) : String.Format(@"{0}:\", driverLetter); if (DVDonly && !File.Exists(fileName)) { rootDrives.RemoveAt(i); } else if (!DVDonly && !Directory.Exists(fileName)) { rootDrives.RemoveAt(i); } } else { rootDrives.RemoveAt(i); } } if (rootDrives.Count > 0) { try { if (rootDrives.Count == 1) { GUIListItem ritem = (GUIListItem)rootDrives[0]; return(ritem.Path); // Only one DVD available, play it! } SetIMDBThumbs(rootDrives, false); // Display a dialog with all drives to select from GUIDialogSelect2 dlgSel = (GUIDialogSelect2)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_SELECT2); if (null == dlgSel) { Log.Info("SelectDVDHandler: Could not open dialog, defaulting to first drive found"); GUIListItem ritem = (GUIListItem)rootDrives[0]; return(ritem.Path); } dlgSel.Reset(); dlgSel.SetHeading(DVDonly ? 196 : 2201); // Choose movie | select source for (int i = 0; i < rootDrives.Count; i++) { GUIListItem dlgItem = new GUIListItem(); dlgItem = (GUIListItem)rootDrives[i]; Log.Debug("SelectDVDHandler: adding list item of possible playback location - {0}", dlgItem.Path); dlgSel.Add(dlgItem); } dlgSel.DoModal(parentId); if (dlgSel.SelectedLabel != -1) { return(dlgSel.SelectedLabelText.Substring(1, 2)); } else { return(null); } } catch (Exception ex) { Log.Warn("SelectDVDHandler: could not determine dvd path - {0},{1}", ex.Message, ex.StackTrace); return(null); } } //no disc in drive... GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlgOk.SetHeading(1020); //information Log.Error("SelectDVDHandler: ShowSelectDriveDialog - Plz Insert Disk"); dlgOk.SetLine(1, 219); //no disc dlgOk.DoModal(parentId); Log.Info("SelectDVDHandler: did not find a movie"); return(null); }
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); }
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { if (control == buttonReset) { labelCurrent.Label = DEFAULT_SETTING; SetCheckMarksBasedOnString(DEFAULT_SETTING); } else if (control == buttonAdd) { VirtualKeyboard vk = (VirtualKeyboard)GUIWindowManager.GetWindow((int)Window.WINDOW_VIRTUAL_KEYBOARD); vk.Reset(); vk.DoModal(GetID); string newStep = vk.Text; if (newStep == string.Empty || newStep == null) { return; } string error = verifySkipStep(newStep); if (error != null) { GUIDialogOK errDialog = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); errDialog.SetHeading(257); errDialog.SetLine(1, error); errDialog.DoModal(GetID); } else { AddStep(Convert.ToInt16(newStep)); // Already verifed, so no numberformatexception can occur } } else if (control == buttonRemove) { GUIDialogSelect2 dlgSel = (GUIDialogSelect2)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_SELECT2); dlgSel.Reset(); foreach (string token in labelCurrent.Label.Split(new char[] { ',', ';', ' ' })) { if (token == string.Empty) { continue; } dlgSel.Add(token); } dlgSel.SetHeading(200040); // Remove skip step dlgSel.DoModal(GetID); if (dlgSel.SelectedLabel != -1) { try { RemoveStep(Convert.ToInt16(dlgSel.SelectedLabelText)); } catch (Exception) { // Should never happen } } } else if (control is GUICheckMarkControl) { int stepSize = 5; if (control == checkMarkButtonStep1) { stepSize = 5; } else if (control == checkMarkButtonStep2) { stepSize = 15; } else if (control == checkMarkButtonStep3) { stepSize = 30; } else if (control == checkMarkButtonStep4) { stepSize = 45; } else if (control == checkMarkButtonStep5) { stepSize = 60; } else if (control == checkMarkButtonStep6) { stepSize = 180; } else if (control == checkMarkButtonStep7) { stepSize = 300; } else if (control == checkMarkButtonStep8) { stepSize = 420; } else if (control == checkMarkButtonStep9) { stepSize = 600; } else if (control == checkMarkButtonStep10) { stepSize = 900; } else if (control == checkMarkButtonStep11) { stepSize = 1800; } else if (control == checkMarkButtonStep12) { stepSize = 2700; } else if (control == checkMarkButtonStep13) { stepSize = 3600; } else if (control == checkMarkButtonStep14) { stepSize = 5400; } else if (control == checkMarkButtonStep15) { stepSize = 7200; } else if (control == checkMarkButtonStep16) { stepSize = 10800; } if (!((GUICheckMarkControl)control).Selected) { RemoveStep(stepSize); } else { AddStep(stepSize); } } base.OnClicked(controlId, control, actionType); }