public ApplicationState() { IsServerHostedMode = false; //Assume locally-hosted book mode by default. SidePanelMode = SidePanelDisplayMode.Hidden; PlayerState = new PlayerState(this); DisplaySettingsState = new DisplaySettingsState(); SearchState = new SearchState(); NavigationState = new NavigationState(); }
/// <summary> /// /// </summary> /// <param name="view"></param> /// <param name="mainPresenter"></param> /// <param name="mainState"></param> public PlayerPresenter(IPlayerView view, ApplicationPresenter mainPresenter, ApplicationState mainState) { View = view; View.SetPresenterReference(this); // View events View.DownLevel += View_DownLevel; View.UpLevel += View_UpLevel; View.NextSection += View_NextSection; View.PreviousSection += View_PreviousSection; View.TogglePlayPause += View_TogglePlayPause; View.SetBookmark += View_SetBookmark; View.AudioCompleted += View_AudioCompleted; View.VolumeChanged += View_VolumeChanged; View.PreviousPage += View_PreviousPage; View.NextPage += view_NextPage; View.ToggleSelfVoicing += new EventHandler(View_ToggleSelfVoicing); View.ToggleMuting += new EventHandler(View_ToggleMuting); View.SelfVoicingSpeakText += View_SelfVoicingSpeakText; View.SpeakableElementSelected += View_SpeakableElementSelected; View.SectionChanged += View_SectionChanged; // Hook into relevent dependent view events View.ApplicationView.BookChanged += ApplicationView_BookChanged; View.ApplicationView.BookLoadStarted += ApplicationView_BookLoadStarted; View.ApplicationView.BookLoadFailed += ApplicationView_BookLoadFailed; View.ApplicationView.BookDisplayed += ApplicationView_BookDisplayed; View.ApplicationView.DisplaySurface.ItemSelected += DisplaySurface_ItemSelected; View.ApplicationView.DisplaySurface.GestureRaised += DisplaySurface_GestureRaised; View.NavigationView.ItemSelected += NavigationView_ItemSelected; View.SearchView.NavigateToPage += SearchView_NavigateToPage; View.SearchView.SearchForSection += SearchView_SearchForSection; View.SearchView.SearchSelected += SearchView_SearchSelected; // Initialise Button State View.SetNavButtonState(false); View.SetPlayButtonState(false, false); _mainPresenter = mainPresenter; base.MainState = mainState; _state = MainState.PlayerState; _state.PresentPhrase = PlayPhrase; _timer = new DispatcherTimer(); _timer.Interval = new TimeSpan(0, 0, 0); _timer.Tick += new EventHandler(MoveNextEvent); }