개정판 b92f142f
convert service 수정
Controller 수정
Change-Id: I38994fcc4d4452d638ea74b27cc8638f4157e17a
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/AliveViewModel.cs | ||
---|---|---|
6 | 6 |
using System.Text; |
7 | 7 |
using System.Threading.Tasks; |
8 | 8 |
using Markus.Service.Extensions; |
9 |
|
|
9 |
using Markus.Service.Helper; |
|
10 |
using Markus.Service.StationController.Extensions; |
|
10 | 11 |
|
11 | 12 |
namespace Markus.Service.StationController.ViewModel |
12 | 13 |
{ |
... | ... | |
14 | 15 |
{ |
15 | 16 |
BackgroundWorker backgroundWorker; |
16 | 17 |
|
17 |
private List<ConvertItem> aliveItems;
|
|
18 |
private System.Collections.ObjectModel.ObservableCollection<ConvertItem> aliveItems;
|
|
18 | 19 |
private bool isLoading; |
19 | 20 |
|
20 |
public List<ConvertItem> AliveItems
|
|
21 |
public System.Collections.ObjectModel.ObservableCollection<ConvertItem> AliveItems
|
|
21 | 22 |
{ |
22 | 23 |
get => aliveItems; set |
23 | 24 |
{ |
... | ... | |
73 | 74 |
newitems.AddRange(items); |
74 | 75 |
} |
75 | 76 |
} |
76 |
|
|
77 | 77 |
|
78 |
if (AliveItems == null) |
|
79 |
{ |
|
80 |
AliveItems = new System.Collections.ObjectModel.ObservableCollection<ConvertItem>(); |
|
78 | 81 |
|
79 |
//newitems.UpdateWhere(AliveItems, new ConvertItem().ConvertID); |
|
82 |
foreach (var item in newitems) |
|
83 |
{ |
|
84 |
AliveItems.Add(item); |
|
85 |
} |
|
86 |
} |
|
87 |
else |
|
88 |
{ |
|
89 |
/// 데이터 업데이트 |
|
90 |
newitems.ForEach(newitem => |
|
91 |
{ |
|
92 |
AliveItems.UpdateWhere(changeitem => ConvertItemEx.ChangeValues(changeitem, newitem), x => x.ProjectNumber == newitem.ProjectNumber && x.ConvertID == newitem.ConvertID); |
|
93 |
}); |
|
80 | 94 |
|
81 |
AliveItems = newitems; |
|
95 |
// 추가 |
|
96 |
foreach (var item in newitems) |
|
97 |
{ |
|
98 |
if (AliveItems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
|
99 |
{ |
|
100 |
AliveItems.Add(item); |
|
101 |
} |
|
102 |
} |
|
103 |
|
|
104 |
/// 삭제 |
|
105 |
|
|
106 |
for (int i = AliveItems.Count() -1; i > -1; --i) |
|
107 |
{ |
|
108 |
var item = AliveItems[i]; |
|
82 | 109 |
|
110 |
if (newitems.Count(x => x.ConvertID == item.ConvertID && x.ProjectNumber == item.ProjectNumber) == 0) |
|
111 |
{ |
|
112 |
AliveItems.RemoveAt(i); |
|
113 |
} |
|
114 |
} |
|
115 |
} |
|
83 | 116 |
} |
84 | 117 |
catch (Exception ex) |
85 | 118 |
{ |
... | ... | |
88 | 121 |
|
89 | 122 |
} |
90 | 123 |
|
124 |
|
|
125 |
|
|
91 | 126 |
|
92 | 127 |
public static bool SimplePing(string uri) |
93 | 128 |
{ |
내보내기 Unified diff