markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / MainViewModel.cs @ 53c9637d
이력 | 보기 | 이력해설 | 다운로드 (1.77 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.ServiceModel; |
5 |
using System.Text; |
6 |
using System.Threading.Tasks; |
7 |
using Markus.Service.Helper; |
8 |
using Markus.Service.StationController.StationService; |
9 |
|
10 |
namespace Markus.Service.StationController.ViewModel |
11 |
{ |
12 |
public class MainViewModel : Base.ViewModelBase |
13 |
{ |
14 |
StationService.StationServiceClient client; |
15 |
|
16 |
public MainViewModel() |
17 |
{ |
18 |
BasicHttpBinding myBinding = new BasicHttpBinding(); |
19 |
EndpointAddress myEndpoint = new EndpointAddress(UriHelper.UriCreate("http://192.168.0.76:9101/StationService")); |
20 |
client = new StationService.StationServiceClient(myBinding, myEndpoint); |
21 |
client.AliveConvertListCompleted += Client_AliveConvertListCompleted; |
22 |
|
23 |
System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer(); |
24 |
timer.Interval = new TimeSpan(0, 0, 1); |
25 |
timer.Tick += Timer_Tick; |
26 |
timer.Start(); |
27 |
} |
28 |
|
29 |
private void Timer_Tick(object sender, EventArgs e) |
30 |
{ |
31 |
client.AliveConvertListAsync(); |
32 |
} |
33 |
|
34 |
private void Client_AliveConvertListCompleted(object sender, AliveConvertListCompletedEventArgs e) |
35 |
{ |
36 |
AliveItems = e.Result; |
37 |
} |
38 |
|
39 |
private string id; |
40 |
|
41 |
public string Id |
42 |
{ |
43 |
get => id; set |
44 |
{ |
45 |
id = value; |
46 |
OnPropertyChanged(() => Id); |
47 |
} |
48 |
} |
49 |
|
50 |
public List<ConvertItem> AliveItems |
51 |
{ |
52 |
get => aliveItems; set |
53 |
{ |
54 |
aliveItems = value; |
55 |
OnPropertyChanged(() => AliveItems); |
56 |
} |
57 |
} |
58 |
|
59 |
private List<StationService.ConvertItem> aliveItems; |
60 |
} |
61 |
} |