DiscoveryViewModel.cs
2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/***********************************************
* CONFIDENTIAL AND PROPRIETARY
*
* The source code and other information contained herein is the confidential and exclusive property of
* ZIH Corp. and is subject to the terms and conditions in your end user license agreement.
* This source code, and any other information contained herein, shall not be copied, reproduced, published,
* displayed or distributed, in whole or in part, in any medium, by any means, for any purpose except as
* expressly permitted under such license agreement.
*
* Copyright ZIH Corp. 2018
*
* ALL RIGHTS RESERVED
***********************************************/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Zebra.Sdk.Printer.Discovery;
using Zebra.Windows.DevDemo.Enums;
using Zebra.Windows.DevDemo.Utils;
namespace Zebra.Windows.DevDemo.Demos.Discovery {
public class DiscoveryViewModel : IDemoViewModel {
private ObservableCollection<DiscoveredPrinter> discoveredPrinters = new ObservableCollection<DiscoveredPrinter>();
private string discoveredPrinterInfo;
private string ipAddress;
private string numberOfHops;
private string subnetRange;
public List<DiscoveryMethod> DiscoveryMethods {
get {
List<DiscoveryMethod> discoveryMethods = Enum.GetValues(typeof(DiscoveryMethod)).Cast<DiscoveryMethod>().ToList();
if(!BluetoothHelper.IsBluetoothSupported()) {
discoveryMethods.Remove(DiscoveryMethod.Bluetooth);
}
return discoveryMethods;
}
}
public ObservableCollection<DiscoveredPrinter> DiscoveredPrinters {
get => discoveredPrinters;
}
public string DiscoveredPrinterInfo {
get => discoveredPrinterInfo;
set {
if (discoveredPrinterInfo != value) {
discoveredPrinterInfo = value;
OnPropertyChanged();
}
}
}
public string IpAddress {
get => ipAddress;
set {
if (ipAddress != value) {
ipAddress = value;
OnPropertyChanged();
}
}
}
public string NumberOfHops {
get => numberOfHops;
set {
if (numberOfHops != value) {
numberOfHops = value;
OnPropertyChanged();
}
}
}
public string SubnetRange {
get => subnetRange;
set {
if (subnetRange != value) {
subnetRange = value;
OnPropertyChanged();
}
}
}
public DiscoveryViewModel() {
Name = "Discovery";
NumberOfHops = "5";
}
}
}