Example #1
0
 public ApplicationSettingViewsService(
     ILogManager logManager,
     IDependencyResolverContainer container)
 {
     this.logger    = logManager.CreateLogger("ApplicationSettingViewsService");
     this.container = container;
 }
Example #2
0
        public GoogleMusicWebService(
            IDependencyResolverContainer container,
            ILogManager logManager,
            IGoogleMusicSessionService sessionService)
        {
            var httpClientHandler = new HttpClientHandler
            {
                UseCookies        = false,
                AllowAutoRedirect = false
            };

            this.httpClient = new HttpClient(httpClientHandler)
            {
                BaseAddress           = new Uri(OriginUrl),
                Timeout               = TimeSpan.FromSeconds(90),
                DefaultRequestHeaders =
                {
                    { HttpRequestHeader.UserAgent.ToString(), "Music Manager (1, 0, 54, 4672 - Windows)" }
                }
            };

            this.container      = container;
            this.sessionService = sessionService;

            this.logger = logManager.CreateLogger("GoogleMusicWebService");
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NavigationService"/> class.
 /// </summary>
 /// <param name="container">
 /// The container.
 /// </param>
 /// <param name="logManager">
 /// The log manager.
 /// </param>
 public NavigationService(
     IDependencyResolverContainer container,
     ILogManager logManager)
 {
     this.container = container;
     this.logger    = logManager.CreateLogger("NavigationService");
 }
Example #4
0
        public SettingsService(
            ILogManager logManager,
            IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
            this.logger          = logManager.CreateLogger("SettingsService");
            var localSettings   = ApplicationData.Current.LocalSettings;
            var roamingSettings = ApplicationData.Current.RoamingSettings;

            if (localSettings.Containers.ContainsKey(SettingsContainerKey))
            {
                this.settingsContainer = localSettings.Containers[SettingsContainerKey];
            }
            else
            {
                this.settingsContainer = localSettings.CreateContainer(
                    SettingsContainerKey, ApplicationDataCreateDisposition.Always);
            }

            if (roamingSettings.Containers.ContainsKey(RoamingSettingsContainerKey))
            {
                this.roamingSettingsContainer = roamingSettings.Containers[RoamingSettingsContainerKey];
            }
            else
            {
                this.roamingSettingsContainer = localSettings.CreateContainer(
                    RoamingSettingsContainerKey, ApplicationDataCreateDisposition.Always);
            }
        }
 public UpdatePluginTask(IApplicationPaths applicationPaths, IHttpClient httpClient,
                         IJsonSerializer jsonSerializer, ILogManager logManager, IZipClient zipClient)
 {
     _applicationPaths = applicationPaths;
     _httpClient       = httpClient;
     _jsonSerializer   = jsonSerializer;
     _logger           = logManager.CreateLogger <UpdatePluginTask>();
     _zipClient        = zipClient;
 }
 public AlbumArtCacheService(
     ILogManager logManager,
     IApplicationStateService stateService,
     ICachedAlbumArtsRepository cachedAlbumArtsRepository)
 {
     this.logger       = logManager.CreateLogger("AlbumArtCacheService");
     this.stateService = stateService;
     this.cachedAlbumArtsRepository = cachedAlbumArtsRepository;
 }
Example #7
0
 public GoogleMusicCurrentSongPublisher(
     ILogManager logManager,
     ISongsRepository songsRepository,
     IEventAggregator eventAggregator)
 {
     this.logger          = logManager.CreateLogger("GoogleMusicCurrentSongPublisher");
     this.songsRepository = songsRepository;
     this.eventAggregator = eventAggregator;
 }
 public MediaControlIntegration(
     ILogManager logManager,
     IPlayQueueService playQueueService,
     IDispatcher dispatcher)
 {
     this.logger           = logManager.CreateLogger("MediaControlIntegration");
     this.playQueueService = playQueueService;
     this.dispatcher       = dispatcher;
     this.playQueueService.StateChanged += this.StateChanged;
 }
Example #9
0
 internal void Initialize(
     IDependencyResolverContainer containerObject,
     ILogManager logManager,
     MainFramePresenter presenterObject)
 {
     this.container   = containerObject;
     this.presenter   = presenterObject;
     this.logger      = logManager.CreateLogger("MainFrame");
     this.DataContext = this.presenter;
 }
Example #10
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ILogManager logManager)
        {
            loggerFactory.AddSerilog(logManager.CreateLogger());

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseCors("CorsPolicy");

            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.All
            });

            //app.UseHttpsRedirection();
            app.Use(async(context, next) =>
            {
                await next();

                //have to ignore api urls here as otherwise we coulgn't get the correct response.
                //There must be a better way to ignore api calls though
                if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value) && !context.Request.Path.Value.StartsWith("/api/"))
                {
                    context.Request.Path = "/index.html"; // Put your Angular root page here
                    await next();
                }
            });

            app.UseDefaultFiles();

            // Set to UseStaticFile with Options to stop caching of static content
            app.UseStaticFiles(new StaticFileOptions
            {
                OnPrepareResponse = context =>
                {
                    var headers          = context.Context.Response.GetTypedHeaders();
                    headers.CacheControl = new CacheControlHeaderValue
                    {
                        NoCache = true,
                        NoStore = true
                    };
                }
            });

            app.UseMvcWithDefaultRoute();
            TypeMapper.Initialize(typeof(Owner));
            TypeMapper.Initialize(typeof(Account));
            Dapper.DefaultTypeMap.MatchNamesWithUnderscores = true;
        }
Example #11
0
 internal void InjectMethod(
     IDependencyResolverContainer container,
     IEventAggregator eventAggregator,
     ILogManager logManager,
     IDispatcher dispatcher)
 {
     this.Logger          = logManager.CreateLogger(this.GetType().Name);
     this.Dispatcher      = dispatcher;
     this.Container       = container;
     this.EventAggregator = eventAggregator;
 }
Example #12
0
 public SongsWebService(
     IGoogleMusicWebService googleMusicWebService,
     IGoogleMusicSessionService sessionService,
     ISettingsService settingsService,
     ILogManager logManager)
 {
     this.googleMusicWebService = googleMusicWebService;
     this.sessionService        = sessionService;
     this.settingsService       = settingsService;
     this.logger = logManager.CreateLogger("SongsWebService");
 }
Example #13
0
 public SongsService(
     ILogManager logManager,
     IEventAggregator eventAggregator,
     ISongsWebService songsWebService,
     ISongsRepository songsRepository)
 {
     this.eventAggregator = eventAggregator;
     this.songsWebService = songsWebService;
     this.songsRepository = songsRepository;
     this.logger          = logManager.CreateLogger("SongMetadataEditService");
 }
Example #14
0
 public InitialSynchronization(
     ILogManager logManager,
     IGoogleMusicSynchronizationService synchronizationService,
     ISongsCachingService songsCachingService,
     IAlbumArtCacheService albumArtCacheService)
 {
     this.dbContext = new DbContext();
     this.logger    = logManager.CreateLogger("InitialSynchronization");
     this.synchronizationService = synchronizationService;
     this.songsCachingService    = songsCachingService;
     this.albumArtCacheService   = albumArtCacheService;
 }
Example #15
0
        public void InitTest()
        {
            var _logger = _logm.CreateLogger(this.GetType());

            if (_logger.DebugIsEnabled)
            {
                _logger.Debug(_SEPARATORTEST);
                _logger.Debug($" Initialisation of {this.TestContext.TestName} Test.");
                _logger.Debug($" DeployDirectory: {this.TestContext.DeploymentDirectory} TestDir{this.TestContext.TestDir}.");
                _logger.Debug(_SEPARATORTEST);
            }
        }
 public GoogleMusicCurrentSongPublisher(
     ILogManager logManager,
     IApplicationStateService stateService,
     ISongsWebService songsWebService,
     ISongsRepository songsRepository,
     IEventAggregator eventAggregator)
 {
     this.logger          = logManager.CreateLogger("GoogleMusicCurrentSongPublisher");
     this.stateService    = stateService;
     this.songsWebService = songsWebService;
     this.songsRepository = songsRepository;
     this.eventAggregator = eventAggregator;
 }
Example #17
0
        public CurrentSongPublisherService(
            ILogManager logManager,
            ISettingsService settingsService,
            IDependencyResolverContainer container,
            IAlbumArtCacheService albumArtCacheService)
        {
            this.settingsService      = settingsService;
            this.container            = container;
            this.albumArtCacheService = albumArtCacheService;
            this.logger = logManager.CreateLogger("CurrentSongPublisherService");

            this.delayPublishersHoldUp = this.settingsService.GetValue(DelayPublishersSettingsKey, defaultValue: 15000);
        }
 public UserPlaylistsService(
     ILogManager logManager,
     IPlaylistsWebService webService,
     IUserPlaylistsRepository repository,
     ISongsRepository songsRepository,
     IEventAggregator eventAggregator)
 {
     this.logger          = logManager.CreateLogger("UserPlaylistsService");
     this.webService      = webService;
     this.repository      = repository;
     this.songsRepository = songsRepository;
     this.eventAggregator = eventAggregator;
 }
Example #19
0
 public GoogleMusicSynchronizationService(
     ILogManager logManager,
     ISettingsService settingsService,
     IPlaylistsWebService playlistsWebService,
     ISongsWebService songsWebService,
     IUserPlaylistsRepository userPlaylistsRepository)
 {
     this.logger                  = logManager.CreateLogger("GoogleMusicSynchronizationService");
     this.settingsService         = settingsService;
     this.playlistsWebService     = playlistsWebService;
     this.songsWebService         = songsWebService;
     this.userPlaylistsRepository = userPlaylistsRepository;
 }
        public RightRegionControlService(
            ILogManager logManager,
            IApplicationResources resources,
            IMainFrameRegionProvider regionProvider,
            IApplicationSettingViewsService settingsCommands)
        {
            this.logger           = logManager.CreateLogger("RightRegionControlService");
            this.resources        = resources;
            this.regionProvider   = regionProvider;
            this.settingsCommands = settingsCommands;

            this.UpdateAdControl();
            InAppPurchases.LicenseChanged += this.UpdateAdControl;
        }
 public AuthentificationService(
     IApplicationResources resources,
     ILogManager logManager,
     IGoogleAccountService googleAccountService,
     IGoogleMusicSessionService sessionService,
     IGoogleAccountWebService googleAccountWebService,
     IGoogleMusicWebService googleMusicWebService)
 {
     this.logger                  = logManager.CreateLogger("AuthentificationService");
     this.resources               = resources;
     this.googleAccountService    = googleAccountService;
     this.sessionService          = sessionService;
     this.googleAccountWebService = googleAccountWebService;
     this.googleMusicWebService   = googleMusicWebService;
 }
Example #22
0
        public ScreenLocker(
            ILogManager logManager,
            IDispatcher dispatcher,
            IEventAggregator eventAggregator,
            ISettingsService settingsService)
        {
            this.logger          = logManager.CreateLogger("ScreenLocker");
            this.dispatcher      = dispatcher;
            this.settingsService = settingsService;

            eventAggregator.GetEvent <SettingsChangeEvent>()
            .Where(e => e.Key == GoogleMusicSettingsServiceExtensions.LockScreenEnabledKey)
            .Subscribe(e => this.UpdateDisplayRequest());

            this.UpdateDisplayRequest();
        }
Example #23
0
        public GoogleAccountWebService(ILogManager logManager)
        {
            this.logger = logManager.CreateLogger("GoogleAccountWebService");

            this.httpClientHandler = new HttpClientHandler
            {
                CookieContainer = new CookieContainer(),
                UseCookies      = true
            };

            // Log information about Proxy settings
            if (this.logger.IsDebugEnabled)
            {
                try
                {
                    this.logger.Debug("Supports Proxy: {0}", this.httpClientHandler.SupportsProxy);
                    this.logger.Debug("UseProxy: {0}", this.httpClientHandler.UseProxy);
                    this.logger.Debug("Proxy: {0}", this.httpClientHandler.Proxy);
                    if (this.httpClientHandler.Proxy != null)
                    {
                        this.logger.Debug("Proxy: {0}", this.httpClientHandler.Proxy);
                    }

                    if (WebRequest.DefaultWebProxy != null)
                    {
                        this.logger.Debug("DefaultWebProxy: {0}", WebRequest.DefaultWebProxy);
                        this.logger.Debug("DefaultWebProxy.IsBypassed: {0}", WebRequest.DefaultWebProxy.IsBypassed(new Uri("https://www.google.com")));
                        this.logger.Debug("DefaultWebProxy.GetProxy: {0}", WebRequest.DefaultWebProxy.GetProxy(new Uri("https://www.google.com")));
                    }
                }
                catch (Exception e)
                {
                    this.logger.Warning(e, "Exception while tried to get proxy settings");
                }
            }

            this.httpClient = new HttpClient(this.httpClientHandler)
            {
                BaseAddress           = new Uri("https://www.google.com"),
                Timeout               = TimeSpan.FromSeconds(60),
                DefaultRequestHeaders =
                {
                    { HttpRequestHeader.UserAgent.ToString(), "Music Manager (1, 0, 54, 4672 - Windows)" }
                }
            };
        }
Example #24
0
        public static void ClassInit(TestContext context)
        {
            log4net.GlobalContext.Properties["LogName"] = context.FullyQualifiedTestClassName;
            log4net.Config.XmlConfigurator.Configure(new FileInfo("Log.xml"));
            _logm = new Log4NetLogManager();

            var _logger = _logm.CreateLogger(context.FullyQualifiedTestClassName);

            if (_logger.DebugIsEnabled)
            {
                _logger.Debug(_SEPARATORTEST);
                _logger.Debug(_SEPARATORCLASS);
                _logger.Debug($" Initialisation of {context.FullyQualifiedTestClassName} class Test.");
                _logger.Debug(_SEPARATORCLASS);
                _logger.Debug(_SEPARATORTEST);
            }
        }
        public RadioStationsService(
            IRadioWebService radioWebService,
            IRadioStationsRepository radioStationsRepository,
            ISongsRepository songsRepository,
            INotificationService notificationService,
            IApplicationResources applicationResources,
            IEventAggregator eventAggregator,
            ILogManager logManager)
        {
            this.radioWebService         = radioWebService;
            this.radioStationsRepository = radioStationsRepository;
            this.songsRepository         = songsRepository;
            this.notificationService     = notificationService;
            this.applicationResources    = applicationResources;
            this.eventAggregator         = eventAggregator;

            this.logger = logManager.CreateLogger("RadioStationsService");
        }
Example #26
0
 public SearchService(
     ILogManager logManager,
     IApplicationResources resources,
     INavigationService navigationService,
     IDispatcher dispatcher,
     IPlaylistsService playlistsService,
     ISongsRepository songsRepository,
     IUserPlaylistsRepository playlistsRepository,
     IAlbumArtCacheService albumArtCacheService)
 {
     this.logger               = logManager.CreateLogger("SearchService");
     this.resources            = resources;
     this.navigationService    = navigationService;
     this.dispatcher           = dispatcher;
     this.playlistsService     = playlistsService;
     this.songsRepository      = songsRepository;
     this.playlistsRepository  = playlistsRepository;
     this.albumArtCacheService = albumArtCacheService;
 }
        public MediaElementContainer(
            ILogManager logManager,
            MediaElement mediaElement,
            ISettingsService settingsService,
            IDispatcher dispatcher)
        {
            this.logger                    = logManager.CreateLogger("MediaElementContainer");
            this.mediaElement              = mediaElement;
            this.settingsService           = settingsService;
            this.dispatcher                = dispatcher;
            this.mediaElement.MediaFailed += this.MediaElementOnMediaFailed;
            this.mediaElement.MediaEnded  += this.MediaElementOnMediaEnded;
            this.mediaElement.MediaOpened += this.MediaElementOnMediaOpened;

            this.mediaElement.Volume = this.settingsService.GetValue(MediaElementVolumeKey, 1d);

            this.timer.Interval = TimeSpan.FromMilliseconds(500);
            this.timer.Tick    += this.TimerOnTick;
        }
Example #28
0
        protected void Initialize(
            IDependencyResolverContainer container,
            ILogManager logManager,
            BindingModelBase presenterBase)
        {
            this.Container   = container;
            this.Presenter   = presenterBase;
            this.Logger      = logManager.CreateLogger(this.GetType().Name);
            this.DataContext = presenterBase;

            var viewPresenterBase = presenterBase as IViewPresenterBase;

            if (viewPresenterBase != null)
            {
                viewPresenterBase.Initialize(this);
            }

            this.OnInitialized();
        }
Example #29
0
        public PlayQueueService(
            ILogManager logManager,
            IMediaElementContainer mediaElement,
            ISettingsService settingsService,
            ISongsCachingService songsCachingService,
            ICurrentSongPublisherService publisherService,
            IGoogleMusicSessionService sessionService,
            IPlaylistsService playlistsService,
            IRadioWebService radioWebService,
            IEventAggregator eventAggregator)
        {
            this.logger              = logManager.CreateLogger("PlayQueueService");
            this.mediaElement        = mediaElement;
            this.settingsService     = settingsService;
            this.songsCachingService = songsCachingService;
            this.publisherService    = publisherService;
            this.playlistsService    = playlistsService;
            this.radioWebService     = radioWebService;
            this.eventAggregator     = eventAggregator;
            this.currentQueueIndex   = -1;

            this.IsRepeatAll = this.settingsService.GetValue("IsRepeatAllEnabled", defaultValue: false);
            this.IsShuffled  = this.settingsService.GetValue("IsShuffleEnabled", defaultValue: false);

            this.State = QueueState.Unknown;

            this.mediaElement.MediaEnded += async(sender, args) =>
            {
                if (this.CanSwitchToNext())
                {
                    await this.NextSongAsync();
                }
                else
                {
                    this.State = QueueState.Stopped;
                }
            };

            sessionService.SessionCleared += async(sender, args) => { await ClearQueueAsync(); };
            eventAggregator.GetEvent <ReloadSongsEvent>().Subscribe(async(e) => { await ClearQueueAsync(); });
        }
Example #30
0
 public GoogleMusicSynchronizationService(
     ILogManager logManager,
     ISettingsService settingsService,
     IPlaylistsWebService playlistsWebService,
     ISongsWebService songsWebService,
     IRadioWebService radioWebService,
     IUserPlaylistsRepository userPlaylistsRepository,
     ISongsRepository songsRepository,
     IRadioStationsRepository radioStationsRepository,
     IConfigWebService configWebService)
 {
     this.logger                  = logManager.CreateLogger("GoogleMusicSynchronizationService");
     this.settingsService         = settingsService;
     this.playlistsWebService     = playlistsWebService;
     this.songsWebService         = songsWebService;
     this.radioWebService         = radioWebService;
     this.userPlaylistsRepository = userPlaylistsRepository;
     this.songsRepository         = songsRepository;
     this.radioStationsRepository = radioStationsRepository;
     this.configWebService        = configWebService;
 }