Beispiel #1
0
 private void Player_SongChanged(object sender, EventArgs e)
 {
     try
     {
         var trackingEntry = new TrackingEntry
         {
             DatePlayed = DateTime.Now,
             Track      = new DatabaseTrack
             {
                 Path        = window.Player.FilePath,
                 Artist      = window.CurrentTrack.Artist,
                 Title       = window.CurrentTrack.Title,
                 Album       = window.CurrentTrack.Album,
                 TrackNumber = window.CurrentTrack.TrackNumber,
                 Length      = window.CurrentTrack.Duration
             }
         };
         TrackingFile.Entries.Add(trackingEntry);
         LoggingHandler.Log("Playtime Logging: Entry created!");
     }
     catch (Exception ex)
     {
         LoggingHandler.Log($"Playtime Logging: Exception was thrown - {ex}");
         // ignored
     }
 }
Beispiel #2
0
        public PlaytimeTrackingHandler(MainWindow window)
        {
            LoggingHandler.Log("Starting Playtime Logging Handler");

            this.window  = window;
            FilePath     = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FRESHMusicPlayer", "Tracking");
            TrackingFile = Read();

            window.Player.SongChanged += Player_SongChanged;
        }
        public PlaytimeTrackingHandler(MainWindow window)
        {
            LoggingHandler.Log("Starting Playtime Logging Handler");

            this.window  = window;
            FilePath     = Path.Combine(App.DataFolderLocation, "Tracking");
            TrackingFile = Read();

            window.Player.SongChanged += Player_SongChanged;
        }