Пример #1
0
        public void Reset()
        {
            IResetable channelModule = (IResetable)ChannelModule;

            channelModule.Reset();
            VolumeModule.Reset();
            InvokeEventStatusChanged(String.Format("{0}:\t \"{1}\" has reseted.", this.GetType(), name));
        }
Пример #2
0
 public void VolumeDown()
 {
     if (VolumeModule.Down())
     {
         InvokeEventStatusChanged(String.Format("{0}:\t \"{1}\" has changed the volume level to {2}.", this.GetType(), name, VolumeLevel));
     }
     else
     {
     }
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserInterfaceModule" /> class.
 /// </summary>
 /// <param name="application">The application.</param>
 /// <param name="userInterfaceBridge">The user interface framework.</param>
 /// <param name="controlsModule">The controls module.</param>
 /// <param name="musicPlayer">The music player.</param>
 /// <param name="playerModule">The player module.</param>
 /// <param name="volumeModule">The volume module.</param>
 /// <param name="allowShutdown">if set to <c>true</c> [allow shutdown].</param>
 /// <param name="lifecycleConfiguration">The lifecycle configuration.</param>
 /// <param name="timeoutConfiguration">The timeout configuration.</param>
 /// <param name="reporters">The reporters.</param>
 public UserInterfaceModule(
     IApplication application,
     IUserInterfaceBridge userInterfaceBridge,
     IControlsModule controlsModule,
     IMusicPlayer musicPlayer,
     PlayerModule playerModule,
     VolumeModule volumeModule,
     bool allowShutdown,
     ILifecycleConfiguration lifecycleConfiguration,
     ITimeoutConfiguration timeoutConfiguration,
     Reporters?reporters = null)
 {
     this.application            = application;
     this.userInterfaceBridge    = userInterfaceBridge;
     this.controlsModule         = controlsModule;
     this.musicPlayer            = musicPlayer;
     this.playerModule           = playerModule;
     this.volumeModule           = volumeModule;
     this.allowShutdown          = allowShutdown;
     this.lifecycleConfiguration = lifecycleConfiguration;
     this.timeoutConfiguration   = timeoutConfiguration;
     this.reporters = reporters;
 }
Пример #4
0
        /// <summary>
        /// Starts the asynchronous.
        /// </summary>
        /// <param name="allowShutdown">if set to <c>true</c> [allow shutdown].</param>
        /// <returns>
        /// An async task.
        /// </returns>
        public async Task StartAsync(bool allowShutdown)
        {
            this.logger.Verbose("Create GpioConnectionDriverFactory");
            var gpioConnectionDriverFactory = this.CreateGpioConnectionDriverFactory();

            // Create Startup Module
            this.logger.Verbose("Create Startup module");
            var startupModuleFactory = this.CreateStartupModule(this.application, gpioConnectionDriverFactory);
            var startupModule        = await startupModuleFactory.StartupModule.ConfigureAwait(false);

            this.logger.Verbose("Navigate to Startup view");
            await startupModule.NavigateToStartupViewAsync().ConfigureAwait(false);

            // Create required ApplicationServices-required system boundaries modules
            this.logger.Verbose("Create Repositories Module");
            var repositoriesModule = this.CreateRepositoriesModule();

            this.logger.Verbose("Initialize Repositories Module");
            var repositoriesModuleTask = repositoriesModule.InitializeAsync().ConfigureAwait(false);

            // Create domain required application modules
            this.logger.Verbose("Create LastPlaylist Module");
            var lastPlaylistModule = new LastPlaylistModule(repositoriesModule.LastPlaylistRepository);

            // Create domain modules
            this.logger.Verbose("Create Playlist Module");
            var playlistModule = new PlaylistModule(lastPlaylistModule.LastPlaylistChangeHandler);

            // Create application required system boundaries modules
            this.logger.Verbose("Create Controls Module");
            var controlsModuleFactory = this.CreateControlsModule(gpioConnectionDriverFactory);
            var controlsModule        = await controlsModuleFactory.ControlsModule;

            // Create music control module.
            var musicControlModule = this.CreateMusicControlModule();
            await musicControlModule.InitializeAsync().ConfigureAwait(false);

            this.logger.Verbose("Create System services");
            var systemServicesModule = this.CreateSystemServicesModule();
            await systemServicesModule.InitializeAsync().ConfigureAwait(false);

            // Create application modules
            this.logger.Verbose("Create Player Module");
            var playerModule = this.CreatePlayerModule(repositoriesModule, playlistModule, musicControlModule);
            await playerModule.InitializeAsync().ConfigureAwait(false);

            this.logger.Verbose("Create Volume Module");
            var volumeModule = new VolumeModule(
                controlsModule.Amplifier,
                musicControlModule.MusicPlayer,
                musicControlModule.MusicPlayer,
                repositoriesModule.VolumeRepository,
                new Percentage(0.05),
                new VolumeServiceLogger(this.logger));
            await repositoriesModuleTask;
            await volumeModule.InitializeAsync().ConfigureAwait(false);

            // Create user interface modules
            this.logger.Verbose("Create UserInterface Module");
            var userInterfaceModule = new UserInterfaceModule(
                this.application,
                startupModule,
                controlsModule,
                musicControlModule.MusicPlayer,
                playerModule,
                volumeModule,
                allowShutdown,
                startupModule.LifecycleConfiguration,
                await repositoriesModule.ConfigurationRepository.GetConfigurationAsync().ConfigureAwait(false),
                new Reporters(
                    new InteractionControllerLogger(this.logger),
                    new SystemActivityAggregatorLogger(this.logger),
                    new IdleMonitorLogger(this.logger),
                    new PlayerControllerLogger(this.logger),
                    new VolumeControllerLogger(this.logger),
                    new ShutdownControllerLogger(this.logger),
                    new ViewNavigatorLogger(this.logger),
                    new DisplayStateControllerLogger(this.logger),
                    this.disposableLogger));

            this.disposer = new Disposer(
                this.disposableLogger,
                new DisposeAction(async() => await repositoriesModule.PlaylistRepository.SaveAsync().ConfigureAwait(false)),
                userInterfaceModule,
                musicControlModule,
                controlsModuleFactory,
                startupModuleFactory,
                gpioConnectionDriverFactory);

            this.logger.Verbose("Initialize Playlist Module");
            await playlistModule.InitializeAsync().ConfigureAwait(false);

            this.logger.Verbose("Initialize UserInterface Module");
            await userInterfaceModule.InitializeAsync().ConfigureAwait(false);

            await userInterfaceModule.ViewNavigator.NavigateToPlayerViewAsync().ConfigureAwait(false);
        }
Пример #5
0
 void Reset()
 {
     master = new VolumeModule(1f);
     game   = new VolumeModule(.8f);
     music  = new VolumeModule(.45f);
 }