Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationViewModel"/> class.
        /// </summary>
        public ConfigurationViewModel(ISettingsService settingsService, IOpenHAB openHabsdk, ILogger <ConfigurationViewModel> logger, Settings settings)
            : base(new object())
        {
            _settingsService = settingsService;
            _logger          = logger;
            _settings        = settings;

            _localConnection = new ConnectionDialogViewModel(_settings.LocalConnection, openHabsdk, OpenHABHttpClientType.Local);
            _localConnection.PropertyChanged += ConnectionPropertyChanged;

            _remoteConnection = new ConnectionDialogViewModel(_settings.RemoteConnection, openHabsdk, OpenHABHttpClientType.Remote);
            _remoteConnection.PropertyChanged += ConnectionPropertyChanged;

            _isRunningInDemoMode = _settings.IsRunningInDemoMode;
            _showDefaultSitemap  = _settings.ShowDefaultSitemap;
            _useSVGIcons         = _settings.UseSVGIcons;
            _startAppMinimized   = _settings.StartAppMinimized;
            _notificationsEnable = _settings.NotificationsEnable;

            _appLanguages        = InitalizeAppLanguages();
            _selectedAppLanguage =
                _appLanguages.FirstOrDefault(x => string.Compare(x.Code, _settings.AppLanguage, StringComparison.InvariantCultureIgnoreCase) == 0);

            PropertyChanged += ConfigurationViewModel_PropertyChanged;
        }
Example #2
0
        private List <LanguageViewModel> InitalizeAppLanguages()
        {
            List <LanguageViewModel> appLanguages = new List <LanguageViewModel>();
            LanguageViewModel        system       = new LanguageViewModel()
            {
                Name = "System",
                Code = null
            };

            LanguageViewModel english = new LanguageViewModel()
            {
                Name = "English",
                Code = "en-us"
            };

            LanguageViewModel german = new LanguageViewModel()
            {
                Name = "Deutsch",
                Code = "de-de"
            };

            appLanguages.Add(system);
            appLanguages.Add(english);
            appLanguages.Add(german);

            return(appLanguages);
        }