Example #1
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            string returnValue = "--.-";

            // ***
            // *** Get the current display unit from the settings
            // ***
            IApplicationSettingsRepository settings = ServiceLocator.Current.GetInstance <IApplicationSettingsRepository>();

            // ***
            // *** Convert the value to a float
            // ***
            float temperature = System.Convert.ToSingle(value);

            if (!float.IsNaN(temperature))
            {
                // ***
                // *** Convert the temperature to Fahrenheit if the
                // *** current display unit is Fahrenheit (otherwise
                // *** it is already Celsius).
                // ***
                if (settings.TemperatureUnit == MagicValue.TemperatureUnit.Fahrenheit)
                {
                    temperature = Temperature.ConvertToFahrenheit(temperature);
                }

                // ***
                // *** Format the output
                // ***
                returnValue = string.Format("{0:0.0°}{1}", temperature, settings.TemperatureUnit);
            }

            return(returnValue);
        }
 public NotificationService(IApplicationSettingsRepository settingsRepository)
 {
     if (settingsRepository == null)
     {
         throw new ArgumentNullException(nameof(settingsRepository));
     }
     _settingsRepository = settingsRepository;
 }
Example #3
0
 } 

 public GoogleGeolocationService(IApplicationSettingsRepository settings) 

 {
     
            if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     
 Settings = settings; 

 }
Example #4
0
 public Auth0CodeClient(IApplicationSettingsRepository settings)
 {
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     _settings = settings;
     _client   = new Auth0Client(_settings.GetStringValue("auth0:domain"), _settings.GetStringValue("auth0:clientid"));
 }
Example #5
0
 public AuthenticationRepository(IUserRepository userRepository, ISqlSettingsRepository settingsRepository, ILdapRepository ldapRepository, ISamlRepository samlRepository, IServiceLogRepository logRepository, IApplicationSettingsRepository applicationSettingsRepository)
 {
     _userRepository     = userRepository;
     _settingsRepository = settingsRepository;
     _ldapRepository     = ldapRepository;
     _samlRepository     = samlRepository;
     _log = logRepository;
     _applicationSettingsRepository = applicationSettingsRepository;
 }
Example #6
0
 internal GroupsController(IGroupRepository groupRepository, IPrivilegesRepository privilegesRepository, IApplicationSettingsRepository applicationSettingsRepository, IServiceLogRepository serviceLogRepository, IItemInfoRepository itemInfoRepository, ISendMessageExecutor sendMessageExecutor, ISqlHelper sqlHelper)
 {
     _groupRepository               = groupRepository;
     _privilegesManager             = new PrivilegesManager(privilegesRepository);
     _applicationSettingsRepository = applicationSettingsRepository;
     _serviceLogRepository          = serviceLogRepository;
     _itemInfoRepository            = itemInfoRepository;
     _sendMessageExecutor           = sendMessageExecutor;
     _sqlHelper = sqlHelper;
 }
 public LoadSessionInfoRepository(IApplicationSettingsRepository applicationSettingsRepository
     , ISessionInfoRepository sessionInfoRepository
     , ILoadSessionInfoFactory loadSessionInfoFactory
     , ISendSessionInfoFactory sendSessionInfoFactory)
 {
     _applicationSettingsRepository = applicationSettingsRepository;
     _sessionInfoRepository = sessionInfoRepository;
     _loadSessionInfoFactory = loadSessionInfoFactory;
     _sendSessionInfoFactory = sendSessionInfoFactory;
 }
 public HomeController(IHostingEnvironment hostEnvironment,
                       IApplicationSettingsRepository appSettingsRepository,
                       IGuestReviewsRepository guestReviewsRepository,
                       IConfiguration configuration)
 {
     _hostEnvironment        = hostEnvironment;
     _appSettingsRepository  = appSettingsRepository;
     _guestReviewsRepository = guestReviewsRepository;
     _configuration          = configuration;
 }
Example #9
0
 public InstanceService(
     IInstanceRepository instanceRepository,
     IApplicationSettingsRepository applicationSettingsRepository,
     IServiceLogRepository serviceLogRepository,
     ISendMessageExecutor sendMessageExecutor)
 {
     _instanceRepository            = instanceRepository;
     _applicationSettingsRepository = applicationSettingsRepository;
     _sendMessageExecutor           = sendMessageExecutor;
     _serviceLogRepository          = serviceLogRepository;
 }
 protected AuthenticationClient(IApplicationSettingsRepository settings, ILogger logger)
 {
     if (logger == null)
     {
         throw new ArgumentNullException(nameof(logger));
     }
     if (settings == null)
     {
         throw new ArgumentNullException(nameof(settings));
     }
     Logger    = logger;
     _settings = settings;
 }
Example #11
0
 public InitializeCommandCommandHandler(
     IApplicationSettingsRepository applicationSettingsRepository,
     IGameRepository gameRepository,
     ITextureManagementSettingsRepository textureManagementSettingsRepository,
     IUsageStatisticsRepository usageStatisticsRepository,
     GameSettingsProcessWatcher processWatcher)
 {
     _applicationSettingsRepository = applicationSettingsRepository;
     _gameRepository = gameRepository;
     _textureManagementSettingsRepository = textureManagementSettingsRepository;
     _usageStatisticsRepository           = usageStatisticsRepository;
     _processWatcher = processWatcher;
 }
Example #12
0
        public iOSGoogleAuthenticationClient(IApplicationSettingsRepository settings, ILogger logger)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _settings = settings;
            _logger   = logger;
        }
Example #13
0
 internal ConfigController
 (
     IApplicationSettingsRepository applicationSettingsRepository,
     ISqlSettingsRepository settingsRepository,
     IUserRepository userRepository,
     IFeaturesService featuresService,
     IHttpClientProvider httpClientProvider,
     IServiceLogRepository log) : base(log)
 {
     _applicationSettingsRepository = applicationSettingsRepository;
     _settingsRepository            = settingsRepository;
     _userRepository     = userRepository;
     _featuresService    = featuresService;
     _httpClientProvider = httpClientProvider;
 }
 public ApplicationLoginService(
     IUserAuthentication authentication,
     IUserRepository userRepository,
     ISocialLoginRepository socialLoginRepository,
     IUserRoleRepository repositoryUserRoles,
     IMapper mapper,
     IApplicationSettingsRepository applicationSettingsRepository)
 {
     this.authentication = authentication;
     this.userRepository = userRepository;
     this.socialLoginRepository = socialLoginRepository;
     this.repositoryUserRoles = repositoryUserRoles;
     this.mapper = mapper;
     this.applicationSettingsRepository = applicationSettingsRepository;
 }
Example #15
0
 public AdminController(IHostingEnvironment hostEnvironment,
                        ILogger <AdminController> logger,
                        ApplicationDbContext context,
                        UserManager <ApplicationUser> userManager,
                        IApplicationSettingsRepository appSettingsRepository,
                        IGuestReviewsRepository guestReviewsRepository,
                        IConfiguration configuration)
 {
     _userManager            = userManager;
     _hostEnvironment        = hostEnvironment;
     _logger                 = logger;
     _context                = context;
     _appSettingsRepository  = appSettingsRepository;
     _guestReviewsRepository = guestReviewsRepository;
     _configuration          = configuration;
 }
Example #16
0
 internal UsersController
 (
     IAuthenticationRepository authenticationRepository, IUserRepository userRepository,
     ISqlSettingsRepository settingsRepository, IEmailHelper emailHelper,
     IApplicationSettingsRepository applicationSettingsRepository, IServiceLogRepository log,
     IHttpClientProvider httpClientProvider, IPrivilegesRepository privilegesRepository,
     IItemInfoRepository itemInfoRepository, ISendMessageExecutor sendMessageExecutor, IImageService imageService, ISqlHelper sqlHelper)
 {
     _authenticationRepository = authenticationRepository;
     _userRepository           = userRepository;
     _settingsRepository       = settingsRepository;
     _emailHelper = emailHelper;
     _applicationSettingsRepository = applicationSettingsRepository;
     _log = log;
     _httpClientProvider  = httpClientProvider;
     _privilegesManager   = new PrivilegesManager(privilegesRepository);
     _itemInfoRepository  = itemInfoRepository;
     _sendMessageExecutor = sendMessageExecutor;
     _imageService        = imageService;
     _sqlHelper           = sqlHelper;
 }
 public StateChangeExecutorRepositories(IArtifactVersionsRepository artifactVersionsRepository,
                                        IWorkflowRepository workflowRepository,
                                        IVersionControlService versionControlService,
                                        IReuseRepository reuseRepository,
                                        ISaveArtifactRepository saveArtifactRepository,
                                        IApplicationSettingsRepository applicationSettingsRepository,
                                        IServiceLogRepository serviceLogRepository,
                                        IUsersRepository usersRepository,
                                        IWebhooksRepository webhooksRepository,
                                        IProjectMetaRepository projectMetaRepository)
 {
     ArtifactVersionsRepository    = artifactVersionsRepository;
     WorkflowRepository            = workflowRepository;
     VersionControlService         = versionControlService;
     ReuseRepository               = reuseRepository;
     SaveArtifactRepository        = saveArtifactRepository;
     ApplicationSettingsRepository = applicationSettingsRepository;
     ServiceLogRepository          = serviceLogRepository;
     UsersRepository               = usersRepository;
     WebhooksRepository            = webhooksRepository;
     ProjectMetaRepository         = projectMetaRepository;
 }
        public async Task ProcessMessages(string logSource,
                                          IApplicationSettingsRepository applicationSettingsRepository,
                                          IServiceLogRepository serviceLogRepository,
                                          IList <IWorkflowMessage> messages,
                                          string exceptionMessagePrepender,
                                          IDbTransaction transaction = null)
        {
            var tenantInfo = await applicationSettingsRepository.GetTenantInfo(transaction);

            if (string.IsNullOrWhiteSpace(tenantInfo?.TenantId))
            {
                throw new TenantInfoNotFoundException("No tenant information found. Please contact your administrator.");
            }

            if (messages == null || messages.Count <= 0)
            {
                return;
            }
            foreach (var actionMessage in messages.Where(a => a != null))
            {
                try
                {
                    await WorkflowMessagingProcessor.Instance.SendMessageAsync(tenantInfo.TenantId, actionMessage);

                    string message = $"Sent {actionMessage.ActionType} message: {actionMessage.ToJSON()} with tenant id: {tenantInfo.TenantId} to the Message queue";
                    await
                    serviceLogRepository.LogInformation(logSource, message);
                }
                catch (Exception ex)
                {
                    string message =
                        $"Error while sending {actionMessage.ActionType} message with content {actionMessage.ToJSON()}. {exceptionMessagePrepender}. Exception: {ex.Message}. StackTrace: {ex.StackTrace ?? string.Empty}";
                    await
                    serviceLogRepository.LogError(logSource, message);

                    throw;
                }
            }
        }
Example #19
0
        public MainWindowViewModel
        (
            IKeyAwaiter keyAwaiter,
            IApplicationSettingsRepository applicationSettingsRepository,
            ISettingsMapper settingsMapper,
            ITacticalCameraServiceFactory tacticalCameraServiceFactory
        )
        {
            _keyAwaiter = keyAwaiter;
            _applicationSettingsRepository = applicationSettingsRepository;
            _settingsMapper = settingsMapper;

            ApplicationSettings settings = GetApplicationSettings();

            RestoreSettings(settings);

            TacticalCameraSettings tacticalCameraSettings = _settingsMapper.MapToTacticalCameraSettings(settings);

            _tacticalCameraService = tacticalCameraServiceFactory.CreateTacticalCameraService(tacticalCameraSettings);
            _tacticalCameraService.ProcessStatusChanged += OnTacticalCameraServiceOnProcessStatusChanged;
            _tacticalCameraService.WaitAndAttachToProcess();
        }
        public async Task Execute(IApplicationSettingsRepository applicationSettingsRepository, IServiceLogRepository serviceLogRepository, ActionMessage message, IDbTransaction transaction)
        {
            var tenantInfo = await applicationSettingsRepository.GetTenantInfo(transaction);

            var tenantId = tenantInfo?.TenantId;

            try
            {
                if (string.IsNullOrWhiteSpace(tenantId))
                {
                    throw new TenantInfoNotFoundException("No tenant information found. Please contact your administrator.");
                }
                await WorkflowMessagingProcessor.Instance.SendMessageAsync(tenantId, message);

                await serviceLogRepository.LogInformation("SendMessageExecutor", $"Sent {message.ActionType} message for tenant {tenantId}: {message.ToJSON()}");
            }
            catch (Exception ex)
            {
                await serviceLogRepository.LogError("SendMessageExecutor", $"Failed to send {message.ActionType} message for tenant {tenantId}: {message.ToJSON()}. Exception: {ex.Message}");

                throw;
            }
        }
        public AutoTraderController(AutoTraderViewModel ViewModel, MainMenuViewModel MenuViewModel, IMessenger Messenger, IMapper Mapper, IApplicationSettingsRepository AppSettingsRepository, IUserSettingsRepository UserSettingsRepository)
        {
            if (Application.Current != null)
            {
                Application.Current.DispatcherUnhandledException += onCurrentDispatcherUnhandledException;
            }

            AppDomain.CurrentDomain.UnhandledException += onDomainUnhandledException;

            Dispatcher.CurrentDispatcher.UnhandledException += onCurrentDispatcherUnhandledException;

            TaskScheduler.UnobservedTaskException += onUnobservedTaskException;

            System.Windows.Forms.Application.ThreadException += onThreadException;

            viewModel     = ViewModel;
            menuViewModel = MenuViewModel;

            messenger = Messenger;
            mapper    = Mapper;

            appSettingsRepository  = AppSettingsRepository;
            userSettingsRepository = UserSettingsRepository;
        }
Example #22
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider, IApplicationSettingsRepository appSettingsRepository)
        {
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseSession();

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            Task createRoles = CreateRoles(serviceProvider);

            createRoles.Wait();
            Task initializeAdmin = InitializeAdmin(serviceProvider);

            initializeAdmin.Wait();

            string rootPath = System.IO.Path.Combine(env.WebRootPath, "images\\apartment");

            var appSettings = appSettingsRepository.Get();

            if (appSettings == null)
            {
                var    allFiles          = Directory.GetFiles(rootPath);
                string imagesOrderString = "-";
                foreach (var file in allFiles)
                {
                    if (file.EndsWith("tb.jpg"))
                    {
                        continue;
                    }
                    var startIndex           = file.LastIndexOf('\\') + 1;
                    var length               = file.LastIndexOf('.') - startIndex;
                    var nameWithoutExtension = file.Substring(startIndex, length);
                    imagesOrderString += $"{nameWithoutExtension}-";
                }
                ApplicationSettings initialSettings = new ApplicationSettings(false, imagesOrderString);
                appSettingsRepository.Add(initialSettings);
            }
        }
 protected OAuthRefreshAuthenticationClient(IApplicationSettingsRepository settings, ILogger logger) : base(settings, logger)
 {
     _clientId     = settings.GetStringValue("ClientId");
     _clientSecret = settings.GetStringValue("ClientSecret");
     _serviceUri   = settings.GetUrl("AuthorisationServiceUrl");
 }
 public ApplicationSettingsService(IApplicationSettingsRepository settingsRepository)
 {
     Repository = settingsRepository;
 }
Example #25
0
        public HeaderViewModel(IApplicationSettingsRepository applicationSettingsRepository
            , ISessionInfoRepository sessionInfoRepository
            , IUserInfoRepository userInfoRepository
            , IUserAvatarRepository userAvatarRepository

            , ILoadSessionInfoFactory loadSessionInfoFactory
            , ISendApplicationSettingsFactory sendApplicationSettingsFactory
            , ISendSessionInfoFactory sendSessionInfoFactory

            , ICommandEngineAsync<AfterLoginAttribute> afterLoginEngine

            , IVkAuthorizer vkAuthorizer
            , ILanguageRepository languageRepository
            , ILogger logger) 
            : base(languageRepository, logger)
        {
            _applicationSettingsRepository = applicationSettingsRepository;
            _sessionInfoRepository = sessionInfoRepository;
            _userInfoRepository = userInfoRepository;
            _userAvatarRepository = userAvatarRepository;

            _loadSessionInfoFactory = loadSessionInfoFactory;
            _sendApplicationSettingsFactory = sendApplicationSettingsFactory;
            _sendSessionInfoFactory = sendSessionInfoFactory;

            _afterLoginEngine = afterLoginEngine;

            _vkAuthorizer = vkAuthorizer;

            _sessionInfoRepository.Loaded += SessionInfoRepositoryLoaded;
            _userInfoRepository.Loaded += UserInfoLoaded;
            _userAvatarRepository.Loaded += UserAvatarLoaded;
        }
Example #26
0
        public MainWindowViewModel(IBoardViewModel boardViewModel,
                                   IBoardPlacementViewModel boardPlacementViewModel,
                                   ILanguageSelectionViewModel languageSelectionViewModel,
                                   IGameService gameService,
                                   IApplicationSettingsRepository applicationSettingsRepository,
                                   IProgressFileVerifierFactory progressFileVerifierFactory,
                                   bool disableClosingDialog)
        {
            CultureManager.CultureChanged += RefreshCaptions;

            this.gameService = gameService;
            this.applicationSettingsRepository = applicationSettingsRepository;
            this.progressFileVerifierFactory   = progressFileVerifierFactory;
            this.disableClosingDialog          = disableClosingDialog;

            LanguageSelectionViewModel = languageSelectionViewModel;
            BoardPlacementViewModel    = boardPlacementViewModel;
            BoardViewModel             = boardViewModel;

            DebugMessages = new ObservableCollection <string>();
            GameProgress  = new ObservableCollection <string>();

            gameService.NewBoardStateAvailable += OnNewBoardStateAvailable;
            gameService.WinnerAvailable        += OnWinnerAvailable;
            gameService.NewDebugMsgAvailable   += OnNewDebugMsgAvailable;

            IsAutoScrollDebugMsgActive = true;
            IsAutoScrollProgressActive = true;

            PreventWindowClosingToAskUser = !disableClosingDialog;

            TopPlayerName = "- - - - -";
            MovesLeft     = "--";

            BrowseDll = new Command(DoBrowseDll,
                                    () => GameStatus != GameStatus.Active,
                                    new PropertyChangedCommandUpdater(this, nameof(GameStatus)));

            Start = new Command(async() => await DoStart(),
                                () => GameStatus != GameStatus.Active && !string.IsNullOrWhiteSpace(DllPathInput),
                                new PropertyChangedCommandUpdater(this, nameof(GameStatus), nameof(DllPathInput)));

            StartWithProgress = new ParameterrizedCommand <string>(async filePath => await DoStartWithProgress(filePath),
                                                                   _ => GameStatus != GameStatus.Active && !string.IsNullOrWhiteSpace(DllPathInput),
                                                                   new PropertyChangedCommandUpdater(this, nameof(GameStatus), nameof(DllPathInput)));
            Capitulate = new Command(DoCapitulate,
                                     IsMoveApplyable,
                                     new PropertyChangedCommandUpdater(this, nameof(GameStatus)));

            ShowAboutHelp      = new Command(DoShowAboutHelp);
            DumpDebugToFile    = new Command(DoDumpDebugToFile);
            DumpProgressToFile = new Command(DoDumpProgressToFile);
            CloseWindow        = new Command(DoCloseWindow);

            GameStatus = GameStatus.Unloaded;

            DllPathInput              = applicationSettingsRepository.LastUsedBotPath;
            IsDebugSectionExpanded    = applicationSettingsRepository.IsDebugSectionExpanded;
            IsProgressSectionExpanded = applicationSettingsRepository.IsProgressSecionExpanded;

            botCountDownTimer = new Timer(BotCountDownTimerOnTick, null, Timeout.Infinite, Timeout.Infinite);
            StopTimer();
        }
 public ApplicationProcessor(ApplicationDbContext dbContext)
 {
     _dbcontext = dbContext;
     _applicationSettingRepository = new ApplicationSettingsRepository(dbContext);
 }
 public LoadApplicationSettingsRepository(IApplicationSettingsRepository applicationSettingsRepository
     , ILoadApplicationSettingsFactory loadApplicationSettingsFactory)
 {
     _applicationSettingsRepository = applicationSettingsRepository;
     _loadApplicationSettingsFactory = loadApplicationSettingsFactory;
 }
 public ApplicationSettingsService(IApplicationSettingsRepository settingsRepository)
 {
     Repository = settingsRepository;
 }
 public OAuthNonInteractiveAuthenticationClient(IApplicationSettingsRepository settings, ILogger logger) : base(settings, logger)
 {
 }
 public ApplicationSettingsController()
 {
     _applicationSettings = new ApplicationSettingsRepository();
 }
Example #32
0
 public OAuthUsernamePasswordAuthenticationClient(IApplicationSettingsRepository settings, ILogger logger, IHashingService hashingService) : base(settings, logger)
 {
     _hashingService = hashingService ?? throw new ArgumentNullException(nameof(hashingService));
 }
 public static void SetMetricsRepository(IApplicationSettingsRepository newRepository)
 {
     genericRepository = newRepository;
 }
Example #34
0
 public UpdateApplicationSettingsCommandHandler(IApplicationSettingsRepository applicationSettingsRepository)
 {
     _applicationSettingsRepository = applicationSettingsRepository;
 }