private void Initialize(string dataType, string componentType, string portName) { UpdateDataTypeCommand = new ReactiveCommand(); UpdatePortNameCommand = new ReactiveCommand(); UpdateCompoentTypeCommand = new ReactiveCommand(); DataTypes = UpdateDataTypeCommand .SelectMany(_ => Observable.Start(() => _recordDescriptionRepository.GetDataTypes(componentType, portName)) .Catch((Exception ex) => Messenger.Raise(new InformationMessage("データベースアクセスに失敗しました。", "エラー", "ShowError")))) .Do(_ => DataTypes.ClearOnScheduler()) .SelectMany(_ => _) .ToReactiveCollection(); PortNames = UpdatePortNameCommand .SelectMany(_ => Observable.Start(() => _recordDescriptionRepository.GetPortNames(dataType, componentType)) .Catch((Exception ex) => Messenger.Raise(new InformationMessage("データベースアクセスに失敗しました。", "エラー", "ShowError")))) .Do(_ => PortNames.ClearOnScheduler()) .SelectMany(_ => _) .ToReactiveCollection(); ComponentTypes = UpdateCompoentTypeCommand .SelectMany(_ => Observable.Start(() => _recordDescriptionRepository.GetComponentTypes(dataType, portName)) .Catch((Exception ex) => Messenger.Raise(new InformationMessage("データベースアクセスに失敗しました。", "エラー", "ShowError")))) .Do(_ => ComponentTypes.ClearOnScheduler()) .SelectMany(_ => _) .ToReactiveCollection(); DataType = dataType; PortName = portName; ComponentType = componentType; UpdateDataTypeCommand.Execute(null); UpdatePortNameCommand.Execute(null); UpdateCompoentTypeCommand.Execute(null); }