Option Strict On
Option Explicit On

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading
Imports System.Threading.Tasks

Imports Nexamas.UI.Architecture
Imports Nexamas.UI.Composition
Imports Nexamas.UI.Controls
Imports Nexamas.UI.FileSystem
Imports Nexamas.UI.General
Imports Nexamas.UI.Icons
Imports Nexamas.UI.Layout
Imports Nexamas.UI.Platform
Imports Nexamas.UI.Theming
Imports Nexamas.UI.Values

Imports SkiaSharp

Namespace Nexamas.UI.Components


    Partial Friend NotInheritable Class MASFileBrowser
#Region "Runtime Services"

        Friend Sub BindControlRuntimeServices(services As MASControlRuntimeServices) Implements IMASControlRuntimeServicesConsumer.BindControlRuntimeServices
            _runtimeServices = services
        End Sub

#End Region

#Region "Lifetime"

        Protected Overrides Sub Dispose(disposing As Boolean)
            _disposedLocal = True
            CancelPendingItemLoad()

            If disposing Then
                Try
                    RemoveHandler _list.SelectedIndexChanged, AddressOf OnListSelectionChanged
                Catch masCaughtException1 As Exception
                    Nexamas.UI.Diagnostics.MASExceptionSilencer.SwallowDisposeCleanup(masCaughtException1)
                End Try

                Try
                    RemoveHandler _list.ItemActivated, AddressOf OnListItemActivated
                Catch masCaughtException2 As Exception
                    Nexamas.UI.Diagnostics.MASExceptionSilencer.SwallowDisposeCleanup(masCaughtException2)
                End Try

                Try
                    RemoveHandler _list.ItemContextMenuRequested, AddressOf OnListItemContextMenuRequested
                Catch masCaughtException3 As Exception
                    Nexamas.UI.Diagnostics.MASExceptionSilencer.SwallowDisposeCleanup(masCaughtException3)
                End Try

                Try
                    RemoveHandler _list.EmptySpaceContextMenuRequested, AddressOf OnListEmptySpaceContextMenuRequested
                Catch masCaughtException4 As Exception
                    Nexamas.UI.Diagnostics.MASExceptionSilencer.SwallowDisposeCleanup(masCaughtException4)
                End Try

                Try
                    RemoveHandler _list.InlineRenameCommitted, AddressOf OnListInlineRenameCommitted
                Catch masCaughtException5 As Exception
                    Nexamas.UI.Diagnostics.MASExceptionSilencer.SwallowDisposeCleanup(masCaughtException5)
                End Try

                Try
                    UnregisterChild(_list)
                Catch masCaughtException6 As Exception
                    Nexamas.UI.Diagnostics.MASExceptionSilencer.SwallowDisposeCleanup(masCaughtException6)
                End Try

                Try
                    _list.Dispose()
                Catch masCaughtException7 As Exception
                    Nexamas.UI.Diagnostics.MASExceptionSilencer.SwallowDisposeCleanup(masCaughtException7)
                End Try
            End If

            MyBase.Dispose(disposing)
        End Sub



#End Region

    End Class

End Namespace
