internal void SetSong(Song song) { try { Song = song; // Make sure the check was performed before trying to load it. Song.Verify(); // Prevent exceptions by testing the existence of the file itself. // DesignMode must be checked since the FileReader must not load // design data. if (Song != null && Song.Valid && !DesignModeChecker.IsInDesignMode()) { Mp3Reader = new Mp3FileReader(Song.FilePath); TotalTime = Mp3Reader.TotalTime; } } catch (DirectoryNotFoundException e) { this.logger.Log(e.Message, Category.Exception, Priority.High); } catch (FileNotFoundException e) { this.logger.Log(e.Message, Category.Exception, Priority.High); } }
private void HandleTimerTick(object sender, EventArgs e) { // In design mode the reader is not instantiated due to requiring a path. if (!DesignModeChecker.IsInDesignMode()) { // Prevent stuttering. this.isTimerTickSetter = true; CurrentTime = Mp3Reader.CurrentTime; this.isTimerTickSetter = false; } }