Imports System.Drawing
Imports System.IO
Imports DevExpress.XtraGrid.Views.Base
Imports DigitalData.Modules.Logging

Namespace DocumentResultList
    Public Class Helpers
        Private ReadOnly Logger As Logger

        Public Property ActiveRowHandle As Integer = Constants.NO_ROW_HANDLE

        Public Sub New(LogConfig As LogConfig)
            Logger = LogConfig.GetLogger()
        End Sub

        Public Sub SetRowHandle(e As FocusedRowChangedEventArgs)
            ActiveRowHandle = e.FocusedRowHandle
        End Sub

        Public Function GetIconByExtension(FilePath As String) As Bitmap
            Dim oFileextension = Path.GetExtension(FilePath)

            Select Case oFileextension.ToUpper
                Case ".csv".ToUpper
                    Return My.Resources.xls
                Case ".txt".ToUpper
                    Return My.Resources.txt
                Case ".pdf".ToUpper
                    Return My.Resources.pdf
                Case ".doc".ToUpper
                    Return My.Resources.doc
                Case ".docx".ToUpper
                    Return My.Resources.doc
                Case ".xls".ToUpper
                    Return My.Resources.xls
                Case ".xlsx".ToUpper
                    Return My.Resources.xls
                Case ".xlsm".ToUpper
                    Return My.Resources.xls
                Case ".ppt".ToUpper
                    Return My.Resources.ppt
                Case ".pptx".ToUpper
                    Return My.Resources.ppt
                Case ".dwg".ToUpper
                    Return My.Resources.dwg
                Case ".dxf".ToUpper
                    Return My.Resources.dxf
                Case ".msg".ToUpper
                    Return My.Resources._page
                Case ".msg".ToUpper
                    Return My.Resources._page
                Case ".tif".ToUpper
                    Return My.Resources.tiff
                Case ".tiff".ToUpper
                    Return My.Resources.tiff
                Case ".jpg".ToUpper
                    Return My.Resources.jpg
                Case Else
                    Return My.Resources._blank
            End Select
        End Function
    End Class
End Namespace
