private async void confirm() { //check whether the user has inputted the patientID if (patientID == null || patientID == "") { await NewInjection.window.ShowMessageAsync("Error", "Please enter Patient ID"); return; } //check whether the room has existing patient if (SelectedRoom.getNumberOfPatient() >= 1 && SelectedRoom.MultiplePatientAllowed == false) { if (!SelectedRoom.hasPatient(patientID)) { duplicatedRoomConfirmDialog.MessageText.Content = "There is multiple patient in the selected room,\n Are you sure to proceed?"; duplicatedRoomConfirmDialog.Cancel.Content = "Return"; duplicatedRoomConfirmDialog.Confirm.Content = "Confirm & Add"; duplicatedRoomConfirmDialog.Confirm.FontSize = 8; duplicatedRoomConfirmDialog.Cancel.Click += duplicatedRoomConfirmDialog_OnCloseDown; duplicatedRoomConfirmDialog.Confirm.Click += duplicatedRoomConfirmDialog_OnConfirmDown; await NewInjection.window.ShowMetroDialogAsync(duplicatedRoomConfirmDialog); return; } } add(); }