| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="ImportItemViewModel.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System.Collections.Generic; |
| | | 8 | | using MyNet.Observable; |
| | | 9 | | |
| | | 10 | | namespace MyNet.UI.ViewModels.Import; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Base class for importable items. |
| | | 14 | | /// </summary> |
| | | 15 | | public class ImportItemViewModel : ObservableObject |
| | | 16 | | { |
| | | 17 | | /// <summary> |
| | | 18 | | /// Gets the import mode for this item. |
| | | 19 | | /// </summary> |
| | | 20 | | public ImportMode Mode { get; init; } = ImportMode.Add; |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// Gets or sets a value indicating whether this item is selected in the UI list. |
| | | 24 | | /// </summary> |
| | 3 | 25 | | public bool IsSelected { get; set => SetProperty(ref field, value); } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Gets or sets a value indicating whether this item should be imported. |
| | | 29 | | /// </summary> |
| | 18 | 30 | | public bool Import { get; set => SetProperty(ref field, value); } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Validates this item before import. |
| | | 34 | | /// </summary> |
| | | 35 | | /// <returns>A sequence of validation error messages. Empty means valid.</returns> |
| | 0 | 36 | | public virtual IReadOnlyCollection<string> ValidateForImport() => []; |
| | | 37 | | } |
| | | 38 | | |