A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
@namespace DevToys.Blazor.Components.UIElements
@using DevToys.Api;
@inherits MefComponentBase
<Container id="@ExtendedId"
IsVisible="@UIFileSelector.IsVisible"
IsEnabled="@(UIFileSelector.IsEnabled && IsActuallyEnabled)"
HorizontalAlignment="@UIFileSelector.HorizontalAlignment"
VerticalAlignment="@UIFileSelector.VerticalAlignment"
Class="ui-file-selector">
<!-- Input form used for getting the dropped file when use drag and drop a file into the UI. -->
<InputFile id="@InputFileId"
style="display: none;"
multiple="true"
webkitdirectory="true"
directory="true"
OnChange="OnFileDropped" />
<StackPanel Class="ui-file-selector-content"
Spacing="8"
Orientation="UIOrientation.Vertical"
HorizontalAlignment="UIHorizontalAlignment.Center"
VerticalAlignment="UIVerticalAlignment.Center">
<TextBlock HorizontalAlignment="UIHorizontalAlignment.Center"
Text="@DragDropInstructions" />
<TextBlock HorizontalAlignment="UIHorizontalAlignment.Center"
NoWrap="true"
Text="@DevToys.Localization.Strings.UIFileSelectorPresenter.UIFileSelectorPresenter.Or" />
<StackPanel HorizontalAlignment="UIHorizontalAlignment.Center"
Spacing="6"
Orientation="UIOrientation.Horizontal">
<Button VerticalAlignment="UIVerticalAlignment.Center"
Appearance="ButtonAppearance.Hyperlink"
@onclick="@OnBrowseFilesButtonClickAsync">
<TextBlock Text="@DevToys.Localization.Strings.UIFileSelectorPresenter.UIFileSelectorPresenter.BrowseFiles" />
</Button>
@if (@UIFileSelector.CanSelectManyFiles)
{
<TextBlock Text="/"
VerticalAlignment="UIVerticalAlignment.Center" />
<Button VerticalAlignment="UIVerticalAlignment.Center"
Appearance="ButtonAppearance.Hyperlink"
@onclick="@OnBrowseFoldersButtonClickAsync">
<TextBlock Text="@DevToys.Localization.Strings.UIFileSelectorPresenter.UIFileSelectorPresenter.BrowserFolders" />
</Button>
}
<TextBlock Text="/"
VerticalAlignment="UIVerticalAlignment.Center" />
<Button VerticalAlignment="UIVerticalAlignment.Center"
Appearance="ButtonAppearance.Hyperlink"
@onclick="@OnPasteButtonClickAsync">
<TextBlock Text="@DevToys.Localization.Strings.UIFileSelectorPresenter.UIFileSelectorPresenter.Paste" />
</Button>
</StackPanel>
<TextBlock Text="@HasInvalidFilesSelectedIndication"
IsVisible="@HasInvalidFilesSelected"
Appearance="TextBlockAppearance.Caption"
HorizontalAlignment="UIHorizontalAlignment.Center"
Style="color: orange" />
<TextBlock Text="@SelectedFilesDescription"
IsVisible="@HasFilesSelected"
Appearance="TextBlockAppearance.Caption"
HorizontalAlignment="UIHorizontalAlignment.Center"
Style="color: orange" />
</StackPanel>
</Container>