private void approveButton_Click(object sender, EventArgs e) { try { bool isValidated; if (this.NeedMessage) { if (string.IsNullOrEmpty(this.Message)) { throw new ApplicationException("To Developer,\nApprovalControlのMessageを設定してください。"); } if (string.IsNullOrEmpty(this.MessageId)) { throw new ApplicationException("To Developer,\nApprovalControlのMessageIdを設定してください。"); } using (var service = new SocketPlanServiceNoTimeout()) { isValidated = service.ValidateUser(this.idText.Text, this.pwText.Text, Environment.MachineName, this.Message); } } else { using (var service = new SocketPlanServiceNoTimeout()) { isValidated = service.ValidateUserWithoutMessage(this.idText.Text, this.pwText.Text, true); } } if (isValidated) { this.Approved(sender, e); } else { this.Denied(sender, e); } } catch (Exception ex) { MessageDialog.ShowError(ex); } }