Option Strict Off
Imports System.Threading.Tasks
Imports DevExpress.Xpf.Docking

Public Class BDContexto
    'Friend Shared Sub Contexto_SavingChanges(GrupoDocumentos As DocumentGroup, TagsApArefrescar() As String, DocPanelTag As String, Aplicacion As String, RegistroNuevo As Boolean, idRegistro As Object)
    '    Try
    '        Dim dcs As IEnumerable(Of BaseLayoutItem)
    '        If Not TagsApArefrescar Is Nothing Then
    '            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
    '                        'DirectCast(dc.Content, tsWPF.ContenedorCabLin).Aplicacion.Refrescar = True
    '                        Dim a = DirectCast(dc.Content, tsWPF.ContenedorCabLin).Aplicacion
    '                        If Not a.DeshabilitarRefresco Then a.uc.Dispatcher.BeginInvoke(New Action(Sub() a.RefrescaUC(, True)), Windows.Threading.DispatcherPriority.SystemIdle)
    '                    ElseIf dc.Content.GetType Is GetType(tsWPF.ContenedorLineas) Then
    '                        'DirectCast(dc.Content, tsWPF.ContenedorLineas).apLinea.Refrescar = True
    '                        Dim a = DirectCast(dc.Content, tsWPF.ContenedorLineas).apLinea
    '                        If Not a.DeshabilitarRefresco Then a.uc.Dispatcher.BeginInvoke(New Action(Sub() a.RefrescaUC(True)), Windows.Threading.DispatcherPriority.SystemIdle)
    '                    ElseIf dc.Content.GetType Is GetType(tsWPF.ContenedorAplicacion) Then
    '                        'DirectCast(dc.Content, tsWPF.ContenedorLineas).apLinea.Refrescar = True
    '                        Dim a = DirectCast(dc.Content, tsWPF.ContenedorAplicacion)._Aplicacion
    '                        If Not a.DeshabilitarRefresco Then a.uc.Dispatcher.BeginInvoke(New Action(Sub() a.RefrescaUC(, True, Aplicacion, RegistroNuevo, idRegistro)), Windows.Threading.DispatcherPriority.SystemIdle)
    '                    End If
    '                End If
    '            Next
    '        Else
    '            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 a.uc.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(, True)), Windows.Threading.DispatcherPriority.Background)
    '                    '  If Not a.DeshabilitarRefresco Then a.uc.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(, True)), Windows.Threading.DispatcherPriority.SystemIdle)
    '                    'If Not a.DeshabilitarRefresco Then
    '                    '    Dim th = New System.Threading.Thread(Sub() a.RefrescaUC(, False))
    '                    '    th.Start()
    '                    'End If
    '                ElseIf dc.Content.GetType Is GetType(tsWPF.ContenedorLineas) Then
    '                    Dim a = DirectCast(dc.Content, tsWPF.ContenedorLineas).apLinea
    '                    If Not a.DeshabilitarRefresco Then a.uc.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(True)), Windows.Threading.DispatcherPriority.Background)
    '                    'If Not a.DeshabilitarRefresco Then
    '                    '    Dim t As Task = Task.Run(New Action(Sub() a.RefrescaUC(True)))
    '                    'End If

    '                    'If Not a.DeshabilitarRefresco Then
    '                    '    If Not a.DeshabilitarRefresco Then
    '                    '        Dim th = New System.Threading.Thread(Sub() a.RefrescaUC(True))
    '                    '        th.Start()
    '                    '    End If
    '                    'End If
    '                ElseIf dc.Content.GetType Is GetType(tsWPF.ContenedorAplicacion) Then
    '                    Dim a = DirectCast(dc.Content, tsWPF.ContenedorAplicacion)._Aplicacion
    '                    If Not a.DeshabilitarRefresco Then a.uc.Dispatcher.InvokeAsync(New Action(Sub() a.RefrescaUC(, True, Aplicacion, RegistroNuevo, idRegistro)), Windows.Threading.DispatcherPriority.Background)
    '                    'If Not a.DeshabilitarRefresco Then
    '                    '    Dim th = New System.Threading.Thread(Sub() a.RefrescaUC(, False, Aplicacion, RegistroNuevo, idRegistro))
    '                    '    th.SetApartmentState(System.Threading.ApartmentState.STA)
    '                    '    th.Start()
    '                    'End If
    '                End If
    '            Next
    '        End If
    '    Catch ex As Exception
    '        Debug.Write(ex.Message)
    '    End Try
    'End Sub

    '    Friend Shared Sub Contexto_SavingChanges(tsuc As tsUserControl, lg As LayoutGroup, TagsApArefrescar() As String, DocPanelTag As String)     
    '        Comun.RefrescaAplicaciones(lg, TagsApArefrescar, DocPanelTag)

    '   End Sub


End Class
