public override async void RowSelected(UITableView tableView, NSIndexPath indexPath) { selectedRecipient = recipients[indexPath.Row]; ClinicianMapPage parent = (ClinicianMapPage)formsMap.Parent.Parent; bool canArrive = await parent.CheckGetToReceiverInTime(currentOrgan, selectedRecipient); if (!canArrive) { UIAlertController okAlertController = UIAlertController.Create("Cannot begin transfer process", "Cannot transfer " + currentOrgan.organType + " to " + selectedRecipient.FullName + " as it will expire before it arrives.", UIAlertControllerStyle.Alert); okAlertController.AddAction(UIAlertAction.Create("Confirm", UIAlertActionStyle.Cancel, null)); owner.PresentViewController(okAlertController, true, null); tableView.DeselectRow(indexPath, true); } else { UIAlertController okAlertController = UIAlertController.Create("Begin transfer process?", "Would you like to transfer " + currentOrgan.organType + " to " + selectedRecipient.FullName + "?", UIAlertControllerStyle.Alert); okAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, BeginTransferProcess)); okAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, null)); owner.PresentViewController(okAlertController, true, null); tableView.DeselectRow(indexPath, true); } }
/* * Event when the callout is called */ async void OnCalloutAccessoryControlTapped(object sender, MKMapViewAccessoryTappedEventArgs e) { //Display Alert //Go back to Mobile App Clent and call show dialog event var customView = e.View as CustomMKAnnotationView; ClinicianMapPage parent = (ClinicianMapPage)formsMap.Parent.Parent; parent.displayUserDialog(customView.Url, customView.Url[customView.Url.Length - 1].ToString()); }
void BeginTransferProcess(UIAlertAction obj) { Console.WriteLine("LET US BEGIN."); //Update bottom sheet to show In transfer - empty table and update countdown owner.timeRemainingLabel.Text = "IN TRANSIT"; owner.timeRemainingLabel.TextColor = UIColor.Orange; owner.potentialRecipientsLabel.Text = "This organ is currently in transit."; owner.potentialRecipientsTableView.Hidden = true; //Update map to get rid of overlays and recipients customMapRenderer.removeOverlays(); customMapRenderer.ClearAllReceivers(); owner.StopTimers(); currentOrgan.inTransfer = 1; //Insert transfer into database and add new helicopter. ClinicianMapPage parent = (ClinicianMapPage)formsMap.Parent.Parent; parent.NewTransfer(currentOrgan, selectedRecipient, customPin.Position); }
public async void OnClick(Android.Views.View view) { int rowIndex = view.Id; String recipientName = null; Android.Views.View nextChild = ((ViewGroup)view).GetChildAt(1); recipientName = ((TextView)nextChild).Text; User selectedReceiver = null; foreach (User receiver in organ.topReceivers) { if (receiver.FullName.ToLower().Equals(recipientName.ToLower())) { selectedReceiver = receiver; } } ClinicianMapPage clinicianMapPage = new ClinicianMapPage(); bool canArrive = await clinicianMapPage.CheckGetToReceiverInTime(organ, selectedReceiver); if (!canArrive) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Cannot Transfer"); alert.SetMessage("Cannot transfer " + organ.organType + " to " + selectedReceiver.FullName + " as it will expire before it arrives."); alert.SetPositiveButton("confirm", (senderAlert, args) => {}); Dialog dialog = alert.Create(); dialog.Show(); } else { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Confirm Transfer"); alert.SetMessage("Are you sure you want to transfer " + organ.organType + " to " + selectedReceiver.FullName + "?"); alert.SetPositiveButton("Yes", async(senderAlert, args) => { Toast.MakeText(this, "Transfer process started.", ToastLength.Short).Show(); Console.WriteLine("LET US BEGIN"); //Update bottom sheet to show In transfer - empty table and update countdown organTimerText.Text = "IN TRANSIT"; organTimerText.SetTextColor(Android.Graphics.Color.Orange); transferText.Text = "This organ is currently in transit."; receiverTable.RemoveAllViews(); //Update map to get rid of overlays and recipients timer.Dispose(); timer = null; organ.inTransfer = 1; //Insert transfer into database and add new helicopter. double donorLat = Convert.ToDouble(Intent.GetStringExtra("donorLat")); double donorLong = Convert.ToDouble(Intent.GetStringExtra("donorLong")); Position pos = new Position(donorLat, donorLong); clinicianMapPage.NewTransferWithoutAddingHelicpoter(organ, selectedReceiver, pos); Intent dummy = new Intent(); SetResult(Result.Ok); //SetResult(RESULT_OK, dummy); Finish(); }); alert.SetNegativeButton("No", (senderAlert, args) => { Toast.MakeText(this, "Transfer Cancelled!", ToastLength.Short).Show(); }); Dialog dialog = alert.Create(); dialog.Show(); } }