Imports System.ComponentModel
Imports System.Drawing.Design
Imports taskFLOW.InputProperties

Public Class ClassImageSelector
    Inherits UITypeEditor
    Public Overrides Function GetEditStyle(context As ITypeDescriptorContext) As UITypeEditorEditStyle
        Return UITypeEditorEditStyle.Modal
    End Function

    Public Overrides Function EditValue(context As ITypeDescriptorContext, provider As IServiceProvider, value As Object) As Object
        Dim oDialog = New OpenFileDialog
        If oDialog.ShowDialog() = DialogResult.OK Then
            If oDialog.FileName = "" Then
                value = "NONE"
            Else
                value = oDialog.FileName
            End If
        Else
            value = "No selection"
        End If

        Return New ImageValue(value)
    End Function
End Class

