Beispiel #1
0
        public SettingsFlyoutViewModel(IApplicationSettings applicationSettings,
                                       IServiceContainer serviceContainer)
        {
            _settings = applicationSettings;

            var repos = applicationSettings.AutoUpdate.PluginRepositories;

            _pluginRepositories = repos != null?string.Join(Environment.NewLine, repos) : string.Empty;

            var defaultEncoding = applicationSettings.LogFile?.DefaultEncoding;

            _defaultTextFileEncoding = Encodings.FirstOrDefault(x => Equals(x.Encoding, defaultEncoding));
            if (_defaultTextFileEncoding == null)
            {
                var @default = TextFileEncodings.FirstOrDefault();
                Log.WarnFormat("Unable to find encoding '{0}', setting default to '{1}'...", defaultEncoding, @default?.Encoding);

                _defaultTextFileEncoding = @default;
            }

            _otherLevel    = new LogLevelSettingsViewModel(_settings, applicationSettings.LogViewer.Other);
            _traceLevel    = new LogLevelSettingsViewModel(_settings, applicationSettings.LogViewer.Trace);
            _debugLevel    = new LogLevelSettingsViewModel(_settings, applicationSettings.LogViewer.Debug);
            _infoLevel     = new LogLevelSettingsViewModel(_settings, applicationSettings.LogViewer.Info);
            _warnLevel     = new LogLevelSettingsViewModel(_settings, applicationSettings.LogViewer.Warning);
            _errorLevel    = new LogLevelSettingsViewModel(_settings, applicationSettings.LogViewer.Error);
            _fatalLevel    = new LogLevelSettingsViewModel(_settings, applicationSettings.LogViewer.Fatal);
            _customFormats = new CustomFormatsSettingsViewModel(_settings, serviceContainer, Encodings);
        }
        public SettingsMainPanelViewModel(IApplicationSettings applicationSettings) : base(applicationSettings)
        {
            _settings = applicationSettings;

            var repos = applicationSettings.AutoUpdate.PluginRepositories;

            _pluginRepositories = repos != null?string.Join(Environment.NewLine, repos) : string.Empty;

            var defaultEncoding = applicationSettings.LogFile?.DefaultEncoding;

            _defaultTextFileEncoding = TextFileEncodings.FirstOrDefault(x => Equals(x.Encoding, defaultEncoding));
            if (_defaultTextFileEncoding == null)
            {
                var @default = TextFileEncodings.FirstOrDefault();
                Log.WarnFormat("Unable to find encoding '{0}', setting default to '{1}'...", defaultEncoding, @default?.Encoding);

                _defaultTextFileEncoding = @default;
            }
        }