private void OnAACAudioCodec() { string strAACAudioCodec = ""; using (Settings xmlreader = new MPSettings()) { strAACAudioCodec = xmlreader.GetValueAsString("mytv", "aacaudiocodec", ""); } ArrayList availableAACAudioFilters = FilterHelper.GetFilters(MediaType.Audio, MediaSubType.LATMAAC); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu int selected = 0; int count = 0; foreach (string codec in availableAACAudioFilters) { dlg.Add(codec); //delete if (codec == strAACAudioCodec) { selected = count; } count++; } dlg.SelectedLabel = selected; } dlg.DoModal(GetID); if (dlg.SelectedLabel < 0) { return; } using (Settings xmlwriter = new MPSettings()) { xmlwriter.SetValue("mytv", "aacaudiocodec", (string)availableAACAudioFilters[dlg.SelectedLabel]); } }
private void ChangeChannelType() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(Utility.GetLocalizedText(TextId.Type)); dlg.Add(Utility.GetLocalizedText(TextId.Television)); dlg.Add(Utility.GetLocalizedText(TextId.Radio)); switch (_currentChannelType) { case ChannelType.Television: dlg.SelectedLabel = 0; break; case ChannelType.Radio: dlg.SelectedLabel = 1; break; } dlg.DoModal(GetID); if (dlg.SelectedId > 0) { switch (dlg.SelectedLabel) { case 0: _currentChannelType = ChannelType.Television; break; case 1: _currentChannelType = ChannelType.Radio; break; } } } }
private void OnAudioRenderer() { string strAudioRenderer = ""; using (Settings xmlreader = new MPSettings()) { strAudioRenderer = xmlreader.GetValueAsString("dvdplayer", "audiorenderer", "Default DirectSound Device"); } ArrayList availableAudioFilters = FilterHelper.GetAudioRenderers(); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu int selected = 0; int count = 0; foreach (string codec in availableAudioFilters) { dlg.Add(codec); //delete if (codec == strAudioRenderer) { selected = count; } count++; } dlg.SelectedLabel = selected; } dlg.DoModal(GetID); if (dlg.SelectedLabel < 0) { return; } using (Settings xmlwriter = new MPSettings()) { xmlwriter.SetValue("dvdplayer", "audiorenderer", (string)availableAudioFilters[dlg.SelectedLabel]); } }
public void ViewButtonHandler() { GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dialog == null) { return; } MyTorrents.ListType = "Torrents"; dialog.Reset(); dialog.SetHeading("Switch Torrent View"); dialog.Add("All"); dialog.Add("Active"); dialog.Add("Downloading"); dialog.Add("Seeding"); dialog.Add("Finished"); dialog.Add("Paused"); dialog.Add("With Errors"); dialog.Add("Stopped"); dialog.DoModal(GUIWindowManager.ActiveWindow); switch (dialog.SelectedLabelText) { case "All": case "Active": case "Downloading": case "Seeding": case "Finished": case "Paused": case "Stopped": MyTorrents.TorrentView = dialog.SelectedLabelText; break; case "With Errors": MyTorrents.TorrentView = "Errors"; break; } }
private void OnHomeUsage() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(496); // options foreach (string home in _homeUsage) { dlg.Add(home); } dlg.SelectedLabel = _homeSelectedIndex; dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } _homeSelectedIndex = dlg.SelectedLabel; btnHomeUsage.Label = dlg.SelectedLabelText; using (Settings xmlwriter = new MPSettings()) { xmlwriter.SetValueAsBool("gui", "useonlyonehome", (dlg.SelectedLabel & (int)HomeUsageEnum.UseOnlyOne) != 0); xmlwriter.SetValueAsBool("gui", "startbasichome", (dlg.SelectedLabel & (int)HomeUsageEnum.PreferBasic) != 0); } GUIPropertyManager.SetProperty("#homeScreen", _homeUsage[_homeSelectedIndex].ToString()); SettingsChanged(true); }
public void ChooseType(SeriesItem item) { GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dialog == null) { return; } dialog.Reset(); dialog.SetHeading("Choose Watching Type"); dialog.Add("New episodes"); dialog.Add("Missing episodes"); dialog.DoModal(GUIWindowManager.ActiveWindow); if (dialog.SelectedId != -1) { MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => e.show.ID == item.show.ID).First().type = dialog.SelectedLabelText; GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Type", dialog.SelectedLabelText); } }
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; } }
private void OnAutoPlay() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(713)); //Autoplay dlg.AddLocalizedString(2135); // Audio dlg.AddLocalizedString(2134); // Video dlg.AddLocalizedString(300006); // Photo if (_selectedOption != -1) { dlg.SelectedLabel = _selectedOption; } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } _selectedOption = dlg.SelectedLabel; switch (dlg.SelectedId) { case 2135: // Audio case 2134: // Video case 300006: // Photo OnPlay(dlg.SelectedId); break; } } }
private void OnAspectRatio() { Geometry.Type aspectRatio = Geometry.Type.Normal; using (Settings xmlreader = new MPSettings()) { string aspectRatioText = xmlreader.GetValueAsString("dvdplayer", "defaultar", "Normal"); aspectRatio = Utils.GetAspectRatio(aspectRatioText); } GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.AddLocalizedString(943); // Normal dlg.AddLocalizedString(944); // Original dlg.AddLocalizedString(947); // Zoom dlg.AddLocalizedString(1190); // Zoom 14:9 dlg.AddLocalizedString(942); // Stretch dlg.AddLocalizedString(945); // Letterbox dlg.AddLocalizedString(946); // Non linear stretch // set the focus to currently used mode dlg.SelectedLabel = (int)aspectRatio; // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } aspectRatio = Utils.GetAspectRatioByLangID(dlg.SelectedId); using (Settings xmlwriter = new MPSettings()) { string aspectRatioText = Utils.GetAspectRatio(aspectRatio); xmlwriter.SetValue("dvdplayer", "defaultar", aspectRatioText); } }
private int?GetKeepValue(int heading, KeepUntilMode mode, int singularName, int pluralName, int?currentValue) { DataTable valueTable = KeepUntilControlUtility.CreateValueTable(mode, currentValue); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.ShowQuickNumbers = false; dlg.SetHeading(heading); string singularValue = "1 " + GUILocalizeStrings.Get(singularName); string pluralSuffix = " " + GUILocalizeStrings.Get(pluralName); foreach (DataRow value in valueTable.Rows) { int val = (int)value[KeepUntilControlUtility.ValueColumnName]; if (val == 1) { dlg.Add(singularValue); } else { dlg.Add(value[KeepUntilControlUtility.TextColumnName] + pluralSuffix); } } dlg.SelectedLabel = KeepUntilControlUtility.GetIndexToSelect(valueTable, currentValue); dlg.DoModal(GetID); if (dlg.SelectedLabel >= 0) { return((int)valueTable.Rows[dlg.SelectedLabel][KeepUntilControlUtility.ValueColumnName]); } } return(null); }
static bool showSimpleContext(GUIPresenter presenter, int selectedLabel = 0) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(Options.Instance.GetStringOption("shownname")); dlg.Add(new GUIListItem(Translator.Instance.switchview)); dlg.Add(new GUIListItem(Translator.Instance.runimport)); dlg.Add(new GUIListItem(Translator.Instance.options)); dlg.SelectedLabel = selectedLabel; dlg.DoModal(Plugin.WINDOW_ID); selectedLabel = dlg.SelectedLabel; switch (dlg.SelectedId) { case 1: presenter.SwitchView(); break; case 2: presenter.RestartImporter(); break; case 3: if (ShowSettingsDialog()) { presenter.ReloadOptions(); } showSimpleContext(presenter, selectedLabel); break; } } return(false); }
public static bool DialogSelectGFQuickSortDirection(ref GroupFilterSortDirection sortDirection, string previousMenu) { //show the selection dialog GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return(false); } dlg.Reset(); dlg.SetHeading("Sort Direction"); dlg.Add("<<< " + previousMenu); dlg.Add("Ascending"); dlg.Add("Descending"); dlg.DoModal(GUIWindowManager.ActiveWindow); int selection = dlg.SelectedLabel; if (selection <= 0) { return(true); } if (selection == 1) { sortDirection = GroupFilterSortDirection.Asc; } if (selection == 2) { sortDirection = GroupFilterSortDirection.Desc; } return(true); }
private void OnChangeKeeUntilValue() { DataTable valueTable = KeepUntilControlUtility.CreateValueTable(_currentKeepUntilMode, null); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.ShowQuickNumbers = false; dlg.SetHeading(Utility.GetLocalizedText(TextId.DefaultKeepValue)); foreach (DataRow value in valueTable.Rows) { dlg.Add(value[KeepUntilControlUtility.TextColumnName].ToString()); } dlg.SelectedLabel = KeepUntilControlUtility.GetIndexToSelect(valueTable, _currentKeepUntilValue); dlg.DoModal(GetID); if (dlg.SelectedId > 0) { _currentKeepUntilValue = (int)valueTable.Rows[dlg.SelectedLabel][KeepUntilControlUtility.ValueColumnName]; } } }
private void OnKeep() { if (_upcomingProgram != null) { Schedule schedule = Proxies.SchedulerService.GetScheduleById(_upcomingProgram.ScheduleId).Result; if (schedule == null) { return; } GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dialog == null) { return; } dialog.Reset(); dialog.SetHeading(1042); // Keep until dialog.Add(Utility.GetLocalizedText(TextId.UntilSpaceNeeded)); dialog.Add(Utility.GetLocalizedText(TextId.NumberOfDays)); dialog.Add(Utility.GetLocalizedText(TextId.NumberOfEpisodes)); dialog.Add(Utility.GetLocalizedText(TextId.NumberOfWatchedEpisodes)); dialog.Add(Utility.GetLocalizedText(TextId.Forever)); switch (schedule.KeepUntilMode) { case KeepUntilMode.UntilSpaceIsNeeded: dialog.SelectedLabel = 0; break; case KeepUntilMode.NumberOfDays: dialog.SelectedLabel = 1; break; case KeepUntilMode.NumberOfEpisodes: dialog.SelectedLabel = 2; break; case KeepUntilMode.NumberOfWatchedEpisodes: dialog.SelectedLabel = 3; break; case KeepUntilMode.Forever: dialog.SelectedLabel = 4; break; } dialog.DoModal(GetID); if (dialog.SelectedId == -1) { return; } switch (dialog.SelectedLabel) { case 0: schedule.KeepUntilMode = KeepUntilMode.UntilSpaceIsNeeded; break; case 1: { int?value = GetKeepValue(1045, KeepUntilMode.NumberOfDays, 3014, 3015, schedule.KeepUntilMode == KeepUntilMode.NumberOfDays ? schedule.KeepUntilValue : 7); if (value.HasValue) { schedule.KeepUntilMode = KeepUntilMode.NumberOfDays; schedule.KeepUntilValue = value; } } break; case 2: { int?value = GetKeepValue(887, KeepUntilMode.NumberOfEpisodes, 682, 914, schedule.KeepUntilMode == KeepUntilMode.NumberOfEpisodes ? schedule.KeepUntilValue : 3); if (value.HasValue) { schedule.KeepUntilMode = KeepUntilMode.NumberOfEpisodes; schedule.KeepUntilValue = value; } } break; case 3: { int?value = GetKeepValue(887, KeepUntilMode.NumberOfWatchedEpisodes, 682, 914, schedule.KeepUntilMode == KeepUntilMode.NumberOfWatchedEpisodes ? schedule.KeepUntilValue : 3); if (value.HasValue) { schedule.KeepUntilMode = KeepUntilMode.NumberOfWatchedEpisodes; schedule.KeepUntilValue = value; } } break; case 4: schedule.KeepUntilMode = KeepUntilMode.Forever; break; } if (schedule != null) { Proxies.SchedulerService.SaveSchedule(schedule).Wait(); } } }
private void OnShowContextMenu(int iItem, bool clicked) { m_iSelectedItem = iItem; GUIListItem item = GetItem(iItem); if (item == null) { return; } if (item.IsFolder && clicked) { bool noitems = false; if (item.Label == "..") { if (selectedItem != null) { selectedItem = null; } LoadDirectory(); return; } if (selectedItem == null) { IList <Schedule> seriesList = TVHome.Util.GetRecordingTimes(item.TVTag as Schedule); if (seriesList.Count < 1) { noitems = true; // no items existing } else { selectedItem = item.TVTag as Schedule; } } if (noitems == false) { LoadDirectory(); return; } } bool showSeries = btnSeries.Selected; Schedule rec = item.TVTag as Schedule; if (rec == null) { return; } Log.Info("OnShowContextMenu: Rec = {0}", rec.ToString()); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(rec.ProgramName); if (showSeries && item.IsFolder) { dlg.AddLocalizedString(982); //Cancel this show (618=delete) dlg.AddLocalizedString(888); //Episodes management } else if (rec.Series == false) { dlg.AddLocalizedString(618); //delete } else { dlg.AddLocalizedString(981); //Cancel this show dlg.AddLocalizedString(982); //Delete this entire recording dlg.AddLocalizedString(888); //Episodes management } VirtualCard card; TvServer server = new TvServer(); bool isRec = Schedule.IsScheduleRecording(rec.IdSchedule); //TVHome.IsRecordingSchedule(rec, null, out card); if (isRec) { dlg.AddLocalizedString(979); //Play recording from beginning dlg.AddLocalizedString(980); //Play recording from live point } //Schedule schedDB = Schedule.Retrieve(rec.IdSchedule); //if (schedDB.ScheduleType != (int)ScheduleRecordingType.Once) //{ dlg.AddLocalizedString(1048); // settings //} dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } bool isSchedRec = TvDatabase.Schedule.IsScheduleRecording(rec.IdSchedule); //TVHome.IsRecordingSchedule(rec, null, out card); string fileName = ""; if (isSchedRec) { bool isCardRec = server.IsRecording(rec.ReferencedChannel().IdChannel, out card); if (isCardRec && card != null) { fileName = card.RecordingFileName; } } Log.Info("recording fname:{0}", fileName); switch (dlg.SelectedId) { case 888: ////Episodes management TvPriorities.OnSetEpisodesToKeep(rec); break; case 1048: ////settings Schedule schedule = item.MusicTag as Schedule; if (schedule == null) { schedule = item.TVTag as Schedule; } if (schedule != null) { TVProgramInfo.CurrentRecording = schedule; GUIWindowManager.ActivateWindow((int)Window.WINDOW_TV_PROGRAM_INFO); } return; case 882: ////Quality settings TvPriorities.OnSetQuality(rec); break; case 981: //Cancel this show { var layer = new TvBusinessLayer(); // get the program that this episode is for var progs = layer.GetPrograms(rec.ReferencedChannel(), rec.StartTime, rec.EndTime); // pick up the schedule that is actually used for recording // see TVUtil.GetRecordingTimes where schedules are all spawend as one off types // and this is what rec is (ie. it does not actually exist in the database) var realSchedule = Schedule.Retrieve(rec.IdParentSchedule) ?? rec; bool res = TVUtil.DeleteRecAndSchedWithPrompt(realSchedule, progs[0]); if (res) { LoadDirectory(); } } break; case 982: //Delete series recording goto case 618; case 618: // delete entire recording { bool res = TVUtil.DeleteRecAndEntireSchedWithPrompt(rec, rec.StartTime); if (res) { if (showSeries && !item.IsFolder) { OnShowContextMenu(0, true); return; } else { LoadDirectory(); } } } break; case 979: // Play recording from beginning { Recording recDB = Recording.Retrieve(fileName); if (recDB != null) { TVUtil.PlayRecording(recDB); } } return; case 980: // Play recording from live point { TVHome.ViewChannelAndCheck(rec.ReferencedChannel()); if (g_Player.Playing) { g_Player.ShowFullScreenWindow(); } /* * g_Player.Stop(); * if (System.IO.File.Exists(fileName)) * { * g_Player.Play(fileName, g_Player.MediaType.Recording); * g_Player.SeekAbsolute(g_Player.Duration); * g_Player.ShowFullScreenWindow(); * return; * } * else * { * string url = server.GetRtspUrlForFile(fileName); * Log.Info("recording url:{0}", url); * if (url.Length > 0) * { * g_Player.Play(url, g_Player.MediaType.Recording); * * if (g_Player.Playing) * { * g_Player.SeekAbsolute(g_Player.Duration); * g_Player.SeekAbsolute(g_Player.Duration); * g_Player.ShowFullScreenWindow(); * return; * } * } * }*/ } break; } while (m_iSelectedItem >= GetItemCount() && m_iSelectedItem > 0) { m_iSelectedItem--; } GUIControl.SelectItemControl(GetID, listSchedules.GetID, m_iSelectedItem); }
private void ChangeType(Schedule rec) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(616)); //616=Select Recording type //611=Record once //612=Record everytime on this channel //613=Record everytime on every channel //614=Record every week at this time //615=Record every day at this time for (int i = 611; i <= 615; ++i) { dlg.Add(GUILocalizeStrings.Get(i)); } dlg.Add(GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.Record_WorkingDays))); dlg.Add(GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.Record_WeekendDays))); switch ((ScheduleRecordingType)rec.ScheduleType) { case ScheduleRecordingType.Once: dlg.SelectedLabel = 0; break; case ScheduleRecordingType.EveryTimeOnThisChannel: dlg.SelectedLabel = 1; break; case ScheduleRecordingType.EveryTimeOnEveryChannel: dlg.SelectedLabel = 2; break; case ScheduleRecordingType.Weekly: dlg.SelectedLabel = 3; break; case ScheduleRecordingType.Daily: dlg.SelectedLabel = 4; break; case ScheduleRecordingType.WorkingDays: dlg.SelectedLabel = 5; break; case ScheduleRecordingType.Weekends: dlg.SelectedLabel = 6; break; case ScheduleRecordingType.WeeklyEveryTimeOnThisChannel: dlg.SelectedLabel = 7; break; } dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedLabel) { case 0: //once rec.ScheduleType = (int)ScheduleRecordingType.Once; rec.Canceled = Schedule.MinSchedule; break; case 1: //everytime, this channel rec.ScheduleType = (int)ScheduleRecordingType.EveryTimeOnThisChannel; rec.Canceled = Schedule.MinSchedule; break; case 2: //everytime, all channels rec.ScheduleType = (int)ScheduleRecordingType.EveryTimeOnEveryChannel; rec.Canceled = Schedule.MinSchedule; break; case 3: //weekly rec.ScheduleType = (int)ScheduleRecordingType.Weekly; rec.Canceled = Schedule.MinSchedule; break; case 4: //daily rec.ScheduleType = (int)ScheduleRecordingType.Daily; rec.Canceled = Schedule.MinSchedule; break; case 5: //WorkingDays rec.ScheduleType = (int)ScheduleRecordingType.WorkingDays; rec.Canceled = Schedule.MinSchedule; break; case 6: //Weekends rec.ScheduleType = (int)ScheduleRecordingType.Weekends; rec.Canceled = Schedule.MinSchedule; break; case 7://Weekly everytime, this channel rec.ScheduleType = (int)ScheduleRecordingType.WeeklyEveryTimeOnThisChannel; rec.Canceled = Schedule.MinSchedule; break; } rec.Persist(); TvServer server = new TvServer(); server.OnNewSchedule(); LoadDirectory(); } }
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(); } } } } } } }
protected override void OnShowContextMenu() { GUIListItem currentitem = m_Facade.SelectedListItem; if (currentitem == null) { return; } if (currentitem.TVTag.GetType() == typeof(VM_AnimeEpisode_User)) { VM_AnimeEpisode_User ep = currentitem.TVTag as VM_AnimeEpisode_User; if (ep != null) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(ep.EpisodeNumberAndName); dlg.Add("Mark as Watched"); dlg.Add("Play Previous Episode"); dlg.Add("Go To Episode List"); dlg.Add("View Series Info"); dlg.DoModal(GUIWindowManager.ActiveWindow); switch (dlg.SelectedLabelText) { case "Mark as Watched": ep.ToggleWatchedStatus(true); LoadData(); break; case "Play Previous Episode": if (ep.AnimeSeries == null) { return; } VM_AnimeEpisode_User epPrev = (VM_AnimeEpisode_User)VM_ShokoServer.Instance.ShokoServices.GetPreviousEpisodeForUnwatched(ep.AnimeSeries.AnimeSeriesID, VM_ShokoServer.Instance.CurrentUser.JMMUserID); if (epPrev == null) { Utils.DialogMsg("Error", "Previous episode not found"); return; } MainWindow.vidHandler.ResumeOrPlay(epPrev); break; case "Go To Episode List": if (ep.AnimeSeries == null) { return; } MainWindow.Breadcrumbs = new List <History> { new History { Selected = GroupFilterHelper.AllGroupsFilter } }; // find the group for this series VM_AnimeGroup_User grp = ShokoServerHelper.GetGroup(ep.AnimeSeries.AnimeGroupID); if (grp == null) { BaseConfig.MyAnimeLog.Write("Group not found"); return; } MainWindow.ContinueWatching_CurrentSeries = ep.AnimeSeries; MainWindow.Breadcrumbs.Add(new History { Listing = GroupFilterHelper.AllGroupsFilter, Selected = grp }); MainWindow.Breadcrumbs.Add(new History { Listing = grp, Selected = MainWindow.ContinueWatching_CurrentSeries }); bool foundEpType = false; if (MainWindow.ContinueWatching_CurrentSeries.EpisodeTypesToDisplay.Count == 1) { MainWindow.Breadcrumbs.Add(new History { Listing = MainWindow.ContinueWatching_CurrentSeries, Selected = null }); } else { foreach (VM_AnimeEpisodeType anEpType in MainWindow.ContinueWatching_CurrentSeries.EpisodeTypesToDisplay) { if (anEpType.EpisodeType == EpisodeType.Episode) { MainWindow.Breadcrumbs.Add(new History { Listing = MainWindow.ContinueWatching_CurrentSeries, Selected = anEpType }); MainWindow.Breadcrumbs.Add(new History { Listing = anEpType, Selected = null }); foundEpType = true; break; } } if (!foundEpType) { return; } } GUIWindowManager.CloseCurrentWindow(); GUIWindowManager.ActivateWindow(Constants.WindowIDs.MAIN, false); return; case "View Series Info": if (ep.AnimeSeries == null) { return; } MainWindow.GlobalSeriesID = ep.AnimeSeries.AnimeSeriesID; GUIWindowManager.ActivateWindow(Constants.WindowIDs.ANIMEINFO, false); break; } } } }
public bool GetDialogInfo(GUIWindow.Window dialogWindow, ref string DialogTitle, ref string DialogHighlightedItem) { GUIListControl control = null; bool focus = false; switch (dialogWindow) { case GUIWindow.Window.WINDOW_DIALOG_YES_NO: case GUIWindow.Window.WINDOW_DIALOG_TVNOTIFYYESNO: { GUIDialogYesNo window = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)dialogWindow); DialogTitle = string.Empty; foreach (object obj16 in window.controlList) { if (obj16.GetType() == typeof(GUIFadeLabel)) { GUIFadeLabel label3 = obj16 as GUIFadeLabel; if (DialogTitle == string.Empty) { if (label3.Label != string.Empty) { DialogTitle = label3.Label; } } else if (label3.Label != string.Empty) { DialogTitle = DialogTitle + " - " + label3.Label; } } if (obj16.GetType() == typeof(GUILabelControl)) { GUILabelControl control14 = obj16 as GUILabelControl; if (DialogTitle == string.Empty) { if (control14.Label != string.Empty) { DialogTitle = control14.Label; } } else if (control14.Label != string.Empty) { DialogTitle = DialogTitle + " - " + control14.Label; } } if (obj16.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control15 = obj16 as GUIButtonControl; if (!control15.Focus) { continue; } DialogHighlightedItem = control15.Description; } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_PROGRESS: { GUIDialogProgress progress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)dialogWindow); foreach (object obj6 in progress.controlList) { if (obj6.GetType() == typeof(GUILabelControl)) { GUILabelControl control6 = obj6 as GUILabelControl; if (control6.GetID == 1) { DialogTitle = control6.Label; } } } foreach (object obj7 in progress.controlList) { if (obj7.GetType() == typeof(GUIProgressControl)) { GUIProgressControl control7 = obj7 as GUIProgressControl; DialogHighlightedItem = "Progress: " + control7.Percentage.ToString() + "%"; } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_SELECT: { GUIDialogSelect select = (GUIDialogSelect)GUIWindowManager.GetWindow((int)dialogWindow); control = null; focus = false; foreach (object obj9 in select.controlList) { if (obj9.GetType() == typeof(GUIListControl)) { control = obj9 as GUIListControl; focus = control.Focus; } } if ((control != null) & focus) { string strLabel = string.Empty; string str5 = string.Empty; string strThumb = string.Empty; string strIndex = string.Empty; control.GetSelectedItem(ref strLabel, ref str5, ref strThumb, ref strIndex); DialogHighlightedItem = strLabel; } else { foreach (object obj10 in select.controlList) { if (obj10.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control10 = obj10 as GUIButtonControl; if (control10.Focus) { DialogHighlightedItem = control10.Description; } } } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_OK: { GUIDialogOK gok = (GUIDialogOK)GUIWindowManager.GetWindow((int)dialogWindow); foreach (object obj5 in gok.controlList) { if (obj5.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control4 = obj5 as GUIButtonControl; if (control4.Focus) { DialogHighlightedItem = control4.Description; Settings.Instance.LogInfo( "MiniDisplay.GetDialogInfo(): found WINDOW_DIALOG_OK buttoncontrol ID = {0} Label = \"{1}\" Desc = \"{2}\"", control4.GetID, control4.Label, control4.Description); } } if (obj5.GetType() == typeof(GUIFadeLabel)) { GUIFadeLabel label = obj5 as GUIFadeLabel; if (DialogTitle == string.Empty) { if (label.Label != string.Empty) { DialogTitle = label.Label; } } else if (label.Label != string.Empty) { DialogTitle = DialogTitle + " - " + label.Label; } } if (obj5.GetType() == typeof(GUILabelControl)) { GUILabelControl control5 = obj5 as GUILabelControl; if (DialogTitle == string.Empty) { if (control5.Label != string.Empty) { DialogTitle = control5.Label; } continue; } if (control5.Label != string.Empty) { DialogTitle = DialogTitle + " - " + control5.Label; } } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_SELECT2: { GUIDialogSelect2 select2 = (GUIDialogSelect2)GUIWindowManager.GetWindow((int)dialogWindow); control = null; focus = false; foreach (object obj11 in select2.controlList) { if (obj11.GetType() == typeof(GUIListControl)) { control = obj11 as GUIListControl; focus = control.Focus; } } if ((control != null) & focus) { string str7 = string.Empty; string str8 = string.Empty; string str9 = string.Empty; string strIndex = string.Empty; control.GetSelectedItem(ref str7, ref str8, ref str9, ref strIndex); DialogHighlightedItem = str7; } else { foreach (object obj12 in select2.controlList) { if (obj12.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control11 = obj12 as GUIButtonControl; if (control11.Focus) { DialogHighlightedItem = control11.Description; } } } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_MENU: { GUIDialogMenu menu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)dialogWindow); foreach (object obj13 in menu.controlList) { if (obj13.GetType() == typeof(GUILabelControl)) { GUILabelControl control12 = obj13 as GUILabelControl; if (!control12.Label.Trim().ToLowerInvariant().Equals("menu")) { DialogTitle = control12.Label; } } } control = null; focus = false; foreach (object obj14 in menu.controlList) { if (obj14.GetType() == typeof(GUIListControl)) { control = obj14 as GUIListControl; focus = control.Focus; } } if ((control != null) & focus) { string str10 = string.Empty; string str11 = string.Empty; string str12 = string.Empty; string strIndex = string.Empty; control.GetSelectedItem(ref str10, ref str11, ref str12, ref strIndex); DialogHighlightedItem = str10; } else { foreach (object obj15 in menu.controlList) { if (obj15.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control13 = obj15 as GUIButtonControl; if (control13.Focus) { DialogHighlightedItem = control13.Description; } } } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_RATING: { GUIDialogSetRating rating = (GUIDialogSetRating)GUIWindowManager.GetWindow((int)dialogWindow); DialogTitle = string.Empty; foreach (object obj8 in rating.controlList) { if (obj8.GetType() == typeof(GUIFadeLabel)) { GUIFadeLabel label2 = obj8 as GUIFadeLabel; if (DialogTitle == string.Empty) { if (label2.Label != string.Empty) { DialogTitle = label2.Label; } } else if (label2.Label != string.Empty) { DialogTitle = DialogTitle + " - " + label2.Label; } } if (obj8.GetType() == typeof(GUILabelControl)) { GUILabelControl control8 = obj8 as GUILabelControl; if (DialogTitle == string.Empty) { if (control8.Label != string.Empty) { DialogTitle = control8.Label; } } else if (control8.Label != string.Empty) { DialogTitle = DialogTitle + " - " + control8.Label; } } if (obj8.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control9 = obj8 as GUIButtonControl; if (!control9.Focus) { continue; } DialogHighlightedItem = control9.Description; } } return(true); } case GUIWindow.Window.WINDOW_DIALOG_MENU_BOTTOM_RIGHT: { GUIDialogMenuBottomRight right = (GUIDialogMenuBottomRight)GUIWindowManager.GetWindow((int)dialogWindow); DialogTitle = string.Empty; foreach (object obj2 in right.controlList) { if (obj2.GetType() == typeof(GUILabelControl)) { GUILabelControl control2 = obj2 as GUILabelControl; if (!control2.Label.Trim().ToLowerInvariant().Equals("menu") && (control2.Label != string.Empty)) { if (DialogTitle == string.Empty) { DialogTitle = control2.Label; } else { DialogTitle = DialogTitle + " - " + control2.Label; } } } } control = null; focus = false; foreach (object obj3 in right.controlList) { if (obj3.GetType() == typeof(GUIListControl)) { control = obj3 as GUIListControl; focus = control.Focus; } } if ((control != null) & focus) { string str = string.Empty; string str2 = string.Empty; string str3 = string.Empty; string strIndex = string.Empty; control.GetSelectedItem(ref str, ref str2, ref str3, ref strIndex); DialogHighlightedItem = str; } else { foreach (object obj4 in right.controlList) { if (obj4.GetType() == typeof(GUIButtonControl)) { GUIButtonControl control3 = obj4 as GUIButtonControl; if (control3.Focus) { DialogHighlightedItem = control3.Description; } } } } return(true); } } return(false); }
private void OnClick(int iItem) { m_iSelectedItem = GetSelectedItemNo(); GUIListItem item = GetItem(iItem); if (item == null) { return; } if (item.IsFolder) { if (item.Label == "..") { if (selectedItem != null) { selectedItem = null; } LoadDirectory(); return; } if (selectedItem == null) { selectedItem = item; } LoadDirectory(); return; } Schedule schedule = item.TVTag as Schedule; if (schedule == null) { return; } if (schedule.ScheduleType == (int)ScheduleRecordingType.Once) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); if (null != dlgYesNo) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording? dlgYesNo.SetLine(1, schedule.ReferencedChannel().DisplayName); dlgYesNo.SetLine(2, schedule.ProgramName); dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure dlgYesNo.DoModal(GUIWindowManager.ActiveWindow); if (dlgYesNo.IsConfirmed) { if (schedule.ScheduleType == (int)ScheduleRecordingType.Once) { schedule.Delete(); selectedItem = null; } } } } else // advanced recording { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(schedule.ProgramName); dlg.AddLocalizedString(981); //Delete this recording dlg.AddLocalizedString(982); //Delete series recording dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 981: //delete specific series CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime); canceledSchedule.Persist(); selectedItem = null; TvServer server = new TvServer(); server.OnNewSchedule(); break; case 982: //Delete entire recording schedule.Delete(); selectedItem = null; break; } } } LoadDirectory(); }
protected override void OnShowContextMenu() { GUIListItem item = facadeLayout.SelectedListItem; if (item == null) { return; } int itemNo = facadeLayout.SelectedListItemIndex; GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(498); // menu dlg.AddLocalizedString(4552); // Play now if (g_Player.Playing && g_Player.IsMusic) { dlg.AddLocalizedString(4551); // Play next } // only offer to queue items if // (a) playlist screen shows now playing list (_playlistIsCurrent is true) OR // (b) playlist screen is showing playlist (not what is playing) but music that is being played // is not from playlist (TEMP playlist is being used) if (_playlistIsCurrent || playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_MUSIC_TEMP) { dlg.AddLocalizedString(1225); // Queue item if (!item.IsFolder) { dlg.AddLocalizedString(1226); // Queue all items } } if (!_playlistIsCurrent) { dlg.AddLocalizedString(926); // add to playlist } dlg.AddLocalizedString(4521); // Show Album Info dlg.AddLocalizedString(4553); // Show playlist if (!item.IsFolder && !item.IsRemote) { Song song = item.AlbumInfoTag as Song; if (song.Id >= 0) { dlg.AddLocalizedString(930); //Add to favorites dlg.AddLocalizedString(931); //Rating } } if (handler.CurrentView == "271") { dlg.AddLocalizedString(718); //Clear top100 } dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 4521: // Show album info OnInfo(itemNo); break; case 4552: // Play now (clear playlist, play, and jump to Now playing) AddSelectionToCurrentPlaylist(true, false); break; case 4551: // Play next (insert after current song) InsertSelectionToPlaylist(false); break; case 1225: // queue item at end of current playlist AddSelectionToCurrentPlaylist(false, false); break; case 1226: // queue all items at end of current playlist AddSelectionToCurrentPlaylist(false, true); break; case 926: // add to playlist AddSelectionToPlaylist(); break; //case 136: // show playlist case 4553: // show playlist GUIWindowManager.ActivateWindow((int)Window.WINDOW_MUSIC_PLAYLIST); break; case 930: // add to favorites AddSongToFavorites(item); break; case 931: // Rating OnSetRating(facadeLayout.SelectedListItemIndex); break; case 718: // Clear top 100 m_database.ResetTop100(); LoadDirectory("db_view"); break; } }
public void ManualSelect3DFormat(VideoFormat preSelected) { _dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (_dlgMenu != null) { _dlgMenu.Reset(); _dlgMenu.SetHeading("Select 2D/3D Format for TV"); if (preSelected == VideoFormat.Fmt2D) { _dlgMenu.Add("2D"); } if (preSelected == VideoFormat.Fmt2D || preSelected == VideoFormat.Fmt3DSBS) { _dlgMenu.Add("3D Side by Side"); _dlgMenu.Add("3D SBS -> 2D via MediaPortal"); } if (preSelected == VideoFormat.Fmt2D || preSelected == VideoFormat.Fmt3DTAB) { _dlgMenu.Add("3D Top and Bottom"); _dlgMenu.Add("3D TAB -> 2D via MediaPortal"); } if (bConvert2Dto3DEnabled && preSelected == VideoFormat.Fmt2D) { _dlgMenu.Add("2D -> 3D SBS via MediaPortal"); } if (_currentMode == VideoFormat.Fmt3DSBS || _currentMode == VideoFormat.Fmt3DTAB) { if (!GUIGraphicsContext.Switch3DSides) { _dlgMenu.Add("3D Reverse Mode"); } else { _dlgMenu.Add("3D Normal Mode"); } } if (_activeDevice.IsDefined(VideoFormat.Fmt2D3D)) { _dlgMenu.Add("2D -> 3D via TV"); } _dlgMenu.DoModal((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); Log.Info("Auto3D: Manually selected " + _dlgMenu.SelectedLabelText); switch (_dlgMenu.SelectedLabelText) { case "2D": _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt2D); GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.None; _currentMode = VideoFormat.Fmt2D; break; case "3D Side by Side": _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt3DSBS); GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.SideBySide; _currentMode = VideoFormat.Fmt3DSBS; break; case "3D Top and Bottom": _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt3DTAB); GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.TopAndBottom; _currentMode = VideoFormat.Fmt3DTAB; break; case "2D -> 3D via TV": _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt2D3D); GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.None; _currentMode = VideoFormat.Fmt2D3D; break; case "3D SBS -> 2D via MediaPortal": _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt2D); GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.SideBySideTo2D; _currentMode = VideoFormat.Fmt2D; break; case "3D TAB -> 2D via MediaPortal": _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt2D); GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.TopAndBottomTo2D; _currentMode = VideoFormat.Fmt2D; break; case "3D Reverse Mode": GUIGraphicsContext.Switch3DSides = true; break; case "3D Normal Mode": GUIGraphicsContext.Switch3DSides = false; break; case "2D -> 3D SBS via MediaPortal": _activeDevice.SwitchFormat(_currentMode, VideoFormat.Fmt3DSBS); GUIGraphicsContext.Render3DMode = GUIGraphicsContext.eRender3DMode.SideBySideFrom2D; _currentMode = VideoFormat.Fmt3DSBS; break; } _dlgMenu = null; } }
protected override void OnShowSort() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } // Sorry for all the fuss with dlg selected index but there is a huge problem with it beacuse // sort methods are in enums and they are not separate per view. Because some sort methods are not // valid for share view we have problem with enums and dlg item index. I sorted out this by two // variables maxCommonSortIndex and dbSortCount but they are need to implement manually on every new // sort added. If there is a better way to handle this (with not meesing too much in code :)) I will // appreciate fix. dlg.Reset(); dlg.SetHeading(495); // Sort options int maxCommonSortIndex = -1; // Inrease by 1 when adding new common sort label(sort valid in share and db views)) int dbSortCount = 0; // increase by one when adding new database sort label // Watch for enums in VideoSort.cs - must be exactly as the enum order // Common sorts - group 1 dlg.AddLocalizedString(365); // 0 name maxCommonSortIndex++; dlg.AddLocalizedString(1309); // 1 nameall maxCommonSortIndex++; dlg.AddLocalizedString(104); // 2 date created (date) maxCommonSortIndex++; dlg.AddLocalizedString(105); // 3 size maxCommonSortIndex++; dlg.AddLocalizedString(527); // 4 watched maxCommonSortIndex++; // Database sorts - group 2 if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEO_TITLE) { dlg.AddLocalizedString(366); // 5 year dbSortCount++; dlg.AddLocalizedString(367); // 6 rating dbSortCount++; } // Share sorts - group 3 if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEOS) { dlg.AddLocalizedString(430); // 7 CD label dlg.AddLocalizedString(1221); // 8 date modified dlg.AddLocalizedString(1220); // 9 date created } // set the focus to currently used sort method // we need to correct index only if sort method enum is greater then max common sort index in share view if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEOS && // must be share view (int)CurrentSortMethod > maxCommonSortIndex) { dlg.SelectedLabel = (int)CurrentSortMethod - dbSortCount; } else { dlg.SelectedLabel = (int)CurrentSortMethod; } // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } CurrentSortAsc = true; switch (dlg.SelectedId) { case 365: CurrentSortMethod = VideoSort.SortMethod.Name; break; case 1309: CurrentSortMethod = VideoSort.SortMethod.NameAll; break; case 104: CurrentSortMethod = VideoSort.SortMethod.Date; CurrentSortAsc = false; break; case 1221: CurrentSortMethod = VideoSort.SortMethod.Modified; CurrentSortAsc = false; break; case 1220: CurrentSortMethod = VideoSort.SortMethod.Created; CurrentSortAsc = false; break; case 105: CurrentSortMethod = VideoSort.SortMethod.Size; break; case 366: CurrentSortMethod = VideoSort.SortMethod.Year; break; case 367: CurrentSortMethod = VideoSort.SortMethod.Rating; break; case 430: CurrentSortMethod = VideoSort.SortMethod.Label; break; case 527: CurrentSortMethod = VideoSort.SortMethod.Watched; break; default: CurrentSortMethod = VideoSort.SortMethod.Name; break; } OnSort(); GUIControl.FocusControl(GetID, btnSortBy.GetID); }
private void OnVideo() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu dlg.AddLocalizedString(6000); // MPEG2 dlg.AddLocalizedString(6036); // H264 dlg.AddLocalizedString(300212); // VC-1 dlg.AddLocalizedString(300213); // VC-1i dlg.AddLocalizedString(300214); // DivX/Xvid dlg.AddLocalizedString(300215); // Splitter dlg.AddLocalizedString(300216); // FileSplitter dlg.AddLocalizedString(6004); // Aspect Ratio dlg.AddLocalizedString(1029); // Subtitle if (_selectedOption != -1) { dlg.SelectedLabel = _selectedOption; } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } _selectedOption = dlg.SelectedLabel; switch (dlg.SelectedId) { case 6000: OnVideoCodec(); break; case 6036: OnH264VideoCodec(); break; case 6004: OnAspectRatio(); break; case 1029: OnSubtitle(); break; case 300212: OnVC1(); break; case 300213: OnVC1i(); break; case 300214: OnDivX(); break; case 300215: OnSplitter(); break; case 300216: OnSplitterFilesync(); break; } } }
public bool PromptUserLogin() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return(true); } //keep showing the dialog until the user closes it int selectedLabel; dlg.Reset(); dlg.SetHeading(Translation.SelectUser); if (CurrentUser != null) { string msgCurUser = string.Format(Translation.CurrentUser, CurrentUser.Username); dlg.Add(msgCurUser); dlg.Add("--------"); dlg.Add(">> " + Translation.LogOut); } List <JMMUser> allUsers = ShokoServerHelper.GetAllUsers(); foreach (JMMUser user in allUsers) { dlg.Add(user.Username); } dlg.DoModal(GUIWindowManager.ActiveWindow); selectedLabel = dlg.SelectedLabel; if (selectedLabel < 0) { return(false); } if (CurrentUser != null) { selectedLabel = selectedLabel - 3; } if (dlg.SelectedLabelText == ">> " + Translation.LogOut) { LogOut(true); return(false); } JMMUser selUser = allUsers[selectedLabel]; BaseConfig.MyAnimeLog.Write("Selected user label: " + selectedLabel); // try and auth user with a blank password bool authed = AuthenticateUser(selUser.Username, ""); string password = ""; while (!authed) { // prompt user for a password if (Utils.DialogText(ref password, true, GUIWindowManager.ActiveWindow)) { authed = AuthenticateUser(selUser.Username, password); if (!authed) { Utils.DialogMsg(Translation.Error, Translation.IncorrectPasswordTryAgain); } } else { return(false); } } SetCurrentUser(selUser); return(true); }
private void OnVideoCodec() { ArrayList availableVideoFilters = FilterHelper.GetFilters(MediaType.Video, MediaSubTypeEx.MPEG2); while (availableVideoFilters.Contains("CyberLink MPEG Muxer")) { availableVideoFilters.Remove("CyberLink MPEG Muxer"); } while (availableVideoFilters.Contains("Ulead MPEG Muxer")) { availableVideoFilters.Remove("Ulead MPEG Muxer"); } while (availableVideoFilters.Contains("PDR MPEG Muxer")) { availableVideoFilters.Remove("PDR MPEG Muxer"); } while (availableVideoFilters.Contains("Nero Mpeg2 Encoder")) { availableVideoFilters.Remove("Nero Mpeg2 Encoder"); } availableVideoFilters.Sort(); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { OnVideo(); return; } dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu int selected = 0; int count = 0; foreach (string codec in availableVideoFilters) { dlg.Add(codec); //delete if (codec == _strVideoCodec) { selected = count; } count++; } dlg.SelectedLabel = selected; dlg.DoModal(GetID); if (dlg.SelectedLabel < 0) { OnVideo(); return; } _strVideoCodec = (string)availableVideoFilters[dlg.SelectedLabel]; OnVideo(); }
internal void MyContextMenu() { try { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(924); //Play Menu Item GUIListItem pItem = new GUIListItem(Translation.Play); dlg.Add(pItem); pItem.ItemId = 1; //Add Watched/Unwatched Filter Menu Item if (!Utils.LatestTVRecordingsWatched) { pItem = new GUIListItem(Translation.ShowUnwatchedRecordings); dlg.Add(pItem); pItem.ItemId = 2; } else { pItem = new GUIListItem(Translation.ShowAllRecordings); dlg.Add(pItem); pItem.ItemId = 2; } //Show Dialog dlg.DoModal(Utils.ActiveWindow); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 1: { // parent.CurrentFacade.Facade = Utils.GetLatestsFacade(parent.CurrentFacade.ControlID); if (parent.CurrentFacade.Facade != null) { PlayRecording(parent.CurrentFacade.Facade.SelectedListItem.ItemId); } break; } case 2: { Utils.LatestTVRecordingsWatched = !Utils.LatestTVRecordingsWatched; GetArgusRecordings(); break; } } } catch (Exception ex) { logger.Error("MyContextMenu: " + ex.ToString()); } }
public override void OnAction(Action action) { if (action.wID == Action.ActionType.ACTION_SELECT_ITEM || action.wID == Action.ActionType.ACTION_MOUSE_CLICK) { int controlId = GetFocusControlId(); if (controlId >= 1000 && controlId <= 9008) { // Show dialog CellControl cntlFoc = (CellControl)GetControl(controlId); int row = (controlId / 1000) - 1; int column = controlId % 1000; if (cntlFoc.editable) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(19116)); // Cell value for (int index = 1; index < 10; index++) { dlg.Add(""); } dlg.Add(GUILocalizeStrings.Get(19117)); // Clear cell dlg.SelectedLabel = cntlFoc.CellValue - 1; dlg.DoModal(GetWindowId()); if (dlg.SelectedLabel < 0) { return; } else { if (dlg.SelectedId == 10) { cntlFoc.CellValue = 0; grid.cells[row, column] = 0; } else { if (!_Settings.Block || cntlFoc.SolutionValue == dlg.SelectedId) { cntlFoc.CellValue = dlg.SelectedId; grid.cells[row, column] = dlg.SelectedId; if (this.GridIsComplete()) { this.Result(); } } } } } CheckCandidates(); } } } else if (action.wID == Action.ActionType.ACTION_KEY_PRESSED || (action.wID >= Action.ActionType.REMOTE_0 && action.wID <= Action.ActionType.REMOTE_9)) { int controlId = GetFocusControlId(); if (controlId >= 1000 && controlId <= 9008) { CellControl cntlFoc = (CellControl)GetControl(controlId); int row = (controlId / 1000) - 1; int column = controlId % 1000; if (cntlFoc != null) { if (action.wID == Action.ActionType.ACTION_KEY_PRESSED) { if (action.m_key.KeyChar == 8) { cntlFoc.CellValue = 0; grid.cells[row, column] = 0; } else if (action.m_key.KeyChar == 35) // # { _nextNumberIsToggle = true; } else if (action.m_key.KeyChar == 42) // * { _nextNumberIsFilter = true; } } else if (action.wID >= Action.ActionType.REMOTE_0 && action.wID <= Action.ActionType.REMOTE_9) { int value = (action.wID - Action.ActionType.REMOTE_0); if (!_nextNumberIsToggle && !_nextNumberIsFilter) { if (value == 0 || !_Settings.Block || cntlFoc.SolutionValue == value) { cntlFoc.CellValue = value; grid.cells[row, column] = value; if (this.GridIsComplete()) { this.Result(); } } } else if (_nextNumberIsToggle) { if (value > 0) { if (cntlFoc.IsCandidate(value)) { cntlFoc.RemoveCandidate(value); } else { cntlFoc.SetCandidate(value); } } _nextNumberIsToggle = false; } else if (_nextNumberIsFilter) { _Settings.Filter = value; _Settings.ShowCandidates = true; _nextNumberIsFilter = false; } } CheckCandidates(); } } } else if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) { StopTimer(); } else if (action.wID == Action.ActionType.ACTION_CONTEXT_MENU) { ShowContextMenu(); } else if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) { StopTimer(); } base.OnAction(action); }
protected override void OnShowContextMenu() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); MusicDatabase dbs; if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(498); // Menu dlg.AddLocalizedString(930); //Add to favorites if (CurrentTrackTag.Album != null) { dlg.AddLocalizedString(33041); } if (PluginManager.IsPluginNameEnabled2("LastFMScrobbler")) { dlg.AddLocalizedString(34010); //last.fm love dlg.AddLocalizedString(34011); //last.fm ban } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } switch (dlg.SelectedId) { case 928: // Find Coverart if (_MusicWindow != null) { string albumFolderPath = Path.GetDirectoryName(CurrentTrackFileName); _MusicWindow.FindCoverArt(false, CurrentTrackTag.Artist, CurrentTrackTag.Album, albumFolderPath, CurrentTrackTag, -1); CurrentThumbFileName = GUIMusicBaseWindow.GetCoverArt(false, CurrentTrackFileName, CurrentTrackTag); if (CurrentThumbFileName.Length > 0) { // let us test if there is a larger cover art image string strLarge = Util.Utils.ConvertToLargeCoverArt(CurrentThumbFileName); if (Util.Utils.FileExistsInCache(strLarge)) { CurrentThumbFileName = strLarge; } AddImageToImagePathContainer(CurrentThumbFileName); UpdateImagePathContainer(); } } break; case 4521: // Show Album Info if (_MusicWindow != null) { string albumFolderPath = Path.GetDirectoryName(CurrentTrackFileName); if (_MusicWindow != null) { _MusicWindow.ShowAlbumInfo(GetID, CurrentTrackTag.Artist, CurrentTrackTag.Album); } } break; case 930: // add to favorites dbs = MusicDatabase.Instance; Song currentSong = new Song(); string strFile = g_Player.Player.CurrentFile; bool songFound = dbs.GetSongByFileName(strFile, ref currentSong); if (songFound) { if (currentSong == null) { return; } if (currentSong.Id < 0) { return; } currentSong.Favorite = true; dbs.SetFavorite(currentSong); } break; case 33041: //Play this album try { if (CurrentTrackTag != null) { dbs = MusicDatabase.Instance; ArrayList albumSongs = new ArrayList(); String strAlbum = CurrentTrackTag.Album; bool albumSongsFound = dbs.GetSongsByAlbum(strAlbum, ref albumSongs); if (albumSongsFound) { for (int i = albumSongs.Count - 1; i >= 0; i--) { Song song = (Song)albumSongs[i]; if (song.Title != CurrentTrackTag.Title && song.Artist == CurrentTrackTag.Artist) { AddSongToPlaylist(ref song); } } OnSongInserted(); } } } catch (Exception ex) { Log.Error("GUIMusicPlayingNow: error while adding album tracks for {0} - {1}", CurrentTrackTag.Album, ex.Message); } break; } }
internal void MyContextMenu() { try { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(924); //Add Details Menu Item //Play Menu Item GUIListItem pItem = new GUIListItem(Translation.Play); dlg.Add(pItem); pItem.ItemId = 1; pItem = new GUIListItem(Translation.MovieDetails); dlg.Add(pItem); pItem.ItemId = 2; //Add Watched/Unwatched Filter Menu Item if (CurrentFacade.UnWatched) { pItem = new GUIListItem(Translation.ShowUnwatchedMovies); dlg.Add(pItem); pItem.ItemId = 3; } else { pItem = new GUIListItem(Translation.ShowAllMovies); dlg.Add(pItem); pItem.ItemId = 3; } //Add Latests/Watched/Rated Menu Item pItem = new GUIListItem("[^] " + CurrentFacade.Title); dlg.Add(pItem); pItem.ItemId = 4; pItem = new GUIListItem(); pItem.Label = Translation.Update; pItem.ItemId = 5; dlg.Add(pItem); //Show Dialog dlg.DoModal(Utils.ActiveWindow); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 1: { PlayMovie(GUIWindowManager.GetWindow(Utils.ActiveWindow)); break; } case 2: { ShowInfo(); break; } case 3: { CurrentFacade.UnWatched = !CurrentFacade.UnWatched; MyVideosUpdateLatest(); break; } case 4: { IDialogbox ldlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (ldlg == null) { return; } ldlg.Reset(); ldlg.SetHeading(924); //Add Types Menu Items pItem = new GUIListItem((CurrentFacade.Type == LatestsFacadeType.Latests ? "[x] " : string.Empty) + Translation.LabelLatestAdded); ldlg.Add(pItem); pItem.ItemId = 1; pItem = new GUIListItem((CurrentFacade.Type == LatestsFacadeType.Watched ? "[x] " : string.Empty) + Translation.LabelLatestWatched); ldlg.Add(pItem); pItem.ItemId = 2; pItem = new GUIListItem((CurrentFacade.Type == LatestsFacadeType.Rated ? "[x] " : string.Empty) + Translation.LabelHighestRated); ldlg.Add(pItem); pItem.ItemId = 3; //Show Dialog ldlg.DoModal(Utils.ActiveWindow); if (ldlg.SelectedLabel == -1) { return; } switch (ldlg.SelectedId - 1) { case 0: CurrentFacade.Type = LatestsFacadeType.Latests; break; case 1: CurrentFacade.Type = LatestsFacadeType.Watched; break; case 2: CurrentFacade.Type = LatestsFacadeType.Rated; break; } MyVideosUpdateLatest(); break; } case 5: { MyVideosUpdateLatest(); break; } } } catch (Exception ex) { logger.Error("MyContextMenu: " + ex.ToString()); } }