Imports System Imports System.ComponentModel Imports System.Collections.Generic Imports System.Diagnostics Imports System.Text Imports DevExpress.ExpressApp Imports DevExpress.ExpressApp.Actions Imports DevExpress.Persistent.Base Imports DevExpress.ExpressApp.SystemModule Public Class RegistryRowsFinancialVC Inherits DevExpress.ExpressApp.ViewController Public Sub New() MyBase.New() 'This call is required by the Component Designer. InitializeComponent() RegisterActions(components) End Sub Protected Overrides Sub OnActivated() MyBase.OnActivated() If View.Id = "RegistryRowsFinancial_DetailView" Then Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", False) End If If View.Id = "RegistryHeader_RegistryRowsFinancial_ListView" Then Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", False) Frame.GetController(Of DeleteObjectsViewController)?.Active.SetItemValue("", False) 'If TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject IsNot Nothing Then ' Dim _RegistryHeader As RegistryHeader = TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject ' If _RegistryHeader IsNot Nothing Then ' Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryHeader) ' 'AddHandler _RegistryHeader.Changed, AddressOf RegistryHeader_RegistryRowsFinancial_ListView_MasterObjectChanged ' AddHandler View.ObjectSpace.ObjectChanged, AddressOf _RegistryRowsFinancial_ListView_ObjectChanged ' AddHandler View.ObjectSpace.ObjectSaved, AddressOf _RegistryRowsFinancial_ListView_ObjectSaved ' AddHandler View.ObjectSpace.ObjectReloaded, AddressOf _RegistryRowsFinancial_ListView_ObjectReloaded ' AddHandler View.ObjectSpace.ObjectDeleted, AddressOf _RegistryRowsFinancial_ListView_ObjectDeleted ' End If 'End If End If End Sub Protected Overrides Sub OnDeactivated() MyBase.OnDeactivated() If View.Id = "RegistryRowsFinancial_DetailView" Then Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", True) End If If View.Id = "RegistryHeader_RegistryRowsFinancial_ListView" Then Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", True) Frame.GetController(Of DeleteObjectsViewController)?.Active.SetItemValue("", True) 'If TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject IsNot Nothing Then ' Dim _RegistryHeader As RegistryHeader = TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject ' If _RegistryHeader IsNot Nothing Then ' RemoveHandler _RegistryHeader.Changed, AddressOf RegistryHeader_RegistryRowsFinancial_ListView_MasterObjectChanged ' End If 'End If End If End Sub Private Sub RegistryHeader_RegistryRowsFinancial_ListView_MasterObjectChanged(sender As Object, e As DevExpress.Xpo.ObjectChangeEventArgs) Dim _RegistryHeader As RegistryHeader = TryCast(e.Object, RegistryHeader) Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryHeader) End Sub Private Sub _RegistryRowsFinancial_ListView_ObjectChanged(sender As Object, e As ObjectChangedEventArgs) Dim _RegistryHeader As RegistryHeader = TryCast(e.Object, RegistryHeader) Dim _RegistryRowsFinancial As RegistryRowsFinancial = TryCast(e.Object, RegistryRowsFinancial) If _RegistryHeader IsNot Nothing Then Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryHeader) If _RegistryRowsFinancial IsNot Nothing Then Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryRowsFinancial.RegistryHeader) End Sub Private Sub _RegistryRowsFinancial_ListView_ObjectReloaded(sender As Object, e As ObjectManipulatingEventArgs) Dim _RegistryHeader As RegistryHeader = TryCast(e.Object, RegistryHeader) Dim _RegistryRowsFinancial As RegistryRowsFinancial = TryCast(e.Object, RegistryRowsFinancial) If _RegistryHeader IsNot Nothing Then Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryHeader) If _RegistryRowsFinancial IsNot Nothing Then Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryRowsFinancial.RegistryHeader) End Sub Private Sub _RegistryRowsFinancial_ListView_ObjectSaved(sender As Object, e As ObjectManipulatingEventArgs) Dim _RegistryHeader As RegistryHeader = TryCast(e.Object, RegistryHeader) Dim _RegistryRowsFinancial As RegistryRowsFinancial = TryCast(e.Object, RegistryRowsFinancial) If _RegistryHeader IsNot Nothing Then Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryHeader) If _RegistryRowsFinancial IsNot Nothing Then Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryRowsFinancial.RegistryHeader) End Sub Private Sub _RegistryRowsFinancial_ListView_ObjectDeleted(sender As Object, e As ObjectsManipulatingEventArgs) If e.Objects.Count <= 0 Then Exit Sub Dim _Object As Object = Nothing For Each _Object In e.Objects Next Dim _RegistryHeader As RegistryHeader = TryCast(_Object, RegistryHeader) Dim _RegistryRowsFinancial As RegistryRowsFinancial = TryCast(_Object, RegistryRowsFinancial) If _RegistryHeader IsNot Nothing Then Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryHeader) If _RegistryRowsFinancial IsNot Nothing Then Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryRowsFinancial.RegistryHeader) End Sub Private Sub Action_NEW_DELETE_Hide_RegistryHeader_RegistryRowsFinancial(_RegistryHeader As RegistryHeader) If _RegistryHeader Is Nothing Then Exit Sub If _RegistryHeader.CurrentWorkflowSystemSteps Is Nothing Then Exit Sub '// Mikor NE látszódjon a NEW action Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", False) If _RegistryHeader.CurrentWorkflowSystemSteps.StepFinancialType = eStepFinancialType.eCheckVAT Or _ _RegistryHeader.CurrentWorkflowSystemSteps.StepFinancialType = eStepFinancialType.eCheckVATPlusControlling Then If _RegistryHeader.IsEditable = True Then If _RegistryHeader.BruttoAmountRemaining <> 0.0 Then Frame.GetController(Of NewObjectViewController)?.Active.SetItemValue("", True) End If End If End If '// Mikor NE látszódjon a törlés gomb Frame.GetController(Of DeleteObjectsViewController)?.Active.SetItemValue("", False) If _RegistryHeader.CurrentWorkflowSystemSteps.StepFinancialType = eStepFinancialType.eCheckVAT Or _ _RegistryHeader.CurrentWorkflowSystemSteps.StepFinancialType = eStepFinancialType.eCheckVATPlusControlling Then If _RegistryHeader.IsEditable = True Then Frame.GetController(Of DeleteObjectsViewController)?.Active.SetItemValue("", True) End If End If End Sub End Class