private void ShowMessage(string title, string message, string[] buttonTitles, Action<int> callBack) { try { //var d1 = new AlertDialog.Builder(Forms.Context); //d1.SetPositiveButton("One", (sender, e) => { }); //d1.SetNeutralButton("Two", (sender, e) => { }); //d1.SetNegativeButton("Three", (sender, e) => { }); //d1.Create().Show(); var d = new AlertDialog.Builder(Forms.Context).Create(); d.SetTitle(title); d.SetMessage(message); if (buttonTitles.Length > 2) { d.SetButton(buttonTitles[0], (e, a) => { callBack?.Invoke(0); }); d.SetButton2(buttonTitles[1], (e, a) => { callBack?.Invoke(1); }); d.SetButton3(buttonTitles[2], (e, a) => { callBack?.Invoke(2); }); } else { d.SetButton(buttonTitles[0], (e, a) => { callBack?.Invoke(0); }); d.SetButton2(buttonTitles[1], (e, a) => { callBack?.Invoke(1); }); } d.Show(); } catch (System.Exception ex) { #if DEBUG Console.WriteLine(ex.Message); #endif } }
public override void OnBackPressed() { AlertDialog CancelDialog = new AlertDialog.Builder(this).Create(); CancelDialog.SetTitle("Are you sure you want to quit"); CancelDialog.SetButton("return", (s, ev) => { CancelDialog.Cancel(); } ); CancelDialog.SetButton2("main menu", (s, ev) => { Finish(); } ); if (CancelDialog != null) { if (CancelDialog.IsShowing) { CancelDialog.Cancel(); } else { CancelDialog.Show(); } } else { CancelDialog.Show(); } }
private void ItemDetail(int position) { View view = contex.LayoutInflater.Inflate(Resource.Layout.layout_dialog, null); AlertDialog builder = new AlertDialog.Builder(contex).Create(); builder.SetTitle("Book Detail"); builder.SetView(view); builder.SetCanceledOnTouchOutside(false); builder.SetButton("Buy", handllerNotingButton); builder.SetButton2("Cancel", handllerNotingButtonCancel); ImageView imageView = view.FindViewById <ImageView>(Resource.Id.imgDetailBook); TextView titleBookDetail = view.FindViewById <TextView>(Resource.Id.titleBookDetail); TextView subtitleDetailBook = view.FindViewById <TextView>(Resource.Id.subtitleDetailBook); TextView isbn13DetailBook = view.FindViewById <TextView>(Resource.Id.isbn13DetailBook); TextView priceDetailBook = view.FindViewById <TextView>(Resource.Id.priceDetailBook); Glide.With(contex).Load(listBook[position].image).Apply(RequestOptions.CenterCropTransform()).Into(imageView); titleBookDetail.Text = listBook[position].title; subtitleDetailBook.Text = listBook[position].subtitle; isbn13DetailBook.Text = listBook[position].isbn13; priceDetailBook.Text = listBook[position].price; positionGlobal = position; builder.Show(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.fragment_conversations, container, false); _conversationsRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.conversations); try { // Initialize contacts string conv = Utils.GetDefaults("Rooms"); if (conv != null) { var contacts = JsonConvert.DeserializeObject <List <ConverstionsModel> >(conv); // Create adapter passing in the sample user data var adapter = new ConvAdapter(contacts); // Attach the adapter to the recyclerview to populate items _conversationsRecyclerView.SetAdapter(adapter); // Set layout manager to position the items _conversationsRecyclerView.SetLayoutManager(new LinearLayoutManager(Activity)); adapter.ItemClick += (sender, args) => { string name = contacts[args.Position].Username; string room = contacts[args.Position].Room; var intent = new Intent(Activity, typeof(ChatActivity)); intent.PutExtra("Room", room); intent.PutExtra("EmailFrom", name); // intent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask); StartActivity(intent); }; adapter.ItemLongClick += delegate(object sender, ConvAdapterClickEventArgs args) { AlertDialog alertDialog = new AlertDialog.Builder(Activity, Resource.Style.AppTheme_Dialog) .Create(); alertDialog.SetTitle("Avertisment"); alertDialog.SetMessage("Doriti sa stergeti aceasta conversatie?"); alertDialog.SetButton("Da", delegate { adapter.DeleteConversation(args.Position); adapter.NotifyDataSetChanged(); string serialized = JsonConvert.SerializeObject(contacts); Utils.SetDefaults("Rooms", serialized); }); alertDialog.SetButton2("Nu", delegate { }); alertDialog.Show(); }; } } catch (Exception e) { e.PrintStackTrace(); } return(view); }
public void ShowAlertDroid(string title, string body, string acceptbtn = null, string rejectbtn = null, string cancelbtn = null) { var dlgAlert = new AlertDialog.Builder(MainApplication.ActivityContext).Create(); dlgAlert.SetMessage(body); dlgAlert.SetTitle(title); dlgAlert.SetButton(acceptbtn, handllerNotingButton); dlgAlert.SetButton2(rejectbtn, handllerNotingButton); dlgAlert.SetButton3(cancelbtn, handllerNotingButton); dlgAlert.Show(); }
public void ConfirmAdditionalAction(string title, string content, Action confirmAction, Action cancelAction) { var currentActivity = Mvx.Resolve <IMvxAndroidCurrentTopActivity>(); var popup = new AlertDialog.Builder(currentActivity.Activity).Create(); popup.SetTitle(title); popup.SetMessage(content); popup.SetButton("Tak", (s, a) => { confirmAction(); }); popup.SetButton2("Nie", (s, a) => { cancelAction(); }); popup.Show(); }
public void lanzarEscogerQuienInicia() { AlertDialog alerta = new AlertDialog.Builder(this).Create(); alerta.SetTitle("Escoja"); // alerta.SetIcon(Resource.Drawable.gato); alerta.SetMessage("¿Quien inicia la partida?"); alerta.SetButton("Yo,Humano", (a, b) => { message("Empiese la jugada Humano"); }); alerta.SetButton2("Maquina", (a, b) => { gatoInicia(); message("Escoja... espero tu respuesta perdedor"); }); alerta.Show(); }
private void Tv_devolped_LongClick(object sender, Android.Views.View.LongClickEventArgs e) { AlertDialog alerta = new AlertDialog.Builder(this).Create(); alerta.SetTitle("Information"); // alerta.SetIcon(Resource.Drawable.gato); alerta.SetMessage("JS CODE VERSION: " + GetCodeVersion() + " GUI VERSION: 0.87 -B COMPATIBLE "); alerta.SetButton2("ok", (a, b) => { ; }); alerta.Show(); }
public override void OnBackPressed() { AlertDialog ad = new AlertDialog.Builder(this).Create(); ad.SetCancelable(false); // This blocks the 'BACK' button ad.SetMessage("Czy chcesz opuœciæ grê (oddasz walkowerem)?"); ad.SetButton("Nie", delegate { dialogLive = false; }); ad.SetButton2("Tak", delegate { byte[] buffer = System.Text.Encoding.ASCII.GetBytes(string.Format("{0};{1}", Convert.ToInt32(MessageTypes.Left), nickname)); Sockets.client.GetStream().Write(buffer, 0, buffer.Length); dialogLive = false; }); dialogLive = true; ad.Show(); }
public override void OnBackPressed() { AlertDialog ad = new AlertDialog.Builder(this).Create(); ad.SetCancelable(false); // This blocks the 'BACK' button ad.SetMessage("Czy chcesz wyjϾ z gry?"); ad.SetButton("Nie", delegate { /*dialogLive = false;*/ }); ad.SetButton2("Tak", delegate { Sockets.client.Close(); Android.OS.Process.KillProcess(Android.OS.Process.MyPid()); //dialogLive = false; }); //dialogLive = true; ad.Show(); }
public void OnClick(View v) { string id = (string)v.Tag; PozivanjaPozvaniDto odg = new PozivanjaPozvaniDto(); odg.IdPoziva = Int32.Parse(id); odg.IdPozvanog = MSettings.CurrentSession.LoggedUser.UserID; try { AlertDialog alert = new AlertDialog.Builder(activity).Create(); alert.SetTitle("Odgovor na poziv"); alert.SetMessage("Da li dolazim?"); alert.SetButton("Da", delegate(object sender, DialogClickEventArgs args) { odg.OdgovorPozvanog = true; try { Api.Api.Respond2Invite(odg); } catch (Exception ex) { Toast.MakeText(activity, ex.Message, ToastLength.Long).Show(); } }); alert.SetButton2("Ne", delegate(object sender, DialogClickEventArgs args) { odg.OdgovorPozvanog = false; try { Api.Api.Respond2Invite(odg); } catch (Exception ex) { Toast.MakeText(activity, ex.Message, ToastLength.Long).Show(); } }); alert.Show(); } catch (System.Exception ex) { Toast.MakeText(activity, ex.Message, ToastLength.Long).Show(); } }
public void Show(string title, string message, string firstButtonText, Action firstButtonAction, string secondButtonText, Action secondButtonAction) { var activity = Mvx.Resolve <IMvxAndroidCurrentTopActivity>().Activity; var alert = new AlertDialog.Builder(activity).Create(); alert.SetTitle(title); alert.SetMessage(message); alert.SetButton(firstButtonText, delegate { firstButtonAction(); }); alert.SetButton2(secondButtonText, delegate { secondButtonAction(); }); alert.Show(); }
private void Btn_rst_juego_Click(object sender, EventArgs e) { AlertDialog alerta = new AlertDialog.Builder(this).Create(); alerta.SetTitle("Cobarde"); //alerta.SetIcon(Resource.Drawable.gato); alerta.SetMessage("¿Quieres realmente reiniciar la partida?"); alerta.SetButton("Si", (a, b) => { resetVals(); message("Juego reiniciado..."); }); alerta.SetButton2("No, cancelar", (a, b) => { ; }); alerta.Show(); }
private void ItemLongClicked(object sender, AdapterView.ItemLongClickEventArgs args) { var contact = contactList[args.Position]; var alert = new AlertDialog.Builder(this).Create(); alert.SetTitle("Delete Item?"); alert.SetMessage($"Are you sure you want to delete {contact.Name}?"); alert.SetButton("No", delegate {}); alert.SetButton2("Yes", delegate { contactList.Remove(contact); adapter.NotifyDataSetChanged(); }); alert.Show(); }
private void ListView_Click(object sender, AdapterView.ItemClickEventArgs e) { Message item = adapter[e.Position]; AlertDialog alert = new AlertDialog.Builder(this).Create(); alert.SetTitle(item.Sender); alert.SetMessage(item.Text + "\n\n" + item.Date + "\n" + item.RequestStatusCode); alert.SetButton("OK", (senderAlert, args) => { alert.Dismiss(); }); alert.SetButton2("RETRY", (senderAlert, args) => { alert.Dismiss(); Forward(item); }); alert.Show(); }
public void ShowInstructions() { AlertDialog alert = new AlertDialog.Builder(this).Create(); AlertDialog aler = new AlertDialog.Builder(this).Create(); alert.SetMessage("Esta aplicacion cuenta cada 5 minutos el cambio de cantidad de energia en el dispositivo, es mejor que no lo use en ese tiempo"); alert.SetButton("Continuar", (a, b) => { aler.Show(); }); aler.SetMessage("La aplicacion ya comenzara a medir la velocidad de carga"); aler.SetButton("Comenzar", (c, f) => { Start(); }); aler.SetButton2("Salir", (g, h) => { System.Environment.Exit(0); }); alert.Show(); }
private void DeleteSelectedExpensePeriod() { var listView = View.FindViewById <ListView>(Resource.Id.ExpensePeriodsListView); var adapter = listView.Adapter as ExpensePeriodsAdapter; if (listView.CheckedItemCount > 0 && adapter != null) { ExpensePeriod selectedExpensePeriod = adapter[listView.CheckedItemPosition]; var alert = new AlertDialog.Builder(Context).Create(); alert.SetMessage(string.Format(GetString(Resource.String.DeleteExpensePeriodConfirmation), selectedExpensePeriod.StartDate.ToString("D"))); alert.SetButton( GetString(Resource.String.DeleteExpensePeriodCommand), async(sender, e) => { await ExecuteDeleteExpensePeriodAsync(selectedExpensePeriod); }); alert.SetButton2( GetString(Android.Resource.String.Cancel), (sender, e) => { alert.Cancel(); }); alert.Show(); } }
public void OpenLocationSettings() { LocationManager LM = (LocationManager)Forms.Context.GetSystemService(Android.Content.Context.LocationService); if (LM.IsProviderEnabled(LocationManager.GpsProvider) == false) { AlertDialog ad = new AlertDialog.Builder(this).Create(); ad.SetMessage("Please open location"); ad.SetCancelable(false); ad.SetCanceledOnTouchOutside(false); ad.SetButton("ok", delegate { Android.Content.Context ctx = Forms.Context; ctx.StartActivity(new Intent(Android.Provider.Settings.ActionLocationSourceSettings)); }); ad.SetButton2("cancle", delegate { }); ad.Show(); } }
private void ItemClick(object sender, EventArgs e) { var view = sender as View; var position = (int)view.GetTag(Resource.Id.Object_Position); var item = Items[position]; var a = new AlertDialog.Builder(Context).Create(); a.SetTitle("Open Torrent"); a.SetMessage("Would you like to open this torrent (magnet)?"); a.SetButton2("Yes", (aS, ev) => { var intent = new Intent(Intent.ActionView); intent.SetData(Android.Net.Uri.Parse(item.Link)); intent.AddFlags(ActivityFlags.NewTask); Context.StartActivity(intent); }); a.SetButton("Open in Browser", (aS, eV) => { var intent = new Intent(Intent.ActionView); intent.AddFlags(ActivityFlags.NewTask); intent.SetData(Android.Net.Uri.Parse(item.Guid)); Context.StartActivity(intent); }); a.Show(); }
public void ShowDialog(Context context, int?titleId, ICharSequence message, int okId = Android.Resource.String.Ok, int cancelId = Android.Resource.String.Cancel, Action okAction = null, Action cancelAction = null) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var alertDialog = new AlertDialog.Builder(context).Create(); alertDialog.SetCancelable(false); if (titleId.HasValue) { alertDialog.SetTitle(titleId.Value); } alertDialog.SetMessage(message); alertDialog.SetButton(context.GetString(okId), (s, e) => { okAction?.Invoke(); alertDialog.Dismiss(); alertDialog = null; }); alertDialog.SetButton2(context.GetString(cancelId), (s, e) => { cancelAction?.Invoke(); alertDialog.Dismiss(); alertDialog = null; }); alertDialog.Show(); }
public override bool OnOptionsItemSelected(IMenuItem item) { Intent i = new Intent(); switch (item.ItemId) { case Android.Resource.Id.Home: AlertDialog saveAlert = new AlertDialog.Builder(this).Create(); saveAlert.SetTitle("Warning"); saveAlert.SetMessage("Do you wish to save the drawing?"); saveAlert.SetButton("Save", delegate { SaveDrawing(); i.SetData(Android.Net.Uri.FromFile(new Java.IO.File(path))); SetResult(Result.Ok, i); WidgetHelper.activity.FireFormChangeEvent(v); Finish(); }); saveAlert.SetButton2("Discard", delegate { if (!string.IsNullOrEmpty(path)) { File.Delete(path); } if (dv != null) { dv.ClearCanvas(); dv = null; } SetResult(Result.Canceled); XForm.SetValue(Binding.nodeset, ""); Finish(); }); saveAlert.Show(); return(true); case Resource.Id.menu_save: //overlay the two bitmaps together i.SetData(Android.Net.Uri.FromFile(new Java.IO.File(path))); SetResult(Result.Ok, i); SaveDrawing(); WidgetHelper.activity.FireFormChangeEvent(v); return(true); //reset the item and canvas case Resource.Id.menu_delete: AlertDialog alert = new AlertDialog.Builder(this).Create(); alert.SetTitle("Warning"); alert.SetMessage("Do you want to delete the annotated image?"); alert.SetButton("Yes", delegate { File.Delete(path); XForm.SetValue(Binding.nodeset, ""); BackgroundImage.SetImageBitmap(null); if (dv != null) { dv.ClearCanvas(); dv = null; } }); alert.SetButton2("No", delegate { return; }); alert.Show(); return(true); //image picker case Resource.Id.menu_select: TakePhoto("drawing", Binding, v, WidgetHelper.activity, false); newPhoto = true; return(true); default: return(base.OnOptionsItemSelected(item)); } }
private async void LoadData(View view) { try { var progressBarDialog = new ProgressBarDialog("Asteptati", "Se incarca datele...", Activity, false); progressBarDialog.Show(); // Initialize contacts List <SharingModel> contacts = null; await Task.Run(async() => { string response = await WebServices.WebServices.Post($"{Constants.PublicServerAddress}/api/getSharedPeople", new JSONObject().Put("id", Utils.GetDefaults("Id")), Utils.GetDefaults("Token")); if (!string.IsNullOrEmpty(response)) { contacts = JsonConvert.DeserializeObject <List <SharingModel> >(response); Log.Error("ListaConexiuni", "No. of contacts: " + contacts.Count); } }); Activity.RunOnUiThread(() => { progressBarDialog.Dismiss(); }); if (contacts != null) { var adapter = new SharingAdapter(contacts); _sharingRecyclerView.SetAdapter(adapter); _sharingRecyclerView.SetLayoutManager(new LinearLayoutManager(Activity)); adapter.ItemClick += delegate(object sender, SharingAdapterClickEventArgs args) { string name = contacts[args.Position].Name; string email = contacts[args.Position].Email; CustomDialogProfileSharingData dialog = OpenMiniProfileDialog(); dialog.Name.Text = name; Glide.With(this).Load($"{Constants.PublicServerAddress}/{contacts[args.Position].Avatar}").Into(dialog.Image); dialog.ButtonConfirm.Visibility = ViewStates.Gone; dialog.ButtonCancel.Text = "Sterge"; dialog.ButtonCancel.SetPadding(5, 5, 5, 5); dialog.ButtonCancel.Click += delegate { AlertDialog alertDialog = new AlertDialog.Builder(Activity, Resource.Style.AppTheme_Dialog).Create(); alertDialog.SetTitle("Avertisment"); alertDialog.SetMessage("Doriti sa stergeti aceasta conexiune?"); alertDialog.SetButton("Da", async delegate { SharingModel obj = adapter.getItemAt(args.Position); adapter.DeleteItemAt(args.Position); adapter.NotifyDataSetChanged(); //item deleted from list, call server await sendData(obj); dialog.Dismiss(); // var serialized = JsonConvert.SerializeObject(contacts); // Utils.SetDefaults("Rooms", serialized, Activity); }); alertDialog.SetButton2("Nu", delegate { }); alertDialog.Show(); }; }; adapter.ItemLongClick += delegate(object sender, SharingAdapterClickEventArgs args) { if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { AlertDialog alertDialog = new AlertDialog.Builder(Activity, Resource.Style.AppTheme_Dialog).Create(); alertDialog.SetTitle("Avertisment"); alertDialog.SetMessage("Doriti sa stergeti aceasta conexiune?"); alertDialog.SetButton("Da", delegate { adapter.DeleteItemAt(args.Position); adapter.NotifyDataSetChanged(); // var serialized = JsonConvert.SerializeObject(contacts); // Utils.SetDefaults("Rooms", serialized, Activity); }); alertDialog.SetButton2("Nu", delegate { }); alertDialog.Show(); } else { AlertDialog alertDialog = new AlertDialog.Builder(Activity, Resource.Style.AppTheme_Dialog).Create(); alertDialog.SetTitle("Avertisment"); alertDialog.SetMessage("Doriti sa stergeti aceasta conexiune?"); alertDialog.SetButton("Da", delegate { adapter.DeleteItemAt(args.Position); adapter.NotifyDataSetChanged(); // var serialized = JsonConvert.SerializeObject(contacts); // Utils.SetDefaults("Rooms", serialized, Activity); }); alertDialog.SetButton2("Nu", delegate { //just close dialog }); alertDialog.Show(); } }; } } catch (Exception e) { e.PrintStackTrace(); } }
public void ContinueToImageSelect() { try { photoFile = CreateImageFile(); } catch (IOException ex) { Console.WriteLine(ex.ToString()); } if (photoFile != null) { photoUri = FileProvider.GetUriForFile(this, $"{PackageName}.fileprovider", photoFile); AlertDialog imagePicker = new AlertDialog.Builder(this).Create(); imagePicker.SetTitle("Choose Image or Take Photo"); imagePicker.SetButton("Take Photo", delegate { Intent captureIntent = new Intent(MediaStore.ActionImageCapture); captureIntent.PutExtra(MediaStore.ExtraOutput, photoUri); StartActivityForResult(captureIntent, REQUEST_IMAGE_CAPTURE); }); imagePicker.SetButton2("Gallery", delegate { /* * Intent galleryIntent = new Intent(Intent.ActionGetContent); * galleryIntent.SetType("image/*"); * galleryIntent.PutExtra(MediaStore.ExtraOutput, photoUri); * StartActivityForResult(galleryIntent, REQUEST_GALLERY_IMAGE); */ List <Intent> galleryIntents = new List <Intent>(); Intent galleryIntent = new Intent(Intent.ActionGetContent); galleryIntent.SetType("image/*"); IList <ResolveInfo> listGallery = PackageManager.QueryIntentActivities(galleryIntent, 0); foreach (ResolveInfo res in listGallery) { string packageName = res.ActivityInfo.PackageName; Intent intent = new Intent(galleryIntent); intent.SetComponent(new ComponentName(packageName, res.ActivityInfo.Name)); intent.SetPackage(packageName); intent.PutExtra(MediaStore.ExtraOutput, photoUri); galleryIntents.Add(intent); } Intent chooserIntent = Intent.CreateChooser(galleryIntent, "Select image from Gallery"); //add gallery options chooserIntent.PutExtra(Intent.ExtraInitialIntents, galleryIntents.ToArray()); StartActivityForResult(chooserIntent, REQUEST_GALLERY_IMAGE); }); imagePicker.Show(); imagePicker.DismissEvent += delegate { File.Delete(photoFile.Path); }; } }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.WorkListLayout); if (!User.IsValidUser()) { StartActivity(typeof(MainActivity)); return; } TextView tvwMainMsg = FindViewById <TextView>(Resource.Id.tvwWkvMsg); (GetSystemService(NotificationService) as NotificationManager).Cancel(0); //cancel all related notifications try { string restUrl = Values.ApiRootAddress + "Approval?compId=" + new AppPreferences().GetValue(User.CompId) + "&empNo=" + new AppPreferences().GetValue(User.EmployeeNo); tvwMainMsg.BasicMsg(Values.LoadingMsg); dynamic response = await new DataApi().GetAsync(restUrl); tvwMainMsg.Text = ""; bool success = DataApi.IsJsonObject(response); if (success) { if (response["Error"] == "") { response = response["Values"]; List <object> appraisees = new List <object>(); for (int i = 0; i < response.Count; i++) { Appraisee appraisee = new Appraisee(); appraisee.SerialNo = i + 1; appraisee.Message = response[i]["Description"]; appraisee.ApprovalType = response[i]["Approval_Type"]; appraisee.SentBy = response[i]["Created By"]; appraisee.DateSent = response[i]["Date"]; appraisee.Alertid = response[i]["Alert_Id"]; appraisee.RequestId = response[i]["REQUEST"] ?? 0; appraisees.Add(appraisee); } tvwMainMsg.SuccessMsg("Outstanding Approvals: " + appraisees.Count); adapter = new ApprovalAdapter(appraisees); adapter.ItemClick += async(sender, position) => { try { Appraisee appraisee = (Appraisee)adapter[position]; //check for internet access object[] networkStatus = await DataApi.NetworkAccessStatus(); if (!(bool)networkStatus[0]) { tvwMainMsg.ErrorMsg((string)networkStatus[1]); return; } if (appraisee.ApprovalType == "Medical") { restUrl = Values.ApiRootAddress + "Approval/GetMedicalRequest?compId=" + new AppPreferences().GetValue(User.CompId) + "&empNo=" + new AppPreferences().GetValue(User.EmployeeNo) + "&accYear=" + new AppPreferences().GetValue(User.AccountingYear) + "&reqId=" + appraisee.RequestId; response = await new DataApi().GetAsync(restUrl); if (response["Error"] == "") { response = response["Values"]; var view = LayoutInflater.Inflate(Resource.Layout.MedApprovalDialogLayout, null); AlertDialog dialog = new AlertDialog.Builder(this).Create(); dialog.SetTitle("MEDICAL APPROVAL"); view.FindViewById <TextView>(Resource.Id.tvwMedEmpName).Text = response[0]["HEMP_EMPLYE_NAME"]; view.FindViewById <TextView>(Resource.Id.tvwMedReqDate).Text = response[0]["Date"]; view.FindViewById <TextView>(Resource.Id.tvwMedHospital).Text = response[0]["HOSP_NAME"]; view.FindViewById <TextView>(Resource.Id.tvwMedLimBal).Text = response[0]["LIMITBAL"]; view.FindViewById <TextView>(Resource.Id.tvwMedUsed).Text = response[0]["USED"]; view.FindViewById <TextView>(Resource.Id.tvwMedReason).Text = response[0]["REQ_REASON"]; dialog.SetView(view); dialog.SetButton("Approve", async(s, e) => { try { string comment = view.FindViewById <EditText>(Resource.Id.edtMedComment).Text; string status = await PostMedical(appraisee, response, "A", comment); CompleteTask(status, adapter, position, dialog, tvwMainMsg); } catch (Exception ex) { ex.Log(); tvwMainMsg.ErrorMsg(Values.ErrorMsg); } }); dialog.SetButton2("Reject", async(s, e) => { try { string comment = view.FindViewById <EditText>(Resource.Id.edtMedComment).Text; string status = await PostMedical(appraisee, response, "D", comment); CompleteTask(status, adapter, position, dialog, tvwMainMsg); } catch (Exception ex) { ex.Log(); tvwMainMsg.ErrorMsg(Values.ErrorMsg); } }); dialog.SetButton3("Cancel", (s, e) => { dialog.Dismiss(); tvwMainMsg.SuccessMsg("Outstanding Approvals: " + adapter.ItemCount); }); dialog.Show(); } else { tvwMainMsg.ErrorMsg((string)response["Error"]); } } else if (appraisee.ApprovalType == "Leave") { restUrl = Values.ApiRootAddress + "Approval/GetLeaveRequest?compId=" + new AppPreferences().GetValue(User.CompId) + "&empNo=" + new AppPreferences().GetValue(User.EmployeeNo) + "&reqId=" + appraisee.RequestId; tvwMainMsg.BasicMsg(Values.WaitingMsg); response = await new DataApi().GetAsync(restUrl); tvwMainMsg.Text = ""; if (response["Error"] == "") { response = response["Values"]; var view = LayoutInflater.Inflate(Resource.Layout.LvlApprovalDialogLayout, null); AlertDialog dialog = new AlertDialog.Builder(this).Create(); dialog.SetTitle("LEAVE APPROVAL"); view.FindViewById <TextView>(Resource.Id.tvwLvlEmpName).Text = response[0]["EmpName"]; view.FindViewById <TextView>(Resource.Id.tvwLvlEmpNo).Text = (int)response[0]["EmpNo"] + ""; view.FindViewById <TextView>(Resource.Id.tvwLvlDesc).Text = response[0]["LvDesc"]; view.FindViewById <TextView>(Resource.Id.tvwLvlStartDate).Text = response[0]["StrtDt"]; view.FindViewById <TextView>(Resource.Id.tvwLvlEndDate).Text = response[0]["EndDt"]; view.FindViewById <TextView>(Resource.Id.tvwLvlNoOfDays).Text = (int)response[0]["NoOfDays"] + ""; view.FindViewById <TextView>(Resource.Id.tvwLvlReason).Text = response[0]["Reason"]; dialog.SetView(view); dialog.SetButton("Approve", async(s, e) => { try { string comment = view.FindViewById <EditText>(Resource.Id.edtLvlComment).Text; string status = await PostLeave(appraisee, response, "A", comment); CompleteTask(status, adapter, position, dialog, tvwMainMsg); } catch (Exception ex) { ex.Log(); tvwMainMsg.ErrorMsg(Values.ErrorMsg); } }); dialog.SetButton2("Reject", async(s, e) => { try { string comment = view.FindViewById <EditText>(Resource.Id.edtLvlComment).Text; string status = await PostLeave(appraisee, response, "D", comment); CompleteTask(status, adapter, position, dialog, tvwMainMsg); } catch (Exception ex) { ex.Log(); tvwMainMsg.ErrorMsg(Values.ErrorMsg); } }); dialog.SetButton3("Cancel", (s, e) => { dialog.Dismiss(); tvwMainMsg.SuccessMsg("Outstanding Approvals: " + adapter.ItemCount); }); dialog.Show(); } else { tvwMainMsg.ErrorMsg((string)response["Error"]); } } else if (appraisee.ApprovalType == "Training") { restUrl = Values.ApiRootAddress + "Approval/GetTrainingRequest?compId=" + new AppPreferences().GetValue(User.CompId) + "&empNo=" + new AppPreferences().GetValue(User.EmployeeNo) + "&reqId=" + appraisee.RequestId; tvwMainMsg.BasicMsg(Values.WaitingMsg); response = await new DataApi().GetAsync(restUrl); tvwMainMsg.Text = ""; if (response["Error"] == "") { response = response["Values"]; var view = LayoutInflater.Inflate(Resource.Layout.TrnApprovalDialogLayout, null); AlertDialog dialog = new AlertDialog.Builder(this).Create(); dialog.SetTitle("TRAINING APPROVAL"); view.FindViewById <TextView>(Resource.Id.tvwTrnEmpName).Text = response[0]["Employee Name"]; view.FindViewById <TextView>(Resource.Id.tvwTrnDesc).Text = response[0]["Training Description"]; view.FindViewById <TextView>(Resource.Id.tvwTrnReason).Text = response[0]["Reason"]; view.FindViewById <TextView>(Resource.Id.tvwTrnNomBy).Text = response[0]["Nominating Emp Name"]; dialog.SetView(view); dialog.SetButton("Approve", async(s, e) => { try { string comment = view.FindViewById <EditText>(Resource.Id.edtTrnComment).Text; string status = await PostTraining(appraisee, response, "A", comment); CompleteTask(status, adapter, position, dialog, tvwMainMsg); } catch (Exception ex) { ex.Log(); tvwMainMsg.ErrorMsg(Values.ErrorMsg); } }); dialog.SetButton2("Reject", async(s, e) => { try { string comment = view.FindViewById <EditText>(Resource.Id.edtTrnComment).Text; string status = await PostTraining(appraisee, response, "D", comment); CompleteTask(status, adapter, position, dialog, tvwMainMsg); } catch (Exception ex) { ex.Log(); tvwMainMsg.ErrorMsg(Values.ErrorMsg); } }); dialog.SetButton3("Cancel", (s, e) => { dialog.Dismiss(); tvwMainMsg.SuccessMsg("Outstanding Approvals: " + adapter.ItemCount); }); dialog.Show(); } else { tvwMainMsg.ErrorMsg((string)response["Error"]); } } else { tvwMainMsg.ErrorMsg("Request type not provisioned"); //should not happen for mobile (handles only 3 approvals) } } catch (Exception ex) { ex.Log(); tvwMainMsg.ErrorMsg(Values.ErrorMsg); } }; RecyclerView recyclerView = (RecyclerView)FindViewById(Resource.Id.rvwWorkListViewer); recyclerView.SetLayoutManager(new LinearLayoutManager(this)); recyclerView.SetAdapter(adapter); } else { tvwMainMsg.ErrorMsg((string)response["Error"]); } } else { tvwMainMsg.ErrorMsg((string)response); } } catch (Exception ex) { ex.Log(); tvwMainMsg.ErrorMsg(Values.ErrorMsg); } }