Skip to content

DevicePickerViewModel

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

The shared device picker (DevicePickerWindow): every managed device in address order, a search over address, model, MAC address, host name and tags, Select all / Select none for the devices the search shows, and the count. With DevicePickerOptions it also offers “All devices”, the tags (a tag stands for every device with it; its devices show checked with the tag’s name) and the device of the event; the result is DevicePickerViewModel.Choice. Built for thousands of devices: the list is replaced in one step, the count is kept per change, select all, none and a tag change are one pass.

public sealed class DevicePickerViewModel : ObservableObject

Inherits ObservableObject

DevicePickerViewModel(IEnumerable<IDeviceInfo> devices, IEnumerable<Guid>? selected = null, Func<IDeviceInfo, string?>? unavailableReason = null)

Parameters

  • devices: Every device that can be shown.
  • selected: The devices chosen when the picker opens.
  • unavailableReason: Why a device cannot be chosen (null = it can); such devices are greyed.
DevicePickerViewModel(IEnumerable<IDeviceInfo> devices, DeviceChoice initial, DevicePickerOptions options, Func<IDeviceInfo, string?>? unavailableReason = null)

Parameters

  • devices: Every device that can be shown.
  • initial: The choice when the picker opens.
  • options: All devices, tags, the device of the event.
  • unavailableReason: Why a device cannot be chosen (null = it can); such devices are greyed.
DeviceChoice Choice { get; }

The result: all devices, the device of the event, or the devices and tags chosen.

int ChosenCount { get; }

How many devices are chosen.

string EmptyText { get; }

What the empty list says.

bool HasChoices { get; }

Whether the left column (event device, all devices, tags) is shown.

bool HasTags { get; }

There are tags to choose.

bool IsAll { get; set; }

Radio “All devices”.

bool IsChosen { get; set; }

Radio “Chosen devices and tags”: the tags and the device list can be used.

bool IsEmpty { get; }

The list shows nothing.

bool IsEventDevice { get; set; }

Radio “The device of the event”.

DeviceChoiceKind Kind { get; set; }

The radio choice of the left column.

DevicePickerOptions Options { get; }

What the picker offers.

string SearchText { get; set; }

The search over address, model, MAC address, host name and tags.

IRelayCommand SelectAllCommand { get; }

Gets an IRelayCommand instance wrapping DevicePickerViewModel.SelectAll.

IRelayCommand SelectNoneCommand { get; }

Gets an IRelayCommand instance wrapping DevicePickerViewModel.SelectNone.

IReadOnlyList<Guid> SelectedIds { get; }

The devices chosen one by one, in list order (not those of a chosen tag).

bool ShowNoTags { get; }

Tags are allowed but no device has one.

string Summary { get; private set; }

“12 of 4,812 devices chosen”.

IReadOnlyList<TagPickItem> Tags { get; }

The tags to choose.

RangeObservableCollection<DevicePickItem> Visible { get; }

The devices the search shows.