/// <summary> /// Ons the create. /// </summary> /// <param name="savedInstanceState">Saved instance state.</param> protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //BroadcastProductosPendientes(); BroadcastProduct(); BroadcastPendientesNoFinalizados(); DataManager.FechaHoy = DateTime.Now.DayOfYear; SetContentView(Resource.Layout.main_activity); if (ValidationUtils.GetNetworkStatus()) { await GetLocationCompatAsync(); loading(); await PerfilarAsync(); AppCenter.Start(Constantes.KEY_APP_CENTER, typeof(Analytics), typeof(Crashes)); } else { Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this); builder.SetTitle("Productos Refresh"); builder.SetIcon(Resource.Mipmap.ic_refresh); builder.SetCancelable(false); builder.SetMessage(" Estimado usuario, al iniciar productos refresh debes tener acceso a internet. Luego podrás ocupar la aplicación sin problemas incluso cuando no tengas conexión a la red.\n Debes tener en cuenta que si cierras las app, debes estar conectado a internet para abrirla nuevamente."); builder.SetPositiveButton("Aceptar", delegate { Cerrar.closeApplication(this); }); builder.Show(); AnalyticService.TrackAnalytics("Main Activity", new Dictionary <string, string> { { "Category", "Sin conexion a internet al iniciar la app" }, { "Action", "Validacion de conexion" } }); } }
/// <summary> /// Ons the back pressed. /// </summary> public override void OnBackPressed() { Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this); builder.SetTitle("Trazabilidad de Carnes"); builder.SetMessage("¿Está seguro que desea salir de la app?"); builder.SetPositiveButton("Aceptar", delegate { Cerrar.closeApplication(this); }); builder.SetNegativeButton("Cancelar", delegate { }); builder.Show(); }
/// <summary> /// Ons the back pressed. /// </summary> public override void OnBackPressed() { Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this); builder.SetTitle("Productos Refresh"); builder.SetMessage("¿Está seguro que desea salir de la app?"); builder.SetPositiveButton("Aceptar", delegate { Cerrar.closeApplication(this); }); builder.SetNegativeButton("Cancelar", delegate { }); builder.Show(); }
/// <summary> /// Dialogs the warning. /// </summary> /// <param name="title">Title.</param> /// <param name="message">Message.</param> /// <param name="positiveButton">Positive button.</param> public void dialogWarning(string title, string message, string positiveButton) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle(title); builder.SetMessage(message); builder.SetIcon(Resource.Mipmap.ic_refresh); builder.SetCancelable(false); builder.SetPositiveButton(positiveButton, delegate { Cerrar.closeApplication(this); }); builder.Show(); }
/// <summary> /// Ons the back pressed. /// </summary> public override void OnBackPressed() { if (DataManager.estadoVolverAlMapa.Equals("1")) { Finish(); } else { Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this); builder.SetTitle("Trazabilidad de carnes"); builder.SetMessage("¿Está seguro que desea salir de la app?"); builder.SetPositiveButton("Aceptar", delegate { Cerrar.closeApplication(this); }); builder.SetNegativeButton("Cancelar", delegate { }); builder.Show(); } }
/// <summary> /// Ons the request permissions result. /// </summary> /// <param name="requestCode">Request code.</param> /// <param name="permissions">Permissions.</param> /// <param name="grantResults">Grant results.</param> public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults) { base.OnRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { case RequestLocationId: { if (grantResults[0] == (int)Permission.Granted) { var toast = Toast.MakeText(this, "Permisos asignados", ToastLength.Short); toast.Show(); } else { var toast = Toast.MakeText(this, "Los permisos no fueron otorgados, la aplicación no se puede utilizar", ToastLength.Long); toast.Show(); Cerrar.closeApplication(this); } } break; } }