public ExhibitDetailsViewModel(IList <Page> pages, string title, bool additionalInformation = false)
        {
            this.additionalInformation = additionalInformation;
            AdjustToolbarColor();

            // stop audio if necessary
            IAudioPlayer player = IoCManager.Resolve <IAudioPlayer> ();

            if (player.IsPlaying)
            {
                player.Stop();
            }

            // init the audio toolbar
            AudioToolbar = new AudioToolbarViewModel(title);
            AudioToolbar.AudioPlayer.AudioCompleted += AudioPlayerOnAudioCompleted;

            // init the current view
            currentViewIndex = 0;
            this.pages       = pages;
            SetCurrentView().ConfigureAwait(true);
            Title = title;

            if (pages.Count > 1)
            {
                NextViewAvailable = true;
            }

            // init commands
            NextViewCommand                  = new Command(async() => await GotoNextView());
            PreviousViewCommand              = new Command(GotoPreviousView);
            ShowAudioToolbarCommand          = new Command(SwitchAudioToolbarVisibleState);
            ShowAdditionalInformationCommand = new Command(ShowAdditionalInformation);
        }
        private AudioToolbarViewModel CreateSystemUnderTest(bool automaticallyStartAudio = false)
        {
            IoCManager.Clear();
            var audioPlayer = Substitute.For <IAudioPlayer> ();

            IoCManager.RegisterInstance(typeof(INavigationService), Substitute.For <INavigationService>());
            IoCManager.RegisterInstance(typeof(IAudioPlayer), audioPlayer);
            audioPlayer.MaximumProgress.Returns(42);

            var audio     = Substitute.For <Audio> ();
            var viewmodel = new AudioToolbarViewModel(automaticallyStartAudio, "Title");

            viewmodel.SetNewAudioFile(audio);

            return(viewmodel);
        }
예제 #3
0
        private AudioToolbarViewModel CreateSystemUnderTest()
        {
            IoCManager.Clear();
            var audioPlayer = Substitute.For <IAudioPlayer>();

            IoCManager.RegisterInstance(typeof(INavigationService), Substitute.For <INavigationService>());
            IoCManager.RegisterInstance(typeof(IAudioPlayer), audioPlayer);
            IoCManager.RegisterInstance(typeof(IMediaFileManager), new DummyMediaFileManager());
            audioPlayer.MaximumProgress.Returns(42);

            var audio     = Substitute.For <Audio>();
            var viewmodel = new AudioToolbarViewModel("Title", true);

            viewmodel.SetNewAudioFile(audio);

            return(viewmodel);
        }