개정판 f0ad40d3
Process Kill 완료
Change-Id: I63e6eaa9eebd57eb3835eeeca651084b8d66d7f2
ConvertService/ServiceBase/Markus.Service.StationController/ViewModel/FinalPDFViewModel.cs | ||
---|---|---|
1394 | 1394 |
|
1395 | 1395 |
private void Stop_Process(object obj) |
1396 | 1396 |
{ |
1397 |
if (SelectFilterConvertList.Count() > 1) |
|
1397 |
|
|
1398 |
string convertid = ""; |
|
1399 |
|
|
1400 |
#if DEBUG |
|
1401 |
convertid = "TEST"; |
|
1402 |
#endif |
|
1403 |
if (SelectRealConvert != null) |
|
1398 | 1404 |
{ |
1399 |
MessageBox.Show("하나만 클릭해 주세요"); |
|
1405 |
if (AliveItems.Count(x => x.ConvertID == SelectRealConvert.ConvertID) == 0) |
|
1406 |
{ |
|
1407 |
convertid = SelectRealConvert.ConvertID; |
|
1408 |
} |
|
1400 | 1409 |
} |
1401 |
else
|
|
1410 |
if (SelectAliveConvert != null)
|
|
1402 | 1411 |
{ |
1403 |
RadWindow.Alert("프로세스 종료 할까요??", this.ON_Stop_Process); |
|
1404 |
|
|
1412 |
if (RealConvertSource.Count(x => x.ConvertID == SelectAliveConvert.ConvertID) == 0) |
|
1413 |
{ |
|
1414 |
convertid = SelectAliveConvert.ConvertID; |
|
1415 |
} |
|
1405 | 1416 |
} |
1406 | 1417 |
|
1418 |
EventHandler<WindowClosedEventArgs> handler = (snd, evt) => |
|
1419 |
{ |
|
1420 |
var result = evt.DialogResult; |
|
1421 |
|
|
1422 |
if (result == true) |
|
1423 |
{ |
|
1424 |
Stop_Process(convertid); |
|
1425 |
} |
|
1426 |
}; |
|
1427 |
|
|
1428 |
//ID 찾아서 멈춰라 |
|
1429 |
RadWindow.Confirm("프로세스 종료 할까요??", handler); |
|
1407 | 1430 |
} |
1408 | 1431 |
|
1409 |
private void ON_Stop_Process(object sender, WindowClosedEventArgs e)
|
|
1432 |
private void Stop_Process(string convertId)
|
|
1410 | 1433 |
{ |
1411 |
var result = e.DialogResult; |
|
1412 |
if (result == true) |
|
1413 |
{ |
|
1414 |
var process = Process.GetProcessesByName("Markus.Service.ConvertProcess"); |
|
1415 | 1434 |
|
1416 |
for (int i = process.Count() - 1; i >= 0; i--) |
|
1435 |
var process = Process.GetProcessesByName("Markus.Service.ConvertProcess"); |
|
1436 |
|
|
1437 |
for (int i = process.Count() - 1; i >= 0; i--) |
|
1438 |
{ |
|
1439 |
try |
|
1417 | 1440 |
{ |
1418 |
try |
|
1419 |
{ |
|
1420 |
var commandLines = process[i].Arguments().CommandLine; |
|
1441 |
var commandLines = process[i].Arguments().CommandLine; |
|
1421 | 1442 |
|
1422 |
if (commandLines.Count() > 0) |
|
1443 |
if (commandLines.Count() > 0) |
|
1444 |
{ |
|
1445 |
if (commandLines[0] == convertId) |
|
1423 | 1446 |
{ |
1424 |
if (commandLines[0] == "TEST" && commandLines[1] == "1") |
|
1425 |
{ |
|
1426 |
process[i].Kill(); |
|
1427 |
} |
|
1428 |
//if (AliveItems.Count(f => f.ConvertID == commandLines[0]) == 0) |
|
1429 |
//{ |
|
1430 |
// process[i].Kill(); |
|
1431 |
//} |
|
1447 |
process[i].Kill(); |
|
1432 | 1448 |
} |
1433 | 1449 |
} |
1434 |
catch (Exception ex)
|
|
1435 |
{
|
|
1436 |
System.Diagnostics.Debug.WriteLine(ex.ToString());
|
|
1437 |
}
|
|
1450 |
}
|
|
1451 |
catch (Exception ex)
|
|
1452 |
{
|
|
1453 |
System.Diagnostics.Debug.WriteLine(ex.ToString());
|
|
1438 | 1454 |
} |
1439 | 1455 |
} |
1440 | 1456 |
} |
내보내기 Unified diff