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
        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);
            }
        }
示例#3
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);
        }
示例#4
0
        /// <summary>
        /// Get WifiRemote representation of the ok dialog
        /// </summary>
        /// <returns>WifiRemote Dialog Instance</returns>
        public static MpDialogOk GetDialogOk()
        {
            GUIDialogOK menu     = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
            MpDialogOk  okDialog = new MpDialogOk(menu);

            return(okDialog);
        }
示例#5
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();
        }
示例#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
        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);
            }
        }
示例#12
0
        public MpDialogOk(MediaPortal.Dialogs.GUIDialogOK menu)
            : base(menu)
        {
            this.dialogMenu = menu;
            this.DialogType = menu.GetModuleName();
            this.DialogId   = menu.GetID;
            this.AvailableActions.Add("ok");
            this.AvailableActions.Add("cancel");

            GetHeading(menu, 1);
            GetText(menu, 2, 3, 4, 5);
        }
示例#13
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);
            }
        }
示例#14
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);
            }
        }
示例#15
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);
            }
        }
示例#16
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();
        }
示例#17
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);
        }
示例#18
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();
            }
        }
示例#20
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);
            }
        }
示例#21
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);
            }
        }
        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();
            }
        }
示例#23
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;
            }
        }
示例#25
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);
         }
     }
 }
示例#26
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);
        }
示例#27
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);
        }
示例#29
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);
        }
        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();
            }
        }