Imports Microsoft.VisualBasic
Imports System
Imports System.Linq
Imports System.Text
Imports DevExpress.ExpressApp
Imports DevExpress.Data.Filtering
Imports System.Collections.Generic
Imports DevExpress.Persistent.Base
Imports DevExpress.ExpressApp.Utils
Imports DevExpress.ExpressApp.Layout
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.ExpressApp.Templates
Imports DevExpress.Persistent.Validation
Imports DevExpress.ExpressApp.SystemModule
Imports DevExpress.ExpressApp.Model.NodeGenerators
Imports DevExpress.ExpressApp.Model

' For more typical usage scenarios, be sure to check out http://documentation.devexpress.com/#Xaf/clsDevExpressExpressAppWindowControllertopic.
Partial Public Class ModelActionsVisible_WC
    Inherits WindowController
    Public Sub New()
        InitializeComponent()
        RegisterActions(components)
        ' Target required Windows (via the TargetXXX properties) and create their Actions.
    End Sub
    Protected Overrides Sub OnActivated()
        MyBase.OnActivated()
        ' Perform various tasks depending on the target Window.
    End Sub
    Protected Overrides Sub OnDeactivated()
        ' Unsubscribe from previously subscribed events and release other references and resources.
        MyBase.OnDeactivated()
    End Sub
    Protected Overrides Sub OnFrameAssigned()
        MyBase.OnFrameAssigned()
        Dim _IModelAction As IModelAction
        Dim _IModelActionExtender As IModelActionExtender

        For Each _Controller As Controller In Frame.Controllers
            For Each _Action As ActionBase In _Controller.Actions
                For Each _IModelAction In Application.Model.ActionDesign.Actions
                    If _Action.Id = _IModelAction.Id Then
                        _IModelActionExtender = TryCast(_IModelAction, IModelActionExtender)
                        If _IModelActionExtender IsNot Nothing Then
                            If _IModelActionExtender.VisibleInCompany = False Then
                                _Action.Active.SetItemValue("NuvolarSecuritybyModel", False)
                                Exit For
                            End If
                        End If
                    End If
                Next
            Next
        Next
    End Sub
End Class
