Option Strict On
Option Explicit On

Imports System
Imports System.Collections.Specialized
Imports System.Diagnostics
Imports System.IO
Imports System.Windows.Forms
Imports Nexamas.UI.Controls
Imports Nexamas.UI.Composition
Imports Nexamas.UI.FileSystem
Imports Nexamas.UI.General
Imports Nexamas.UI.Rendering
Imports Nexamas.UI.Theming
Imports Nexamas.UI.Values
Imports Nexamas.UI.Layout
Imports SkiaSharp

Namespace Nexamas.UI.Components

    Partial Public NotInheritable Class MASFilePickerControl
        Inherits MASControlBase
        Implements IMASDefaultFocusProvider
        Implements IMASPanelShellHostedContent
        Implements IMASIntrinsicSizeContract
        Implements IMASFloatSurfaceSizeContract
        Implements IMASLayoutParticipant




        Private _controller As FilePickerController
        Private _browser As MASFileBrowser

        Private ReadOnly _navigationBar As New MASFilePickerNavigationBar()
        Private ReadOnly _primaryButton As New MASButton()
        Private ReadOnly _cancelButton As New MASButton()
        Private _fileNameBox As MASTextBox

        Private _disposedLocal As Boolean
        Private _lastDpi As Single = 1.0F
        Private _layout As FilePickerLayoutInfo = New FilePickerLayoutInfo()

        Private ReadOnly _contentRenderer As New MASFilePickerContentRenderer()

        Public Event Accepted As EventHandler(Of MASFilePickerResultEventArgs)
        Public Event Cancelled As EventHandler
        Public Event StateChanged As EventHandler
        Public Event CurrentPathChanged As EventHandler
        Public Event SelectionChanged As EventHandler
        Public Event ItemsChanged As EventHandler
        Friend Event ItemContextMenuRequested As EventHandler(Of MASFilePickerItemContextMenuRequestedEventArgs)
        Friend Event EmptySpaceContextMenuRequested As EventHandler(Of MASFilePickerEmptySpaceContextMenuRequestedEventArgs)
        Friend Event InlineRenameFailed As EventHandler(Of MASFilePickerInlineRenameFailedEventArgs)
        Private ReadOnly _footerLabel As New MASLabel()

        Private _lastShellResult As MASPanelShellResult
        Private _panelShellCloseHover As Boolean
        Private _panelShellClosePressed As Boolean

        Public Sub New()
            Me.New(New MASFilePickerOptions())
        End Sub



        Public Sub New(options As MASFilePickerOptions)
            Me.New(options, Nothing)
        End Sub

        Friend Sub New(options As MASFilePickerOptions, provider As IFileSystemProvider)
            ConfigureButtons()
            ConfigureNavigationBar()
            ConfigureFooterLabel()
            RegisterPermanentChildren()
            CreateController(MASFilePickerOptions.SafeClone(options), provider)
        End Sub

    End Class

End Namespace
