예제 #1
0
        private static FakeSongLoadEngine CreateFakeLoadEngine(List <Song> songs)
        {
            var engine = new FakeSongLoadEngine(songs);

            LoaderFactory.SetLoaderInstance(new FakeAsyncSongLoader(engine, new FakeSongCollector(songs)));
            return(engine);
        }
예제 #2
0
        public IntroWindow(JukeViewModel viewModel)
        {
            InitializeComponent();
            DataContext    = viewModel;
            viewModel.View = this;

            viewModel.PropertyChanged += ViewModel_PropertyChanged;
            LoaderFactory.SetLoaderInstance(new AsyncSongLoader(new FileFinderEngine(),
                                                                new TaglibTagReaderFactory()
            {
                BackupFactory = new WmpTagReaderFactory()
            }));
        }
        public void LoadSongs_ViewControlNotifiedOnCompletion()
        {
            var songs  = ViewModelFaker.CreateSongs(1, 2, 1);
            var engine = CreateFakeLoadEngine(songs);

            var viewControl = new FakeViewControl("path");

            LoaderFactory.SetLoaderInstance(new FakeAsyncSongLoader(engine, new FakeSongCollector(songs)));

            var viewModel = CreateAdminViewModel(viewControl);

            viewModel.LoadSongs.Execute(this);
            engine.SignalComplete();
            IsTrue(viewControl.Completed);
        }
        public void LoadSongs_LoaderStartedWithPath()
        {
            var engine      = CreateFakeLoadEngine(ViewModelFaker.CreateSongs(1, 2, 1));
            var listener    = new EventListener(JukeController.Instance);
            var viewControl = new FakeViewControl("path");

            LoaderFactory.SetLoaderInstance(new FakeAsyncSongLoader(engine));

            var viewModel = CreateAdminViewModel(viewControl);

            viewModel.LoadSongs.Execute(this);

            AreEqual("path", engine.Path);
            IsTrue(listener.LoadInitiated);
        }
예제 #5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            JukeController.Instance.Player.RegisterPlayerEngine(new WmpPlayerEngine());
            LoaderFactory.SetLoaderInstance(new AsyncSongLoader(new FileFinderEngine(),
                                                                new TaglibTagReaderFactory()
            {
                BackupFactory = new WmpTagReaderFactory()
            }));
            LoaderFactory.SetLibraryLoaderInstance(new XmlSongReader("library.xml"));
            WriterFactory.SetWriterInstance(new XmlSongWriter("library.xml"));


            Logger.Start("juke.log");
            //Logger.ConsoleLog();
            Messenger.Log("Starting J.U.K.E.");
            this.DispatcherUnhandledException += App_DispatcherUnhandledException;
        }