Ejemplo n.º 1
0
        /// <summary></summary>
        /// <param name="spotifyProcessManager"></param>
        /// <param name="songClassificationInfo"></param>
        /// <param name="refreshInterval"></param>
        /// <param name="logger"></param>
        /// <param name="maxSongs">
        /// Note: -1 == infinite, and numbers between 0 and 10 inclusive are not allowed
        /// (in order to guarantee current and future internal functionality)
        /// </param>
        public SongTracker(SpotifyProcessManager spotifyProcessManager, SongClassificationInfo songClassificationInfo, int refreshInterval, Logger logger, int maxSongs = -1)
        {
            if (maxSongs >= 0 && maxSongs <= 10)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(maxSongs),
                          maxSongs,
                          "To guarantee correctness of current and any future internal functionality, "
                          + nameof(maxSongs) + " cannot be between 0 and 10 inclusive"
                          );
            }

            this.MaxSongs = maxSongs;

            this._songs = new List <SongInfo>();
            this.Songs  = _songs.AsReadOnly();

            this.SpotifyProcessManager  = spotifyProcessManager;
            this.SongClassificationInfo = songClassificationInfo;

            this.RefreshInterval = refreshInterval;

            this._logger = logger;

            this.State = TrackState.Unused;
        }
Ejemplo n.º 2
0
        public MainController(IEnumerable <LogHandler> logHandlers)
        {
            foreach (var handler in logHandlers)
            {
                handler.Provider = this;
            }

            this.Logger = (mesage, messageType) => LogMessageReceived?.Invoke(mesage, messageType);

            this.SettingsFolder = Application.StartupPath;             //StartupPath is just the folder, not the actual exe file path
            this.SettingsHost   = new SettingsHost(
                SettingsLoader.Load(
                    settingsFolder: this.SettingsFolder,
                    logger: Logger
                    )
                );
            this.SettingsSaver = new SettingsSaver(
                settingsHost: this.SettingsHost,
                settingsFolder: this.SettingsFolder,
                saveDelay: 60000,
                logger: Logger
                );
            this.SettingsHost.AnySettingChanged += delegate { this.SettingsSaver.SaveAfterWaiting(); };

            this._spotifyProcessManager = new SpotifyProcessManager(Logger);

            this.RecordingTabController = new RecordingTabController(this.SettingsHost, this._spotifyProcessManager, this.Logger);
            this.PlayerTabController    = new PlayerTabController(this.SettingsHost, this._spotifyProcessManager, this.Logger);
        }
Ejemplo n.º 3
0
 public SpotifyController(SpotifyProcessManager spotifyProcessManager)
 {
     this.SpotifyProcessManager = SpotifyProcessManager;
 }