Esempio n. 1
0
 public HomeController(IApplicationUsersService applicationUsersService, ITraceManager traceManager, ILocalizedStrings localizedStrings,
                       ILocalizationManager localizationManager)
     : base(localizationManager)
 {
     _applicationUsersService = applicationUsersService;
     _traceManager            = traceManager;
     _localizedStrings        = localizedStrings;
 }
Esempio n. 2
0
 public UtilsController(IApplicationUsersService applicationUsersService, ITraceManager traceManager, ILocalizedStrings localizedStrings, IAPIHttpClient apiHttpClient,
                        ILocalizationManager localizationManager)
     : base(localizationManager)
 {
     _applicationUsersService = applicationUsersService;
     _traceManager            = traceManager;
     _localizedStrings        = localizedStrings;
     _apiHttpClient           = apiHttpClient;
 }
Esempio n. 3
0
 public AccountController(ILanguageStorageProvider languageStorageProvider,
                          ILocalizedStrings localizedStrings,
                          IAPIHttpClient apiHttpClient,
                          IApplicationUsersService applicationUsersService,
                          ILocalizationManager localizationManager)
     : base(localizationManager)
 {
     _languageStorageProvider = languageStorageProvider;
     _apiHttpClient           = apiHttpClient;
     _applicationUsersService = applicationUsersService;
 }
Esempio n. 4
0
        /// <inheritdoc/>
        public void Load(CultureInfo culture)
        {
            ExceptionUtility.CheckArgumentNotNull(culture, "culture");

            if (culture == this.Culture)
            {
                return;
            }

            this.strings = this.repository.GetLocalizedStrings(culture);
            this.Culture = culture;

            this.OnLoaded();
        }
Esempio n. 5
0
        public void Add(string translatedString, ILocalizedStrings localizedStrings, long index)
        {
            IList <TranslationSource> translationSourceList;

            if (this._translatedStrings.ContainsKey(key: translatedString))
            {
                translationSourceList = this._translatedStrings[key : translatedString];
            }
            else
            {
                translationSourceList = new List <TranslationSource>();
                this._translatedStrings[key : translatedString] = translationSourceList;
            }

            translationSourceList.Add(item: new TranslationSource(localizedStrings: localizedStrings, translationIndex: index));
        }
Esempio n. 6
0
        public WireguardKeysManager(Func <bool> isCanUpdateKey, AppSettings appSettings, ILocalizedStrings appServices)
        {
            __IsCanUpdateKey   = isCanUpdateKey;
            __AppSettings      = appSettings;
            __LocalizedStrings = appServices;

            // try regenerate keys by a timer
            __CheckTimer = new Timer(async(object state) =>
            {
                try
                {
                    await RegenerateKeysIfNecessary();
                }
                catch (Exception ex)
                {
                    Logging.Info($"WARNING (WireguardKeysManager): automatic keys regeneration failed: {ex}");
                }
            });

            // check if we should regenerate keys when settings changed ('WireGuardKeysRegenerationIntervalHours' or 'WireGuardKeysTimestamp')
            __AppSettings.PropertyChanged += __AppSettings_PropertyChanged;
        }
Esempio n. 7
0
        public ViewModelWireguardSettings(MainViewModel mainViewModel, ILocalizedStrings localizedStrings)
        {
            __LocalizedStrings = localizedStrings;
            __MainViewModel    = mainViewModel;
            Settings           = __MainViewModel.AppState.Settings;

            KeysManager.OnStarted += () => { IsUpdateInProgress = true; };
            KeysManager.OnStopped += () => { IsUpdateInProgress = false; };

            Settings.PropertyChanged += (sender, e) =>
            {
                if (string.Equals(e.PropertyName, nameof(Settings.WireGuardKeysTimestamp)) ||
                    string.Equals(e.PropertyName, nameof(Settings.WireGuardKeysRegenerationIntervalHours)))
                {
                    RaisePropertyWillChange(nameof(Generated));
                    RaisePropertyChanged(nameof(Generated));

                    RaisePropertyWillChange(nameof(ExpirationDate));
                    RaisePropertyChanged(nameof(ExpirationDate));

                    RaisePropertyWillChange(nameof(AutoRegenerationDate));
                    RaisePropertyChanged(nameof(AutoRegenerationDate));

                    RaisePropertyWillChange(nameof(RegenerationIntervalDays));
                    RaisePropertyChanged(nameof(RegenerationIntervalDays));

                    RaisePropertyWillChange(nameof(WireGuardClientInternalIp));
                    RaisePropertyChanged(nameof(WireGuardClientInternalIp));

                    RaisePropertyWillChange(nameof(WireGuardClientPublicKey));
                    RaisePropertyChanged(nameof(WireGuardClientPublicKey));
                }
            };

            KeysManager.OnProgress += (string progress) =>
            {
                ProgressStatus = progress;
            };
        }
Esempio n. 8
0
        public ViewModelWireguardSettings(MainViewModel mainViewModel, IService service, ILocalizedStrings localizedStrings)
        {
            __Service          = service;
            __LocalizedStrings = localizedStrings;
            __MainViewModel    = mainViewModel;
            Settings           = AppSettings.Instance();

            KeysManager.OnStarted += () => { IsUpdateInProgress = true; };
            KeysManager.OnStopped += () => { IsUpdateInProgress = false; };

            __MainViewModel.AppState.OnSessionChanged += (SessionInfo sessionInfo) =>
            {
                RaisePropertyWillChange(nameof(Generated));
                RaisePropertyChanged(nameof(Generated));

                RaisePropertyWillChange(nameof(ExpirationDate));
                RaisePropertyChanged(nameof(ExpirationDate));

                RaisePropertyWillChange(nameof(AutoRegenerationDate));
                RaisePropertyChanged(nameof(AutoRegenerationDate));

                RaisePropertyWillChange(nameof(RegenerationIntervalDays));
                RaisePropertyChanged(nameof(RegenerationIntervalDays));

                RaisePropertyWillChange(nameof(WireGuardClientInternalIp));
                RaisePropertyChanged(nameof(WireGuardClientInternalIp));

                RaisePropertyWillChange(nameof(WireGuardClientPublicKey));
                RaisePropertyChanged(nameof(WireGuardClientPublicKey));
            };

            KeysManager.OnProgress += (string progress) =>
            {
                ProgressStatus = progress;
            };
        }
Esempio n. 9
0
 public TranslationSource(ILocalizedStrings localizedStrings, long translationIndex)
 {
     this._localizedStrings = localizedStrings;
     this._translationIndex = translationIndex;
 }
Esempio n. 10
0
 public ApplicationServices(ILocalizedStrings localizedStrings)
 {
     __LocalizedStrings = localizedStrings;
 }
Esempio n. 11
0
 /// <summary>
 /// Initialise le LocalizationManager.
 /// </summary>
 public LocalizationManager(ILocalizedStrings localizedStrings)
 {
     _localizedStrings = localizedStrings;
     SupportedCultures = _localizedStrings.GetSupportedLanguages();
 }
Esempio n. 12
0
 static LocalizationManager()
 {
     _localizedStrings = new LocalizedStrings(new SQLiteLanguageStorageProvider("Data Source=Resources\\Localization.sqlite;"));
     SupportedCultures = _localizedStrings.GetSupportedLanguages();
     CurrentCulture    = Thread.CurrentThread.CurrentCulture;
 }
Esempio n. 13
0
 public ProofsViewModel(ILocalizedStrings localizedStrings)
 {
     __LocalizedStrings = localizedStrings;
     UpdateCommand      = new RelayCommand(Update);
 }
 public static ILocalizedStrings CreateRef(this ILocalizedStrings objectRef) =>
 ((ILocalizedStrings)objectRef.CreateRef(typeof(ILocalizedStrings)));