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.Win.Editors
Imports DevExpress.ExpressApp.ConditionalAppearance
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.ExpressApp.Model
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp.Utils
Imports DevExpress.ExpressApp.TreeListEditors.Win
Imports DevExpress.ExpressApp.Win.Core
Imports DevExpress.Xpo
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.ExpressApp.Validation

Public Class InLineEditVC
    Inherits DevExpress.ExpressApp.ViewController(Of ListView)
    Private _GridListEditor As GridListEditor
    Private _TreeListEditor As TreeListEditor
    Private _HandlerCreated As Boolean = False
    Private appearanceController As AppearanceController
    Public Sub New()
        MyBase.New()

        InitializeComponent()
        RegisterActions(components)
    End Sub

    Protected Overrides Sub OnActivated()
        MyBase.OnActivated()
    End Sub
    Protected Overrides Sub OnViewControlsCreated()
        MyBase.OnViewControlsCreated()

        Dim _ListView As ListView = CType(View, ListView)
        _GridListEditor = TryCast(_ListView.Editor, GridListEditor)

        If _GridListEditor IsNot Nothing Then
            _GridListEditor.AllowEdit = True
            Dim _ic As New DevExpress.Utils.ImageCollection
            _ic.AddImage(ImageLoader.Instance.GetImageInfo("data_edit").Image, "data_edit")
            _GridListEditor.GridView.Images = _ic

            AddHandler _GridListEditor.ColumnCreated, AddressOf GridListEditor_ColumnCreated
            _HandlerCreated = True

            For Each column As XafGridColumnWrapper In _GridListEditor.Columns
                UpdateColumnProperties(column.Column, column.PropertyName, _GridListEditor)
            Next

            AddHandler _GridListEditor.GridView.CustomColumnDisplayText, AddressOf GridView_CustomColumnDisplayText
            'AddHandler _GridListEditor.GridView.CustomDrawCell
            Dim _IModelListViewExtender As IModelListViewExtender = TryCast(View.Model, IModelListViewExtender)
            If _IModelListViewExtender IsNot Nothing Then
                If _GridListEditor.GridView IsNot Nothing Then
                    _GridListEditor.GridView.GroupFormat = _IModelListViewExtender.GridViewGroupFormat
                End If
            End If
        End If

        _TreeListEditor = TryCast(_ListView.Editor, TreeListEditor)

        If _TreeListEditor IsNot Nothing Then
            _TreeListEditor.TreeList.OptionsBehavior.Editable = True
            _TreeListEditor.TreeList.OptionsFilter.AllowColumnMRUFilterList = True
            _TreeListEditor.TreeList.OptionsFilter.AllowFilterEditor = True
            _TreeListEditor.TreeList.OptionsFilter.AllowMRUFilterList = True
            If TryCast(View.Model, IModelListViewExtender) IsNot Nothing Then
                If TryCast(View.Model, IModelListViewExtender).TreeListEnableFiltering Then
                    _TreeListEditor.TreeList.OptionsBehavior.EnableFiltering = True
                End If
            End If

            For Each _RepositoryItem As RepositoryItem In _TreeListEditor.TreeList.RepositoryItems
                _RepositoryItem.ReadOnly = False
            Next _RepositoryItem

            For Each column As TreeListColumnWrapper In _TreeListEditor.Columns
                Dim modelColumn As IModelColumnExtender = Nothing
                If column.PropertyName IsNot Nothing Then
                    DisableInlineEdit(column.Column)
                    If column.PropertyName.Contains(".") Then
                        Dim NewName As String() = column.PropertyName.Split(New Char() {"."c}, StringSplitOptions.RemoveEmptyEntries)
                        modelColumn = TryCast(CType(View.Model.Columns, IModelList(Of IModelColumn))(NewName(NewName.Length - 1)), IModelColumnExtender)
                    Else
                        modelColumn = TryCast(CType(View.Model.Columns, IModelList(Of IModelColumn))(column.PropertyName), IModelColumnExtender)
                    End If

                    If modelColumn IsNot Nothing Then
                        If modelColumn.InLineEdit = True Then
                            EnableInlineEdit(column.Column)
                        End If
                        If modelColumn.InLineEditAutoCommit Then
                            AddHandler _TreeListEditor.TreeList.CellValueChanged, AddressOf TreeListEditor_CellValueChanged
                            AddHandler _TreeListEditor.TreeList.ShownEditor, AddressOf TreeListEditor_ShownEditor
                            _TreeListEditor.TreeList.OptionsBehavior.ImmediateEditor = True
                        End If
                    End If
                End If
            Next

        End If
    End Sub
    Protected Overrides Sub OnDeactivated()
        MyBase.OnDeactivated()
        If _HandlerCreated Then
            If _GridListEditor IsNot Nothing Then
                RemoveHandler _GridListEditor.ColumnCreated, AddressOf GridListEditor_ColumnCreated
                If _GridListEditor.GridView IsNot Nothing Then RemoveHandler _GridListEditor.GridView.CustomColumnDisplayText, AddressOf GridView_CustomColumnDisplayText
            End If
        End If
    End Sub

    Private Sub GridListEditor_ColumnCreated(sender As Object, e As ColumnCreatedEventArgs)
        Dim _GridListEditor = DirectCast(sender, GridListEditor)

        UpdateColumnProperties(e.Column, e.ColumnInfo.PropertyName, _GridListEditor)
    End Sub
    Private Sub UpdateColumnProperties(gridColumn As DevExpress.XtraGrid.Columns.GridColumn, name As String, GridListEditor As GridListEditor)
        '//Tiltás -----------------------------------------------------------------------------------------
        DisableInlineEdit(gridColumn)
        '--------------------------------------------------------------------------------------------------

        '//Engedélyezés -----------------------------------------------------------------------------------
        Select Case View.Id
            Case "GLRows_ListView_Account"
                Select Case name
                    Case "NoteRows", "Controlling", "CostHolder", "CostPlace", "JobNumberObjects", "UniqueObjects"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "CRMEstate_Leads_CRMEstate_Leads_Immovables_ListView", "CRMEstate_Opportunity_CRMEstate_Opportunity_Immovables_ListView"
                Select Case name
                    Case "AreaPriceNettoHUF", "AreaPriceNettoDEV", "AreaPriceDivide"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "StorageOutRowsInRows_ListView_DeliveryNote_OrderIn", "StorageOutRowsInRows_ListView_DeliveryNote_Transfer", "DeliveryNoteOutRows_ListView_Invoice"
                Select Case name
                    Case "QTT_Will"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "ImmovablesPriceListHeader_ImmovablesPriceListRowsA_ListView", "ImmovablesPriceListHeader_ImmovablesPriceListRowsO_ListView", _
                 "ImmovablesPriceListHeader_ImmovablesPriceListRowsG_ListView", "ImmovablesPriceListHeader_ImmovablesPriceListRowsC_ListView"
                Select Case name
                    Case "ListPriceBruttoDEV", "ListPriceBruttoHUF", "ListPriceBruttoDEVRent", "ListPriceBruttoHUFRent"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "InvoiceHeader_InvoiceRows_ListView"
                Dim _ListView As ListView = CType(View, ListView)
                Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
                Dim _InvoiceHeader As InvoiceHeader = CType(_PropertyCollectionSource.MasterObject, InvoiceHeader)
                If _InvoiceHeader.IsEditable = True Then
                    Select Case name
                        Case "ShortName", "InvoicePeriod", "CustomsTariffs", "Description", "Units", "Controlling"
                            EnableInlineEdit(gridColumn)
                    End Select
                End If

            Case "OrderInHeader_OrderInRowsOther_ListView"
                Dim _ListView As ListView = CType(View, ListView)
                Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
                Dim _OrderInHeader As OrderInHeader = CType(_PropertyCollectionSource.MasterObject, OrderInHeader)

                If _OrderInHeader.IsEditable = True Then
                    Select Case name
                        Case "QTT", "Description"
                            EnableInlineEdit(gridColumn)
                    End Select

                    If _OrderInHeader.OrderInParameters.CurrencyName.ShortName = "HUF" Then
                        If name = "DiscountPriceHUF" Then
                            EnableInlineEdit(gridColumn)
                        End If
                    Else
                        If name = "DiscountPriceDEV" Then
                            EnableInlineEdit(gridColumn)
                        End If
                    End If
                End If

            Case "OfferInHeader_OfferInRows_ListView"
                Dim _ListView As ListView = CType(View, ListView)
                Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
                Dim _OfferInHeader As OfferInHeader = CType(_PropertyCollectionSource.MasterObject, OfferInHeader)

                If _OfferInHeader.IsEditable = True Then
                    Select Case name
                        Case "QTT"
                            EnableInlineEdit(gridColumn)
                    End Select

                    If _OfferInHeader.CurrencyName.ShortName = "HUF" Then
                        If name = "FinalPriceHUF" Then
                            EnableInlineEdit(gridColumn)
                        End If
                    Else
                        If name = "FinalPriceDEV" Then
                            EnableInlineEdit(gridColumn)
                        End If
                    End If
                End If

            Case "OfferOutHeader_OfferOutRows_ListView"
                Dim _ListView As ListView = CType(View, ListView)
                Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
                Dim _OfferOutHeader As OfferOutHeader = CType(_PropertyCollectionSource.MasterObject, OfferOutHeader)

                CriteriaOperator.Parse("")
                If _OfferOutHeader.IsEditable = True Then
                    Select Case name
                        Case "QTT", "Description", "RowGroup1", "RowGroup2", "DescriptionPrivate"
                            EnableInlineEdit(gridColumn)
                    End Select

                    If _OfferOutHeader.CurrencyName.ShortName = "HUF" Then
                        If name = "FinalPriceHUF" Then
                            EnableInlineEdit(gridColumn)
                        End If
                    Else
                        If name = "FinalPriceHUF" Then
                            EnableInlineEdit(gridColumn)
                        End If
                    End If
                End If

            Case "OrderOutHeader_OrderOutRows_ListView"
                Dim _ListView As ListView = CType(View, ListView)
                Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
                Dim _OrderOutHeader As OrderOutHeader = CType(_PropertyCollectionSource.MasterObject, OrderOutHeader)

                If _OrderOutHeader.IsEditable = True Then
                    Select Case name
                        Case "Products"
                            EnableInlineEdit(gridColumn)
                    End Select
                End If

            Case "ContractRows_ListView_Invoice_Not_MileStone"
                Dim _ListView As ListView = CType(View, ListView)
                Dim _PropertyCollectionSource As PropertyCollectionSource = TryCast(_ListView.CollectionSource, PropertyCollectionSource)

                Select Case name
                    Case "NettoPriceHUF", "NettoPriceDEV", "ShortName", "Description", "InvoicePeriod", "Controlling", "PaymentOption", "VAT", "CurrencyRate", "QTT", "DateExecution"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "ProductFinder_ProductSelected_ListView"
                Select Case name
                    Case "QTT", "Description"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "InventoryHeader_InventorySC_ListView"
                Select Case name
                    Case "QTT_Found"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "StorageInRows_ListView", "StorageInHeader_StorageInRows_ListView"
                Select Case name
                    Case "QTT_Will"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "Subcontractor_SubcontractorCustomers_ListView"
                Select Case name
                    Case "Workplace"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "WorkSheet_Header_WorkSheet_Rows_ListView"
                Select Case name
                    Case "RowGroup1", "RowGroup2", "ShortName", "Description", "Quantity"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "WorkSheet_Header_Worksheet_CostRows_ListView"
                Select Case name
                    Case "FinalPriceHUF_Out", "FinalPriceDEV_Out", "Controlling"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "BankImportHeaderSum_BankImportNameParameters_ListView"
                Select Case name
                    Case "Controlling", "ChartOfAccounts"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "GLRows_ListView_Bank"
                Select Case name
                    Case "NoteRows", "Controlling", "CostHolder", "CostPlace", "JobNumberObjects", "UniqueObjects"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "GLRowsDivideH_GLRowsDivideR_ListView_ConnectionDivide", "GLRowsDivideH_GLRowsDivideR_ListView"
                Select Case name
                    Case "AmountHUF", "AmountDEV", "Controlling", "CostHolder", "CostPlace", "UniqueObjects", "JobNumberObjects"
                        EnableInlineEdit(gridColumn)
                End Select
            Case "GLRows_ListView_Cassa"
                Select Case name
                    Case "NoteRows", "Controlling", "CostHolder", "CostPlace", "JobNumberObjects", "UniqueObjects"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "GLRows_ListView_Compensation"
                Select Case name
                    Case "NoteRows", "Controlling", "CostHolder", "CostPlace", "JobNumberObjects", "UniqueObjects"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "LiquidAssetsReturnHeader_LiquidAssetsReturnDenomination_ListView"
                Select Case name
                    Case "DenominationValue"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "GLHeader_GLRows_ListView_Mixed"
                Select Case name
                    Case "NoteRows", "AmountHUF", "AmountDEV", "DebitChartOfAccounts", "CreditChartOfAccounts", "Controlling", "CostHolder", "CostPlace", "JobNumberObjects", "UniqueObjects"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "GLRows_ListView_Mixed"
                Select Case name
                    Case "NoteRows", "Controlling", "CostHolder", "CostPlace", "JobNumberObjects", "UniqueObjects"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "GLCardsHeader_GLCardsRows_ListView"
                Select Case name
                    Case "Note_Rows"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "GLRows_ListView_Bank"
                Select Case name
                    Case "CurrencyRate2"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "PermissionMatrix_ListView"
                Select Case name
                    Case "IsCreate", "IsRead", "IsWrite", "IsNavigate", "IsDelete"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "Corner_InvoiceNameParameters_ListView"
                Select Case name
                    Case "Controlling"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "Corner_CustomerNameParameters_ListView"
                Select Case name
                    Case "Customers"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "Vivaldi_InvoiceNameParameters_ListView"
                Select Case name
                    Case "Controlling"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "Vivaldi_CustomerNameParameters_ListView"
                Select Case name
                    Case "Customers"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "StorageOutRows_ListView_DeliveryNote"
                Select Case name
                    Case "QTT_Will"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "StorageInfromDeliveryNoteInRowsHeader_StorageInfromDeliveryNoteInRowsRows_ListView", _
                  "DeliveryNoteInFromOrderOutRowsHeader_DeliveryNoteInFromOrderOutRowsRows_ListView"
                Select Case name
                    Case "QTT_Process"
                        EnableInlineEdit(gridColumn)
                End Select

            Case "DeliveryNoteInHeader_DeliveryNoteInrows_ListView"
                Dim _ListView As ListView = CType(View, ListView)
                Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
                Dim _DeliveryNoteInHeader As DeliveryNoteInHeader = CType(_PropertyCollectionSource.MasterObject, DeliveryNoteInHeader)

                If _DeliveryNoteInHeader.IsEditable = True Then

                    Select Case name
                        Case "QTT", "NoteRows"
                            EnableInlineEdit(gridColumn)
                    End Select

                    If _DeliveryNoteInHeader.CurrencyName.ShortName = "HUF" Then
                        If name = "ListPriceHUF" Then
                            EnableInlineEdit(gridColumn)
                        End If
                    Else
                        If name = "ListPriceDEV" Then
                            EnableInlineEdit(gridColumn)
                        End If
                    End If

                End If
        End Select

        '// ModelEditor InLineEdit, InLineEditCriteria alapján
        Dim modelColumn As IModelColumnExtender = Nothing
        If name IsNot Nothing Then
            If name.Contains(".") Then
                Dim NewName As String() = name.Split(New Char() {"."c}, StringSplitOptions.RemoveEmptyEntries)
                modelColumn = TryCast(CType(View.Model.Columns, IModelList(Of IModelColumn))(NewName(NewName.Length - 1)), IModelColumnExtender)
            Else
                modelColumn = TryCast(CType(View.Model.Columns, IModelList(Of IModelColumn))(name), IModelColumnExtender)
            End If

            If modelColumn IsNot Nothing Then
                If modelColumn.InLineEdit = True Then
                    EnableInlineEdit(gridColumn)
                End If
                If modelColumn.InLineEditAutoCommit Then
                    AddHandler GridListEditor.GridView.CellValueChanged, AddressOf GridListEditor_CellValueChanged
                End If
            End If
        End If
    End Sub

    Sub DisableInlineEdit(gridColumn As DevExpress.XtraGrid.Columns.GridColumn)
        gridColumn.OptionsColumn.ReadOnly = True
        gridColumn.OptionsColumn.AllowEdit = False
        gridColumn.OptionsColumn.TabStop = False
        gridColumn.ImageIndex = -1
        If Mid(gridColumn.FieldName, 1, 4) = "row_" Then
            gridColumn.OptionsColumn.AllowShowHide = False
        End If

    End Sub
    Sub DisableInlineEdit(_TreeListColumn As DevExpress.XtraTreeList.Columns.TreeListColumn)
        _TreeListColumn.OptionsColumn.ReadOnly = True
        _TreeListColumn.OptionsColumn.AllowEdit = False
    End Sub
    Sub EnableInlineEdit(gridColumn As DevExpress.XtraGrid.Columns.GridColumn)

        gridColumn.OptionsColumn.ReadOnly = False
        gridColumn.OptionsColumn.AllowEdit = True
        gridColumn.OptionsColumn.TabStop = True
        gridColumn.ImageIndex = 0


    End Sub
    Sub EnableInlineEdit(_TreeListColumn As DevExpress.XtraTreeList.Columns.TreeListColumn)

        _TreeListColumn.OptionsColumn.ReadOnly = False
        _TreeListColumn.OptionsColumn.AllowEdit = True

    End Sub

    Private Sub GridListEditor_CellValueChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs)
        Try
            Dim nestedFrame As NestedFrame = TryCast(Frame, NestedFrame)
            Dim modelColumn As IModelColumnExtender = TryCast(CType(View.Model.Columns, IModelList(Of IModelColumn))(e.Column.FieldName.Trim("!")), IModelColumnExtender)
            If modelColumn Is Nothing Then Exit Sub
            If nestedFrame IsNot Nothing Then
                If modelColumn.InLineEditAutoCommit Then
                    Frame.GetController(Of PersistenceValidationController)().Active.SetItemValue("", False)
                    Dim parentView As View = nestedFrame.View
                    TryCast(parentView.ObjectSpace, Xpo.XPObjectSpace).CommitChanges()
                    Frame.GetController(Of PersistenceValidationController)().Active.SetItemValue("", True)
                    parentView.ObjectSpace.Refresh()
                End If
            ElseIf Frame IsNot Nothing Then
                If modelColumn.InLineEditAutoCommit Then
                    Frame.GetController(Of PersistenceValidationController)().Active.SetItemValue("", False)
                    TryCast(View.ObjectSpace, Xpo.XPObjectSpace).CommitChanges()
                    Frame.GetController(Of PersistenceValidationController)().Active.SetItemValue("", True)
                    View.ObjectSpace.Refresh()
                End If
            End If
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
        End Try
    End Sub
    Private Sub GridView_CustomColumnDisplayText(sender As Object, e As DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs)
        Dim modelColumn As IModelColumnExtender = Nothing
        If View IsNot Nothing Then
            If e.Column.FieldName <> "" Then
                'If e.Column.FieldName.Contains(".") Then
                '    Dim NewName As String() = e.Column.FieldName.Split(New Char() {"."c}, StringSplitOptions.RemoveEmptyEntries)
                '    modelColumn = TryCast(CType(View.Model.Columns, IModelList(Of IModelColumn))(NewName(NewName.Length - 1)), IModelColumnExtender)
                'Else
                modelColumn = TryCast(CType(View.Model.Columns, IModelList(Of IModelColumn))(e.Column.FieldName), IModelColumnExtender)
                'End If
                If modelColumn IsNot Nothing Then
                    If modelColumn.HideValueIfZero = True Then
                        If e.Value = 0 Then e.DisplayText = ""
                    End If
                End If

            End If
        End If
    End Sub

    Private Sub TreeListEditor_CellValueChanged(sender As Object, e As DevExpress.XtraTreeList.CellValueChangedEventArgs)
        Try
            Dim nestedFrame As NestedFrame = TryCast(Frame, NestedFrame)
            Dim newValue As Object = e.Value
            If TypeOf e.Value Is IXPSimpleObject Then
                newValue = ObjectSpace.GetObject(e.Value)
            End If
            Dim focusedObject As Object = _TreeListEditor.FocusedObject
            If focusedObject IsNot Nothing Then
                Dim focusedColumnMemberInfo As DevExpress.ExpressApp.DC.IMemberInfo = ObjectSpace.TypesInfo.FindTypeInfo(focusedObject.GetType()).FindMember(e.Column.FieldName)
                If focusedColumnMemberInfo IsNot Nothing Then
                    focusedColumnMemberInfo.SetValue(focusedObject, Convert.ChangeType(newValue, focusedColumnMemberInfo.MemberType))
                End If
            End If

            If nestedFrame IsNot Nothing Then
                Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)().Active.SetItemValue("", False)
                Dim parentView As View = nestedFrame.View
                TryCast(parentView.ObjectSpace, Xpo.XPObjectSpace).CommitChanges()
                Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)().Active.SetItemValue("", True)
                'parentView.ObjectSpace.Refresh()
            ElseIf Frame IsNot Nothing Then
                Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)().Active.SetItemValue("", False)
                TryCast(View.ObjectSpace, Xpo.XPObjectSpace).CommitChanges()
                Frame.GetController(Of DevExpress.ExpressApp.Validation.PersistenceValidationController)().Active.SetItemValue("", True)
                'View.ObjectSpace.Refresh()
            End If

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
        End Try
    End Sub


    Private Sub TreeListEditor_ShownEditor(sender As Object, e As EventArgs)
        'Dim activeEditor As IGridInplaceEdit = TryCast(_TreeListEditor.TreeList.ActiveEditor, IGridInplaceEdit)
        'If activeEditor IsNot Nothing AndAlso TypeOf _TreeListEditor.TreeList.FocusedObject Is IXPSimpleObject Then
        '    activeEditor.GridEditingObject = _TreeListEditor.TreeList.FocusedObject
        'End If
    End Sub







End Class
