193c57e815d90fbaf95360871125e48c1b84dd4e.svn-base 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace IControls_FireManager
  10. {
  11. public partial class Form_Project_Delete : Form
  12. {
  13. public Form_Project_Delete()
  14. {
  15. InitializeComponent();
  16. ///
  17. /// 이벤트
  18. ///
  19. // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용)
  20. this.FormClosing += new FormClosingEventHandler(CreateForm_FormClosing);
  21. // 윈도우 스타일 변경 이벤트 핸들러 등록
  22. _Event.WindowStyleSet_SendMessage_Event += new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event);
  23. ///
  24. /// 스타일 변경
  25. ///
  26. UI_Style_Initialize();
  27. ///
  28. /// UI
  29. ///
  30. UI_ListBox_Initialize();
  31. }
  32. // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용)
  33. public void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
  34. {
  35. // 윈도우 스타일 변경 이벤트 핸들러 해제
  36. _Event.WindowStyleSet_SendMessage_Event -= new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event);
  37. }
  38. // 윈도우 스타일 변경 이벤트
  39. public void _Event_WindowStyleSet_SendMessage_Event()
  40. {
  41. UI_Style_Initialize();
  42. }
  43. // 스타일 초기화 함수
  44. private void UI_Style_Initialize()
  45. {
  46. }
  47. // 리스트 박스 초기화 함수
  48. private void UI_ListBox_Initialize()
  49. {
  50. // 초기화
  51. this.listBox_ProjectNames.Items.Clear();
  52. // 폴더명 리스트 가져오기
  53. string FolderNameString = _File.Get_Folder(_Data.Project_Path+"\\");
  54. if (FolderNameString != null)
  55. {
  56. string[] FolderNames = _Convert.String_to_ArrayString(FolderNameString);
  57. if (FolderNames != null)
  58. {
  59. // 리스트에 추가
  60. foreach (string FolderName in FolderNames)
  61. {
  62. this.listBox_ProjectNames.Items.Add(FolderName);
  63. }
  64. }
  65. }
  66. }
  67. // 삭제 버튼
  68. private void UiButton_Project_Open_Click(object sender, EventArgs e)
  69. {
  70. // 예외처리
  71. if (this.listBox_ProjectNames.SelectedItem == null || this.listBox_ProjectNames.SelectedItem.ToString().Trim().Length == 0)
  72. {
  73. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.NotSelectProjectInform, 0);
  74. return;
  75. }
  76. else if (this.listBox_ProjectNames.SelectedItem.ToString() != _Data.Project_Name)
  77. {
  78. // 프로세스 삭제
  79. System.Diagnostics.Process[] mProcess = System.Diagnostics.Process.GetProcessesByName("fbserver");
  80. foreach (System.Diagnostics.Process p in mProcess)
  81. p.Kill();
  82. System.Threading.Thread.Sleep(1000);
  83. // 폴더 삭제
  84. _File.Delete_Folder(_Data.Project_Path , this.listBox_ProjectNames.SelectedItem.ToString());
  85. // 삭제후 갱신
  86. UI_ListBox_Initialize();
  87. }
  88. // 현재 프로젝트를 삭제하려는 경우
  89. else
  90. {
  91. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 550, 150, _Text.CurrentProjectDel, 0);
  92. }
  93. }
  94. }
  95. }