Skip to content

ServerFolderPickerViewModel

Class in Oadm.Sdk.Client.Controls · Oadm.Sdk.Client.dll

The view model of the server folder dialog (ServerFolderWindow): the open folder in the path bar, its subfolders (double click opens), Up, Drives, New folder with its name checked below the field, and Choose for the open folder once the server’s check passed (IServerFolders.CheckAsync; the reason below the path bar otherwise). Testable without Avalonia; members run on the UI thread.

public sealed class ServerFolderPickerViewModel : ValidatingViewModel

Inherits ValidatingViewModel

ServerFolderPickerViewModel(IServerFolders folders, string? startPath)

Parameters

bool CanChoose { get; }

Choose may run: nothing loads, no editor is open, and the open folder passed the check or another path was typed.

IRelayCommand CancelNewFolderCommand { get; }

Gets an IRelayCommand instance wrapping ServerFolderPickerViewModel.CancelNewFolder.

string? ChooseTip { get; }

Why Choose is off (its tooltip); null when it is on.

string? ChosenPath { get; private set; }

The folder Choose returned (the open folder).

IAsyncRelayCommand CreateCommand { get; }

Gets an IAsyncRelayCommand instance wrapping ServerFolderPickerViewModel.CreateAsync.

IAsyncRelayCommand DrivesCommand { get; }

Gets an IAsyncRelayCommand instance wrapping ServerFolderPickerViewModel.DrivesAsync.

string EmptyText { get; }

The line of an empty list.

RangeObservableCollection<ServerFolder> Folders { get; }

The subfolders of the open folder (the drives at the top).

IAsyncRelayCommand GoCommand { get; }

Gets an IAsyncRelayCommand instance wrapping ServerFolderPickerViewModel.GoAsync.

bool IsAtRoots { get; private set; }

The list shows the drives / top folders.

bool IsCreating { get; private set; }

The inline New folder editor is open: its Create is the primary button, Choose turns secondary.

bool IsEmpty { get; }

Nothing to list (after the read).

bool IsLoading { get; private set; }

A listing is being read: the list shows the loading overlay.

bool IsSaving { get; private set; }

The new folder is being made.

bool More { get; private set; }

The folder has more subfolders than the list holds.

static string MoreText { get; }

The line below a list that was cut off.

IRelayCommand NewFolderCommand { get; }

Gets an IRelayCommand instance wrapping ServerFolderPickerViewModel.NewFolder.

string NewFolderName { get; set; }

The name of the new folder.

IAsyncRelayCommand<ServerFolder?> OpenFolderCommand { get; }

Gets an IAsyncRelayCommand<T> instance wrapping ServerFolderPickerViewModel.OpenFolderAsync.

string PathText { get; set; }

The path bar: the open folder, or what the user typed (Enter opens it).

ServerFolder? SelectedFolder { get; set; }

The row the user clicked.

IAsyncRelayCommand UpCommand { get; }

Gets an IAsyncRelayCommand instance wrapping ServerFolderPickerViewModel.UpAsync.

Task<bool> ChooseAsync()

Choose: a typed path is opened (and checked) first; true with ServerFolderPickerViewModel.ChosenPath when the open folder passed the server’s check, else false with the reason below the path bar.

Task LoadAsync()

Opens the start folder; when it cannot be listed, the drives with the reason below the path bar.

Task<bool> OpenAsync(string? path)

Lists path (null or empty: the drives); true when it was listed. A listing that fails keeps the one before and shows why below the path bar. A newer open cancels an older one.

const string LoadingText = "Reading folders"

The loading text of the list.

const string NoDrivesText = "The server shows no drives."

The empty list of the drives.

const string NoFoldersText = "No folders here. Create one with New folder."

The empty list of a folder.