public SettingsViewModel(CandySettings settings) { _settings = settings; _phantom = _settings.Clone(); ApplicationInformationServiceUrl = _phantom.ToReactivePropertyAsSynchronized(x => x.ApplicationInformationServiceUrl) .SetValidateAttribute(() => ApplicationInformationServiceUrl); ApplicationRootDirectoryPath = _phantom.ToReactivePropertyAsSynchronized(x => x.ApplicationRootDirectoryPath); SetDefaultServiceCommand = ApplicationInformationServiceUrl.DistinctUntilChanged() .Select(x => x != CandySettings.DefaultApplicationInformationServiceUrl) .ToReactiveCommand(); SetDefaultServiceCommand.Subscribe(_ => SetDefaultService()); OkCommand = new ReactiveCommand(); OkCommand.Subscribe(_ => ApplySettings()); CancelCommand = new ReactiveCommand(); CancelCommand.Subscribe(_ => Cancel()); }
/// <summary> /// 使用する <see cref="IStateRepository"/> を指定して、<see cref="ApplicationManager"/> クラスの新しいインスタンスを初期化します。 /// </summary> /// <param name="repository">使用する <see cref="IStateRepository"/> 。</param> public ApplicationManager(IStateRepository repository) { _repository = repository; Settings = new CandySettings(); }
public void ApplySettings(CandySettings newSettings) { Mapper.Map(newSettings, this); }