Imports System.ComponentModel Imports DevExpress.Xpf.Docking Imports DevExpress.Xpf.Editors Public Enum TiposModificacion Modificable = 0 ModificableEnNuevos = 1 ModificableEnExistentes = 2 NoModificable = 3 End Enum Public Class PropiedadesTS ' Public Property ApCablin As ApCabLin Public Property NombreCampo As String = "" Public Property Modificable As TiposModificacion Public Property Obligatorio As Boolean Public Property UsualCorreccion As Boolean = True Public Property Unico As Boolean = False Public Property NumeroObjeto As Integer Public Property CapturarEnter As Boolean = True Public Property MayusculasMinusculas As CharacterCasing = CharacterCasing.Upper End Class Public Class PropiedadesTSGC Public Property Descripcion As String Public Property CamposObligatorios As String Public Property CamposUnicos As String Public Property PermitirEliminar As Boolean = True Public Property PermitirExportar As Boolean? = True Public Property EnlazarNulosOVacios As Boolean = False Public Property PermisosDefecto As Permisos Public Property CabeceraImpresion As String Public Property BusquedaAcentosInsensitivo As Boolean = False End Class Public Class Permisos Property Consultar As Boolean Property Nuevos As Boolean Property Eliminar As Boolean Property Modificar As Boolean Property Impresion As Boolean Property Otros As Boolean Property Exportar As Boolean End Class Public Class Plantilla Property idPlantilla As Integer Property Descripcion As String End Class Public Class Accion Property idAccion As Integer Property Descripcion As String End Class Public Enum TiposPermisosEnum Consultar = 0 Nuevos = 1 Eliminar = 2 Modificar = 3 Otros = 4 End Enum Public Enum ModoContextoSavingChangesEnum EventoSavingChanges = 0 SoloDespuesGuardar = 1 End Enum Public Class Configuracion Public Shared ModoBusquedaAND As Boolean = False Public Shared ComportamientoValidacion As Validation.InvalidValueBehavior = Validation.InvalidValueBehavior.AllowLeaveEditor ' Public Shared ComportamientoValidacion As Validation.InvalidValueBehavior = Validation.InvalidValueBehavior.WaitForValidValue ' Public Shared ModoEventosContextoSavingChanges As ModoContextoSavingChangesEnum = ModoContextoSavingChangesEnum.EventoSavingChanges Public Shared ModoEventosContextoSavingChanges As ModoContextoSavingChangesEnum = ModoContextoSavingChangesEnum.SoloDespuesGuardar Public Shared MostrarBotonCerrarEnPestaña As Boolean = True Public Shared NuevosRapido As Boolean = True Public Shared BusquedaAcentosInsensitivo As Boolean = False Public Delegate Function DelegadoModoSuperUsuario(Aplicacion As tsUserControl) As Boolean Public Shared FuncionModoSuperUsuario As DelegadoModoSuperUsuario ' Public Delegate Function DelegadoModoSuperUsuarioTsAplicacion(Aplicacion As tsAplicacion) As Boolean ' Public Shared FuncionModoSuperUsuarioTsAplicacion As DelegadoModoSuperUsuarioTsAplicacion Public Shared ComportamientoGuardar As ComportamientoGuardarEnum = ComportamientoGuardarEnum.GUARDAR_CERRAR_BUSCAR Public Shared Property OcultarBotonEliminarSinPermisos As Boolean = False End Class Public Enum ComportamientoGuardarEnum As Integer GUARDAR_CERRAR_BUSCAR = 0 GUARDAR_CERRAR_ULTIMA_PESTAÑA = 1 End Enum Public Class Comun Public Shared WithEvents dm As DockLayoutManager Public Shared DocPanelActual As DevExpress.Xpf.Docking.DocumentPanel Public Shared DocPanelAnterior As DevExpress.Xpf.Docking.DocumentPanel Public Delegate Sub ErrorNoControlado(Aplicacion As String, ex As Exception) 'Public Shared Sub RefrescaAplicaciones(lg As LayoutGroup, TagsApArefrescar() As String, DocPanelTag As String) ' Try ' Dim dcs As IEnumerable(Of BaseLayoutItem) ' If Not TagsApArefrescar Is Nothing Then ' For Each grupodocumentos As DocumentGroup In lg.Items.Where(Function(x) x.GetType Is GetType(DocumentGroup)) ' For Each Etiqueta In TagsApArefrescar ' dcs = (From p In grupodocumentos.Items Where p.Tag = Etiqueta) ' If dcs.Count > 0 Then ' Dim dc As DocumentPanel = dcs.First ' If dc.Content.GetType Is GetType(tsWPF.ContenedorCabLin) Then ' Dim a = DirectCast(dc.Content, tsWPF.ContenedorCabLin).Aplicacion ' If Not a.DeshabilitarRefresco Then ' If a.RefrescoSolicitado = False Then ' a.RefrescoSolicitado = True ' a.uc.Dispatcher.BeginInvoke(New Action(Sub() a.RefrescaUC(, True)), System.Windows.Threading.DispatcherPriority.SystemIdle) ' End If ' End If ' ElseIf dc.Content.GetType Is GetType(tsWPF.ContenedorLineas) Then ' Dim a = DirectCast(dc.Content, tsWPF.ContenedorLineas).apLinea ' If Not a.DeshabilitarRefresco Then ' If a.RefrescoSolicitado = False Then ' a.RefrescoSolicitado = True ' a.uc.Dispatcher.BeginInvoke(New Action(Sub() a.RefrescaUC(True)), System.Windows.Threading.DispatcherPriority.SystemIdle) ' End If ' End If ' ElseIf dc.Content.GetType Is GetType(tsWPF.ContenedorAplicacion) Then ' Dim a = DirectCast(dc.Content, tsWPF.ContenedorAplicacion)._Aplicacion ' If a.HabilitarRefresco Then ' If a.RefrescoSolicitado = False Then ' a.RefrescoSolicitado = True ' a.Dispatcher.BeginInvoke(New Action(Sub() a.RefrescaUC(, True)), System.Windows.Threading.DispatcherPriority.SystemIdle) ' End If ' End If ' End If ' End If ' Next ' Next ' Else ' For Each grupodocumentos As DocumentGroup In lg.Items.Where(Function(x) x.GetType Is GetType(DocumentGroup)) ' dcs = (From p In grupodocumentos.Items Where p.Tag <> DocPanelTag) ' For Each dc As DocumentPanel In dcs ' If dc.Content.GetType Is GetType(tsWPF.ContenedorCabLin) Then ' Dim a = DirectCast(dc.Content, tsWPF.ContenedorCabLin).Aplicacion ' If Not a.DeshabilitarRefresco Then ' If a.RefrescoSolicitado = False Then ' a.RefrescoSolicitado = True ' a.uc.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(, True)), System.Windows.Threading.DispatcherPriority.Background) ' End If ' End If ' ElseIf dc.Content.GetType Is GetType(tsWPF.ContenedorLineas) Then ' Dim a = DirectCast(dc.Content, tsWPF.ContenedorLineas).apLinea ' If Not a.DeshabilitarRefresco Then ' If a.RefrescoSolicitado = False Then ' a.RefrescoSolicitado = True ' a.uc.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(True)), System.Windows.Threading.DispatcherPriority.Background) ' End If ' End If ' ElseIf dc.Content.GetType Is GetType(tsWPF.ContenedorAplicacion) Then ' Dim a = DirectCast(dc.Content, tsWPF.ContenedorAplicacion)._Aplicacion ' If a.HabilitarRefresco Then ' If a.RefrescoSolicitado = False Then ' a.RefrescoSolicitado = True ' a.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(, True)), System.Windows.Threading.DispatcherPriority.Background) ' End If ' End If ' End If ' Next ' Next ' End If ' Catch ex As Exception ' Debug.Write(ex.Message) ' End Try 'End Sub Public Shared Sub RefrescaAplicaciones(lg As LayoutGroup, TagsApArefrescar() As String, DocPanelTag As String, Optional AplicacionPadre As Type = Nothing) Try Dim dcs As IEnumerable(Of BaseLayoutItem) If Not TagsApArefrescar Is Nothing Then For Each grupodocumentos As DocumentGroup In lg.Items.Where(Function(x) x.GetType Is GetType(DocumentGroup)) For Each Etiqueta In TagsApArefrescar dcs = (From p In grupodocumentos.Items Where p.Tag = Etiqueta) If dcs.Count > 0 Then Dim dc As DocumentPanel = dcs.First Select Case dc.Content.GetType Case GetType(ContenedorAplicacion) Dim a = DirectCast(dc.Content, ContenedorAplicacion)._Aplicacion If a.HabilitarRefresco OrElse (AplicacionPadre IsNot Nothing AndAlso a.GetType Is AplicacionPadre) Then If a.RefrescoSolicitado = False Then a.RefrescoSolicitado = True a.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(, True)), System.Windows.Threading.DispatcherPriority.Background) End If End If Case GetType(ContenedorLineas) Dim a = DirectCast(dc.Content, ContenedorLineas).apLinea If a.DeshabilitarRefresco = False Then If a.RefrescoSolicitado = False Then a.RefrescoSolicitado = True a.ContenedorL.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(True)), System.Windows.Threading.DispatcherPriority.Background) End If End If Case GetType(ContenedorCabLin) Dim a = DirectCast(dc.Content, ContenedorCabLin).Aplicacion If a.DeshabilitarRefresco = False Then If a.RefrescoSolicitado = False Then a.RefrescoSolicitado = True a.ContenedorCL.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(, True)), System.Windows.Threading.DispatcherPriority.Background) End If End If End Select End If Next Next Else For Each grupodocumentos As DocumentGroup In lg.Items.Where(Function(x) x.GetType Is GetType(DocumentGroup)) dcs = (From p In grupodocumentos.Items Where p.Tag <> DocPanelTag) For Each dc As DocumentPanel In dcs Select Case dc.Content.GetType Case GetType(ContenedorAplicacion) Dim a = DirectCast(dc.Content, ContenedorAplicacion)._Aplicacion If a.HabilitarRefresco OrElse (AplicacionPadre IsNot Nothing AndAlso a.GetType Is AplicacionPadre) Then If a.RefrescoSolicitado = False Then a.RefrescoSolicitado = True a.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(, True)), System.Windows.Threading.DispatcherPriority.Background) End If End If Case GetType(ContenedorLineas) Dim a = DirectCast(dc.Content, ContenedorLineas).apLinea If a.DeshabilitarRefresco = False Then If a.RefrescoSolicitado = False Then a.RefrescoSolicitado = True a.ContenedorL.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(True)), System.Windows.Threading.DispatcherPriority.Background) End If End If Case GetType(ContenedorCabLin) Dim a = DirectCast(dc.Content, ContenedorCabLin).Aplicacion If a.DeshabilitarRefresco = False Then If a.RefrescoSolicitado = False Then a.RefrescoSolicitado = True a.ContenedorCL.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(, True)), System.Windows.Threading.DispatcherPriority.Background) End If End If End Select Next Next End If Catch ex As Exception Debug.Write(ex.Message) End Try End Sub Private Shared Sub dm_DockItemClosed(sender As Object, e As Base.DockItemClosedEventArgs) Handles dm.DockItemClosed If e.Item.Tag = "visualizadorinformes" Then Try Dim uc = DirectCast(DirectCast(e.Item, DocumentPanel).Content, ucVisualizadorInformesa) Dim modelo As tsXtraReportPreviewModel = uc.Visualizador.Model modelo.Report.Dispose() modelo.Dispose() Catch ex As Exception End Try End If 'GC.Collect() End Sub Private Shared Sub dm_DockItemActivated(sender As Object, ea As Base.DockItemActivatedEventArgs) Handles dm.DockItemActivated If Not ea.Item Is Nothing AndAlso ea.Item.GetType Is GetType(DocumentPanel) Then Dim contenedor = DirectCast(ea.Item, DocumentPanel).Content If contenedor.GetType Is GetType(ContenedorCabLin) Then Dim apcl As ApCabLin = DirectCast(contenedor, ContenedorCabLin).Aplicacion If apcl.Refrescar And Not apcl.DeshabilitarRefresco Then apcl.RefrescaUC() Comun.DocPanelAnterior = Comun.DocPanelActual Comun.DocPanelActual = apcl.DocPanel ElseIf contenedor.GetType Is GetType(ContenedorLineas) Then Dim apl As ApLineas = DirectCast(contenedor, ContenedorLineas).apLinea If apl.Refrescar Then apl.RefrescaUC(, False) End If apl.Refrescar = False Comun.DocPanelAnterior = Comun.DocPanelActual Comun.DocPanelActual = apl.DocPanel ElseIf contenedor.GetType Is GetType(ContenedorAplicacion) Then Dim ap As tsUserControl = DirectCast(contenedor, ContenedorAplicacion)._Aplicacion Comun.DocPanelAnterior = Comun.DocPanelActual Comun.DocPanelActual = ap.docpanel End If End If End Sub Public Enum EstadosAplicacion SinDatos = 0 Nuevo = 1 ModificandoRegistro = 2 AplicacionSinIndice = 3 Cancelado = 100 End Enum End Class