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.Data.Filtering

Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.ExpressApp.Win.Editors
Imports DevExpress.ExpressApp.Editors
Imports System.Drawing

Public Class TrialBalanceVC
    Inherits SISBusiness.Module.TrialBalanceVC
    Private InBold As Boolean = False
    Private CurrentRowHandle As Integer = -1
    Private LastRowHandle As Integer = -1
    Dim _WaitFormClass As New WaitFormClass
    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()
        RegisterActions(components)

      

    End Sub
    Protected Overrides Sub OnViewControlsCreated()
        MyBase.OnViewControlsCreated()
        If View.Id = "TrialBalanceHeader_TrialBalance_ListView" Or _
            View.Id = "TrialBalanceHeader_TrialBalanceOpenClose_ListView" Then
            Dim editor As ListEditor = (CType(View, ListView)).Editor
            Dim gridView As GridView = (CType(editor, GridListEditor)).GridView

            gridView.OptionsCustomization.AllowSort = False
            gridView.OptionsCustomization.AllowGroup = False
            AddHandler gridView.RowCellStyle, AddressOf gridView_RowCellStyle

        End If
    End Sub
    Private Sub gridView_RowCellStyle(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs)
        Dim _CellValue As String
        Dim sArray() As String

        CurrentRowHandle = e.RowHandle
        If LastRowHandle <> CurrentRowHandle Then
            LastRowHandle = CurrentRowHandle
            InBold = False
        End If
        If e.Column.FieldName = "ShortNameFormatted" Then
            _CellValue = LTrim(RTrim(e.CellValue))
            sArray = Split(_CellValue, " ")
            If Len(sArray(0)) <= 2 Then
                InBold = True
            Else
                InBold = False
            End If
        End If
        If InBold Then
            e.Appearance.Font = New Font(e.Appearance.Font, FontStyle.Bold)

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

        AddHandler DoWork, AddressOf _WaitFormClass.DoWork
        AddHandler InitWork, AddressOf _WaitFormClass.Initwork
        AddHandler FinalWork, AddressOf _WaitFormClass.Finalwork
    End Sub
    Protected Overrides Sub OnDeactivated()
        MyBase.OnDeactivated()
        RemoveHandler DoWork, AddressOf _WaitFormClass.DoWork
        RemoveHandler InitWork, AddressOf _WaitFormClass.Initwork
        RemoveHandler FinalWork, AddressOf _WaitFormClass.Finalwork
    End Sub
    
End Class
