public override void OnAction(MediaPortal.GUI.Library.Action action) { // do nothing when we are not initialized if (!initComplete) return; switch (action.wID) { case MediaPortal.GUI.Library.Action.ActionType.ACTION_PARENT_DIR: GUIWindowManager.ShowPreviousWindow(); break; case MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU: if (browser.CurrentView == BrowserViewMode.DETAILS) { if (browser.TopLevelView == BrowserViewMode.DETAILS) { //the skin opened movingpictures to show movie details -> return to mp on back browser.SelectedMovie = null; GUIWindowManager.ShowPreviousWindow(); } else { // return to the one of the facade screens browser.CurrentView = browser.PreviousView; } } else if (remoteFilter.Active) { // if a remote filter is active remove it remoteFilter.Clear(); } else if (searchFilter != null) { browser.Filters.Remove(searchFilter); browser.ReAddCategoryFilters(); browser.CurrentView = browser.PreviousView; searchFilter = null; OnBrowserContentsChanged(); if (SearchStringLoadParameter != null) GUIWindowManager.ShowPreviousWindow(); } else if (browser.CategoriesAvailable && browser.CurrentNode != null && browser.CurrentNode != browser.TopLevelNode) { // go to the parent category browser.CurrentNode = browser.CurrentNode.Parent; } else { // The user presses back in the topmost node -> clear the history and exit browser.LastNode = null; browser.LastView = BrowserViewMode.CATEGORIES; browser.LastSelectedMovie = null; browser.SelectedMovie = null; // show previous screen (exit the plug-in) GUIWindowManager.ShowPreviousWindow(); } break; case MediaPortal.GUI.Library.Action.ActionType.ACTION_PLAY: case MediaPortal.GUI.Library.Action.ActionType.ACTION_MUSIC_PLAY: // don't be confused, this in some cases is the generic PLAY action playSelectedMovie(); break; case MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED: // if remote filtering is active, try to route the keypress through the filter bool remoteFilterEnabled = MovingPicturesCore.Settings.UseRemoteControlFiltering; if (remoteFilterEnabled && browser.CurrentView != BrowserViewMode.DETAILS && browser.CurrentView != BrowserViewMode.CATEGORIES) { // try to update the filter bool changedFilter = false; if (action.m_key != null) changedFilter = remoteFilter.KeyPress((char)action.m_key.KeyChar); // if update failed (an incorrect key press?) use standard key processing if (!changedFilter) base.OnAction(action); } // basic keypress functionality else { base.OnAction(action); } break; case MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_UP: int _loopDelay = 100; // wait at the last item this amount of msec until loop to the last item // if the user is holding the up key, don't go past index 1 // we need to do this ourselves because the GUIListControl is hard coded to stop at index 0 // index 0 is a group header in our case, so we want to stop at 1 instead if (!(browser.CurrentView == BrowserViewMode.LIST && MovingPicturesCore.Settings.AllowGrouping && browser.Facade.SelectedListItemIndex == 1 && AnimationTimer.TickCount - _lastCommandTime < _loopDelay )) { base.OnAction(action); } _lastCommandTime = AnimationTimer.TickCount; break; case MediaPortal.GUI.Library.Action.ActionType.ACTION_PAGE_UP: lock (browser.Facade) { base.OnAction(action); if ((browser.CurrentView == BrowserViewMode.LIST && MovingPicturesCore.Settings.AllowGrouping && browser.Facade.SelectedListItemIndex == 0 )) { browser.Facade.SelectedListItemIndex = 1; } } break; default: base.OnAction(action); break; } }
private bool Search(SearchMode mode, string searchStr) { var searchResults = MovingPicturesCore.Searchers[mode].Search(searchStr); var movies = searchResults.Select(result => result.Item); if (movies.Count() == 0) { ShowMessage(Translation.Search, Translation.SearchNoResults); return false; } if (searchFilter != null) { browser.Filters.Remove(searchFilter); browser.ReAddCategoryFilters(); } searchFilter = new WhiteListFilter(movies); browser.TemporarilyRemoveCategoryFilters(); browser.Filters.Add(searchFilter); browser.CurrentView = BrowserViewMode.LIST; return true; }