private void btnCreate_Click(object sender, EventArgs e) { _dto = new SignatureAlgorithmDto { MaxKeySize = (int)nudMaxKeySize.Value, MinKeySize = (int)nudMinKeySize.Value, Priority = (int)nudPriority.Value }; DialogResult = DialogResult.OK; Close(); }
public override void AwakeFromNib() { base.AwakeFromNib(); IsUpdated = false; //Events this.BtnAdd.Activated += (object sender, EventArgs e) => { if (string.IsNullOrEmpty(TxtMaxKeySize.StringValue)) { UIErrorHelper.ShowAlert("Max Key size has invalid value", "Alert"); } else if (string.IsNullOrEmpty(TxtMinKeySize.StringValue)) { UIErrorHelper.ShowAlert("Min Key size has invalid value", "Alert"); } else if (string.IsNullOrEmpty(TxtPriority.StringValue)) { UIErrorHelper.ShowAlert("Priority has invalid value", "Alert"); } else { SignatureAlgorithmDto = new SignatureAlgorithmDto { MaxKeySize = TxtMaxKeySize.IntValue, MinKeySize = TxtMinKeySize.IntValue, Priority = TxtPriority.IntValue, }; IsUpdated = true; this.Close(); NSApplication.SharedApplication.StopModalWithCode(0); } }; this.BtnClose.Activated += (object sender, EventArgs e) => { this.Close(); NSApplication.SharedApplication.StopModalWithCode(0); }; if (SignatureAlgorithmDto != null) { TxtMaxKeySize.IntValue = SignatureAlgorithmDto.MaxKeySize; TxtMinKeySize.IntValue = SignatureAlgorithmDto.MinKeySize; TxtPriority.IntValue = SignatureAlgorithmDto.Priority; } }
private void btnCreate_Click(object sender, EventArgs e) { var max = (int)nudMaxKeySize.Value; var min = (int)nudMinKeySize.Value; if (max < min) { MMCDlgHelper.ShowError("MAX Key size cannot be less than MIN key size"); } else { _dto = new SignatureAlgorithmDto { MaxKeySize = max, MinKeySize = min, Priority = (int)nudPriority.Value }; DialogResult = DialogResult.OK; Close(); } }