Imports Microsoft.VisualBasic
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.Templates
Imports System.Windows.Forms
Imports DevExpress.Utils.Frames
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp.Model

Partial Public Class ViewHintController
    Inherits ViewController
    Public Sub New()
        InitializeComponent()
        RegisterActions(components)
    End Sub
    Protected Overrides Sub OnActivated()
        MyBase.OnActivated()
        AddHandler Frame.GetController(Of WindowHintController)().HintPanelReady, AddressOf ViewHintController_HintPanelReady
    End Sub
    Protected Overrides Sub OnDeactivated()
        MyBase.OnDeactivated()
        RemoveHandler Frame.GetController(Of WindowHintController)().HintPanelReady, AddressOf ViewHintController_HintPanelReady
    End Sub
    Private Sub ViewHintController_HintPanelReady(ByVal sender As Object, ByVal e As HintPanelReadyEventArgs)

        e.HintPanel.Text = ""
        e.HintPanel.Visible = False

        If TryCast(View, DevExpress.ExpressApp.ListView) IsNot Nothing Then
            Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
            Dim _IModelListView As IModelListView
            Dim _IModelListViewExtender As IModelListViewExtender

            _IModelListView = _ListView.Model
            _IModelListViewExtender = TryCast(_IModelListView, IModelListViewExtender)

            If String.IsNullOrEmpty(_IModelListViewExtender.Hints) = False Then
                e.HintPanel.Text = _IModelListViewExtender.Hints
                e.HintPanel.Visible = True
            End If
        End If

        If TryCast(View, DevExpress.ExpressApp.DetailView) IsNot Nothing Then
            Dim _DetailView As DevExpress.ExpressApp.DetailView = TryCast(View, DevExpress.ExpressApp.DetailView)
            Dim _IModelDetailView As IModelDetailView
            Dim _IModelDetailViewExtender As IModelDetailViewExtender

            _IModelDetailView = _DetailView.Model
            _IModelDetailViewExtender = TryCast(_IModelDetailView, IModelDetailViewExtender)

            If String.IsNullOrEmpty(_IModelDetailViewExtender.Hints) = False Then
                e.HintPanel.Text = _IModelDetailViewExtender.Hints
                e.HintPanel.Visible = True
            End If
        End If


    End Sub
End Class