private void StartCommand(IMainWindow window) { var browser = window.WebBrowser; var password = window.PasswordBox.Password; var userName = this.UserName; if (string.IsNullOrEmpty(userName)) { MessageBox.Show("ユーザー名を入力してください。", "エラー", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } if (string.IsNullOrEmpty(password)) { MessageBox.Show("パスワードを入力してください。", "エラー", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } if (this.IsProgress) { MessageBox.Show("現在取得中です。 "); return; } this.ExecButtonText = "取得中"; this.ProgressMaximum = 0; this.ProgressValue = 0; this.IsProgress = true; if (this.api != null) { this.api.Dispose(); this.api = null; } var api = this.SelectedPointMall.CreateApiInstance(); api.Failed += this.Failure; api.LinkLengthChanged += this.LinkLengthChanged; api.ProgressMaxChanged += this.ProgressMaxChanged; api.ProgressValueChanged += this.ProgressValueChanged; api.Ended += this.Ended; api.Start(browser, this.UserName, password, this.Timeout * 1000); this.api = api; }