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);
        }
        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);
        }