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, DeviceGroupChoice initial, DeviceGroupPickerOptions group)

The device group editor (DevicePickerOptions.Group): sites and tags on the left, the devices they cover checked and locked, single devices tickable, covered devices can be excepted; the result is DevicePickerViewModel.GroupChoice. Serials of the group that no listed device has (removed devices) are kept as they are.

Parameters

  • devices: Every device of the server.
  • initial: The rules of the group when the editor opens.
  • group: The sites (“This server” first) and the defined tags.
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.

int CoveredCount { get; private set; }

How many devices the group has with the choice now (“412” of “412 of 4,812 devices”).

string EmptyText { get; }

What the empty list says.

string? ErrorText { get; set; }

A refusal of the whole choice (e.g. the server refused a device group’s rules), shown directly below the list.

DeviceGroupChoice GroupChoice { get; }

The device group editor’s result: “This server”, the chosen sites, tags (definition ids), single devices and excepted devices by serial number (also those no chosen site or tag covers now, and those of devices not listed).

bool HasChoices { get; }

Whether the left column (event device, all devices, tags; the group editor’s sites and tags) is shown.

bool HasError { get; }

DevicePickerViewModel.ErrorText is set.

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”.

bool IsGroup { get; }

The device group editor (DevicePickerOptions.Group).

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 (the group editor: no tag is defined).

IReadOnlyList<SitePickItem> Sites { get; }

The device group editor’s sites, “This server” first; empty elsewhere.

string Summary { get; private set; }

“12 of 4,812 devices chosen”.

IReadOnlyList<TagPickItem> Tags { get; }

The tags to choose.

int TotalCount { get; }

Every device of the list.

RangeObservableCollection<DevicePickItem> Visible { get; }

The devices the search shows.