public MainWindowViewModel() { EdgeLocalStateFilePath.SetValidateNotifyError(IsExitisFile); EdgeCookiesFilePath.SetValidateNotifyError(IsExitisFile); ChromeLocalStateFilePath.SetValidateNotifyError(IsExitisFile); ChromeCookiesFilePath.SetValidateNotifyError(IsExitisFile); ObsCookiesFilePath.SetValidateNotifyError(IsExitisFile); EdgeCommand = new[] { EdgeLocalStateFilePath.ObserveHasErrors, EdgeCookiesFilePath.ObserveHasErrors, ObsCookiesFilePath.ObserveHasErrors }.CombineLatestValuesAreAllFalse().ToReactiveCommand <Models.CommandParameter>(); ChromeCommand = new[] { ChromeLocalStateFilePath.ObserveHasErrors, ChromeCookiesFilePath.ObserveHasErrors, ObsCookiesFilePath.ObserveHasErrors }.CombineLatestValuesAreAllFalse().ToReactiveCommand <Models.CommandParameter>(); LocalStateFilePath.SetValidateNotifyError(IsExitisFile); SrcCookieFilePath.SetValidateNotifyError(IsExitisFile); DestCookieFilePath.SetValidateNotifyError(IsExitisFile); HostKey.SetValidateNotifyError(host => { if (String.IsNullOrWhiteSpace(host)) { return("Empty"); } return(null); }); ParamCommand = new[] { LocalStateFilePath.ObserveHasErrors, SrcCookieFilePath.ObserveHasErrors, HostKey.ObserveHasErrors, DestCookieFilePath.ObserveHasErrors }.CombineLatestValuesAreAllFalse().ToReactiveCommand <Models.CommandParameter>(); EdgeCommand.Subscribe(ExecuteCommand.Execute); ChromeCommand.Subscribe(ExecuteCommand.Execute); ParamCommand.Subscribe(ExecuteCommand.Execute); OkCommand.Subscribe(async _ => { Executing.Value = true; try { await System.Threading.Tasks.Task.Run(() => { CookieManager.Converter.Convert(Environment.ExpandEnvironmentVariables(Param.LocalStateFilePath), Environment.ExpandEnvironmentVariables(Param.SrcCookieFilePath), Param.HostKey, Environment.ExpandEnvironmentVariables(Param.DestCookieFilePath)); }); } catch { IsErrorDialogOpen.Value = true; } Executing.Value = false; IsDialogOpen.Value = false; } ); ExecuteCommand.Subscribe(param => { IsDialogOpen.Value = true; Param = param; }); CancelCommand.Subscribe(_ => IsDialogOpen.Value = false); ErrorOkCommand.Subscribe(_ => IsErrorDialogOpen.Value = false); }