Ejemplo n.º 1
0
        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;
            }

            _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);
        }
        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;
            }
        }
Ejemplo n.º 3
0
 private bool Equals(EncodingViewModel other)
 {
     return(Equals(Encoding, other.Encoding));
 }