Ejemplo n.º 1
0
        public OptionsVM(
            IAppConfig appConfig,
            IUserConfig userConfig,
            J4JHostInfo hostInfo
            )
        {
            _appConfig  = appConfig;
            _userConfig = userConfig;
            _hostInfo   = hostInfo;

            SaveCommand   = new RelayCommand(SaveCommandHandlerAsync);
            ReloadCommand = new RelayCommand(ReloadCommandHandler);
            CloseCommand  = new RelayCommand <OptionsWindow>(CloseCommandHandler);

            // go live for messages
            IsActive = true;

            // store configuration backups
            _prevUserConfig  = _userConfig.Copy();
            _cachedAppConfig = new CachedAppConfig(_appConfig);

            SettingsChanged = false;
        }
Ejemplo n.º 2
0
        public void RestoreFrom(CachedAppConfig src)
        {
            InputFile.FilePath  = src.InputPath;
            OutputFile.FilePath = src.OutputPath;
            ProcessorType       = src.ProcessorType;

            Processors.Clear();

            foreach (var kvp in src.Processors)
            {
                var cachedPI = new ProcessorInfo
                {
                    MaxDistanceMultiplier = kvp.Value.MaxDistanceMultiplier,
                    MaxSeparation         = new Distance(kvp.Value.MaxSeparation.Unit, kvp.Value.MaxSeparation.OriginalValue)
                };

                Processors.Add(kvp.Key, cachedPI);
            }

            APIKey              = src.APIKey;
            RouteWidth          = src.RouteWidth;
            RouteColor          = src.RouteColor;
            RouteHighlightColor = src.RouteHighlightColor;
        }