개정판 6f6e7dbf
service 중복 convert 방지
mvvmtoolkit 수정
Change-Id: I860d70f64586b2893d4f98a6ea890f2a5512410e
ConvertService/ServiceBase/Markus.Mvvm.ToolKit/Markus.Mvvm.ToolKit.csproj | ||
---|---|---|
41 | 41 |
</PropertyGroup> |
42 | 42 |
<ItemGroup> |
43 | 43 |
<Reference Include="PresentationCore" /> |
44 |
<Reference Include="PresentationFramework" /> |
|
44 | 45 |
<Reference Include="System" /> |
45 | 46 |
<Reference Include="System.Core" /> |
46 | 47 |
<Reference Include="System.Xml.Linq" /> |
... | ... | |
49 | 50 |
<Reference Include="System.Data" /> |
50 | 51 |
<Reference Include="System.Net.Http" /> |
51 | 52 |
<Reference Include="System.Xml" /> |
53 |
<Reference Include="WindowsBase" /> |
|
52 | 54 |
</ItemGroup> |
53 | 55 |
<ItemGroup> |
54 | 56 |
<Compile Include="AsyncCommand\AsyncCommand.cs" /> |
ConvertService/ServiceBase/Markus.Mvvm.ToolKit/ViewModelBase.cs | ||
---|---|---|
1 |
using System.Windows.Input; |
|
1 |
using System.ComponentModel; |
|
2 |
using System.Windows; |
|
3 |
using System.Windows.Input; |
|
2 | 4 |
|
3 | 5 |
namespace Markus.Mvvm.ToolKit |
4 | 6 |
{ |
5 | 7 |
public abstract class ViewModelBase : NotifyExpectation |
6 | 8 |
{ |
9 |
public bool IsDesignMode |
|
10 |
{ |
|
11 |
get |
|
12 |
{ |
|
13 |
return DesignerProperties.GetIsInDesignMode(new DependencyObject()); |
|
14 |
} |
|
15 |
private set { } |
|
16 |
} |
|
7 | 17 |
|
8 | 18 |
#region ViewModel Base Binding |
9 | 19 |
|
ConvertService/ServiceBase/Markus.Service.ConvertProcess/Program.cs | ||
---|---|---|
27 | 27 |
try |
28 | 28 |
{ |
29 | 29 |
logger = LogManager.GetLogger(typeof(Convert)); |
30 |
|
|
30 |
//#if DEBUG |
|
31 |
// args = new[] { "11cb3ebc-2323-3b12-1a3e-87a783579ec3", "9gW0LjBVZwt3Z5opwby84cqlTB9oEZzLWBpFJ6LmRo0DArLL680d3EWmRT2gQ5E6gqNSmuC7Jse/4JZPXR9srb1NGnt3B4682sQAX6bfd412bdc+3pqI+ZySkvfAuiaESFWWYlEpDTUahE2mGpenD+JIA3lLBR5DNtdTlpYMHiI8/TiciIizUNbFKy7Ubp4dJ1QvBsNA+r5TcKvuSZIykLTaxAvIfC9T31wYSG9d24vkm3cj2NdzWIKNoYGj9wCREoaakyKANyTumVSlfTFclizlZACANPopOOmpb+FG4f7kGEn0tMCAKPo8Vx1muRLDXM/pVfOUAsisXWHfc/A7Vxfx/xQuVQX55SZWxOGPtdNXFiyfXnBIE0MANMnYthnxzbp2ZqYEXvJlClMrcRCLpUQ/SDVOvvhaTmU4FfyKaKVMTZ6yMlbqqSvYZr9R7NN+UW+h2ghsfJhx3y+GNIRpqHVriP/C6mc3hV72mDAAe+00uV4DlvO78qMCaX0xIXj0VjQHiEA2ePcpZRxFcVf6luE1n37OVFecv89cxl3Tk+fD7MjIJYvuy3U8WySDm1XqDlO1PX/yz/xDhtjHIXnkxK+upqoVr+W5Sd9uRN+JGsGP3AkGbWg01sQOe1T63om3gPIjMtCPrkhjSdQRED/mpJumeR85j/2uBIkkBbXWVJQs8tG+Engcd6+zCyoNJ8tf2+GBozzjXIPHCze57i9kWrtp4scfop8aAlaUsexC3C3msu3ZP9+LaLrqtcGTvO9XXhSld/B2pB3fF1r/PPESJCKavStakkwH80ak2FvY/p9bsf/jB9TDTXHuinTq52fNlT0SUFwMZvDcit7qODlRtLuwfODyZbPqx6bu2Eh4o/2+AQ4a9lvSfUGXJY88Q+JycNXEvJv0A5WQBdtjkdBFt6I0Lc8y8Vme8x7RDE76UwfOrsaEOdBh1oo9dg60eWp7t3QSRSOh5gDV3jfwqPVRkdSLUPujX6VRKCNkYclUtQcfd/vPQFEIyXaeRYHcJa5AVCNLFcoAg4Lp8BxXuNvxtg==" }; |
|
32 |
//#endif |
|
31 | 33 |
if (args.Length == 2) |
32 | 34 |
{ |
33 | 35 |
string ConvertID = args[0]; |
ConvertService/ServiceBase/Markus.Service.DataBase/ConvertDatabase.cs | ||
---|---|---|
239 | 239 |
var convertWaitingItems = entities.CONVERTER_DOC.OrderBy(x => x.CREATE_DATETIME).Where( |
240 | 240 |
x => |
241 | 241 |
projectList.Contains(x.PROJECT_NO) && |
242 |
(x.STATUS == (int)StatusCodeType.None || |
|
243 |
x.STATUS == (int)StatusCodeType.Error && x.RECONVERTER < 2)).Take(TakeCount); |
|
242 |
(x.STATUS == (int)StatusCodeType.None || x.STATUS > (int)StatusCodeType.Completed && x.RECONVERTER < 2)) |
|
243 |
.GroupBy(x=>x.DOCUMENT_ID).Select(x => x.FirstOrDefault()) |
|
244 |
.Take(TakeCount); |
|
244 | 245 |
|
245 | 246 |
return convertWaitingItems.ToList(); |
246 | 247 |
} |
ConvertService/ServiceBase/Markus.Service.Station/ServiceStation.ini | ||
---|---|---|
5 | 5 |
SERVICE_ID = 03A98B3B-ECCD-4972-B658-43C7571965DA |
6 | 6 |
|
7 | 7 |
# 구분자는 , |
8 |
SERVICE_LIST = 03A98B3B-ECCD-4972-B658-43C7571965DA |
|
8 |
SERVICE_LIST = 03A98B3B-ECCD-4972-B658-43C7571965DA,0AC6FD8E-5060-4B0F-9E6B-A7380B9FCF7B
|
|
9 | 9 |
#MarkusDataBaseConnectionString = data source=.\SQLEXPRESS;initial catalog=Markus;persist security info=True;user id=ConvertService;Password=ConvertService;MultipleActiveResultSets=True; |
10 | 10 |
#MarkusDataBaseConnectionString = data source=DESKTOP-MARKUS;initial catalog=Markus_V3;persist security info=True;user id=doftech;Password=dof1073#;MultipleActiveResultSets=True; |
11 | 11 |
|
... | ... | |
18 | 18 |
# remote test MARKUS_V3 |
19 | 19 |
MarkusDataBaseConnectionString = YNP/egPgsKY5wO/j9T7VgkiSClJH7p9hANqnTbQFNYaOnS1f9eeZS5UzPwsGuI3syNfjUnBbiLk37BjsNNWzZevN8Jbd9EzwE9l5g8upXhNqX9eF2brizRZ4ud+GK/35HvqSjvIaz5ggszA3dHT2b+r9279mJXo42QzRBNbUcBgnl2njNNSB7EfckQ5Hwd7eatvWuf3ESIUv4KTqGU5V6A== |
20 | 20 |
|
21 |
#daelim |
|
22 |
#MarkusDataBaseConnectionString = yRW0I8OJY/boJcR9rTFeH229g456BwO8BaXQbW8h6iCR10JRc5tOl2BDWa1595q0bvW9uD5HsHn9ke4oK3yaw2OYHh8pgYKdhW48xeAl49510h1DPv8uSbqcWdwZ2AjernORxxaEAUqHZb5DFlndcWuid82ZwP/EGxGNhaaCG+KVogeHwI5FZZKrmUTWe3159qk11Q4XswrHeLy8HQn5Qg== |
|
23 |
|
|
21 | 24 |
DownloadTempFolder = D:\CONVERT_SERVICE_TEMP |
22 | 25 |
MULTI_TRHEAD_MAX_PAGE = 250 |
23 | 26 |
|
24 | 27 |
# MIN_FONT_SIZE = -1 인 경우 기본 Resolution 100으로 사용 |
25 | 28 |
# 페이지에 설정된 폰트 이하의 문자가 있는 경우 Resolution 200으로 변환 |
26 | 29 |
# 기본 = 10 |
27 |
MIN_FONT_SIZE = 10
|
|
30 |
MIN_FONT_SIZE = -1
|
|
28 | 31 |
|
29 | 32 |
# 설정된 Resolution으로 강제 변환 |
30 | 33 |
# 기본 = 0 |
31 |
USE_RESOLUTION = 300
|
|
34 |
USE_RESOLUTION = 100
|
|
32 | 35 |
|
33 | 36 |
# 상태 저장 간격(페이지당 상태 저장 간각) |
34 | 37 |
# 기본 5 |
ConvertService/ServiceBase/Markus.Service.Station/StationService/ServiceStationTask.cs | ||
---|---|---|
143 | 143 |
} |
144 | 144 |
} |
145 | 145 |
|
146 |
private void PassConvertItem(string ProjectNo,string ConvertID)
|
|
146 |
private void ReflashSubService()
|
|
147 | 147 |
{ |
148 |
foreach (var item in StationServiceList)
|
|
148 |
foreach (var subservice in StationServiceList)
|
|
149 | 149 |
{ |
150 | 150 |
try |
151 | 151 |
{ |
152 |
var aliveItems = item.Service.AliveConvertList(); |
|
153 |
|
|
154 |
if (item.Properties.PROCESS_COUNT > aliveItems.Count()) |
|
155 |
{ |
|
156 |
|
|
157 |
item.Service.ConvertAdd(ProjectNo, ConvertID); |
|
152 |
var result = subservice.Service.AliveConvertList(); |
|
158 | 153 |
|
159 |
logger.Info($"PassConvertItem - Service ID : {item.Properties.ID} ConvertID : {ConvertID}");
|
|
160 |
}
|
|
154 |
subservice.ConvertItems = result.ToList();
|
|
155 |
subservice.AliveCount = result.Count();
|
|
161 | 156 |
} |
162 | 157 |
catch (Exception ex) |
163 | 158 |
{ |
164 |
logger.Error($"PassConvertItem - Service ID : {item.Properties.ID} ConvertID : {ConvertID}",ex); |
|
159 |
logger.Error($"ReflashSubService error - Service ID : {subservice.Properties.ID} ", ex); |
|
160 |
} |
|
161 |
} |
|
162 |
} |
|
163 |
|
|
164 |
private void PassConvertItem(string ProjectNo,string ConvertID) |
|
165 |
{ |
|
166 |
|
|
167 |
ReflashSubService(); |
|
168 |
|
|
169 |
try |
|
170 |
{ |
|
171 |
|
|
172 |
if (StationServiceList.SelectMany(x => x.ConvertItems).Count(c => c.ProjectNumber == ProjectNo && c.ConvertID == ConvertID) == 0) |
|
173 |
{ |
|
174 |
var station = StationServiceList.OrderBy(x => x.AliveCount).FirstOrDefault(); |
|
175 |
|
|
176 |
if (station != null) |
|
177 |
{ |
|
178 |
var result = station.Service.ConvertAdd(ProjectNo, ConvertID); |
|
179 |
logger.Info($"PassConvertItem - Service ID : {station.Properties.ID} ConvertID : {ConvertID}"); |
|
180 |
} |
|
165 | 181 |
} |
166 | 182 |
} |
183 |
catch (Exception ex) |
|
184 |
{ |
|
185 |
logger.Error($"setDataBaseWaitingList", ex); |
|
186 |
} |
|
167 | 187 |
} |
168 | 188 |
|
169 | 189 |
private void CleanUpItems() |
ConvertService/ServiceBase/Markus.Service.Station/StationService/ServiceStationWCF.cs | ||
---|---|---|
262 | 262 |
/// <returns></returns> |
263 | 263 |
public List<ConvertItem> AliveConvertList() |
264 | 264 |
{ |
265 |
ServiceStation.AliveConvertQueue.ToList(); |
|
266 |
|
|
265 | 267 |
return ServiceStation.AliveConvertQueue.ToList(); |
266 | 268 |
} |
267 | 269 |
|
ConvertService/ServiceBase/Markus.Service.Station/SubStationServiceItem.cs | ||
---|---|---|
10 | 10 |
{ |
11 | 11 |
public Service.DataBase.SERVICE_PROPERTIES Properties { get;set;} |
12 | 12 |
public StationService.StationServiceClient Service { get; set; } |
13 |
public int AliveCount { get; set; } |
|
14 |
public List<StationService.ConvertItem> ConvertItems { get; set; } |
|
13 | 15 |
} |
14 | 16 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/AppDefine.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace Markus.Service.StationController |
|
8 |
{ |
|
9 |
public static class CONFIG_DEFINE |
|
10 |
{ |
|
11 |
|
|
12 |
public const string SERVICE = "SERVICE"; |
|
13 |
public const string SERVICE_ADDRESS = "SERVICE_ADDRESS"; |
|
14 |
|
|
15 |
public const string MARKUS_CONNECTION_STRING = "MarkusDataBaseConnectionString"; |
|
16 |
} |
|
17 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/AppInit.cs | ||
---|---|---|
8 | 8 |
using System.Text; |
9 | 9 |
using System.Threading.Tasks; |
10 | 10 |
using System.Windows; |
11 |
using static Markus.Service.Extensions.Encrypt; |
|
11 | 12 |
|
12 | 13 |
namespace Markus.Service.StationController |
13 | 14 |
{ |
14 | 15 |
public partial class App : Application |
15 | 16 |
{ |
16 | 17 |
public static List<StationService.StationServiceClient> StationClientList; |
18 |
public static string MarkusDataBaseConnecitonString; |
|
17 | 19 |
|
18 | 20 |
public App() |
19 | 21 |
{ |
... | ... | |
30 | 32 |
|
31 | 33 |
var config = ConfigHelper.AppConfig(configFileName); |
32 | 34 |
|
33 |
var serviceUri = config.GetValue("SERVICE", "ADDRESS", "http://Localhost:9101/StationService");
|
|
35 |
var serviceUri = config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.SERVICE_ADDRESS, "http://Localhost:9101/StationService");
|
|
34 | 36 |
StationClientList = new List<StationServiceClient>(); |
35 | 37 |
|
36 | 38 |
foreach (var item in serviceUri.Split(',')) |
... | ... | |
43 | 45 |
StationClientList.Add(StationClient); |
44 | 46 |
} |
45 | 47 |
|
48 |
MarkusDataBaseConnecitonString = AESEncrypter.Decrypt(config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.MARKUS_CONNECTION_STRING)); |
|
46 | 49 |
} |
47 | 50 |
catch (Exception ex) |
48 | 51 |
{ |
ConvertService/ServiceBase/Markus.Service.StationController/Markus.Service.StationController.csproj | ||
---|---|---|
62 | 62 |
<Reference Include="ConfigParser, Version=0.3.3.6, Culture=neutral, processorArchitecture=MSIL"> |
63 | 63 |
<HintPath>..\packages\Salaros.ConfigParser.0.3.3\lib\net45\ConfigParser.dll</HintPath> |
64 | 64 |
</Reference> |
65 |
<Reference Include="MaterialDesignColors, Version=1.1.3.0, Culture=neutral, processorArchitecture=MSIL"> |
|
66 |
<HintPath>..\packages\MaterialDesignColors.1.1.3\lib\net45\MaterialDesignColors.dll</HintPath> |
|
65 |
<Reference Include="Markus.Message, Version=1.5.3.0, Culture=neutral, processorArchitecture=MSIL"> |
|
66 |
<HintPath>..\packages\Markus.Message.1.5.4\lib\net45\Markus.Message.dll</HintPath> |
|
67 |
</Reference> |
|
68 |
<Reference Include="MaterialDesignColors, Version=1.2.0.325, Culture=neutral, processorArchitecture=MSIL"> |
|
69 |
<HintPath>..\packages\MaterialDesignColors.1.2.0\lib\net45\MaterialDesignColors.dll</HintPath> |
|
67 | 70 |
</Reference> |
68 | 71 |
<Reference Include="MaterialDesignExtensions, Version=2.6.0.0, Culture=neutral, processorArchitecture=MSIL"> |
69 | 72 |
<HintPath>..\packages\MaterialDesignExtensions.2.6.0\lib\net45\MaterialDesignExtensions.dll</HintPath> |
70 | 73 |
</Reference> |
71 |
<Reference Include="MaterialDesignThemes.Wpf, Version=2.5.1.1345, Culture=neutral, processorArchitecture=MSIL">
|
|
72 |
<HintPath>..\packages\MaterialDesignThemes.2.5.1\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
|
|
74 |
<Reference Include="MaterialDesignThemes.Wpf, Version=2.6.0.325, Culture=neutral, processorArchitecture=MSIL">
|
|
75 |
<HintPath>..\packages\MaterialDesignThemes.2.6.0\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
|
|
73 | 76 |
</Reference> |
74 | 77 |
<Reference Include="Microsoft.EntityFrameworkCore"> |
75 | 78 |
<HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.entityframeworkcore\2.2.0\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll</HintPath> |
... | ... | |
105 | 108 |
<SubType>Designer</SubType> |
106 | 109 |
</ApplicationDefinition> |
107 | 110 |
<Compile Include="AppInit.cs" /> |
111 |
<Compile Include="AppDefine.cs" /> |
|
108 | 112 |
<Compile Include="Data\NavigationItem.cs" /> |
113 |
<Compile Include="ViewModel\DataBaseByStatusViewModel.cs" /> |
|
109 | 114 |
<Compile Include="ViewModel\AliveViewModel.cs" /> |
110 | 115 |
<Compile Include="ViewModel\MainViewModel.cs" /> |
116 |
<Compile Include="Views\MergeDataView.xaml.cs"> |
|
117 |
<DependentUpon>MergeDataView.xaml</DependentUpon> |
|
118 |
</Compile> |
|
111 | 119 |
<Compile Include="ViewModel\SettingsViewModel.cs" /> |
120 |
<Compile Include="Views\DataBaseByStatusView.xaml.cs"> |
|
121 |
<DependentUpon>DataBaseByStatusView.xaml</DependentUpon> |
|
122 |
</Compile> |
|
112 | 123 |
<Compile Include="Views\AliveView.xaml.cs"> |
113 | 124 |
<DependentUpon>AliveView.xaml</DependentUpon> |
114 | 125 |
</Compile> |
... | ... | |
139 | 150 |
<SubType>Designer</SubType> |
140 | 151 |
<Generator>MSBuild:Compile</Generator> |
141 | 152 |
</Page> |
153 |
<Page Include="Views\MergeDataView.xaml"> |
|
154 |
<SubType>Designer</SubType> |
|
155 |
<Generator>MSBuild:Compile</Generator> |
|
156 |
</Page> |
|
157 |
<Page Include="Views\DataBaseByStatusView.xaml"> |
|
158 |
<Generator>MSBuild:Compile</Generator> |
|
159 |
<SubType>Designer</SubType> |
|
160 |
</Page> |
|
142 | 161 |
<Page Include="Views\AliveView.xaml"> |
143 | 162 |
<SubType>Designer</SubType> |
144 | 163 |
<Generator>MSBuild:Compile</Generator> |
ConvertService/ServiceBase/Markus.Service.StationController/StationController.ini | ||
---|---|---|
1 | 1 |
[SERVICE] |
2 |
ADDRESS = http://172.20.120.142:9991/StationService,http://172.20.120.143:9991/StationService |
|
2 |
SERVICE_ADDRESS = http://localhost:9101/StationService,http://localhost:9991/StationService |
|
3 |
|
|
4 |
# remote test MARKUS_V3 |
|
5 |
MarkusDataBaseConnectionString = YNP/egPgsKY5wO/j9T7VgkiSClJH7p9hANqnTbQFNYaOnS1f9eeZS5UzPwsGuI3syNfjUnBbiLk37BjsNNWzZevN8Jbd9EzwE9l5g8upXhNqX9eF2brizRZ4ud+GK/35HvqSjvIaz5ggszA3dHT2b+r9279mJXo42QzRBNbUcBgnl2njNNSB7EfckQ5Hwd7eatvWuf3ESIUv4KTqGU5V6A== |
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/AliveViewModel.cs | ||
---|---|---|
67 | 67 |
|
68 | 68 |
foreach (var client in App.StationClientList) |
69 | 69 |
{ |
70 |
newitems.AddRange(await client.AliveConvertListAsync()); |
|
70 |
var items = await client.AliveConvertListAsync(); |
|
71 |
|
|
72 |
newitems.AddRange(items); |
|
71 | 73 |
} |
72 | 74 |
|
73 | 75 |
newitems.Update(AliveItems); |
... | ... | |
86 | 88 |
{ |
87 | 89 |
base.Loaded(); |
88 | 90 |
|
89 |
backgroundWorker = new BackgroundWorker(); |
|
90 |
backgroundWorker.DoWork += backgroundWorker_DoWork; |
|
91 |
backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted; |
|
92 |
backgroundWorker.WorkerReportsProgress = false; |
|
93 |
backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
91 |
if (!IsDesignMode) |
|
92 |
{ |
|
93 |
backgroundWorker = new BackgroundWorker(); |
|
94 |
backgroundWorker.DoWork += backgroundWorker_DoWork; |
|
95 |
backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted; |
|
96 |
backgroundWorker.WorkerReportsProgress = false; |
|
97 |
backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
94 | 98 |
|
95 |
backgroundWorker.RunWorkerAsync(); |
|
99 |
backgroundWorker.RunWorkerAsync(); |
|
100 |
} |
|
96 | 101 |
} |
97 | 102 |
|
98 | 103 |
public override void Closed() |
99 | 104 |
{ |
100 |
backgroundWorker.DoWork -= backgroundWorker_DoWork; |
|
101 |
backgroundWorker.RunWorkerCompleted -= backgroundWorker_RunWorkerCompleted; |
|
102 |
backgroundWorker.WorkerReportsProgress = false; |
|
103 |
backgroundWorker.ProgressChanged -= new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
105 |
if (backgroundWorker != null) |
|
106 |
{ |
|
107 |
backgroundWorker.DoWork -= backgroundWorker_DoWork; |
|
108 |
backgroundWorker.RunWorkerCompleted -= backgroundWorker_RunWorkerCompleted; |
|
109 |
backgroundWorker.WorkerReportsProgress = false; |
|
110 |
backgroundWorker.ProgressChanged -= new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
104 | 111 |
|
105 |
backgroundWorker.Dispose(); |
|
112 |
backgroundWorker.Dispose(); |
|
113 |
} |
|
106 | 114 |
|
107 | 115 |
base.Closed(); |
108 | 116 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/DataBaseByStatusViewModel.cs | ||
---|---|---|
1 |
using Markus.Service.StationController.StationService; |
|
2 |
using System; |
|
3 |
using System.Collections.Generic; |
|
4 |
using System.ComponentModel; |
|
5 |
using System.Linq; |
|
6 |
using System.Text; |
|
7 |
using System.Threading.Tasks; |
|
8 |
using Markus.Service.Extensions; |
|
9 |
using Markus.Message; |
|
10 |
|
|
11 |
namespace Markus.Service.StationController.ViewModel |
|
12 |
{ |
|
13 |
public class DataBaseByStatusViewModel : Mvvm.ToolKit.ViewModelBase |
|
14 |
{ |
|
15 |
BackgroundWorker backgroundWorker; |
|
16 |
|
|
17 |
private List<StationService.ConvertItem> items; |
|
18 |
private StatusCodeType statusType; |
|
19 |
private bool isLoading; |
|
20 |
|
|
21 |
public List<ConvertItem> Items |
|
22 |
{ |
|
23 |
get => items; set |
|
24 |
{ |
|
25 |
items = value; |
|
26 |
OnPropertyChanged(() => Items); |
|
27 |
} |
|
28 |
} |
|
29 |
|
|
30 |
|
|
31 |
public StatusCodeType StatusType |
|
32 |
{ |
|
33 |
get => statusType; set |
|
34 |
{ |
|
35 |
statusType = value; |
|
36 |
OnPropertyChanged(() => StatusType); |
|
37 |
} |
|
38 |
} |
|
39 |
|
|
40 |
public bool IsLoading |
|
41 |
{ |
|
42 |
get => isLoading; set |
|
43 |
{ |
|
44 |
if (isLoading != value) |
|
45 |
{ |
|
46 |
isLoading = value; |
|
47 |
OnPropertyChanged(() => IsLoading); |
|
48 |
} |
|
49 |
} |
|
50 |
} |
|
51 |
|
|
52 |
public DataBaseByStatusViewModel() |
|
53 |
{ |
|
54 |
} |
|
55 |
|
|
56 |
// 진행률에 변화가 있을때 이벤트가 발생 |
|
57 |
private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) |
|
58 |
{ |
|
59 |
} |
|
60 |
|
|
61 |
// 일이 모두 마쳤을때 수행되어야할 코드 |
|
62 |
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) |
|
63 |
{ |
|
64 |
} |
|
65 |
|
|
66 |
// BackgroundWorker에서 수행할 일을 정의. |
|
67 |
private async void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) |
|
68 |
{ |
|
69 |
while (IsAcitve) |
|
70 |
{ |
|
71 |
System.Threading.Thread.Sleep(1000); |
|
72 |
|
|
73 |
try |
|
74 |
{ |
|
75 |
IsLoading = true; |
|
76 |
|
|
77 |
List<ConvertItem> newitems = new List<ConvertItem>(); |
|
78 |
|
|
79 |
foreach (var client in App.StationClientList) |
|
80 |
{ |
|
81 |
var items = await client.AliveConvertListAsync(); |
|
82 |
|
|
83 |
newitems.AddRange(items); |
|
84 |
} |
|
85 |
|
|
86 |
newitems.Update(Items); |
|
87 |
|
|
88 |
Items = newitems; |
|
89 |
|
|
90 |
} |
|
91 |
catch (Exception ex) |
|
92 |
{ |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
} |
|
97 |
|
|
98 |
public override void Loaded() |
|
99 |
{ |
|
100 |
base.Loaded(); |
|
101 |
|
|
102 |
backgroundWorker = new BackgroundWorker(); |
|
103 |
backgroundWorker.DoWork += backgroundWorker_DoWork; |
|
104 |
backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted; |
|
105 |
backgroundWorker.WorkerReportsProgress = false; |
|
106 |
backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
107 |
|
|
108 |
backgroundWorker.RunWorkerAsync(); |
|
109 |
} |
|
110 |
|
|
111 |
public override void Closed() |
|
112 |
{ |
|
113 |
backgroundWorker.DoWork -= backgroundWorker_DoWork; |
|
114 |
backgroundWorker.RunWorkerCompleted -= backgroundWorker_RunWorkerCompleted; |
|
115 |
backgroundWorker.WorkerReportsProgress = false; |
|
116 |
backgroundWorker.ProgressChanged -= new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); |
|
117 |
|
|
118 |
backgroundWorker.Dispose(); |
|
119 |
|
|
120 |
base.Closed(); |
|
121 |
} |
|
122 |
} |
|
123 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/MainViewModel.cs | ||
---|---|---|
76 | 76 |
{ |
77 | 77 |
new MenuItem |
78 | 78 |
{ |
79 |
Name = "Alive Items", |
|
79 |
Name = "Process Alive Items",
|
|
80 | 80 |
Description = "Convert Station Alive Items", |
81 | 81 |
Content = new Views.AliveView() |
82 | 82 |
}, |
83 |
|
|
84 |
new MenuItem |
|
85 |
{ |
|
86 |
Name = "Convert Items", |
|
87 |
Description = "Convert Items", |
|
88 |
Content = new Views.DataBaseByStatusView() |
|
89 |
}, |
|
83 | 90 |
new MenuItem |
84 | 91 |
{ |
85 | 92 |
Name = "Settings", |
ConvertService/ServiceBase/Markus.Service.StationController/Views/DataBaseByStatusView.xaml | ||
---|---|---|
1 |
<UserControl x:Class="Markus.Service.StationController.Views.DataBaseByStatusView" |
|
2 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
3 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
4 |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
5 |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
6 |
mc:Ignorable="d" |
|
7 |
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" |
|
8 |
xmlns:vm="clr-namespace:Markus.Service.StationController.ViewModel" |
|
9 |
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" |
|
10 |
d:DesignHeight="450" d:DesignWidth="800"> |
|
11 |
<UserControl.DataContext> |
|
12 |
<vm:AliveViewModel/> |
|
13 |
</UserControl.DataContext> |
|
14 |
<i:Interaction.Triggers> |
|
15 |
<i:EventTrigger EventName="Loaded"> |
|
16 |
<i:InvokeCommandAction Command="{Binding LoadedCommand}"/> |
|
17 |
</i:EventTrigger> |
|
18 |
<i:EventTrigger EventName="Unloaded"> |
|
19 |
<i:InvokeCommandAction Command="{Binding ClosingCommand}"/> |
|
20 |
</i:EventTrigger> |
|
21 |
</i:Interaction.Triggers> |
|
22 |
<Grid> |
|
23 |
<Grid.RowDefinitions> |
|
24 |
<RowDefinition Height="*"/> |
|
25 |
<RowDefinition Height="Auto"/> |
|
26 |
</Grid.RowDefinitions> |
|
27 |
<DataGrid ItemsSource="{Binding AliveItems}" AutoGenerateColumns="False" |
|
28 |
x:Name="DataGrid" ScrollViewer.CanContentScroll="False"> |
|
29 |
<DataGrid.Columns> |
|
30 |
<materialDesign:MaterialDataGridTextColumn Header="Convert ID" Binding="{Binding ConvertID}"/> |
|
31 |
<materialDesign:MaterialDataGridTextColumn Header="Project No" Binding="{Binding ProjectNumber}"/> |
|
32 |
<materialDesign:MaterialDataGridTextColumn Header="Status" Binding="{Binding ConvertState}"/> |
|
33 |
<materialDesign:MaterialDataGridTextColumn Header="Current Page" Binding="{Binding CurrentPageNo}"/> |
|
34 |
<materialDesign:MaterialDataGridTextColumn Header="TotalPage" Binding="{Binding TotalPage}"/> |
|
35 |
<materialDesign:MaterialDataGridTextColumn Header="Originfile" Binding="{Binding OriginfilePath}"/> |
|
36 |
<materialDesign:MaterialDataGridTextColumn Header="Output Path" Binding="{Binding ConvertPath}"/> |
|
37 |
</DataGrid.Columns> |
|
38 |
</DataGrid> |
|
39 |
<ProgressBar Grid.Row="1" IsIndeterminate="{Binding IsLoading}" Height="5"/> |
|
40 |
</Grid> |
|
41 |
</UserControl> |
ConvertService/ServiceBase/Markus.Service.StationController/Views/DataBaseByStatusView.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using System.Windows; |
|
7 |
using System.Windows.Controls; |
|
8 |
using System.Windows.Data; |
|
9 |
using System.Windows.Documents; |
|
10 |
using System.Windows.Input; |
|
11 |
using System.Windows.Media; |
|
12 |
using System.Windows.Media.Imaging; |
|
13 |
using System.Windows.Navigation; |
|
14 |
using System.Windows.Shapes; |
|
15 |
|
|
16 |
namespace Markus.Service.StationController.Views |
|
17 |
{ |
|
18 |
/// <summary> |
|
19 |
/// AliveView.xaml에 대한 상호 작용 논리 |
|
20 |
/// </summary> |
|
21 |
public partial class DataBaseByStatusView : UserControl |
|
22 |
{ |
|
23 |
public DataBaseByStatusView() |
|
24 |
{ |
|
25 |
InitializeComponent(); |
|
26 |
} |
|
27 |
} |
|
28 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/Views/MergeDataView.xaml | ||
---|---|---|
1 |
<UserControl xmlns:Views="clr-namespace:Markus.Service.StationController.Views" x:Class="Markus.Service.StationController.ViewModel.MergeDataView" |
|
2 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
3 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
4 |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
5 |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
6 |
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" |
|
7 |
xmlns:local="clr-namespace:Markus.Service.StationController.ViewModel" |
|
8 |
mc:Ignorable="d" |
|
9 |
d:DesignHeight="450" d:DesignWidth="800"> |
|
10 |
<Grid> |
|
11 |
<Grid.RowDefinitions> |
|
12 |
<RowDefinition Height="3.5*"/> |
|
13 |
<RowDefinition Height="3.5*"/> |
|
14 |
<RowDefinition Height="3.5*"/> |
|
15 |
</Grid.RowDefinitions> |
|
16 |
<GroupBox Header="Service Alive Items" Style="{DynamicResource MaterialDesignGroupBox}" Margin="3" BorderThickness="0"> |
|
17 |
<Views:AliveView /> |
|
18 |
</GroupBox> |
|
19 |
<GroupBox Header="Error Items" Grid.Row="1" Style="{DynamicResource MaterialDesignGroupBox}" Margin="3" BorderThickness="0"> |
|
20 |
<Views:DataBaseByStatusView/> |
|
21 |
</GroupBox> |
|
22 |
<GroupBox Header="Completed Items" Grid.Row="2" Style="{DynamicResource MaterialDesignGroupBox}" Margin="3" BorderThickness="0"> |
|
23 |
<Views:DataBaseByStatusView/> |
|
24 |
</GroupBox> |
|
25 |
|
|
26 |
</Grid> |
|
27 |
</UserControl> |
ConvertService/ServiceBase/Markus.Service.StationController/Views/MergeDataView.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using System.Windows; |
|
7 |
using System.Windows.Controls; |
|
8 |
using System.Windows.Data; |
|
9 |
using System.Windows.Documents; |
|
10 |
using System.Windows.Input; |
|
11 |
using System.Windows.Media; |
|
12 |
using System.Windows.Media.Imaging; |
|
13 |
using System.Windows.Navigation; |
|
14 |
using System.Windows.Shapes; |
|
15 |
|
|
16 |
namespace Markus.Service.StationController.ViewModel |
|
17 |
{ |
|
18 |
/// <summary> |
|
19 |
/// MergeDataView.xaml에 대한 상호 작용 논리 |
|
20 |
/// </summary> |
|
21 |
public partial class MergeDataView : UserControl |
|
22 |
{ |
|
23 |
public MergeDataView() |
|
24 |
{ |
|
25 |
InitializeComponent(); |
|
26 |
} |
|
27 |
} |
|
28 |
} |
ConvertService/ServiceBase/Markus.Service.StationController/packages.config | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="utf-8"?> |
2 | 2 |
<packages> |
3 |
<package id="MaterialDesignColors" version="1.1.3" targetFramework="net461" /> |
|
3 |
<package id="Markus.Message" version="1.5.4" targetFramework="net45" /> |
|
4 |
<package id="MaterialDesignColors" version="1.2.0" targetFramework="net45" /> |
|
4 | 5 |
<package id="MaterialDesignExtensions" version="2.6.0" targetFramework="net461" /> |
5 |
<package id="MaterialDesignThemes" version="2.5.1" targetFramework="net461" />
|
|
6 |
<package id="MaterialDesignThemes" version="2.6.0" targetFramework="net45" />
|
|
6 | 7 |
<package id="Microsoft.CSharp" version="4.5.0" targetFramework="net45" /> |
7 | 8 |
<package id="Salaros.ConfigParser" version="0.3.3" targetFramework="net461" /> |
8 | 9 |
<package id="System.Windows.Interactivity.WPF" version="2.0.20525" targetFramework="net461" /> |
내보내기 Unified diff