public override void Play(SearchResultItem resultItem)
        {
            YouTubeEntry entry = resultItem.MetaData["entry"] as YouTubeEntry;

            YoutubeGUIBase.SetLabels(entry, "NowPlaying");
            Youtube2MP.NowPlayingEntry = entry;
            VideoInfo info = new VideoInfo();

            g_Player.PlayVideoStream(Youtube2MP.StreamPlaybackUrl(entry, info));
            if (g_Player.Playing)
            {
                if (Youtube2MP._settings.ShowNowPlaying)
                {
                    GUIWindowManager.ActivateWindow(29052);
                }
                else
                {
                    g_Player.ShowFullScreenWindow();
                }
            }

            if (!g_Player.Playing)
            {
                GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                if (dlgOK != null)
                {
                    dlgOK.SetHeading(25660);
                    dlgOK.SetLine(1, "Unable to playback the item ! ");
                    dlgOK.SetLine(2, "");
                    dlgOK.DoModal(GUIWindowManager.ActiveWindow);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Displays a OK dialog with heading and up to 4 lines split by \n in lines string.
        /// </summary>
        public static void ShowOKDialog(string heading, string lines)
        {
            if (GUIGraphicsContext.form.InvokeRequired)
            {
                ShowOKDialogDelegate d = ShowOKDialog;
                GUIGraphicsContext.form.Invoke(d, heading, lines);
                return;
            }

            GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);

            dlgOK.Reset();
            dlgOK.SetHeading(heading);

            int lineid = 1;

            foreach (string line in lines.Split(new string[] { "\\n", "\n" }, StringSplitOptions.None))
            {
                dlgOK.SetLine(lineid, line);
                lineid++;
            }
            for (int i = lineid; i <= 4; i++)
            {
                dlgOK.SetLine(i, string.Empty);
            }

            dlgOK.DoModal(GUIWindowManager.ActiveWindow);
        }
示例#3
0
        private void OnCleanup()
        {
            int iCleaned = 0;
            IList <Schedule> itemlist = Schedule.ListAll();

            foreach (Schedule rec in itemlist)
            {
                if (rec.IsDone() || rec.Canceled != Schedule.MinSchedule)
                {
                    iCleaned++;
                    Schedule r = Schedule.Retrieve(rec.IdSchedule);
                    r.Delete();
                }
            }
            GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);

            LoadDirectory();
            if (pDlgOK != null)
            {
                pDlgOK.SetHeading(624);
                pDlgOK.SetLine(1, String.Format("{0} {1}", GUILocalizeStrings.Get(625), iCleaned));
                pDlgOK.SetLine(2, String.Empty);
                pDlgOK.DoModal(GetID);
            }
        }
示例#4
0
        public static void DialogMsg(string title, string msg)
        {
            GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);

            if (null == dlgOK)
            {
                return;
            }

            dlgOK.Reset();
            dlgOK.SetHeading(title);

            string[] lines = msg.Split('\n');
            BaseConfig.MyAnimeLog.Write("lines: " + lines.Length.ToString());

            if (lines.Length == 1)
            {
                dlgOK.SetLine(1, lines[0]);
            }
            if (lines.Length == 2)
            {
                dlgOK.SetLine(2, lines[1]);
            }
            if (lines.Length == 3)
            {
                dlgOK.SetLine(2, lines[2]);
            }

            dlgOK.DoModal(GUIWindowManager.ActiveWindow);
        }
        protected void OnShowSavedPlaylists(string _directory)
        {
            VirtualDirectory _virtualDirectory = new VirtualDirectory();

            _virtualDirectory.AddExtension(".tvsplaylist");

            List <GUIListItem> itemlist = _virtualDirectory.GetDirectoryExt(_directory);

            if (_directory == DBOption.GetOptions(DBOption.cPlaylistPath))
            {
                itemlist.RemoveAt(0);
            }

            // If no playlists found, show a Message to user and then exit
            if (itemlist.Count == 0)
            {
                GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                dlgOK.SetHeading(983);
                dlgOK.SetLine(1, Translation.NoPlaylistsFound);
                dlgOK.SetLine(2, _directory);
                dlgOK.DoModal(GUIWindowManager.ActiveWindow);
                return;
            }

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(983); // Saved Playlists

            foreach (GUIListItem item in itemlist)
            {
                MediaPortal.Util.Utils.SetDefaultIcons(item);
                dlg.Add(item);
            }

            dlg.DoModal(GetID);

            if (dlg.SelectedLabel == -1)
            {
                return;
            }

            GUIListItem selectItem = itemlist[dlg.SelectedLabel];

            if (selectItem.IsFolder)
            {
                OnShowSavedPlaylists(selectItem.Path);
                return;
            }

            GUIWaitCursor.Show();
            LoadPlayList(selectItem.Path);
            GUIWaitCursor.Hide();
        }
示例#6
0
        private void Result()
        {
            GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);

            if (SolvedCorrect())
            {
                StopTimer();
                gameRunning = false;
                int score = (100000000 / gameRating) / (totalTime.Hours * 3600 + totalTime.Minutes * 60 + totalTime.Seconds);

                dlg.SetHeading(GUILocalizeStrings.Get(19111)); // Game Over
                dlg.SetLine(1, GUILocalizeStrings.Get(19112)); // Congratulation!
                dlg.SetLine(2, GUILocalizeStrings.Get(19113)); // You have solved the game correctly.

                if ((_Settings.HighScore.Count < 3 || score > _Settings.HighScore[2].Score) && isScoreGame)
                {
                    //dlg.SetLine(3, "New Highscore! Your Name?");
                    dlg.DoModal(GUIWindowManager.ActiveWindow);

                    string name = GetPlayerName();
                    _Settings.HighScore.Add(new Highscore(name, score));
                    _Settings.HighScore.Sort(new ScoreComparer());
                    _Settings.Save();
                }
                else
                {
                    dlg.DoModal(GUIWindowManager.ActiveWindow);
                }

                Log.Info("GUINumberPlace: Solved in: {0} game Rating: {2} Score: {1}",
                         (totalTime.Hours * 3600 + totalTime.Minutes * 60 + totalTime.Seconds), score, gameRating);

                //Utils.PlaySound("notify.wav", false, true);
            }
            else
            {
                dlg.SetHeading(GUILocalizeStrings.Get(19111)); // Game Over
                dlg.SetLine(1, GUILocalizeStrings.Get(19114)); // Sorry, but your solution is wrong.
                dlg.SetLine(2, string.Empty);
                dlg.SetLine(3, string.Empty);
                dlg.DoModal(GUIWindowManager.ActiveWindow);
            }
        }
示例#7
0
        private void ShowInfo(string strHeading, string strLine1, string strLine2)
        {
            GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow(2002);

            pDlgOK.SetHeading(strHeading);
            pDlgOK.SetLine(1, strLine1);
            pDlgOK.SetLine(2, strLine2);
            pDlgOK.SetLine(3, "");
            pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
        }
        public bool OnMovieNotFound(IMDBFetcher fetcher)
        {
            // show dialog...
            GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);

            pDlgOK.SetHeading(195);
            pDlgOK.SetLine(1, fetcher.MovieName);
            pDlgOK.SetLine(2, string.Empty);
            pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
            return(true);
        }
示例#9
0
        /// <summary>
        /// Show an ok dialog in MediaPortal
        /// </summary>
        /// <param name="title">Dialog title</param>
        /// <param name="text">Dialog text</param>
        internal static void ShowOkDialog(string title, string text)
        {
            GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);

            if (dlg != null)
            {
                dlg.Reset();
                dlg.SetHeading(title);
                dlg.SetLine(1, text);
                dlg.DoModal(GUIWindowManager.ActiveWindow);
            }
        }
示例#10
0
        public void ErrMessage(string langid)
        {
            GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);

            if (dlgOK != null)
            {
                dlgOK.SetHeading(Translation.Message);
                dlgOK.SetLine(1, langid);
                dlgOK.SetLine(2, "");
                dlgOK.DoModal(GetID);
            }
        }
        private void TellUserSomethingWentWrong()
        {
            GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);

            if (dlgOK != null)
            {
                dlgOK.SetHeading(6);
                dlgOK.SetLine(1, 477);
                dlgOK.SetLine(2, string.Empty);
                dlgOK.DoModal(GetID);
            }
        }
        public void Err_message(string message)
        {
            GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);

            if (dlgOK != null)
            {
                dlgOK.SetHeading(25660);
                dlgOK.SetLine(1, message);
                dlgOK.SetLine(2, "");
                dlgOK.DoModal(GetID);
            }
        }
示例#13
0
        public void ShowNotifyDialog(int timeOut, string header, string icon, string text, Helper.PLUGIN_NOTIFY_WINDOWS notifyType)
        {
            try {
                GUIWindow guiWindow = GUIWindowManager.GetWindow((int)notifyType);
                switch (notifyType)
                {
                default:
                case Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_AUTO:
                    if (text.Length <= 60)
                    {
                        ShowNotifyDialog(timeOut, header, icon, text, Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_NOTIFY);
                    }
                    else
                    {
                        ShowNotifyDialog(timeOut, header, icon, text, Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_TEXT);
                    }
                    break;

                case Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_NOTIFY:
                    GUIDialogNotify notifyDialog = (GUIDialogNotify)guiWindow;
                    notifyDialog.Reset();
                    notifyDialog.TimeOut = timeOut;
                    notifyDialog.SetImage(icon);
                    notifyDialog.SetHeading(header);
                    notifyDialog.SetText(text);
                    notifyDialog.DoModal(GUIWindowManager.ActiveWindow);
                    break;

                case Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_OK:
                    GUIDialogOK okDialog = (GUIDialogOK)guiWindow;
                    okDialog.Reset();
                    okDialog.SetHeading(header);
                    okDialog.SetLine(1, (text.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))[0]);
                    okDialog.DoModal(GUIWindowManager.ActiveWindow);
                    break;

                case Helper.PLUGIN_NOTIFY_WINDOWS.WINDOW_DIALOG_TEXT:
                    GUIDialogText textDialog = (GUIDialogText)guiWindow;
                    textDialog.Reset();
                    try {
                        textDialog.SetImage(icon);
                    } catch (Exception e) { Debug.WriteLine(e.ToString()); }
                    textDialog.SetHeading(header);
                    textDialog.SetText(text);
                    textDialog.DoModal(GUIWindowManager.ActiveWindow);
                    break;
                }
            } catch (Exception ex) {
                Log.Error(ex);
            }
        }
示例#14
0
        public static void Alert(this GUIWindow window, string title, params string[] lines)
        {
            GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);

            if (null != dlgOk)
            {
                dlgOk.SetHeading(title);
                for (int x = 0; x < lines.Length; x++)
                {
                    dlgOk.SetLine(x + 1, lines[x]);
                }
                dlgOk.DoModal(GUIWindowManager.ActiveWindow);
            }
        }
示例#15
0
        internal static void ReloadDownloadedDlls()
        {
            Log.Instance.Info("Reloading SiteUtil Dlls at runtime.");
            bool stopPlayback = (MediaPortal.Player.g_Player.Player != null && MediaPortal.Player.g_Player.Player.GetType().Assembly == typeof(GUISiteUpdater).Assembly);
            bool stopDownload = DownloadManager.Instance.Count > 0;

            if (stopDownload || stopPlayback)
            {
                GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                if (dlg != null)
                {
                    dlg.Reset();
                    dlg.SetHeading(PluginConfiguration.Instance.BasicHomeScreenName);
                    dlg.SetLine(1, Translation.Instance.NewDllDownloaded);
                    int i = 1;
                    if (stopDownload)
                    {
                        dlg.SetLine(i++, Translation.Instance.DownloadsWillBeAborted);
                    }
                    if (stopPlayback)
                    {
                        dlg.SetLine(i++, Translation.Instance.PlaybackWillBeStopped);
                    }
                    dlg.DoModal(GUIWindowManager.ActiveWindow);
                }
            }
            // stop playback if an OnlineVideos video is playing
            if (stopPlayback)
            {
                MediaPortal.Player.g_Player.Stop();
            }
            // stop downloads
            DownloadManager.Instance.StopAll();
            // reset the GuiOnlineVideos instance and stop the LatestVideos Thread
            GUIOnlineVideos ovGuiInstance = (GUIOnlineVideos)GUIWindowManager.GetWindow(GUIOnlineVideos.WindowId);

            if (ovGuiInstance != null)
            {
                ovGuiInstance.ResetToFirstView();
                ovGuiInstance.LatestVideosManager.Stop();
            }
            // now reload the appdomain
            OnlineVideoSettings.Reload();
            TranslationLoader.SetTranslationsToSingleton();
            OnlineVideoSettings.Instance.BuildSiteUtilsList();
            GC.Collect();
            GC.WaitForFullGCComplete();
            // restart the LatestVideos thread
            ovGuiInstance.LatestVideosManager.Start();
        }
示例#16
0
        static public bool SubmitRating(RatingType type, string itemId, int rating)
        {
            string account = DBOption.GetOptions(DBOption.cOnlineUserID);

            if (String.IsNullOrEmpty(account))
            {
                string[] lines = new string[] { Translation.TVDB_INFO_ACCOUNTID_1, Translation.TVDB_INFO_ACCOUNTID_2 };
                //TVSeriesPlugin.ShowDialogOk(Translation.TVDB_INFO_TITLE, lines); //trakt.tv also listens to this, also can store ratings locally.
                MPTVSeriesLog.Write("Cannot submit rating to thetvdb.com, this requires your Account Identifier to be set.");
                return(false);
            }

            if (itemId == "0" || rating < 0 || rating > 10)
            {
                MPTVSeriesLog.Write("Cannot submit rating, invalid values...this is most likely a programming error");
                return(false);
            }

            if (!DBOnlineMirror.IsMirrorsAvailable)
            {
                // Server maybe available now.
                DBOnlineMirror.Init();
                if (!DBOnlineMirror.IsMirrorsAvailable)
                {
                    GUIDialogOK dlgOK = ( GUIDialogOK )GUIWindowManager.GetWindow(( int )GUIWindow.Window.WINDOW_DIALOG_OK);
                    dlgOK.SetHeading(Translation.TVDB_ERROR_TITLE);
                    if (!TVSeriesPlugin.IsNetworkAvailable)
                    {
                        string[] lines = new string[] { Translation.NETWORK_ERROR_UNAVAILABLE_1, Translation.NETWORK_ERROR_UNAVAILABLE_2 };
                        TVSeriesPlugin.ShowDialogOk(Translation.TVDB_ERROR_TITLE, lines);
                    }
                    else
                    {
                        string[] lines = new string[] { Translation.TVDB_ERROR_UNAVAILABLE_1, Translation.TVDB_ERROR_UNAVAILABLE_2 };
                        TVSeriesPlugin.ShowDialogOk(Translation.TVDB_ERROR_TITLE, lines);
                    }

                    MPTVSeriesLog.Write("Cannot submit rating, the online database is unavailable");
                    return(false);
                }
            }
            // ok we're good
            MPTVSeriesLog.Write(string.Format("Submitting Rating of {2} for {0} {1}", type.ToString(), itemId, rating), MPTVSeriesLog.LogLevel.Debug);
            Generic(string.Format(apiURIs.SubmitRating, account, type.ToString(), itemId, rating), true, false, Format.NoExtension);
            return(true);
        }
示例#17
0
 /// <summary>
 /// Checks if the local Version is at least equal to the latest online available version and presents a message if not.
 /// </summary>
 /// <returns>true if the local version is equal or higher than the online version, otherwise false.</returns>
 bool CheckOnlineVideosVersion()
 {
     if (!Sites.Updater.VersionCompatible)
     {
         GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
         if (dlg != null)
         {
             dlg.Reset();
             dlg.SetHeading(PluginConfiguration.Instance.BasicHomeScreenName);
             dlg.SetLine(1, Translation.Instance.AutomaticUpdateDisabled);
             dlg.SetLine(2, string.Format(Translation.Instance.LatestVersionRequired, Sites.Updater.VersionOnline));
             dlg.DoModal(GUIWindowManager.ActiveWindow);
         }
         return(false);
     }
     return(true);
 }
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            base.OnClicked(controlId, control, actionType);

            if (control == btnSavedPlaylists)
            {
                OnShowSavedPlaylists(m_strPlayListPath);
            }

            if (control == btnPlayDVD)
            {
                ISelectDVDHandler selectDVDHandler;
                if (GlobalServiceProvider.IsRegistered <ISelectDVDHandler>())
                {
                    selectDVDHandler = GlobalServiceProvider.Get <ISelectDVDHandler>();
                }
                else
                {
                    selectDVDHandler = new SelectDVDHandler();
                    GlobalServiceProvider.Add <ISelectDVDHandler>(selectDVDHandler);
                }
                string dvdToPlay = selectDVDHandler.ShowSelectDVDDialog(GetID);
                if (dvdToPlay != null)
                {
                    OnPlayDVD(dvdToPlay, GetID);
                }
                return;
            }

            if (control == btnScanNew)
            {
                // Check Internet connection
                if (!Win32API.IsConnectedToInternet())
                {
                    GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlgOk.SetHeading(257);
                    dlgOk.SetLine(1, GUILocalizeStrings.Get(703));
                    dlgOk.DoModal(GUIWindowManager.ActiveWindow);
                    return;
                }

                OnSearchNew();
            }
        }
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            base.OnClicked(controlId, control, actionType);

            if (control == lcFolders)
            {
                if (lcFolders.SelectedListItem.IsPlayed)
                {
                    lcFolders.SelectedListItem.Label2   = "";
                    lcFolders.SelectedListItem.IsPlayed = false;
                    FolderInfo(lcFolders.SelectedListItem).ScanShare = false;
                    _scanShare--;
                }
                else
                {
                    lcFolders.SelectedListItem.Label2   = GUILocalizeStrings.Get(193); // Scan
                    lcFolders.SelectedListItem.IsPlayed = true;
                    FolderInfo(lcFolders.SelectedListItem).ScanShare = true;
                    _scanShare++;
                }
            }

            if (control == btnScanDatabase)
            {
                if (_scanShare == 0)
                {
                    GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlgOk.SetHeading(GUILocalizeStrings.Get(1020));   // Information
                    dlgOk.SetLine(1, GUILocalizeStrings.Get(300004)); // Nothing to scan
                    dlgOk.SetLine(2, GUILocalizeStrings.Get(300005)); //Please select folder(s) for scan
                    dlgOk.DoModal(GetID);
                    return;
                }
                OnScanDatabase();
            }

            if (control == btnResetDatabase)
            {
                OnResetDatabase();
            }
        }
示例#20
0
        private void GetAndDisplayImage(string imagename, string imagedesc)
        {
            WikipediaImage image         = new WikipediaImage(imagename, language);
            string         imagefilename = image.GetImageFilename();

            Log.Info("Wikipedia: Trying to display image file: {0}", imagefilename);

            if (imagefilename != string.Empty && File.Exists(imagefilename))
            {
                if (txtArticle.IsVisible)
                {
                    GUIControl.HideControl(GetID, txtArticle.GetID);
                }
                if (!imageControl.IsVisible)
                {
                    GUIControl.ShowControl(GetID, imageControl.GetID);
                }
                if (searchtermLabel.IsVisible)
                {
                    GUIControl.HideControl(GetID, searchtermLabel.GetID);
                }
                if (!imagedescLabel.IsVisible)
                {
                    GUIControl.ShowControl(GetID, imagedescLabel.GetID);
                }
                if (!buttonBack.IsVisible)
                {
                    GUIControl.ShowControl(GetID, buttonBack.GetID);
                }
                imagedescLabel.Label = imagedesc;
                imageControl.SetFileName(imagefilename);
            }
            else
            {
                GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                dlg.SetHeading(GUILocalizeStrings.Get(257));  // Error
                dlg.SetLine(1, GUILocalizeStrings.Get(2512)); // Can't display image.
                dlg.SetLine(2, GUILocalizeStrings.Get(2513)); // Please have a look at the logfile.
                dlg.DoModal(GUIWindowManager.ActiveWindow);
            }
        }
示例#21
0
        /// <summary>
        /// Handler for the GUIMessage of the MP System
        /// </summary>
        /// <param name="message">Message of MP</param>
        /// <returns>Result</returns>
        public override bool OnMessage(GUIMessage message)
        {
            if (message.Message == GUIMessage.MessageType.GUI_MSG_WINDOW_INIT)
            {
                bool mplayerPlayerAvailable;
                using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
                {
                    mplayerPlayerAvailable = xmlreader.GetValueAsBool("plugins", "MPlayer", false);
                }

                mplayerPlayerAvailable = (mplayerPlayerAvailable & File.Exists(Config.GetFile(Config.Dir.Plugins, "ExternalPlayers", "MPlayer_ExtPlayer.dll")));
                if (!mplayerPlayerAvailable)
                {
                    GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlgOk.SetHeading("My MPlayer GUI");
                    dlgOk.SetLine(1, "MPlayer External Player not available!");
                    dlgOk.SetLine(2, "Please activate it in the Setup");
                    dlgOk.DoModal(GetID);
                    GUIWindowManager.ShowPreviousWindow();
                }
            }
            return(base.OnMessage(message));
        }
        private void RemoveLocation()
        {
            if (availableLocations.Count > 0)
            {
                GUIDialogMenu dialogCitySelect = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                if (dialogCitySelect != null)
                {
                    dialogCitySelect.Reset();
                    dialogCitySelect.ShowQuickNumbers = false;
                    dialogCitySelect.SetHeading(GUILocalizeStrings.Get(409)); // Remove Location
                    foreach (LocationInfo loc in availableLocations)
                    {
                        dialogCitySelect.Add(loc.City + " (" + loc.CityCode + ")");
                    }
                    dialogCitySelect.DoModal(GetID);

                    // Remove the selected city
                    if (dialogCitySelect.SelectedLabel >= 0)
                    {
                        LocationInfo loc = (LocationInfo)availableLocations[dialogCitySelect.SelectedLabel];
                        availableLocations.Remove(loc);
                        SaveLocations();
                        SetDefaultLocation();  // Reset the default location as necessary
                        InitDefaultLocation(); // Refresh default location button as necessary
                    }
                }
            }
            else
            {
                GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                dlg.SetHeading(GUILocalizeStrings.Get(409));
                dlg.SetLine(1, GUILocalizeStrings.Get(520));
                dlg.SetLine(2, "");
                dlg.DoModal(GetID);
                return;
            }
        }
示例#23
0
 private void ShowErrorDialog(string message, bool waitForOK)
 {
     if (waitForOK)
     {
         GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
         if (dlgOK != null)
         {
             dlgOK.SetHeading("Error" /* or Message */);
             dlgOK.SetLine(1, message);
             dlgOK.SetLine(2, "");
             dlgOK.DoModal(PLUGIN_ID);
         }
     }
     else
     {
         GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
         if (dlgNotify != null)
         {
             dlgNotify.SetHeading("Error");
             dlgNotify.SetText(message);
             dlgNotify.DoModal(PLUGIN_ID);
         }
     }
 }
示例#24
0
        public void ShowMessage(string heading, string line1, string line2, string line3, string line4)
        {
            GUIDialogOK dialog = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);

            dialog.Reset();
            dialog.SetHeading(heading);
            if (line1 != null)
            {
                dialog.SetLine(1, line1);
            }
            if (line2 != null)
            {
                dialog.SetLine(2, line2);
            }
            if (line3 != null)
            {
                dialog.SetLine(3, line3);
            }
            if (line4 != null)
            {
                dialog.SetLine(4, line4);
            }
            dialog.DoModal(GetID);
        }
示例#25
0
        // Sub methods

        private void OnAddName()
        {
            string sName = _folderName;

            GetStringFromKeyboard(ref sName, -1);

            // If user edit folder and did nothing, return
            if (sName == _folderName)
            {
                OnAddEditFolder();
                return;
            }

            if (!string.IsNullOrEmpty(sName))
            {
                // Don't allow empty or equal existing name
                foreach (GUIListItem item in videosShareListcontrol.ListItems)
                {
                    if (FolderInfo(item).Name.Equals(sName, StringComparison.InvariantCultureIgnoreCase))
                    {
                        GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                        if (dlgOk != null)
                        {
                            dlgOk.SetHeading(GUILocalizeStrings.Get(257));
                            dlgOk.SetLine(1, GUILocalizeStrings.Get(300013)); // Name can't be empty or must be unique!
                            dlgOk.DoModal(GetID);
                            OnAddEditFolder();
                            return;
                        }
                    }
                }
                _folderName = sName;
            }

            OnAddEditFolder();
        }
        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);
        }
示例#27
0
        /// <summary>
        /// Try to connect to the core service, if not connected.
        /// </summary>
        /// <param name="showHomeOnError"></param>
        /// <param name="schowError"></param>
        /// <returns></returns>
        internal static bool EnsureConnection(bool showHomeOnError, bool schowError)
        {
            if (!Proxies.IsInitialized)
            {
                bool           succeeded      = false;
                string         errorMessage   = string.Empty;
                ServerSettings serverSettings = LoadServerSettings();

                if (IsSingleSeat)
                {
                    StartServices(serverSettings.ServerName);
                }

                /*else
                 * {
                 *  if (!NetworkAvailable)
                 *  {
                 *      if (((showHomeOnError || !_connectionErrorShown)
                 *          && GUIWindowManager.ActiveWindow != 0) && schowError)
                 *      {
                 *          GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                 *          dlg.Reset();
                 *          dlg.SetHeading(Utility.GetLocalizedText(TextId.Error));
                 *          dlg.SetLine(1, "Failed to connect to ARGUS TV");
                 *          dlg.SetLine(2, "No internet connection!");
                 *          dlg.SetLine(3, "");
                 *          dlg.DoModal(GUIWindowManager.ActiveWindow);
                 *          _connectionErrorShown = true;
                 *      }
                 *
                 *      _connected = false;
                 *      return false;
                 *  }
                 * }*/

                succeeded = Utility.InitialiseServerSettings(serverSettings, out errorMessage);
                if (!succeeded && !IsSingleSeat)
                {
                    StartServices(serverSettings.ServerName);
                    succeeded = Utility.InitialiseServerSettings(serverSettings, out errorMessage);
                }

                if (!succeeded)
                {
                    if (((showHomeOnError || !_connectionErrorShown) &&
                         GUIWindowManager.ActiveWindow != 0) && schowError)
                    {
                        GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                        dlg.Reset();
                        dlg.SetHeading("Failed to connect to ARGUS TV");
                        dlg.SetLine(1, serverSettings.ServiceUrlPrefix);
                        dlg.SetLine(2, errorMessage);
                        dlg.SetLine(3, "Check plugin setup in Configuration");
                        dlg.DoModal(GUIWindowManager.ActiveWindow);
                        _connectionErrorShown = true;
                    }
                }
            }

            if (!Proxies.IsInitialized)
            {
                if (showHomeOnError && GUIWindowManager.ActiveWindow != 0)
                {
                    using (Settings xmlreader = new MPSettings())
                    {
                        bool _startWithBasicHome = xmlreader.GetValueAsBool("gui", "startbasichome", false);
                        if (_startWithBasicHome && System.IO.File.Exists(GUIGraphicsContext.Skin + @"\basichome.xml"))
                        {
                            GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SECOND_HOME);
                        }
                        else
                        {
                            GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_HOME);
                        }
                    }
                }
                _connected = false;
                return(false);
            }

            _connected = true;
            return(true);
        }
示例#28
0
        void ShowOptionsForSite(OnlineVideosWebservice.Site site)
        {
            SiteSettings localSite      = null;
            int          localSiteIndex = OnlineVideoSettings.Instance.GetSiteByName(site.Name, out localSite);

            GUIDialogMenu dlgSel = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            dlgSel.ShowQuickNumbers = false;
            if (dlgSel != null)
            {
                dlgSel.Reset();
                dlgSel.SetHeading(Translation.Instance.Actions);

                if (localSiteIndex == -1)
                {
                    if (site.State != OnlineVideosWebservice.SiteState.Broken)
                    {
                        dlgSel.Add(Translation.Instance.AddToMySites);
                    }
                }
                else
                {
                    if ((site.LastUpdated - localSite.LastUpdated).TotalMinutes > 2 && site.State != OnlineVideosWebservice.SiteState.Broken)
                    {
                        dlgSel.Add(Translation.Instance.UpdateMySite);
                        dlgSel.Add(Translation.Instance.UpdateMySiteSkipCategories);
                    }
                    dlgSel.Add(Translation.Instance.RemoveFromMySites);
                }

                if (GUI_infoList.Count > 1)
                {
                    dlgSel.Add(Translation.Instance.RemoveAllFromMySites);
                    dlgSel.Add(Translation.Instance.UpdateAll);
                    dlgSel.Add(Translation.Instance.UpdateAllSkipCategories);
                }

                if (!string.IsNullOrEmpty(site.Owner_FK) && localSiteIndex >= 0) // !only local && ! only global
                {
                    dlgSel.Add(Translation.Instance.ShowReports);
                    if (site.State != OnlineVideosWebservice.SiteState.Broken)
                    {
                        dlgSel.Add(Translation.Instance.ReportBroken);
                    }
                }
            }
            dlgSel.DoModal(GUIWindowManager.ActiveWindow);
            if (dlgSel.SelectedId == -1)
            {
                return;                          // ESC used, nothing selected
            }
            if (dlgSel.SelectedLabelText == Translation.Instance.AddToMySites ||
                dlgSel.SelectedLabelText == Translation.Instance.UpdateMySite ||
                dlgSel.SelectedLabelText == Translation.Instance.UpdateMySiteSkipCategories)
            {
                if (CheckOnlineVideosVersion())
                {
                    Gui2UtilConnector.Instance.ExecuteInBackgroundAndCallback(
                        () =>
                    {
                        bool?updateResult = OnlineVideos.Sites.Updater.UpdateSites(null, new List <OnlineVideosWebservice.Site> {
                            site
                        }, false,
                                                                                   dlgSel.SelectedLabelText == Translation.Instance.UpdateMySiteSkipCategories);
                        if (updateResult == true)
                        {
                            newDllsDownloaded = true;
                        }
                        else if (updateResult == null)
                        {
                            newDataSaved = true;
                        }
                        return(updateResult != false);
                    },
                        (success, result) =>
                    {
                        if (success && (bool)result)
                        {
                            SiteImageExistenceCache.UnCacheImageForSite(site.Name);
                            RefreshDisplayedOnlineSites();
                        }
                    },
                        Translation.Instance.GettingSiteXml, true);
                }
            }
            else if (dlgSel.SelectedLabelText == Translation.Instance.UpdateAll ||
                     dlgSel.SelectedLabelText == Translation.Instance.UpdateAllSkipCategories)
            {
                if (CheckOnlineVideosVersion())
                {
                    GUIDialogProgress dlgPrgrs = PrepareProgressDialog(Translation.Instance.FullUpdate);
                    new System.Threading.Thread(delegate()
                    {
                        bool?updateResult = OnlineVideos.Sites.Updater.UpdateSites((m, p) =>
                        {
                            if (dlgPrgrs != null)
                            {
                                if (!string.IsNullOrEmpty(m))
                                {
                                    dlgPrgrs.SetLine(1, m);
                                }
                                if (p != null)
                                {
                                    dlgPrgrs.SetPercentage(p.Value);
                                }
                                return(dlgPrgrs.ShouldRenderLayer());
                            }
                            else
                            {
                                return(true);
                            }
                        }, GUI_infoList.ListItems.Select(g => g.TVTag as OnlineVideosWebservice.Site).ToList(), dlgSel.SelectedLabelText == Translation.Instance.UpdateAllSkipCategories);
                        if (updateResult == true)
                        {
                            newDllsDownloaded = true;
                        }
                        else if (updateResult == null)
                        {
                            newDataSaved = true;
                        }
                        if (updateResult != false)
                        {
                            SiteImageExistenceCache.ClearCache();
                        }
                        if (dlgPrgrs != null)
                        {
                            dlgPrgrs.Close();
                        }
                        GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) => { RefreshDisplayedOnlineSites(); return(0); }, 0, 0, null);
                    })
                    {
                        Name = "OVSelectUpdate", IsBackground = true
                    }.Start();
                }
            }
            else if (dlgSel.SelectedLabelText == Translation.Instance.RemoveFromMySites)
            {
                OnlineVideoSettings.Instance.RemoveSiteAt(localSiteIndex);
                OnlineVideoSettings.Instance.SaveSites();
                newDataSaved = true;
                RefreshDisplayedOnlineSites(GUI_infoList.SelectedListItemIndex);
            }
            else if (dlgSel.SelectedLabelText == Translation.Instance.RemoveAllFromMySites)
            {
                bool needRefresh = false;
                foreach (var siteToRemove in GUI_infoList.ListItems.Where(g => g.IsPlayed).Select(g => g.TVTag as OnlineVideosWebservice.Site).ToList())
                {
                    localSiteIndex = OnlineVideoSettings.Instance.GetSiteByName(siteToRemove.Name, out localSite);
                    if (localSiteIndex >= 0)
                    {
                        OnlineVideoSettings.Instance.RemoveSiteAt(localSiteIndex);
                        needRefresh = true;
                    }
                }
                if (needRefresh)
                {
                    OnlineVideoSettings.Instance.SaveSites();
                    newDataSaved = true;
                    RefreshDisplayedOnlineSites();
                }
            }
            else if (dlgSel.SelectedLabelText == Translation.Instance.ShowReports)
            {
                Gui2UtilConnector.Instance.ExecuteInBackgroundAndCallback(
                    () =>
                {
                    OnlineVideosWebservice.OnlineVideosService ws = new OnlineVideosWebservice.OnlineVideosService();
                    return(ws.GetReports(site.Name));
                },
                    (success, result) =>
                {
                    if (success)
                    {
                        OnlineVideosWebservice.Report[] reports = result as OnlineVideosWebservice.Report[];

                        if (reports == null || reports.Length == 0)
                        {
                            GUIDialogNotify dlg = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
                            if (dlg != null)
                            {
                                dlg.Reset();
                                dlg.SetImage(SiteImageExistenceCache.GetImageForSite("OnlineVideos", type: "Icon"));
                                dlg.SetHeading(PluginConfiguration.Instance.BasicHomeScreenName);
                                dlg.SetText(Translation.Instance.NoReportsForSite);
                                dlg.DoModal(GUIWindowManager.ActiveWindow);
                            }
                        }
                        else
                        {
                            selectedSite = site.Name;
                            GUIControl.ClearControl(GetID, GUI_infoList.GetID);

                            Array.Sort(reports, new Comparison <OnlineVideosWebservice.Report>(delegate(OnlineVideosWebservice.Report a, OnlineVideosWebservice.Report b)
                            {
                                return(b.Date.CompareTo(a.Date));
                            }));

                            foreach (OnlineVideosWebservice.Report report in reports)
                            {
                                string shortMsg            = report.Message.Replace(Environment.NewLine, " ").Replace("\n", " ").Replace("\r", " ");
                                GUIListItem loListItem     = new GUIListItem(shortMsg.Length > 44 ? shortMsg.Substring(0, 40) + " ..." : shortMsg);
                                loListItem.TVTag           = report;
                                loListItem.Label2          = report.Type.ToString();
                                loListItem.Label3          = report.Date.ToString("g", OnlineVideoSettings.Instance.Locale);
                                loListItem.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnReportSelected);
                                GUI_infoList.Add(loListItem);
                            }
                            GUIControl.SelectItemControl(GetID, GUI_infoList.GetID, 0);
                            GUIPropertyManager.SetProperty("#itemcount", GUI_infoList.Count.ToString());
                            GUIPropertyManager.SetProperty("#itemtype", Translation.Instance.Reports);
                        }
                    }
                }, Translation.Instance.GettingReports, true);
            }
            else if (dlgSel.SelectedLabelText == Translation.Instance.ReportBroken)
            {
                if (CheckOnlineVideosVersion())
                {
                    if ((site.LastUpdated - localSite.LastUpdated).TotalMinutes > 1)
                    {
                        GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                        if (dlg != null)
                        {
                            dlg.Reset();
                            dlg.SetHeading(site.Name);
                            dlg.SetLine(1, Translation.Instance.PleaseUpdateLocalSite);
                            dlg.DoModal(GUIWindowManager.ActiveWindow);
                        }
                    }
                    else
                    {
                        string userReason = "";
                        if (GUIOnlineVideos.GetUserInputString(ref userReason, false))
                        {
                            if (userReason.Length < 15)
                            {
                                GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                                if (dlg != null)
                                {
                                    dlg.Reset();
                                    dlg.SetHeading(PluginConfiguration.Instance.BasicHomeScreenName);
                                    dlg.SetLine(1, Translation.Instance.PleaseEnterDescription);
                                    dlg.DoModal(GUIWindowManager.ActiveWindow);
                                }
                            }
                            else
                            {
                                OnlineVideosWebservice.OnlineVideosService ws = new OnlineVideosWebservice.OnlineVideosService();
                                string      message = "";
                                bool        success = ws.SubmitReport(site.Name, userReason, OnlineVideosWebservice.ReportType.Broken, out message);
                                GUIDialogOK dlg     = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                                if (dlg != null)
                                {
                                    dlg.Reset();
                                    dlg.SetHeading(PluginConfiguration.Instance.BasicHomeScreenName);
                                    dlg.SetLine(1, success ? Translation.Instance.Done : Translation.Instance.Error);
                                    dlg.SetLine(2, message);
                                    dlg.DoModal(GUIWindowManager.ActiveWindow);
                                }
                                if (success)
                                {
                                    // reload online sites
                                    OnlineVideos.Sites.Updater.GetRemoteOverviews(true);
                                    RefreshDisplayedOnlineSites();
                                }
                            }
                        }
                    }
                }
            }
        }
        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)
        {
            base.OnClicked(controlId, control, actionType);

            if (control == lcFolders)
            {
                if (lcFolders.SelectedListItem.IsPlayed)
                {
                    lcFolders.SelectedListItem.Label2   = "";
                    lcFolders.SelectedListItem.IsPlayed = false;
                    FolderInfo(lcFolders.SelectedListItem).ScanShare = false;
                    _scanShare--;
                }
                else
                {
                    lcFolders.SelectedListItem.Label2   = GUILocalizeStrings.Get(193); // Scan
                    lcFolders.SelectedListItem.IsPlayed = true;
                    FolderInfo(lcFolders.SelectedListItem).ScanShare = true;
                    _scanShare++;
                }
            }

            if (control == btnStripartistprefixes)
            {
                if (btnStripartistprefixes.Selected)
                {
                    OnStripArtistsPrefixes();
                    SettingsChanged(true);
                }
            }

            if (control == btnTreatFolderAsAlbum)
            {
                if (btnTreatFolderAsAlbum.Selected)
                {
                    btnCreateMissingFolderThumbs.IsEnabled = true;
                }
                else
                {
                    btnCreateMissingFolderThumbs.IsEnabled = false;
                }
                SettingsChanged(true);
            }

            if (control == btnDateAdded)
            {
                OnDateAdded();
            }

            if (control == btnUpdateDatabase)
            {
                if (_scanShare == 0)
                {
                    GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlgOk.SetHeading(GUILocalizeStrings.Get(1020));   // Information
                    dlgOk.SetLine(1, GUILocalizeStrings.Get(300004)); // Nothing to scan
                    dlgOk.SetLine(2, GUILocalizeStrings.Get(300005)); //Please select folder(s) for scan.
                    dlgOk.DoModal(GetID);
                    return;
                }
                OnUpdateDatabase();
            }
        }