public NeoPlayerWindow() { neoServer = new NeoServer(); neoServer.OnMessage += OnMessage; neoServer.OnConnect += OnConnect; neoServer.Run(Settings.Port); status = new Status(neoServer); updateState = new SingleRunner(UpdateState); slides.CollectionChanged += (s, e) => updateState.Signal(); music.CollectionChanged += (s, e) => updateState.Signal(); queue.CollectionChanged += (s, e) => { status.Queue = queue.Select(videoFile => videoFile.VideoFileID).ToList(); updateState.Signal(); }; InitializeComponent(); // Keep screen/computer on Win32.SetThreadExecutionState(Win32.ES_CONTINUOUS | Win32.ES_DISPLAY_REQUIRED | Win32.ES_SYSTEM_REQUIRED); var random = new Random(); Directory.EnumerateFiles(Settings.MusicPath).OrderBy(x => random.Next()).Select(fileName => new MusicFile { FileName = fileName, Title = Path.GetFileNameWithoutExtension(fileName) }).ForEach(file => music.Add(file)); SlidesQuery = Helpers.Debug ? "test" : "saved:pics"; SlidesSize = "2mp"; SlideDisplayTime = 60; SlidesPlaying = true; VideoState = null; MusicState = null; Volume = 50; mediaPlayer.MediaEnded += (s, e) => { AddHistory(); MediaForward(); }; mediaPlayer.MediaFailed += (s, e) => MediaForward(); changeSlideTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(0.25) }; changeSlideTimer.Tick += (s, e) => CheckCycleSlide(); changeSlideTimer.Start(); UpdateVideoFiles(); status.History = new List <int>(); status.Queue = new List <int>(); status.Downloads = new List <DownloadData>(); }