private async void SeleccionarEmpresa(object sender, SelectedItemChangedEventArgs e) { bool b_visible = (e.SelectedItem as lc_acc_unidad).b_visible; VarGlobal.cod_empresa = (e.SelectedItem as lc_acc_unidad).cod_empresa; if (b_visible) { Content.IsEnabled = false; var loadingPage = new pg_Loading(); await Navigation.PushPopupAsync(loadingPage); //VarGlobal.cod_empresa = (e.SelectedItem as lc_acc_unidad).cod_empresa; VarGlobal.cod_unidad = (e.SelectedItem as lc_acc_unidad).cod_unidad; VarGlobal.cod_personal = (e.SelectedItem as lc_acc_unidad).cod_personal; VarGlobal.nom_personal = (e.SelectedItem as lc_acc_unidad).nom_personal; await Navigation.PushModalAsync(new MasterDetailPage1("pg_pro_tarea_opc")); await Navigation.RemovePopupPageAsync(loadingPage); Content.IsEnabled = true; } }
private async void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { VarGlobal.alerta_registro = true; Type TargetType = typeof(MasterDetailPage1Detail);; var item = e.SelectedItem as lc_acc_menu; if (item == null) { return; } var loadingPage = new pg_Loading(); await Navigation.PushPopupAsync(loadingPage); if (item.nom_menu == "Cerrar Sesión") { var popupAlert = new pg_confirmacion(new ent_mensaje { tip_mensaje = "INF", tit_mensaje = "@tento24", tex_mensaje = "¿Desea Cerrar Sesión?... se perderan los registros grabados en el dispositivo." }); var result = await popupAlert.Show(); await Navigation.PushPopupAsync(loadingPage); if (result) { VarGlobal.Limpiar(); DB = LocalDB.Instance; var usuario = DB.lc_acc_usuario.ToList(); string s_cod_usuario = ""; for (int i = 0; i < usuario.Count; i++) { s_cod_usuario = usuario[i].cod_usuario; } var eliminar = DB.lc_acc_usuario.Delete(x => x.cod_usuario == s_cod_usuario); VarGlobal.EliminarTodosRegistros(); await Navigation.PushModalAsync(new MainPage("sin_login")); await Navigation.RemovePopupPageAsync(loadingPage); return; } else { MainPage = new MasterDetailPage1(ruta); await Navigation.RemovePopupPageAsync(loadingPage); return; } } VarGlobal.cod_modulo_2do = ""; switch (item.cod_menu) { case "SINCRO": //Proyecto TargetType = typeof(pg_sincronizar); VarGlobal.cod_modulo = ""; break; case "UNIDAD": //Proyecto // Direccionar a Seleccionar Empresa //lc_acc_menu_Data o_Data = new lc_acc_menu_Data(); //o_Data.Eliminar(); VarGlobal.cod_empresa = ""; MainPage = new MasterDetailPage1("pg_empresa"); TargetType = typeof(pg_empresa); //VarGlobal.cod_unidad = ""; //VarGlobal.cod_modulo = ""; break; case "15_30_": //Proyecto //TargetType = typeof(pg_pro_proyecto_qry); VarGlobal.cod_modulo = "PG"; break; case "72_10_": //Inspección TargetType = typeof(pg_pro_inspeccion_qry); VarGlobal.pro_hallazgo = new lc_pro_hallazgo(); VarGlobal.cod_modulo = "IP"; VarGlobal.pro_hallazgo.cod_modulo = "IP"; //VarGlobal.pro_hallazgo.cod_modulo = "IP"; VarGlobal.cod_modulo_2do = "IP"; break; case "66_10_": //Observacion TargetType = typeof(pg_pro_hallazgo_qry); VarGlobal.pro_hallazgo = new lc_pro_hallazgo(); VarGlobal.pro_hallazgo.cod_modulo = "OB"; VarGlobal.cod_modulo = "OB"; VarGlobal.cod_modulo_2do = "OB"; VarGlobal.pro_hallazgo.cod_referencia = ""; break; case "69_10_": //Incidente TargetType = typeof(pg_pro_incidente_qry); VarGlobal.cod_modulo = "IN"; //VarGlobal.cod_modulo_2do = "IN"; break; case "85_10_": //Tarea TargetType = typeof(pg_pro_tarea_opc); break; case "62_10_": //VEO TargetType = typeof(pg_pro_veoregistro_qry); VarGlobal.cod_modulo = "VE"; break; } var page = (Page)Activator.CreateInstance(TargetType); page.Title = item.nom_menu; await Navigation.RemovePopupPageAsync(loadingPage); Detail = new IconNavigationPage(page) { BarBackgroundColor = Color.FromHex("#0199DC") }; ContarRegistros(); IsPresented = false; MasterPage.ListView.SelectedItem = null; }