bool SetAlmoco() { bool result = false; switch (controller.SetAlmoco()) { case StatusPontoEletronico.NAO_INICIADO: Toast.MakeText(this, Resources.GetString(Resource.String.almoco_error_ponto), ToastLength.Long).Show(); break; case StatusPontoEletronico.ALMOCO_INICIADO: result = true; break; case StatusPontoEletronico.ALMOCO_FINALIZADO: Toast.MakeText(this, Resources.GetString(Resource.String.almoco_finalizado), ToastLength.Long).Show(); var resultintent = new Intent(this, typeof(AlarmReceiverAlmoco)); var pending = PendingIntent.GetBroadcast(this, (int)TipoNotificacao.AlarmeAlmoco, resultintent, PendingIntentFlags.UpdateCurrent); if (pending != null) { var alarmManager = GetSystemService(AlarmService).JavaCast <AlarmManager>(); alarmManager.Cancel(pending); pending.Cancel(); } break; case StatusPontoEletronico.CHECKOUT: Toast.MakeText(this, Resources.GetString(Resource.String.almoco_error), ToastLength.Long).Show(); break; } return(result); }
bool SetAlmoco() { bool result = false; UIAlertController alert; InvokeOnMainThread(delegate { switch (genController.SetAlmoco()) { case StatusPontoEletronico.NAO_INICIADO: alert = UIAlertController.Create("E necessario um ponto aberto\npara ativar o horario de almoco", null, UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); alert.View.TintColor = UIColor.FromRGB(10, 88, 90); PresentViewController(alert, true, null); break; case StatusPontoEletronico.ALMOCO_INICIADO: result = true; break; case StatusPontoEletronico.ALMOCO_FINALIZADO: alert = UIAlertController.Create("Horario de Almoco finalizado", null, UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); alert.View.TintColor = UIColor.FromRGB(10, 88, 90); PresentViewController(alert, true, null); if (requestID != null) { string[] ids = { requestID }; UNUserNotificationCenter.Current.RemovePendingNotificationRequests(ids); } break; case StatusPontoEletronico.CHECKOUT: alert = UIAlertController.Create("Horario de almoco ja realizado", null, UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); alert.View.TintColor = UIColor.FromRGB(10, 88, 90); PresentViewController(alert, true, null); break; } }); return(result); }
internal bool SetAlmoco() { bool result = false; UIAlertController alertError; switch (genericController.SetAlmoco()) { case StatusPontoEletronico.NAO_INICIADO: alertError = UIAlertController.Create("E necessario um ponto aberto\npara ativar o horario de almoco", null, UIAlertControllerStyle.Alert); alertError.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Cancel, (actionCancel) => { })); alertError.View.TintColor = UIColor.FromRGB(10, 88, 90); PresentViewController(alertError, true, null); break; case StatusPontoEletronico.ALMOCO_INICIADO: result = true; break; case StatusPontoEletronico.ALMOCO_FINALIZADO: alertError = UIAlertController.Create("Horario de Almoco finalizado", null, UIAlertControllerStyle.Alert); alertError.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Cancel, (actionCancel) => { })); alertError.View.TintColor = UIColor.FromRGB(10, 88, 90); PresentViewController(alertError, true, null); if (requestID != null) { string[] ids = { requestID }; UNUserNotificationCenter.Current.RemovePendingNotificationRequests(ids); } break; case StatusPontoEletronico.CHECKOUT: alertError = UIAlertController.Create("Horario de almoco ja realizado", null, UIAlertControllerStyle.Alert); alertError.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Cancel, (actionCancel) => { })); alertError.View.TintColor = UIColor.FromRGB(10, 88, 90); PresentViewController(alertError, true, null); break; } return(result); }