Example #1
0
 public void ApplyConfig()
 {
     _config.SetUnique <MapSizeComponent>(c => c.Value        = _settings.BoardSize);
     _config.SetUnique <TypeCountComponent>(c => c.Value      = _settings.TypeCount);
     _config.SetUnique <MaxActionCountComponent>(c => c.Value = _settings.MaxActionCount);
     _config.SetUnique <MinMatchCountComponent>(c => c.Value  = _settings.MinMatchCount);
 }
    private void Settings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
    {
        switch (e.PropertyName)
        {
        // Note board size changes are applied on restart, other settings are applied here instantly.

        case nameof(SettingsViewModel.MaxActionCount):
            _config.SetUnique <MaxActionCountComponent>(c => c.Value = _model.Settings.MaxActionCount);
            break;

        case nameof(SettingsViewModel.MinMatchCount):
            _config.SetUnique <MinMatchCountComponent>(c => c.Value = _model.Settings.MinMatchCount);
            break;

        case nameof(SettingsViewModel.TypeCount):
            _config.SetUnique <TypeCountComponent>(c => c.Value = _model.Settings.TypeCount);
            break;
        }
    }