Пример #1
0
        /// <summary>
        /// The main function of the the tester program.
        /// </summary>
        public static void Main()
        {
            var playerState = new MockPlayerState();
            var nowPlaying  = new MockNowPlaying();
            var player      = new MockPlayer(playerState, nowPlaying);
            var library     = new MockLibrary();

            var libraryApiAdapter    = new LibraryApiAdapter(library);
            var nowPlayingApiAdapter = new NowPlayingApiAdapter(nowPlaying, player);
            var outputApiAdapter     = new MockOutputApiAdapter();
            var playerApiAdapter     = new MockPlayerApiAdapter(playerState, player);
            var queueAdapter         = new QueueAdapter();
            var trackApiAdapter      = new TrackApiAdapter(player);
            var baseStoragePath      = Path.GetTempPath();

            var dependencies = new MusicBeeDependencies(
                libraryApiAdapter,
                nowPlayingApiAdapter,
                outputApiAdapter,
                playerApiAdapter,
                queueAdapter,
                trackApiAdapter,
                null,
                baseStoragePath,
                "1.0.0");

            var remoteBootstrap      = new RemoteBootstrap();
            var musicBeeRemotePlugin = remoteBootstrap.BootStrap(dependencies);

            musicBeeRemotePlugin.Start();

            while (true)
            {
                Console.WriteLine(Resources.Input);
                var line = Console.ReadLine();
                if (line != "q!")
                {
                    continue;
                }

                musicBeeRemotePlugin.Terminate();
                remoteBootstrap.Dispose();
                Console.WriteLine(Resources.Quitting);
                break;
            }
        }
Пример #2
0
 /// <summary>
 /// Called by MusicBee when it closes the Remote plugin for any reason.
 /// </summary>
 /// <param name="reason">The reason for the plugin close.</param>
 public void Close(PluginCloseReason reason)
 {
     // Terminated the plugin core, when the plugin received the close event
     _musicBeeRemotePlugin.Terminate();
     _bootstrap.Dispose();
 }