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.Xpo
Imports DevExpress.ExpressApp.Win.Editors
Imports DevExpress.XtraGrid.Columns
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraEditors.Controls
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.Data
Imports DevExpress.ExpressApp.Editors

Public Class StorageTransactionsVC
    Inherits DevExpress.ExpressApp.ViewController(Of ListView) ' FIGYELNI!!!! CSAK LISTVIEW
    Private _GridListEditor As GridListEditor

    Public Sub New()
        MyBase.New()
        InitializeComponent()
        RegisterActions(components)
    End Sub
    Protected Overrides Sub OnViewControlsCreated()
        MyBase.OnViewControlsCreated()

        If View.Id = "StorageMoveInfo_ProductFinderInfo_ListView" Then
            Dim _GLE As GridListEditor = TryCast(View.Editor, GridListEditor)
            If _GLE IsNot Nothing Then
                If _GLE.GridView IsNot Nothing Then
                    _GLE.GridView.OptionsView.RowAutoHeight = True
                    '_GLE.GridView.OptionsView.ShowColumnHeaders = False
                    '_GLE.GridView.OptionsView.ShowVerticalLines = False
                End If
            End If
        End If
       
    End Sub
    'Sub InitGridView()
    '    For i As Integer = 0 To _GridListEditor.Columns.Count - 1
    '        If _GridListEditor.GridView.Columns(i).FieldName <> "QTT_Will" Then
    '            _GridListEditor.GridView.Columns(i).OptionsColumn.ReadOnly = True
    '            _GridListEditor.GridView.Columns(i).OptionsColumn.AllowEdit = False
    '            _GridListEditor.GridView.Columns(i).OptionsColumn.TabStop = False
    '        End If
    '    Next i
    'End Sub
    Protected Overrides Sub OnActivated()
        MyBase.OnActivated()

        If View.Id Like "Storage*Header_DetailView" Then
            Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.WinModificationsController).ModificationsHandlingMode = SystemModule.ModificationsHandlingMode.AutoCommit
        End If
        If View.Id = "StorageInHeader_StorageInRows_ListView" Then
            Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", False)
        End If
        If View.Id = "StorageOutHeader_StorageOutRows_ListView" Then
            Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", False)
        End If
        If View.Id = "StorageOutRows_ListView_Order" Then
            Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", False)
        End If
    End Sub
    Protected Overrides Sub OnDeactivated()
        MyBase.OnDeactivated()

        If View.Id = "StorageInHeader_StorageInRows_ListView" Then
            Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", True)
        End If
        If View.Id = "StorageOutHeader_StorageOutRows_ListView" Then
            Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", True)
        End If
        If View.Id = "StorageOutRows_ListView_Order" Then
            Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", True)
        End If
    End Sub
End Class
