public MainWindowViewModel(IDialogService dialogService, Models.IRKit iRKit) { GetIPAddress.Subscribe(async _ => await SendMessageAsync()); httpClient = new HttpClient(); this.iRKit = iRKit; IRCommandList = iRKit.IRCommandList.ToReadOnlyReactiveCollection(); AddList = new ReactiveCommand(); AddList.Subscribe(_ => iRKit.IRCommandList.Add(new Models.IRCommand("コマンド3", "3"))); IDialogResult result = null; OpenDialog = new ReactiveCommand <object>() .WithSubscribe(_ => dialogService.ShowDialog("AddIRCommandDialog", null, ret => result = ret)) .AddTo(disposables); ExecIRCommand = new ReactiveCommand <object>() .WithSubscribe(async _ => await ExecIRCommandAsync()) .AddTo(disposables); SelectedIRCommand = null; }