372a6ff469da947af103fc39fc9a47ff9f37a631.svn-base 166 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759
  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. using Janus.Windows.GridEX;
  10. using System.IO;
  11. using System.Drawing.Imaging;
  12. using Microsoft.VisualBasic.PowerPacks;
  13. using System.Drawing.Drawing2D;
  14. using System.Collections;
  15. using Janus.Windows.GridEX.EditControls;
  16. namespace IControls_FireManager
  17. {
  18. public partial class Form_MapDesigner : Form
  19. {
  20. // CheckedComboBox_DeviceType콤보박스에 체크되어 있는 것만 알기 위해서 사용되는 ArrayList
  21. ArrayList DeviceType = new ArrayList();
  22. // 접근 파일 및 경로
  23. string Default_Field_PageName = null;
  24. string Default_Field_FileName = null;
  25. string Default_Field_FullPath = null;
  26. string Default_Field_FullPath_FileName = null;
  27. string Default_Symbol_FullPath = null;
  28. string Default_Xml_FullPath = null;
  29. // 아이디 순번 (리스트뷰에 속한 디바이스 아이콘 혹은 배경에서 오른쪽 마우스 클릭해서 추가하는 버튼 아이콘)
  30. int ICON_ID_Order = 0;
  31. // 현재 선택된 픽쳐박스
  32. _PictureBoxItem Selected_PictureBoxItem = new _PictureBoxItem();
  33. // 배경화면에서 드래그 혹은 아이템(디바이스 아이콘, 버튼 아이콘) 을 선택하는 경우 생성되는 네모박스 스타일
  34. DashStyle Selected_DashStyle_First = DashStyle.Dash;
  35. DashStyle Selected_DashStyle_Second = DashStyle.DashDot;
  36. Color Selected_Color = Color.Red;
  37. int Selected_BorderWidth_BakcGround = 1; // 배경에서 드래그할때 생기는 네모박스 굵기
  38. int Selected_BorderWidth_Item = 3; // 별도로 아이템 (디바이스 아이콘, 버튼 아이콘) 선택되었을때 생기는 네모박스 굵기는 조금 더 굵게 표시한다
  39. // 배경에서 마우스 드래그시 좌표값
  40. bool BackGround_MouseDrag = false;
  41. int BackGround_MouseDrag_Before_X = 0;
  42. int BackGround_MouseDrag_Before_Y = 0;
  43. int BackGround_MouseDrag_After_X = 0;
  44. int BackGround_MouseDrag_After_Y = 0;
  45. // 배경에서 마우스 드래그하면 사각형이 생성
  46. public ShapeContainer ShapeContainer_MouseDragBackGround = new ShapeContainer();
  47. public LineShape LineShape_MouseDragBackGround_TOP = new LineShape();
  48. public LineShape LineShape_MouseDragBackGround_BOTTOM = new LineShape();
  49. public LineShape LineShape_MouseDragBackGround_LEFT = new LineShape();
  50. public LineShape LineShape_MouseDragBackGround_RIGHT = new LineShape();
  51. // 키이벤트
  52. bool KeyDown_ALTKEY = false; // 현재 ALTKEY 키를 눌렀는지 확인
  53. bool KeyDown_SHIFTKEY = false; // 현재 SHIFTKEY 키를 눌렀는지 확인
  54. // 복사용 : 아이콘 (디바이스 아이콘 혹은 버튼 아이콘)을 복사하기 위해서 사용되는 해쉬테이블
  55. public Hashtable COPY_HASH_ICON = new Hashtable();
  56. public ArrayList COPY_LIST_ICON_ID = new ArrayList();
  57. // 임시용 : 저장직전 맵디자이너중 추가된 아이콘 (디바이스 아이콘 혹은 버튼 아이콘)을 관리하기 위해서 사용되는 해쉬테이블
  58. public Hashtable TEMP_HASH_ICON = new Hashtable();
  59. public ArrayList TEMP_LIST_ICON_ID = new ArrayList();
  60. // 타이머 동작
  61. int MapDesigner_Count = 0;
  62. // 팝업용
  63. Form DialogPopup = new Form();
  64. // 관할수신기 아이디 정보
  65. public string Seleted_RECEIVER_ID = null;
  66. // 페이지 정보
  67. public string Seleted_PageNodeKey = null;
  68. public string Seleted_PageNodeText = null;
  69. // 픽쳐박스 좌표 (수직으로 드래그 할지 수평으로 드래그 할지 이전 좌표값 비교용)
  70. public int PictureBox_Old_MousePoint_X = 0;
  71. public int PictureBox_New_MousePoint_X = 0;
  72. // 픽쳐박스 드래그하는 경우 Shift 키를 누른상태가 유지 (true : Down , false : Up)
  73. public bool PictureBox_Drag_Shift = false;
  74. // 픽쳐박스 드래그하는 경우 모드 (true : 수직으로 , false : 수평으로)
  75. public bool PictureBox_Drag_Vertical = false;
  76. // 디바이스 조회창 색상 (연동되면 파랑)
  77. Color Apply_Color_HASH = Color.SteelBlue;
  78. Color Apply_Color_TEMP = Color.YellowGreen;
  79. Color Apply_Color_NOT = Color.White;
  80. // 연동 여부 대화 팝업창
  81. public Form Popup_DeviceOper = new Form();
  82. //
  83. // 맵디자이너 초기화
  84. //
  85. // 신규 이미지를 추가하는 경우와 맵디자이너가 켜져 있지 않는 상태에서 그림 수정을 선택하는 경우
  86. public Form_MapDesigner(string RECEIVER_ID, string PageNodeKey, string PageNodeText)
  87. {
  88. InitializeComponent();
  89. ///
  90. /// 이벤트
  91. ///
  92. // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용)
  93. this.FormClosing += new FormClosingEventHandler(CreateForm_FormClosing);
  94. // 윈도우 스타일 변경 이벤트 핸들러 등록
  95. _Event.WindowStyleSet_SendMessage_Event += new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event);
  96. // 메인 메뉴에서 그림 수정 이벤트 핸들러 등록
  97. _Event.PictrueEdit_NodeSeleted_SendMessage_Event += new _Event.PictrueEdit_NodeSeleted_SendMessage_Handler(_Event_PictrueEdit_NodeSeleted_SendMessage_Event);
  98. // 맵디자이너 창을 닫는 이벤트 핸들러 등록
  99. _Event.MapDesigner_Close_SendMessage_Event += new _Event.MapDesigner_Close_SendMessage_Handler(_Event_MapDesigner_Close_SendMessage_Event);
  100. ///
  101. /// 스타일 변경
  102. ///
  103. UI_Style_Initialize();
  104. ///
  105. /// 수신기 정보
  106. ///
  107. // 단, 수신기 정보없다면 이는 단순히 클래스 내부의 함수에 접근하기 위한 용도이니 필요없다
  108. if (RECEIVER_ID == null)
  109. return;
  110. else
  111. Seleted_RECEIVER_ID = RECEIVER_ID;
  112. ///
  113. /// 페이지 이름, 파일명, 파일경로
  114. ///
  115. Seleted_PageNodeKey = PageNodeKey;
  116. Seleted_PageNodeText = PageNodeText;
  117. if (PageNodeKey == null)
  118. {
  119. Default_Field_PageName = _Text.DEFAULT_FIELD_PAGENAME;
  120. Default_Field_FileName = _Text.DEFAULT_FIELD_FILENAME;
  121. }
  122. else
  123. {
  124. Default_Field_PageName = PageNodeText;
  125. Default_Field_FileName = ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[RECEIVER_ID]).HASH_PAGE[PageNodeKey]).PictureBoxItem_BackGround.FileName;
  126. // 페이지명이 null 값이 아니라면 트리노드에 설정되어있는 그래픽노드중 1개를 선택했다는 뜻이다
  127. // 즉, 페이지명은 수정이 불가하다
  128. this.editBox_Base_PageName.ReadOnly = true;
  129. this.editBox_Base_PageName.BackColor = System.Drawing.SystemColors.MenuBar;
  130. this.editBox_Base_PageName.Text = PageNodeText;
  131. }
  132. // 수신기 폴더명
  133. string ReiceiverFolderName = _Text.DEFAULT_FOLDER_RECEIVER_PREFIX + Seleted_RECEIVER_ID;
  134. Default_Field_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_FIELD;
  135. Default_Field_FullPath_FileName = Default_Field_FullPath + "\\" + Default_Field_FileName;
  136. Default_Symbol_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_SYMBOL;
  137. Default_Xml_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_XML;
  138. ///
  139. /// XML
  140. ///
  141. ITEM_XML_Initialize();
  142. ///
  143. /// 타이머
  144. ///
  145. _Timer_WindowBase.Delete("Form_MapDesigner");
  146. _Timer_WindowBase.Create("Form_MapDesigner", 1000, timer_MapDesignerConfig_Tick, true);
  147. ///
  148. /// UI 초기화
  149. ///
  150. UI_Base_Initialize(Default_Field_PageName, Default_Field_FileName, Default_Field_FullPath_FileName);
  151. UI_Item_Initialize(Default_Symbol_FullPath);
  152. UI_Device_Initialize();
  153. UI_Tree_Initialize();
  154. UI_Status_Initialize(Item_Type.BackGround, Default_Field_FullPath_FileName);
  155. UI_Work_Initialize(Default_Field_FullPath_FileName);
  156. ///
  157. /// 해쉬 및 리스트 초기화
  158. ///
  159. TEMP_HASH_LIST_Initialize();
  160. COPY_HASH_LIST_Initialize();
  161. ///
  162. /// 페이지 클래스에 저장된 정보를 토대로 화면에 표시
  163. ///
  164. if (PageNodeKey != null)
  165. {
  166. UI_DATA_Initialize(PageNodeKey);
  167. ///
  168. /// 아이템 아이디 셋팅
  169. ///
  170. /// 페이지에 있는 최대의 아이콘
  171. int MaxValue = 0;
  172. foreach (string ICON_ID in ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[RECEIVER_ID]).HASH_PAGE[PageNodeKey]).LIST_ICON_ID)
  173. {
  174. if (MaxValue <= Int32.Parse(ICON_ID))
  175. MaxValue = Int32.Parse(ICON_ID);
  176. }
  177. ICON_ID_Order = MaxValue + 1;
  178. }
  179. // 화면 위치는 항상 모니터 최상단 (Left , Up)
  180. this.Location = new System.Drawing.Point(0, 0);
  181. this.StartPosition = FormStartPosition.Manual;
  182. }
  183. ///
  184. /// 기기타입 XML 파일 접근
  185. ///
  186. // XML 파일에 파일이 속해있는지 검사
  187. private bool Check_DevTypeXml_FileName(string filename)
  188. {
  189. foreach (string DevTypeID in _Data.LIST_XMLDEVTYPE_ID)
  190. {
  191. if (((_DevTypeXML)_Data.HASH_XMLDEVTYPE[DevTypeID]).FILENAME == filename)
  192. return true;
  193. }
  194. return false;
  195. }
  196. ///
  197. /// 파일정보 추출
  198. ///
  199. // XML 데이터 읽어오기
  200. private void ITEM_XML_Initialize()
  201. {
  202. // 초기화
  203. _Data.HASH_XMLDEVTYPE.Clear();
  204. _Data.LIST_XMLDEVTYPE_ID.Clear();
  205. // 현재 설정된 프로젝트명에 의해 폴더를 접근하여 DevType.xml 파일을 로드한다
  206. _File.Read_DevType_XML(Default_Xml_FullPath);
  207. }
  208. // 파일 포맷 가져오기
  209. private string Get_Image_Format(string FIleName)
  210. {
  211. try
  212. {
  213. string[] Temps = FIleName.Split('.');
  214. //예시 : test.txt => txt
  215. return Temps[1];
  216. }
  217. catch
  218. {
  219. return _Text.Null;
  220. }
  221. }
  222. // 파일 이름 가져오기
  223. private string Get_Image_RemoveFormat(string FIleName)
  224. {
  225. try
  226. {
  227. string[] Temps = FIleName.Split('.');
  228. //예시 : test.txt => test
  229. return Temps[0];
  230. }
  231. catch
  232. {
  233. return _Text.Null;
  234. }
  235. }
  236. // 파일 사이즈 가져오기
  237. private string Get_Image_Size(string FilePath)
  238. {
  239. try
  240. {
  241. string result = null;
  242. Image Info = Image.FromFile(FilePath);
  243. //예시 : Size : 1080 * 720"
  244. result = Info.Width + " * " + Info.Height;
  245. return result;
  246. }
  247. catch
  248. {
  249. return "0 * 0";
  250. }
  251. }
  252. // 파일 정보를 지정된 형식대로 가져오기
  253. private string Get_Image_Info(string FilePath)
  254. {
  255. try
  256. {
  257. // 파일정보
  258. string result = null;
  259. long FileLength_Kilobyte = 0;
  260. string FileName = null;
  261. if (_File.Read_FileInfo(FilePath) != null)
  262. {
  263. FileLength_Kilobyte = _File.Read_FileInfo(FilePath).Length;
  264. FileName = _File.Read_FileInfo(FilePath).Name;
  265. }
  266. // 3자리수 이상이라면
  267. if (FileLength_Kilobyte - 1000 >= 0)
  268. {
  269. string FileKilobyte = FileLength_Kilobyte.ToString();
  270. FileKilobyte = FileKilobyte.Remove(FileKilobyte.Length - 3);
  271. result = FileName + " / " + FileKilobyte + "K byte";
  272. }
  273. else
  274. {
  275. string Filebyte = FileLength_Kilobyte.ToString();
  276. result = FileName + " / " + Filebyte + " byte";
  277. }
  278. if (FileLength_Kilobyte == 0 || FileName == null)
  279. result = _Text.Null;
  280. return result;
  281. }
  282. catch
  283. {
  284. return _Text.Null;
  285. }
  286. }
  287. ///
  288. /// 초기화
  289. ///
  290. // 스타일 초기화 함수
  291. private void UI_Style_Initialize()
  292. {
  293. }
  294. // 기본 패널 초기화
  295. private void UI_Base_Initialize(string PageName, string Field_FileName, string Field_FullPath_FileName)
  296. {
  297. // 페이지명
  298. this.editBox_Base_PageName.Text = PageName;
  299. // 배경그림
  300. this.editBox_Base_BackgrondFileName.Text = Field_FileName;
  301. // 파일경로
  302. this.editBox_Base_BackgrondFilePath.Text = Field_FullPath_FileName;
  303. // 파일정보
  304. //this.label_Base_BackgrondFileInfo.Text =
  305. // "Format : " + Get_Image_Format(Field_FullPath_FileName) + " File / " +
  306. // "Size : " + Get_Image_Size(Field_FullPath_FileName);
  307. // 아이콘 잠금
  308. UI_Base_IconLock(false);
  309. }
  310. // 아이템 패널 초기화
  311. private void UI_Item_Initialize(string Symbol_FullPath)
  312. {
  313. // 이미지 경로
  314. string temp_path = Symbol_FullPath;
  315. // 파일명 리스트 가져오기
  316. string GetImageFileNameList = _File.Get_FileNameList(temp_path);
  317. // 파일명을 저장
  318. string[] FileNames = _Convert.String_to_ArrayString(GetImageFileNameList);
  319. // Construct the ImageList.
  320. ImageList ImageList_GetImages = new ImageList();
  321. // Set the ImageSize property to a larger size
  322. // (the default is 16 x 16).
  323. ImageList_GetImages.ImageSize = new Size(24, 24);
  324. if (FileNames != null)
  325. {
  326. // 리스트에 추가
  327. for (int i = 0; i < FileNames.Length; i++)
  328. {
  329. // 필요없는 파일은 올릴 필요가 없다
  330. if (Check_DevTypeXml_FileName(FileNames[i]) == true)
  331. {
  332. ImageList_GetImages.Images.Add(FileNames[i], this.Get_Image_From_File(temp_path + "\\" + FileNames[i]));
  333. }
  334. }
  335. }
  336. // 리스트뷰 초기화
  337. this.listView_Item.Clear();
  338. // 리스트뷰 이미지리스트 치환
  339. this.listView_Item.LargeImageList = ImageList_GetImages;
  340. // 이미지리스트가 존재하는 경우에만 리스트뷰에 추가
  341. if (ImageList_GetImages != null)
  342. {
  343. // 리스트에 추가
  344. for (int i = 0; i < ImageList_GetImages.Images.Count; i++)
  345. {
  346. ListViewItem a = new ListViewItem(ImageList_GetImages.Images.Keys[i], i);
  347. this.listView_Item.Items.Add(a);
  348. }
  349. }
  350. // 리스트뷰 정렬
  351. this.listView_Item.Sort();
  352. }
  353. // 디바이스 정보창 초기화
  354. private void UI_Device_Initialize()
  355. {
  356. //** UiComboBox_Board 콤보박스 셋팅
  357. // 먼저 UiComboBox_Board 콤보박스를 클리어시킴
  358. UiComboBox_Board.Items.Clear();
  359. DataRowCollection DB_TABLE_TB_BOARD = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_BoardTable("1", "", "Y", Seleted_RECEIVER_ID));
  360. if (DB_TABLE_TB_BOARD != null)
  361. {
  362. // 공백도 하나 넣어둠
  363. UiComboBox_Board.Items.Add("");
  364. foreach (DataRow dr in DB_TABLE_TB_BOARD)
  365. {
  366. // UiComboBox_Board 콤보박스에 아이템 ADD
  367. UiComboBox_Board.Items.Add(dr[2]);
  368. }
  369. }
  370. UiComboBox_Board.Items.Sort(); // 정렬
  371. //** CheckedComboBox_DeviceType 콤보박스 셋팅
  372. // 먼저 CheckedComboBox_DeviceType 콤보박스를 클리어시킴
  373. CheckedComboBox_DeviceType.Clear();
  374. // TB_DEVICE_TYPE 테이블에 접근
  375. DataRowCollection DB_TABLE_TB_DEVICE_TYPE = _Db.ExecuteRead_SqlDataAdapter(_Sql.SearchAll_Table_Value("TB_DEVICE_TYPE", null));
  376. if (DB_TABLE_TB_DEVICE_TYPE != null && CheckedComboBox_DeviceType.DropDownList != null)
  377. {
  378. foreach (DataRow dr in DB_TABLE_TB_DEVICE_TYPE)
  379. {
  380. // GridEx에 내용 채우기
  381. GridEXRow row;
  382. row = CheckedComboBox_DeviceType.DropDownList.AddItem();
  383. row.BeginEdit();
  384. row.Cells["Device_Type"].Value = dr[1].ToString();
  385. row.EndEdit();
  386. }
  387. }
  388. //** UiComboBox_Device_InOut 콤보박스 셋팅
  389. UiComboBox_Device_InOut.Items.Clear();
  390. UiComboBox_Device_InOut.Items.Add("");
  391. UiComboBox_Device_InOut.Items.Add("IN");
  392. UiComboBox_Device_InOut.Items.Add("OUT");
  393. UiComboBox_Device_InOut.Items.Sort();// 정렬
  394. // 기본값 지정
  395. UiComboBox_Device_InOut.Text = "IN";
  396. UiComboBox_Board.Text = "1";
  397. UiComboBox_Channel.Text = "";
  398. // 배경색 지정
  399. string[] gridex_device_columnheader = _Gridex.Get_ColumnHeadersName(this.GridEX_Device);
  400. // 연동 적용된 아이템은 배경 색상이 변경된다 (HASH 혹은 TEMP 혹은 NOT)
  401. _Gridex.BackColorFormatCondition_Create(this.GridEX_Device, Apply_Color_HASH, gridex_device_columnheader, "Apply", "HASH");
  402. _Gridex.BackColorFormatCondition_Create(this.GridEX_Device, Apply_Color_TEMP, gridex_device_columnheader, "Apply", "TEMP");
  403. _Gridex.BackColorFormatCondition_Create(this.GridEX_Device, Apply_Color_NOT, gridex_device_columnheader, "Apply", "NOT");
  404. }
  405. // 오브젝트 트리 초기화
  406. private void UI_Tree_Initialize()
  407. {
  408. // 초기화
  409. this.treeView_ObjectTree.Nodes.Clear();
  410. // 버튼 아이콘 노드와 디바이스 아이콘 노드를 추가하고
  411. // 버튼이 삽입되면 트리에 표시하고, 디바이스가 삽입되면 트리에 표시된다
  412. // 버튼이 삭제되면 트리에서 삭제하고, 디바이스가 삭제되면 트리에서 삭제된다
  413. // 버튼의 경우 점프 페이지가 설정되면 트리에 표시된다
  414. // 디바이스의 경우 연동이 설정되면 트리에 표시된다
  415. // 루트 노드 추가 : 페이지 이름
  416. _Tree.NodeAdd_Root(this.treeView_ObjectTree, _Text.UI_TREE_ROOT_KEY, this.editBox_Base_PageName.Text, Object_Type.PAGE);
  417. // 버튼 아이콘 노드 추가 : 버튼 아이콘 메인
  418. _Tree.NodeAdd_Root_Node(this.treeView_ObjectTree, 0, _Text.UI_TREE_BUTTON_ICON, _Text.UI_TREE_BUTTON_ICON, Object_Type.BUTTON_ICON);
  419. // 디바이스 아이콘 노드 추가 : 디바이스 아이콘 메인
  420. _Tree.NodeAdd_Root_Node(this.treeView_ObjectTree, 0, _Text.UI_TREE_DEVICE_ICON, _Text.UI_TREE_DEVICE_ICON, Object_Type.DEVICE_ICON);
  421. // 트리 노드 확장
  422. this.treeView_ObjectTree.ExpandAll();
  423. // 트리 노드 정렬
  424. this.treeView_ObjectTree.Sort();
  425. }
  426. // 작업화면 초기화 (배경화면)
  427. private void UI_Work_Initialize(string FullPath_PlusFileName)
  428. {
  429. // 그림을 전체 모드로 교체 (픽쳐박스의 크기에 따라 이미지 사이즈가 자동조절)
  430. pictureBox_Background.SizeMode = PictureBoxSizeMode.StretchImage;
  431. // 파일경로 + 파일명
  432. pictureBox_Background.BackgroundImage = Get_Image_From_File(FullPath_PlusFileName);
  433. // 갱신
  434. pictureBox_Background.ResumeLayout();
  435. // 선택취소
  436. Selected_PictureBoxItem = null;
  437. }
  438. // 상태창 초기화
  439. private void UI_Status_Initialize(Item_Type itemType, string Item_Full_Path)
  440. {
  441. // 파일정보
  442. this.label_Status_Info.Text = Get_Image_Info(Item_Full_Path);
  443. // 타입
  444. this.label_Status_IconType.Text = itemType.ToString();
  445. // 디바이스
  446. this.label_Status_Device.Text = _Text.None;
  447. // X
  448. this.editBox_Status_Location_X.Text = pictureBox_Background.Location.X.ToString();
  449. // Y
  450. this.editBox_Status_Location_Y.Text = pictureBox_Background.Location.Y.ToString();
  451. // W
  452. this.editBox_Status_Size_W.Text = pictureBox_Background.Width.ToString();
  453. // H
  454. this.editBox_Status_Size_H.Text = pictureBox_Background.Height.ToString();
  455. // JUMP
  456. this.uiComboBox_Status_Jump.Text = _Text.None;
  457. }
  458. ///
  459. /// 리스트 초기화
  460. ///
  461. // 저장직전 해쉬 및 리스트
  462. private void TEMP_HASH_LIST_Initialize()
  463. {
  464. // 디바이스 아이콘 및 버튼 아이콘 전체 삭제
  465. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  466. {
  467. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Dispose();
  468. }
  469. TEMP_LIST_ICON_ID.Clear();
  470. TEMP_HASH_ICON.Clear();
  471. }
  472. // 복사용 해쉬 및 리스트
  473. private void COPY_HASH_LIST_Initialize()
  474. {
  475. // 디바이스 아이콘 및 버튼 아이콘 전체 삭제
  476. foreach (string ICON_ID in COPY_LIST_ICON_ID)
  477. {
  478. ((_PictureBoxItem)COPY_HASH_ICON[ICON_ID]).Dispose();
  479. }
  480. COPY_LIST_ICON_ID.Clear();
  481. COPY_HASH_ICON.Clear();
  482. }
  483. ///
  484. /// 데이터를 토대로 화면에 표시
  485. ///
  486. public void UI_DATA_Initialize(string PageName)
  487. {
  488. // 임시 리스트 및 해쉬 테이블을 만듬 -> 차후 TEMP_LIST_ICON_ID,TEMP_HASH_ICON 생성에서 사용함
  489. ArrayList temp_list_icon_id = new ArrayList();
  490. Hashtable temp_hash_icon = new Hashtable();
  491. // 저장 정보를 토대로 리스트 및 해쉬 생성 - 불러오기
  492. Copy_HASH_LIST(
  493. ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[PageName]).LIST_ICON_ID,
  494. ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[PageName]).HASH_ICON,
  495. temp_list_icon_id,
  496. temp_hash_icon);
  497. // 해쉬테이블에서 매칭한다
  498. foreach (string ICON_ID in temp_list_icon_id)
  499. {
  500. // 아이템 화면 배치
  501. _PictureBoxItem PictureBoxItem = UI_Create_PictureBoxItem(
  502. this.pictureBox_Background,
  503. ((_PictureBoxItem)temp_hash_icon[ICON_ID]).ItemType,
  504. ((_PictureBoxItem)temp_hash_icon[ICON_ID]).FullPath_FileName,
  505. ((_PictureBoxItem)temp_hash_icon[ICON_ID]).FileName,
  506. ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name,
  507. ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Location.X,
  508. ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Location.Y);
  509. if (PictureBoxItem != null)
  510. {
  511. ///
  512. /// 동적 할당 변수 처리
  513. ///
  514. // 디바이스 연동 회로 번호
  515. if (PictureBoxItem.ItemType == Item_Type.Device)
  516. {
  517. PictureBoxItem.Device_Oper_ID = ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_Oper_ID;
  518. PictureBoxItem.Device_DB_Name = ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_DB_Name;
  519. }
  520. // 점프 페이지
  521. if (PictureBoxItem.ItemType == Item_Type.Button)
  522. PictureBoxItem.Button_JumpPageName = ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Button_JumpPageName;
  523. ///
  524. /// 오브젝트 트리에 추가
  525. ///
  526. // 버튼 아이콘의 경우
  527. if (((_PictureBoxItem)temp_hash_icon[ICON_ID]).ItemType == Item_Type.Button)
  528. {
  529. // 트리 추가
  530. _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 0, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).NodeText(), Object_Type.BUTTON_DETAIL);
  531. // 오브젝트 트리 색상 반영 (버튼)
  532. _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Button_JumpPageName);
  533. }
  534. // 디바이스 아이콘의 경우
  535. else if (((_PictureBoxItem)temp_hash_icon[ICON_ID]).ItemType == Item_Type.Device)
  536. {
  537. // 트리 추가
  538. _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 1, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).NodeText(), Object_Type.DEVICE_DETAIL);
  539. // 오브젝트 트리 색상 반영 (디바이스)
  540. _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Name, ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_Oper_ID);
  541. }
  542. // 해쉬 추가
  543. if (_Hash.Add(TEMP_HASH_ICON, PictureBoxItem.Name, PictureBoxItem) == true)
  544. {
  545. TEMP_LIST_ICON_ID.Add(PictureBoxItem.Name);
  546. }
  547. }
  548. }
  549. // 디바이스 조회창 색상 반영
  550. GridexDevice_ChangeColor_By_HASH();
  551. // 트리는 초기화 작업시 무조건 확장
  552. this.treeView_ObjectTree.ExpandAll();
  553. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  554. ObjectTree_RootNodeUpdate();
  555. }
  556. public Image Get_Image_From_File(string FilePath)
  557. {
  558. try
  559. {
  560. return Image.FromFile(FilePath);
  561. }
  562. catch
  563. {
  564. return null;
  565. }
  566. }
  567. ///
  568. /// 픽쳐박스 생성부
  569. ///
  570. public _PictureBoxItem UI_Create_PictureBoxItem(
  571. PictureBox PictureBox_BackGround,
  572. Item_Type type, // 아이콘 타입
  573. string FullPath_FileName, // 파일경로+파일명
  574. string FileName, // 파일명
  575. string UI_Create_PictureBoxItem_ID, // 픽쳐박스 순번 (숫자로 저장되는 고유 아이디이다. 단, xml 저장시에는 버튼은 B 접두사를 붙임)
  576. int Location_X, // 위치 X 좌표
  577. int Location_Y) // 위치 Y 좌표
  578. {
  579. // PictureBox 기본 정보 설정
  580. _PictureBoxItem PictureBoxItem = new _PictureBoxItem();
  581. // 이미지
  582. PictureBoxItem.Image = Get_Image_From_File(FullPath_FileName);
  583. // 이미지가 널값이라면 무시하자
  584. if (PictureBoxItem.Image == null)
  585. return null;
  586. // ID
  587. // 픽쳐박스 순번 (숫자로 저장되는 고유 아이디)
  588. PictureBoxItem.Name = UI_Create_PictureBoxItem_ID;
  589. // 타입
  590. PictureBoxItem.ItemType = type;
  591. // 파일정보
  592. PictureBoxItem.Info = Get_Image_Info(FullPath_FileName);
  593. // 아이콘 아이디
  594. if (type == Item_Type.Device)
  595. {
  596. PictureBoxItem.Device_Icon_ID = ((_DevTypeXML)_File.Read_DevType_By_FileName(FileName)).ID;
  597. PictureBoxItem.Device_Icon_NAME = ((_DevTypeXML)_File.Read_DevType_By_FileName(FileName)).NAME;
  598. }
  599. // 드래그 상태
  600. PictureBoxItem.MouseDrag_Status = false;
  601. // 드래그 X 좌표
  602. PictureBoxItem.MouseDown_X = 0;
  603. // 드래그 Y 좌표
  604. PictureBoxItem.MouseDown_Y = 0;
  605. // 파일 이름
  606. PictureBoxItem.FileName = FileName;
  607. // 파일 경로
  608. PictureBoxItem.FullPath_FileName = FullPath_FileName;
  609. // 이미지를 크기에 맞게 셋팅
  610. PictureBoxItem.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
  611. // 위치
  612. PictureBoxItem.Location = new System.Drawing.Point(Location_X, Location_Y);
  613. // 사이즈
  614. PictureBoxItem.Size = new System.Drawing.Size(PictureBoxItem.Image.Width, PictureBoxItem.Image.Height);
  615. // 배경을 제외한 나머지는 아래의 속성을 받는다
  616. if (type != Item_Type.BackGround)
  617. {
  618. // 배경보다 작아야 한다
  619. if (PictureBoxItem.Image.Width >= PictureBox_BackGround.Size.Width || PictureBoxItem.Image.Height >= PictureBox_BackGround.Size.Height)
  620. return null;
  621. // 일반 픽쳐박스 속성 지정
  622. PictureBoxItem.BackColor = Color.Transparent;
  623. PictureBoxItem.Parent = PictureBox_BackGround;// 부모는 항상 백그라운드
  624. PictureBoxItem.MouseDown += new MouseEventHandler(pictureBox_Create_MouseDown);
  625. PictureBoxItem.MouseUp += new MouseEventHandler(pictureBox_Create_MouseUp);
  626. PictureBoxItem.MouseMove += new MouseEventHandler(pictureBox_Create_MouseMove);
  627. PictureBoxItem.MouseClick += new MouseEventHandler(pictureBox_Create_MouseClick);
  628. // 외부 선
  629. PictureBoxItem.Selected = false; // 생성당시에는 선택된 상태가 아님
  630. PictureBoxItem.ShapeContainer_Seleted = new ShapeContainer();
  631. PictureBoxItem.LineShape_TOP = new LineShape();
  632. PictureBoxItem.LineShape_LEFT = new LineShape();
  633. PictureBoxItem.LineShape_RIGHT = new LineShape();
  634. PictureBoxItem.LineShape_BOTTOM = new LineShape();
  635. // 선 스타일 지정
  636. LineShape_Item_BorderStyle(PictureBoxItem, Selected_DashStyle_First, Selected_Color, Selected_BorderWidth_Item);
  637. // TOP
  638. LineShape_Start(PictureBoxItem.LineShape_TOP, 0, 0);
  639. LineShape_End(PictureBoxItem.LineShape_TOP, PictureBoxItem.Size.Width, 0);
  640. // LEFT
  641. LineShape_Start(PictureBoxItem.LineShape_LEFT, 0, 0);
  642. LineShape_End(PictureBoxItem.LineShape_LEFT, 0, PictureBoxItem.Size.Height);
  643. // RIGHT
  644. LineShape_Start(PictureBoxItem.LineShape_RIGHT, PictureBoxItem.Size.Width - 1, 0);
  645. LineShape_End(PictureBoxItem.LineShape_RIGHT, PictureBoxItem.Size.Width - 1, PictureBoxItem.Size.Height);
  646. // BOTTM
  647. LineShape_Start(PictureBoxItem.LineShape_BOTTOM, 0, PictureBoxItem.Size.Height - 1);
  648. LineShape_End(PictureBoxItem.LineShape_BOTTOM, PictureBoxItem.Size.Width, PictureBoxItem.Size.Height - 1);
  649. // 컨테이너에 상위 4개 선 포함
  650. PictureBoxItem.ShapeContainer_Seleted.Shapes.AddRange(new Microsoft.VisualBasic.PowerPacks.Shape[]
  651. {
  652. PictureBoxItem.LineShape_TOP,PictureBoxItem.LineShape_LEFT,PictureBoxItem.LineShape_RIGHT,PictureBoxItem.LineShape_BOTTOM,
  653. });
  654. // 배경그림에 컨테이너 포함
  655. PictureBoxItem.Controls.Add(PictureBoxItem.ShapeContainer_Seleted);
  656. // 선택하면 표시하도록 한다
  657. PictureBoxItem.ShapeContainer_Seleted.Visible = false;
  658. }
  659. PictureBoxItem.ResumeLayout();
  660. return PictureBoxItem;
  661. }
  662. ///
  663. /// 이벤트
  664. ///
  665. // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용)
  666. public void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
  667. {
  668. // 윈도우 스타일 변경 이벤트 핸들러 해제
  669. _Event.WindowStyleSet_SendMessage_Event -= new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event);
  670. // 메인 메뉴에서 그림 수정 이벤트 핸들러 해제
  671. _Event.PictrueEdit_NodeSeleted_SendMessage_Event -= new _Event.PictrueEdit_NodeSeleted_SendMessage_Handler(_Event_PictrueEdit_NodeSeleted_SendMessage_Event);
  672. // 맵디자이너 창을 닫는 이벤트 핸들러 해제
  673. _Event.MapDesigner_Close_SendMessage_Event -= new _Event.MapDesigner_Close_SendMessage_Handler(_Event_MapDesigner_Close_SendMessage_Event);
  674. // 워크뷰 그래픽 개요 페이지로 전환
  675. _Event.WorkViewPageName_SendMessage_Write(Seleted_RECEIVER_ID, Object_Type.IMAGE, null, null);
  676. }
  677. // 윈도우 스타일 변경 이벤트
  678. public void _Event_WindowStyleSet_SendMessage_Event()
  679. {
  680. UI_Style_Initialize();
  681. }
  682. // 메인에서 맵디자이너가 켜져 있는 상태에서 그래픽 노드의 페이지 노드를 선택하여 오른쪽 마우스 버튼 메뉴중 그림 수정 버튼을 누르는 경우
  683. public void _Event_PictrueEdit_NodeSeleted_SendMessage_Event(_RECEIVER RECEIVER, string PageName)
  684. {
  685. ///
  686. /// 페이지 이름, 파일명, 파일경로
  687. ///
  688. // 수신기
  689. Seleted_RECEIVER_ID = RECEIVER.ID;
  690. if (PageName == null)
  691. {
  692. Default_Field_PageName = _Text.DEFAULT_FIELD_PAGENAME;
  693. Default_Field_FileName = _Text.DEFAULT_FIELD_FILENAME;
  694. }
  695. else
  696. {
  697. Default_Field_PageName = PageName;
  698. Default_Field_FileName = ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[RECEIVER.ID]).HASH_PAGE[PageName]).PictureBoxItem_BackGround.FileName;
  699. // 페이지명이 null 값이 아니라면 트리노드에 설정되어있는 그래픽노드중 1개를 선택했다는 뜻이다
  700. // 즉, 페이지명은 수정이 불가하다
  701. this.editBox_Base_PageName.ReadOnly = true;
  702. this.editBox_Base_PageName.BackColor = System.Drawing.SystemColors.MenuBar;
  703. this.editBox_Base_PageName.Text = PageName;
  704. }
  705. // 수신기 폴더명
  706. string ReiceiverFolderName = _Text.DEFAULT_FOLDER_RECEIVER_PREFIX + RECEIVER.ID;
  707. Default_Field_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_FIELD;
  708. Default_Field_FullPath_FileName = Default_Field_FullPath + "\\" + Default_Field_FileName;
  709. Default_Symbol_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_SYMBOL;
  710. Default_Xml_FullPath = _Data.Project_Path + "\\" + _Data.Project_Name + "\\" + ReiceiverFolderName + "\\" + _Text.DEFAULT_FOLDER_MAPVIEW + "\\" + _Text.DEFAULT_FOLDER_XML;
  711. ///
  712. /// UI 초기화
  713. ///
  714. UI_Base_Initialize(Default_Field_PageName, Default_Field_FileName, Default_Field_FullPath_FileName);
  715. UI_Item_Initialize(Default_Symbol_FullPath);
  716. UI_Device_Initialize();
  717. UI_Tree_Initialize();
  718. UI_Status_Initialize(Item_Type.BackGround, Default_Field_FullPath_FileName);
  719. UI_Work_Initialize(Default_Field_FullPath_FileName);
  720. ///
  721. /// 해쉬 및 리스트 초기화
  722. ///
  723. TEMP_HASH_LIST_Initialize();
  724. COPY_HASH_LIST_Initialize();
  725. ///
  726. /// 페이지 클래스에 저장된 정보를 토대로 화면에 표시
  727. ///
  728. if (PageName != null)
  729. {
  730. UI_DATA_Initialize(PageName);
  731. ///
  732. /// 아이템 아이디 셋팅
  733. ///
  734. /// 페이지에 있는 최대의 아이콘
  735. int MaxValue = 0;
  736. foreach (string ICON_ID in ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[RECEIVER.ID]).HASH_PAGE[PageName]).LIST_ICON_ID)
  737. {
  738. if (MaxValue <= Int32.Parse(ICON_ID))
  739. MaxValue = Int32.Parse(ICON_ID);
  740. }
  741. ICON_ID_Order = MaxValue + 1;
  742. }
  743. // 최대화 혹은 최소화 된 창을 일반으로 돌리고 포커스를 줌
  744. this.WindowState = FormWindowState.Normal;
  745. this.Focus();
  746. }
  747. // 맵디자이너 창을 닫는 이벤트 전용 델리게이트
  748. delegate void Close_SetCallback();
  749. // 맵디자이너 창을 닫는 이벤트
  750. public void _Event_MapDesigner_Close_SendMessage_Event()
  751. {
  752. if (this.InvokeRequired)
  753. {
  754. Close_SetCallback d = new Close_SetCallback(_Event_MapDesigner_Close_SendMessage_Event);
  755. this.Invoke(d, new object[] { });
  756. }
  757. else
  758. {
  759. this.Close();
  760. }
  761. }
  762. ///
  763. /// 기본
  764. ///
  765. // 기본 - 배경화면 열기 버튼
  766. private void uiButton_Base_BackgrondFileName_Click(object sender, EventArgs e)
  767. {
  768. OpenFileDialog openFileDialog = new OpenFileDialog();
  769. // 배경 삽입시에 다이얼로그창은 프로젝트 경로에 따라서 Field 폴더에 곧바로 접근할 수있도록 함
  770. openFileDialog.InitialDirectory = Default_Field_FullPath;
  771. if (openFileDialog.ShowDialog() == DialogResult.OK)
  772. {
  773. // 기본 패널 초기화
  774. UI_Base_Initialize(this.editBox_Base_PageName.Text, openFileDialog.SafeFileName, openFileDialog.FileName);
  775. // 작업화면 초기화
  776. UI_Work_Initialize(openFileDialog.FileName);
  777. // 상태창 초기화
  778. UI_Status_Initialize(Item_Type.BackGround, openFileDialog.FileName);
  779. }
  780. }
  781. // 기본 - 페이지명 체크
  782. private bool Check_PageName(string PageNameText)
  783. {
  784. // 페이지이름
  785. string PageName = PageNameText.Trim();
  786. // 널값 허용안함
  787. if (PageName.Length == 0 || PageName == null)
  788. {
  789. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.NullPageNameInform, 0);
  790. return false;
  791. }
  792. // 동일한 페이지 이름은 허용안함
  793. if (((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE.Contains(PageName) == true)
  794. {
  795. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.ContainPageNameInform, 0);
  796. return false;
  797. }
  798. return true;
  799. }
  800. // 페이지명 트리에 반영
  801. private void uiButton_PageName_Edit_Click(object sender, EventArgs e)
  802. {
  803. // 페이지명 체크
  804. if (Check_PageName(this.editBox_Base_PageName.Text) == false)
  805. return;
  806. // 트리에 반영
  807. TreeNode PageName = _Tree.GetNode_By_Name(this.treeView_ObjectTree, _Text.UI_TREE_ROOT_KEY);
  808. PageName.Text = this.editBox_Base_PageName.Text;
  809. }
  810. // 기본 - 저장 버튼
  811. private void uiButton_Base_Save_Click(object sender, EventArgs e)
  812. {
  813. // 그래픽 노드를 선택해서 맵디자이너를 여는 경우
  814. if (this.editBox_Base_PageName.ReadOnly == true)
  815. {
  816. // 대화 팝업
  817. DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 350, 150,
  818. _Text.LeftBracket + this.editBox_Base_PageName.Text + _Text.RightBracket + _Text.Blank + _Text.PageEditDataInform, 0);
  819. // 대화 팝업은 특별처리
  820. _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_Edit);
  821. }
  822. // 새로운 페이지를 저장하는 경우
  823. else
  824. {
  825. // 오브젝트 트리의 페이지명과 저장시에 페이지 명이 틀린 경우
  826. if (this.editBox_Base_PageName.Text != this.treeView_ObjectTree.Nodes[0].Text)
  827. {
  828. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.PageNameNotSameObjectTree, 0);
  829. return;
  830. }
  831. // 신규로 저장하는 경우 페이지명이 기존에 있는 페이지와 일치하면 수정이다
  832. // 덮어쓰기
  833. if (_Data.Check_Receiver_In_PageName(Seleted_RECEIVER_ID, this.editBox_Base_PageName.Text) == true)
  834. {
  835. // 대화 팝업
  836. DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 350, 150,
  837. _Text.LeftBracket + this.editBox_Base_PageName.Text + _Text.RightBracket + _Text.Blank + _Text.PageEditDataInform, 0);
  838. // 대화 팝업은 특별처리
  839. _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_Edit);
  840. }
  841. // 신규
  842. else
  843. {
  844. // 대화 팝업
  845. DialogPopup = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 350, 150,
  846. _Text.LeftBracket + this.editBox_Base_PageName.Text + _Text.RightBracket + _Text.Blank + _Text.PageSaveDataInform, 0);
  847. // 대화 팝업은 특별처리
  848. _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_New);
  849. }
  850. }
  851. }
  852. // 기본 - 저장 버튼 -> 신규
  853. private void _Event_PopupClose_SendMessage_Event_New(object sender, object etc)
  854. {
  855. // 대화 팝업 주체
  856. Form DialogPopup = (Form)sender;
  857. // 팝업창에서 확인 버튼을 누르면
  858. if (DialogPopup.Name == DialogPopup.Name && etc.ToString() == _Text.OK)
  859. {
  860. // 무조건 편집 혹은 새로만들기의 경우 차후 저장을 위해 셋팅
  861. if (_Data.LIST_XmlDBNotSave_Receiver.Contains(Seleted_RECEIVER_ID) == false)
  862. _Data.LIST_XmlDBNotSave_Receiver.Add(Seleted_RECEIVER_ID);
  863. // 페이지명 및 배경그림 안에 있는 픽쳐박스를 전부 해쉬에 저장 해야한다
  864. // 차후 프로젝트 저장시에 XML 파일이 생성될 수 있도록 한다
  865. _Page Page = new _Page();
  866. // 페이지명 (중복되지 않는 고유의 아이디로 사용함)
  867. string Item_ID = Page.NodeKey = _Data.CREATE_PAGE_ID(Seleted_RECEIVER_ID, this.editBox_Base_PageName.Text); //Seleted_RECEIVER_ID + _Text.Minus + this.editBox_Base_PageName.Text;
  868. Page.NodeText = this.editBox_Base_PageName.Text;
  869. // 관할 수신기 아이디
  870. Page.Receiver_ID = Seleted_RECEIVER_ID;
  871. // 배경그림
  872. Page.PictureBoxItem_BackGround = UI_Create_PictureBoxItem(
  873. this.pictureBox_Background,
  874. Item_Type.BackGround,
  875. this.editBox_Base_BackgrondFilePath.Text,
  876. this.editBox_Base_BackgrondFileName.Text,
  877. Item_ID,
  878. 0, 0);
  879. if (Page.PictureBoxItem_BackGround != null)
  880. {
  881. // 해쉬 추가
  882. if (_Hash.Add(((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE, Item_ID, Page) == true)
  883. {
  884. ((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).LIST_PAGE_ID.Add(Item_ID);
  885. }
  886. // 추가된 아이콘 (디바이스 아이콘 혹은 버튼 아이콘) 모두 저장 - 신규저장
  887. Copy_HASH_LIST(
  888. TEMP_LIST_ICON_ID,
  889. TEMP_HASH_ICON,
  890. Page.LIST_ICON_ID,
  891. Page.HASH_ICON);
  892. // 확인 메세지
  893. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.PageSaveData_TreeNodeInform, 0);
  894. // 메인 창의 페이지 노드를 트리에 추가한다
  895. _Event.TreeView_PageNodeSet_SendMessage_Write(Seleted_RECEIVER_ID, Page);
  896. // UI 정리
  897. uiButton_Device_Clear_Click(null, null);
  898. }
  899. }
  900. // 대화 팝업은 특별처리
  901. _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_New);
  902. }
  903. // 저장용도로 사용되는 리스트와 해쉬테이블에 작업완료한 리스트와 해쉬테이블을 복사한다
  904. public void Copy_HASH_LIST(ArrayList Temp_List, Hashtable Temp_Hash, ArrayList Save_List, Hashtable Save_Hash)
  905. {
  906. foreach (string ICON_ID in Temp_List)
  907. {
  908. // 리스트 추가
  909. Save_List.Add(ICON_ID);
  910. // 아이템 정보 읽기
  911. _PictureBoxItem PictureBoxItem = new _PictureBoxItem();
  912. // 타입
  913. PictureBoxItem.ItemType = ((_PictureBoxItem)Temp_Hash[ICON_ID]).ItemType;
  914. // 파일정보
  915. PictureBoxItem.Info = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Info;
  916. // 디바이스 아이콘 아이디 (DevType.XML)
  917. PictureBoxItem.Device_Icon_ID = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Device_Icon_ID;
  918. // 디바이스 아이콘 이름 (DevType.XML)
  919. PictureBoxItem.Device_Icon_NAME = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Device_Icon_NAME;
  920. // 드래그 상태
  921. PictureBoxItem.MouseDrag_Status = ((_PictureBoxItem)Temp_Hash[ICON_ID]).MouseDrag_Status;
  922. // 드래그 X 좌표
  923. PictureBoxItem.MouseDown_X = ((_PictureBoxItem)Temp_Hash[ICON_ID]).MouseDown_X;
  924. // 드래그 Y 좌료
  925. PictureBoxItem.MouseDown_Y = ((_PictureBoxItem)Temp_Hash[ICON_ID]).MouseDown_Y;
  926. // 파일 이름
  927. PictureBoxItem.FileName = ((_PictureBoxItem)Temp_Hash[ICON_ID]).FileName;
  928. // 파일 경로
  929. PictureBoxItem.FullPath_FileName = ((_PictureBoxItem)Temp_Hash[ICON_ID]).FullPath_FileName;
  930. // 현재 선택여부
  931. PictureBoxItem.Selected = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Selected;
  932. // 선택하는 경우 외부 테두리
  933. PictureBoxItem.ShapeContainer_Seleted = ((_PictureBoxItem)Temp_Hash[ICON_ID]).ShapeContainer_Seleted;
  934. PictureBoxItem.LineShape_TOP = ((_PictureBoxItem)Temp_Hash[ICON_ID]).LineShape_TOP;
  935. PictureBoxItem.LineShape_BOTTOM = ((_PictureBoxItem)Temp_Hash[ICON_ID]).LineShape_BOTTOM;
  936. PictureBoxItem.LineShape_LEFT = ((_PictureBoxItem)Temp_Hash[ICON_ID]).LineShape_LEFT;
  937. PictureBoxItem.LineShape_RIGHT = ((_PictureBoxItem)Temp_Hash[ICON_ID]).LineShape_RIGHT;
  938. // 이미지
  939. PictureBoxItem.Image = Image.FromFile(PictureBoxItem.FullPath_FileName);
  940. // 이미지를 크기에 맞게 셋팅
  941. PictureBoxItem.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
  942. // 위치
  943. PictureBoxItem.Location = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Location;
  944. // 사이즈
  945. if (PictureBoxItem.Image == null) PictureBoxItem.Size = new System.Drawing.Size(0, 0);
  946. else PictureBoxItem.Size = new System.Drawing.Size(PictureBoxItem.Image.Width, PictureBoxItem.Image.Height);
  947. // 이름
  948. PictureBoxItem.Name = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Name;
  949. // 디바이스 아이콘
  950. if (PictureBoxItem.ItemType == Item_Type.Device)
  951. {
  952. // 데이타베이스 디바이스 명칭
  953. PictureBoxItem.Device_DB_Name = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Device_DB_Name;
  954. // 연동 회로 번호
  955. PictureBoxItem.Device_Oper_ID = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Device_Oper_ID;
  956. }
  957. // 버튼 아이콘
  958. else if (PictureBoxItem.ItemType == Item_Type.Button)
  959. {
  960. // 점프 페이지 (문자열로 저장되는 페이지 이름이다. 단, xml 저장시에는 페이지 아이디로 저장됨)
  961. PictureBoxItem.Button_JumpPageName = ((_PictureBoxItem)Temp_Hash[ICON_ID]).Button_JumpPageName;
  962. }
  963. // 해쉬테이블 추가
  964. Save_Hash.Add(ICON_ID, PictureBoxItem);
  965. }
  966. }
  967. // 기존의 내용을 편집해서 저장하는 경우
  968. private void _Event_PopupClose_SendMessage_Event_Edit(object sender, object etc)
  969. {
  970. // 대화 팝업 주체
  971. Form DialogPopup = (Form)sender;
  972. // 팝업창에서 확인 버튼을 누르면
  973. if (DialogPopup.Name == DialogPopup.Name && etc.ToString() == _Text.OK)
  974. {
  975. // 무조건 편집 혹은 새로만들기의 경우 차후 저장을 위해 셋팅
  976. if (_Data.LIST_XmlDBNotSave_Receiver.Contains(Seleted_RECEIVER_ID) == false)
  977. _Data.LIST_XmlDBNotSave_Receiver.Add(Seleted_RECEIVER_ID);
  978. // 페이지명 및 배경그림 안에 있는 픽쳐박스를 전부 해쉬에 저장 해야한다
  979. // 차후 프로젝트 저장시에 XML 파일이 생성될 수 있도록 한다
  980. //_Page Page = new _Page();
  981. // 페이지명 (중복되지 않는 고유의 아이디로 사용함)
  982. Seleted_PageNodeKey = _Data.CREATE_PAGE_ID(Seleted_RECEIVER_ID, this.editBox_Base_PageName.Text); // 페이지를 새로 생성한후에 페이키값이 없다
  983. Seleted_PageNodeText = this.editBox_Base_PageName.Text;
  984. string Item_ID = Seleted_PageNodeKey;
  985. // 배경그림을 다시 저장
  986. ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).PictureBoxItem_BackGround = UI_Create_PictureBoxItem(
  987. this.pictureBox_Background,
  988. Item_Type.BackGround,
  989. this.editBox_Base_BackgrondFilePath.Text,
  990. this.editBox_Base_BackgrondFileName.Text,
  991. Item_ID,
  992. 0, 0);
  993. if (((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).PictureBoxItem_BackGround != null)
  994. {
  995. // 해쉬 추가
  996. //if (_Hash.Add(_Data.HASH_PAGE, Item_ID, Page) == true)
  997. //{
  998. // _Data.LIST_PAGE_ID.Add(Item_ID);
  999. //}
  1000. // 특별히 수정하려는 페이지에서 저장하는 경우에는 기존의 리스트 및 해쉬를 초기화하고 복사를 진행하자
  1001. ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).LIST_ICON_ID.Clear();
  1002. ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).HASH_ICON.Clear();
  1003. // 추가된 아이콘 (디바이스 아이콘 혹은 버튼 아이콘) 모두 저장 - 기존 내용 편집
  1004. Copy_HASH_LIST(
  1005. TEMP_LIST_ICON_ID,
  1006. TEMP_HASH_ICON,
  1007. ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).LIST_ICON_ID,
  1008. ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[Item_ID]).HASH_ICON);
  1009. // 확인 메세지
  1010. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 300, 150, _Text.PageEditData_TreeNodeInform, 0);
  1011. // 메인 창의 페이지 노드를 트리에 추가한다
  1012. //_Event.TreeView_PageNodeSet_SendMessage_Write(Seleted_RECEIVER, Page);
  1013. // UI 정리
  1014. uiButton_Device_Clear_Click(null, null);
  1015. }
  1016. }
  1017. // 대화 팝업은 특별처리
  1018. _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_PopupClose_SendMessage_Event_Edit);
  1019. }
  1020. ///
  1021. /// 리스트뷰
  1022. ///
  1023. // 리스트뷰의 아이템(디바이스 아이콘) 더블클릭하면 아이템이 작업화면에 보여진다
  1024. private void listView_Item_MouseDoubleClick(object sender, MouseEventArgs e)
  1025. {
  1026. // Work 패널 포커스 이동
  1027. this.uiPanel_Work.Focus();
  1028. // 아이템이 새롭게 추가되면 선택되엇던 아이템이 모두 선택 해제된다
  1029. pictureBox_SeletedStatusInitialize();
  1030. // 선택
  1031. Selected_PictureBoxItem = null;
  1032. ListView ListViewItem = (ListView)sender;
  1033. // 아이템 아이디
  1034. string Item_ID = ICON_ID_Order++.ToString();
  1035. // 파일경로, 아이디, 위치, 사이즈 지정
  1036. _PictureBoxItem PictureBoxItem = UI_Create_PictureBoxItem(
  1037. this.pictureBox_Background,
  1038. Item_Type.Device,
  1039. Default_Symbol_FullPath + "\\" + ListViewItem.FocusedItem.Text,
  1040. ListViewItem.FocusedItem.Text,
  1041. Item_ID,
  1042. 0, 0);
  1043. // 사이즈 제한
  1044. if (PictureBoxItem == null)
  1045. {
  1046. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 450, 150, _Text.SizeLimitOrEtcError, 0);
  1047. return;
  1048. }
  1049. // 해쉬 추가
  1050. if (_Hash.Add(TEMP_HASH_ICON, Item_ID, PictureBoxItem) == true)
  1051. {
  1052. TEMP_LIST_ICON_ID.Add(Item_ID);
  1053. }
  1054. // 상태바 갱신
  1055. UI_Status_Write(PictureBoxItem);
  1056. // 오브젝트 트리에 추가 - 디바이스
  1057. _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 1, Item_ID, PictureBoxItem.NodeText(), Object_Type.DEVICE_DETAIL);
  1058. this.treeView_ObjectTree.ExpandAll();
  1059. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  1060. ObjectTree_RootNodeUpdate();
  1061. }
  1062. // 리스트뷰의 아이템 클릭하면 상태바가 갱신된다
  1063. private void listView_Item_MouseClick(object sender, MouseEventArgs e)
  1064. {
  1065. // 아이템이 새롭게 추가되면 선택되엇던 아이템이 모두 선택 해제된다
  1066. pictureBox_SeletedStatusInitialize();
  1067. // 선택
  1068. Selected_PictureBoxItem = null;
  1069. ListView item = (ListView)sender;
  1070. _PictureBoxItem PictureBoxItem = new _PictureBoxItem();
  1071. // 타입
  1072. PictureBoxItem.ItemType = Item_Type.Device;
  1073. // 파일정보
  1074. PictureBoxItem.Info = Get_Image_Info(Default_Symbol_FullPath + "\\" + item.FocusedItem.Text);
  1075. // 드래그 상태
  1076. PictureBoxItem.MouseDrag_Status = false;
  1077. // 드래그 X 좌표
  1078. PictureBoxItem.MouseDown_X = 0;
  1079. // 드래그 Y 좌표
  1080. PictureBoxItem.MouseDown_Y = 0;
  1081. // 점프페이지
  1082. PictureBoxItem.Button_JumpPageName = null;
  1083. // 픽쳐박스에서 상속
  1084. PictureBoxItem.Location = new System.Drawing.Point(0, 0);
  1085. PictureBoxItem.Size = new System.Drawing.Size(24, 24);
  1086. // 상태바 갱신
  1087. UI_Status_Write(PictureBoxItem);
  1088. }
  1089. ///
  1090. /// 상태창 변경
  1091. ///
  1092. // 파일정보를 표시하는 경우
  1093. private void UI_Status_Write(_PictureBoxItem PictureBoxItem)
  1094. {
  1095. // 파일정보
  1096. this.label_Status_Info.Text = PictureBoxItem.Info;
  1097. // 아이콘 타입
  1098. this.label_Status_IconType.Text = Convert.ToString(PictureBoxItem.ItemType);
  1099. // 디바이스 연동 회로 아이디
  1100. this.label_Status_Device.Text = PictureBoxItem.Device_Oper_ID;
  1101. // X
  1102. this.editBox_Status_Location_X.Text = PictureBoxItem.Location.X.ToString();
  1103. // Y
  1104. this.editBox_Status_Location_Y.Text = PictureBoxItem.Location.Y.ToString();
  1105. // W
  1106. this.editBox_Status_Size_W.Text = PictureBoxItem.Width.ToString();
  1107. // H
  1108. this.editBox_Status_Size_H.Text = PictureBoxItem.Height.ToString();
  1109. // JUMP
  1110. this.uiComboBox_Status_Jump.Text = PictureBoxItem.Button_JumpPageName;
  1111. }
  1112. // 파일정보를 표시하는 경우 (좌표만 갱신하는 경우, 부하를 막기 위해 마우스 move 이벤트에서만 동작하도록 한다)
  1113. private void UI_Status_Write(int x, int y)
  1114. {
  1115. // X
  1116. this.editBox_Status_Location_X.Text = x.ToString();
  1117. // Y
  1118. this.editBox_Status_Location_Y.Text = y.ToString();
  1119. }
  1120. // 파일정보를 표시하지 않아도 되는 경우
  1121. private void UI_Status_Clear()
  1122. {
  1123. // 파일정보
  1124. this.label_Status_Info.Text = _Text.None;
  1125. // 타입
  1126. this.label_Status_IconType.Text = _Text.None;
  1127. // 디바이스
  1128. this.label_Status_Device.Text = _Text.None;
  1129. // X
  1130. this.editBox_Status_Location_X.Text = _Text.Zero;
  1131. // Y
  1132. this.editBox_Status_Location_Y.Text = _Text.Zero;
  1133. // W
  1134. this.editBox_Status_Size_W.Text = _Text.Zero;
  1135. // H
  1136. this.editBox_Status_Size_H.Text = _Text.Zero;
  1137. // JUMP
  1138. this.uiComboBox_Status_Jump.Text = _Text.None;
  1139. }
  1140. ///
  1141. /// 아이템 (디바이스 아이콘 혹은 버튼 아이콘 ) 마우스 이벤트 처리부
  1142. ///
  1143. // 모든 픽쳐박스 선택 해제
  1144. private void pictureBox_SeletedStatusInitialize()
  1145. {
  1146. // 버튼 선택 해제
  1147. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1148. {
  1149. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected = false;
  1150. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ShapeContainer_Seleted.Visible = false;
  1151. }
  1152. this.pictureBox_Background.ResumeLayout();
  1153. }
  1154. // 픽쳐박스 마우스 다운
  1155. private void pictureBox_Create_MouseDown(object sender, MouseEventArgs e)
  1156. {
  1157. // Work 패널 포커스 이동
  1158. this.uiPanel_Work.Focus();
  1159. // 선택한 픽쳐박스
  1160. _PictureBoxItem PictureBoxItem = (_PictureBoxItem)sender;
  1161. // 범위를 벗어나면 안됨
  1162. Check_Icon_Location(PictureBoxItem);
  1163. // 선택
  1164. Selected_PictureBoxItem = null;
  1165. // 상태갱신
  1166. UI_Status_Write(PictureBoxItem);
  1167. // 오브젝트 트리에 현재 선택된 아이콘 정보를 입력
  1168. treeView_ObjectTree.SelectedNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, PictureBoxItem.Name);
  1169. // 오브젝트 트리에 포커스 입력
  1170. treeView_ObjectTree.Focus();
  1171. // 선택
  1172. Selected_PictureBoxItem = PictureBoxItem;
  1173. // 오른쪽 마우스 버튼
  1174. if (e.Button == System.Windows.Forms.MouseButtons.Right)
  1175. {
  1176. int Selected_Icon_Count = 0;
  1177. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1178. {
  1179. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  1180. Selected_Icon_Count++;
  1181. }
  1182. if (Selected_Icon_Count > 1) // 1개이상 선택하는 경우
  1183. {
  1184. // 팝업 메세지 출력
  1185. _Contextmenustrip.Create(PictureBoxItem, e.Location,
  1186. _Text.IconLeftSort + ";" +
  1187. _Text.IconRightSort + ";" +
  1188. _Text.IconTopSort + ";" +
  1189. _Text.IconBottomSort + ";" +
  1190. _Text.ContextStripSeparator + ";" +
  1191. _Text.IconSelDel,
  1192. PictureBoxItem_Menustrip_ItemClicked);
  1193. }
  1194. else if (Selected_Icon_Count == 1)
  1195. {
  1196. // 팝업 메세지 출력
  1197. _Contextmenustrip.Create(PictureBoxItem, e.Location,
  1198. _Text.IconSelDel,
  1199. PictureBoxItem_Menustrip_ItemClicked);
  1200. }
  1201. }
  1202. // 왼쪽 마우스 버튼
  1203. else
  1204. {
  1205. // 쉬프트키를 누르지 않았다면
  1206. if (KeyDown_SHIFTKEY == false)
  1207. {
  1208. // 디바이스 아이콘 혹은 버튼 아이콘 선택 초기화
  1209. pictureBox_SeletedStatusInitialize();
  1210. }
  1211. // 드래그 시작하면
  1212. PictureBox_Drag_Shift = false;
  1213. // 선택시 스타일 변경 (주변에 네모박스 보이도록 출력)
  1214. Selected_PictureBoxItem.Selected = true;
  1215. Selected_PictureBoxItem.ShapeContainer_Seleted.Visible = true;
  1216. // 버튼이라면 점프페이지 선택가능함
  1217. if (Selected_PictureBoxItem.ItemType == Item_Type.Button)
  1218. {
  1219. this.uiComboBox_Status_Jump.ReadOnly = false;
  1220. this.uiComboBox_Status_Jump.BackColor = System.Drawing.Color.White;
  1221. if (Selected_PictureBoxItem.Button_JumpPageName != null && Selected_PictureBoxItem.Button_JumpPageName.Length != 0)
  1222. this.uiComboBox_Status_Jump.Text = Selected_PictureBoxItem.Button_JumpPageName;
  1223. else
  1224. this.uiComboBox_Status_Jump.Text = _Text.None;
  1225. }
  1226. else
  1227. {
  1228. this.uiComboBox_Status_Jump.ReadOnly = true;
  1229. this.uiComboBox_Status_Jump.BackColor = System.Drawing.SystemColors.MenuBar;
  1230. this.uiComboBox_Status_Jump.Text = _Text.None;
  1231. }
  1232. // 단 멀티선택의 경우 동시에 옮겨야 한다
  1233. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1234. {
  1235. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  1236. {
  1237. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status = true;
  1238. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDown_X = e.X;
  1239. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDown_Y = e.Y;
  1240. }
  1241. }
  1242. // 키보드를 누른상태에서 마우스를 누르면 잔상이 남고 그건 나중에 원본이랑 대체가 된다
  1243. if (KeyDown_ALTKEY == true)
  1244. {
  1245. // 아이콘 잠금 기능 활성화 체크
  1246. if (this.uiCheckBox_IconLock.Checked == true)
  1247. {
  1248. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0);
  1249. return;
  1250. }
  1251. // 복사 해쉬 및 리스트 초기화
  1252. COPY_HASH_ICON.Clear();
  1253. COPY_LIST_ICON_ID.Clear();
  1254. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1255. {
  1256. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  1257. {
  1258. // 아이템 아이디
  1259. string Item_ID = ICON_ID_Order++.ToString();
  1260. // 파일경로, 아이디, 위치, 사이즈 지정
  1261. _PictureBoxItem Copy_PictureBoxItem = UI_Create_PictureBoxItem(
  1262. this.pictureBox_Background,
  1263. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType,
  1264. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).FullPath_FileName,
  1265. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).FileName,
  1266. Item_ID,
  1267. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X,
  1268. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y);
  1269. ///
  1270. /// 동적 할당 변수 처리
  1271. ///
  1272. // 디바이스 연동 회로 번호
  1273. Copy_PictureBoxItem.Device_Oper_ID = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID;
  1274. // 점프 페이지
  1275. PictureBoxItem.Button_JumpPageName = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName;
  1276. if (Copy_PictureBoxItem != null)
  1277. {
  1278. // 복사 리스트에 일단 넣고
  1279. if (_Hash.Add(COPY_HASH_ICON, Item_ID, Copy_PictureBoxItem) == true)
  1280. {
  1281. COPY_LIST_ICON_ID.Add(Item_ID);
  1282. }
  1283. }
  1284. }
  1285. }
  1286. }
  1287. }
  1288. }
  1289. // 픽쳐박스 마우스 업
  1290. private void pictureBox_Create_MouseUp(object sender, MouseEventArgs e)
  1291. {
  1292. // 선택한 픽쳐박스
  1293. _PictureBoxItem PictureBoxItem = (_PictureBoxItem)sender;
  1294. // 범위를 벗어나면 안됨
  1295. Check_Icon_Location(PictureBoxItem);
  1296. // 마우스 드래그 상태 해제
  1297. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1298. {
  1299. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  1300. {
  1301. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status = false;
  1302. }
  1303. }
  1304. // 드래그 종료하면
  1305. PictureBox_Drag_Shift = false;
  1306. // Alt 키를 누르는 경우 복사를 완료한다
  1307. if (KeyDown_ALTKEY == true)
  1308. {
  1309. // 복사한 리스트를 토대로 해쉬테이블에 추가
  1310. foreach (string COPY_ICON_ID in COPY_LIST_ICON_ID)
  1311. {
  1312. TEMP_LIST_ICON_ID.Add(COPY_ICON_ID);
  1313. TEMP_HASH_ICON.Add(COPY_ICON_ID, COPY_HASH_ICON[COPY_ICON_ID]);
  1314. // 오브젝트 트리에 추가
  1315. if (((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).ItemType == Item_Type.Button)
  1316. {
  1317. // 버튼 타입
  1318. _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 1, ((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).Name, ((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).NodeText(), Object_Type.BUTTON_DETAIL);
  1319. }
  1320. else
  1321. {
  1322. // 디바이스 타입
  1323. _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 1, ((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).Name, ((_PictureBoxItem)COPY_HASH_ICON[COPY_ICON_ID]).NodeText(), Object_Type.DEVICE_DETAIL);
  1324. }
  1325. }
  1326. // 완료한후 해쉬 및 리스트 초기화
  1327. COPY_LIST_ICON_ID.Clear();
  1328. COPY_HASH_ICON.Clear();
  1329. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  1330. ObjectTree_RootNodeUpdate();
  1331. }
  1332. // 이동
  1333. else
  1334. {
  1335. // 복사하려는 아이템이 있을경우에만 (즉 복사시도를 했을경우에만)
  1336. if (COPY_LIST_ICON_ID.Count != 0)
  1337. {
  1338. // 원본위치에서 복사했던 리스트 삭제
  1339. COPY_HASH_LIST_Initialize();
  1340. }
  1341. }
  1342. }
  1343. // 픽쳐박스 마우스 이동
  1344. private void pictureBox_Create_MouseMove(object sender, MouseEventArgs e)
  1345. {
  1346. // 아이콘 잠금 기능 활성화 체크 (팝업창은 날리지 않는다)
  1347. if (this.uiCheckBox_IconLock.Checked == true)
  1348. return;
  1349. // 선택한 픽쳐박스
  1350. _PictureBoxItem PictureBoxItem = (_PictureBoxItem)sender;
  1351. // 범위를 벗어나면 안됨
  1352. Check_Icon_Location(PictureBoxItem);
  1353. // 마우스 포인트 (픽쳐박스 내부 마우스 포인트)
  1354. int PictureBox_MousePoint_X = e.X;
  1355. int PictureBox_MousePoint_Y = e.Y;
  1356. // 새로운 좌표
  1357. PictureBox_New_MousePoint_X = PictureBox_MousePoint_X;
  1358. // 쉬프트키를 누르면 수직 혹은 수평으로 이동할수 있다
  1359. if (KeyDown_SHIFTKEY == true)
  1360. {
  1361. // 마우스를 떼기 전까지는 단한번의 결정으로 모드가 결정된다
  1362. if (PictureBox_Drag_Shift == false)
  1363. {
  1364. // 드래그 중이다
  1365. PictureBox_Drag_Shift = true;
  1366. // 수평이동만 하는 경우에는 가장 최근의 좌표와 비교해서 X 좌표가 변경되었다면
  1367. if (PictureBox_New_MousePoint_X != PictureBox_Old_MousePoint_X)
  1368. {
  1369. PictureBox_Drag_Vertical = false;
  1370. }
  1371. // 수직이동만 하는 경우에는 가장 최근의 좌표와 비교해서 Y 좌표가 변경되었다면
  1372. else //if (New_PictureBoxItem_Y != Old_PictureBoxItem_Y)
  1373. {
  1374. PictureBox_Drag_Vertical = true;
  1375. }
  1376. }
  1377. if (PictureBox_Drag_Vertical == false)
  1378. {
  1379. // 좌표 갱신 (1개만)
  1380. if (PictureBoxItem.MouseDrag_Status == true)
  1381. {
  1382. // X 좌표만 갱신한다
  1383. UI_Status_Write(
  1384. PictureBoxItem.Location.X + PictureBox_MousePoint_X - PictureBoxItem.MouseDown_X,
  1385. PictureBoxItem.Location.Y);
  1386. }
  1387. // 실제 위치 변경
  1388. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1389. {
  1390. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  1391. {
  1392. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status == true)
  1393. {
  1394. _PictureBoxItem PictureBoxItem_Selected = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]);
  1395. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location =
  1396. new Point(
  1397. PictureBoxItem_Selected.Location.X + PictureBox_MousePoint_X - PictureBoxItem_Selected.MouseDown_X,
  1398. PictureBoxItem_Selected.Location.Y);
  1399. }
  1400. }
  1401. }
  1402. }
  1403. else
  1404. {
  1405. // 좌표 갱신 (1개만)
  1406. if (PictureBoxItem.MouseDrag_Status == true)
  1407. {
  1408. // Y좌표만 갱신한다
  1409. UI_Status_Write(
  1410. PictureBoxItem.Location.X,
  1411. PictureBoxItem.Location.Y + PictureBox_MousePoint_Y - PictureBoxItem.MouseDown_Y);
  1412. }
  1413. // 실제 위치 변경
  1414. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1415. {
  1416. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  1417. {
  1418. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status == true)
  1419. {
  1420. _PictureBoxItem PictureBoxItem_Selected = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]);
  1421. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location =
  1422. new Point(
  1423. PictureBoxItem_Selected.Location.X,
  1424. PictureBoxItem_Selected.Location.Y + PictureBox_MousePoint_Y - PictureBoxItem_Selected.MouseDown_Y);
  1425. }
  1426. }
  1427. }
  1428. }
  1429. }
  1430. else
  1431. {
  1432. // 좌표 갱신 (1개만)
  1433. if (PictureBoxItem.MouseDrag_Status == true)
  1434. {
  1435. // 좌표만 갱신한다
  1436. UI_Status_Write(
  1437. PictureBoxItem.Location.X + PictureBox_MousePoint_X - PictureBoxItem.MouseDown_X,
  1438. PictureBoxItem.Location.Y + PictureBox_MousePoint_Y - PictureBoxItem.MouseDown_Y);
  1439. }
  1440. // 실제 위치 변경
  1441. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1442. {
  1443. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  1444. {
  1445. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).MouseDrag_Status == true)
  1446. {
  1447. _PictureBoxItem PictureBoxItem_Selected = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]);
  1448. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location =
  1449. new Point(
  1450. PictureBoxItem_Selected.Location.X + PictureBox_MousePoint_X - PictureBoxItem_Selected.MouseDown_X,
  1451. PictureBoxItem_Selected.Location.Y + PictureBox_MousePoint_Y - PictureBoxItem_Selected.MouseDown_Y);
  1452. }
  1453. }
  1454. }
  1455. }
  1456. // 마지막 좌표
  1457. PictureBox_Old_MousePoint_X = PictureBox_MousePoint_X;
  1458. }
  1459. // 아이템클릭
  1460. private void pictureBox_Create_MouseClick(object sender, MouseEventArgs e)
  1461. {
  1462. //// Work 패널 포커스 이동
  1463. //this.uiPanel_Work.Focus();
  1464. //// 선택한 픽쳐박스
  1465. //_PictureBoxItem PictureBoxItem = (_PictureBoxItem)sender;
  1466. //// 선택
  1467. //Selected_PictureBoxItem = PictureBoxItem;
  1468. //// 오른쪽 마우스 버튼
  1469. //if (e.Button == System.Windows.Forms.MouseButtons.Right)
  1470. //{
  1471. // ; // Down 이벤트에서 처리
  1472. //}
  1473. //// 왼쪽 마우스 버튼
  1474. //else
  1475. //{
  1476. // // 아이템 (디바이스 아이콘 혹은 버튼 아이콘 선택 초기화)
  1477. // pictureBox_SeletedStatusInitialize();
  1478. // // 선택시 스타일 변경 (주변에 네모박스 보이도록 출력)
  1479. // Selected_PictureBoxItem.Selected = true;
  1480. // Selected_PictureBoxItem.ShapeContainer_Seleted.Visible = true;
  1481. // // 버튼이라면 점프페이지 선택가능함
  1482. // if (Selected_PictureBoxItem.ItemType == Item_Type.Button)
  1483. // {
  1484. // this.uiComboBox_Status_Jump.ReadOnly = false;
  1485. // this.uiComboBox_Status_Jump.BackColor = System.Drawing.Color.White;
  1486. // if (Selected_PictureBoxItem.Button_JumpPageName != null && Selected_PictureBoxItem.Button_JumpPageName.Length != 0)
  1487. // this.uiComboBox_Status_Jump.Text = Selected_PictureBoxItem.Button_JumpPageName;
  1488. // else
  1489. // this.uiComboBox_Status_Jump.Text = _Text.None;
  1490. // }
  1491. // else
  1492. // {
  1493. // this.uiComboBox_Status_Jump.ReadOnly = true;
  1494. // this.uiComboBox_Status_Jump.BackColor = System.Drawing.SystemColors.MenuBar;
  1495. // this.uiComboBox_Status_Jump.Text = _Text.None;
  1496. // }
  1497. //}
  1498. }
  1499. // 아이템 클릭후 오른쪽 마우스 팝업
  1500. public void PictureBoxItem_Menustrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  1501. {
  1502. // 호출한 것은 감추기
  1503. ContextMenuStrip menustrip = (ContextMenuStrip)sender;
  1504. // 잔상 삭제
  1505. menustrip.Hide();
  1506. // 위 정렬
  1507. if (e.ClickedItem.Text == _Text.IconTopSort)
  1508. {
  1509. PictureBoxItem_TopSort();
  1510. }
  1511. // 아래 정렬
  1512. else if (e.ClickedItem.Text == _Text.IconBottomSort)
  1513. {
  1514. PictureBoxItem_BottomSort();
  1515. }
  1516. // 아래 정렬
  1517. else if (e.ClickedItem.Text == _Text.IconLeftSort)
  1518. {
  1519. PictureBoxItem_LeftSort();
  1520. }
  1521. // 아래 정렬
  1522. else if (e.ClickedItem.Text == _Text.IconRightSort)
  1523. {
  1524. PictureBoxItem_RightSort();
  1525. }
  1526. // 선택된 아이콘 삭제
  1527. else if (e.ClickedItem.Text == _Text.IconSelDel)
  1528. {
  1529. // 선택된 아이콘 삭제
  1530. Common_IconSelDel();
  1531. }
  1532. }
  1533. ///
  1534. /// 상태창에서 사이즈 및 위치를 편집할수있다 (단, 입력후 반드시 엔터키를 눌러야 된다)
  1535. ///
  1536. private void editBox_Status_Location_X_KeyPress(object sender, KeyPressEventArgs e)
  1537. {
  1538. try
  1539. {
  1540. if (e.KeyChar.ToString() == _Text.Return)
  1541. {
  1542. if (Selected_PictureBoxItem != null &&
  1543. editBox_Status_Location_X.Text.Length != 0 && editBox_Status_Location_Y.Text.Length != 0)
  1544. {
  1545. int x = Int32.Parse(editBox_Status_Location_X.Text);
  1546. int y = Int32.Parse(editBox_Status_Location_Y.Text);
  1547. if (x >= 0 && x <= 1080 && y >= 0 && y <= 720)
  1548. Selected_PictureBoxItem.Location = new Point(x, y);
  1549. }
  1550. }
  1551. }
  1552. catch
  1553. {
  1554. ; // 잘못된 입력입니다
  1555. }
  1556. }
  1557. private void editBox_Status_Location_Y_KeyPress(object sender, KeyPressEventArgs e)
  1558. {
  1559. try
  1560. {
  1561. if (e.KeyChar.ToString() == _Text.Return)
  1562. {
  1563. if (Selected_PictureBoxItem != null &&
  1564. editBox_Status_Location_X.Text.Length != 0 && editBox_Status_Location_Y.Text.Length != 0)
  1565. {
  1566. int x = Int32.Parse(editBox_Status_Location_X.Text);
  1567. int y = Int32.Parse(editBox_Status_Location_Y.Text);
  1568. if (x >= 0 && x <= 1080 && y >= 0 && y <= 720)
  1569. Selected_PictureBoxItem.Location = new Point(x, y);
  1570. }
  1571. }
  1572. }
  1573. catch
  1574. {
  1575. ; // 잘못된 입력입니다
  1576. }
  1577. }
  1578. private void editBox_Status_Size_W_KeyPress(object sender, KeyPressEventArgs e)
  1579. {
  1580. try
  1581. {
  1582. if (e.KeyChar.ToString() == _Text.Return)
  1583. {
  1584. if (Selected_PictureBoxItem != null &&
  1585. editBox_Status_Size_W.Text.Length != 0 && editBox_Status_Size_H.Text.Length != 0)
  1586. {
  1587. int w = Int32.Parse(editBox_Status_Size_W.Text);
  1588. int h = Int32.Parse(editBox_Status_Size_H.Text);
  1589. if (w > 0 && w <= 1080 && h > 0 && h <= 720)
  1590. Selected_PictureBoxItem.Size = new Size(w, h);
  1591. }
  1592. }
  1593. }
  1594. catch
  1595. {
  1596. ; // 잘못된 입력입니다
  1597. }
  1598. }
  1599. private void editBox_Status_Size_H_KeyPress(object sender, KeyPressEventArgs e)
  1600. {
  1601. try
  1602. {
  1603. if (e.KeyChar.ToString() == _Text.Return)
  1604. {
  1605. if (Selected_PictureBoxItem != null &&
  1606. editBox_Status_Size_W.Text.Length != 0 && editBox_Status_Size_H.Text.Length != 0)
  1607. {
  1608. int w = Int32.Parse(editBox_Status_Size_W.Text);
  1609. int h = Int32.Parse(editBox_Status_Size_H.Text);
  1610. if (w > 0 && w <= 1080 && h > 0 && h <= 720)
  1611. Selected_PictureBoxItem.Size = new Size(w, h);
  1612. }
  1613. }
  1614. }
  1615. catch
  1616. {
  1617. ; // 잘못된 입력입니다
  1618. }
  1619. }
  1620. ///
  1621. /// 상태창 추가 이벤트
  1622. ///
  1623. // 점프페이지 콤보박스 아이템 추가
  1624. private void uiComboBox_Status_Jump_DroppingDown(object sender, CancelEventArgs e)
  1625. {
  1626. // 콤보박스에 추가할 리스트
  1627. ArrayList TempComboBoxPageName = new ArrayList();
  1628. foreach (string PAGE_ID in ((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).LIST_PAGE_ID)
  1629. {
  1630. _RECEIVER RECEIVER = ((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]);
  1631. // 페이지 명을 추가한다
  1632. TempComboBoxPageName.Add(((_Page)RECEIVER.HASH_PAGE[PAGE_ID]).NodeText);
  1633. }
  1634. // 선택한 점프페이지
  1635. if (Selected_PictureBoxItem != null && this.uiComboBox_Status_Jump.Text.Length != 0 && this.uiComboBox_Status_Jump.Text != null)
  1636. {
  1637. // 콤보박스 셋팅
  1638. _Combobox.Initialize(this.uiComboBox_Status_Jump, TempComboBoxPageName, Selected_PictureBoxItem.Button_JumpPageName);
  1639. // None 값도 추가
  1640. if (this.uiComboBox_Status_Jump.Items.Contains(_Text.None) == false)
  1641. this.uiComboBox_Status_Jump.Items.Add(_Text.None);
  1642. }
  1643. }
  1644. // 점프페이지 설정
  1645. private void uiComboBox_Status_Jump_SelectedItemChanged(object sender, EventArgs e)
  1646. {
  1647. if (Selected_PictureBoxItem != null && this.uiComboBox_Status_Jump.Text.Length != 0 && this.uiComboBox_Status_Jump.Text != null)
  1648. {
  1649. if (Selected_PictureBoxItem.ItemType == Item_Type.Button)
  1650. {
  1651. //
  1652. // 아이템에 점프 페이지 적용
  1653. //
  1654. ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).Button_JumpPageName = this.uiComboBox_Status_Jump.Text;
  1655. // 편집할 노드 검색
  1656. TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).Name);
  1657. // 트리에 반영
  1658. EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).NodeText();
  1659. // 오브젝트 트리 색상 반영 (버튼)
  1660. _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[Selected_PictureBoxItem.Name]).Button_JumpPageName);
  1661. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  1662. ObjectTree_RootNodeUpdate();
  1663. }
  1664. }
  1665. }
  1666. ///
  1667. /// 공통으로 사용되는 선 (배경에서 드래그를 하여 생성되는 네모 혹은 아이템(디바이스 아이콘 혹은 버튼 아이콘을 선택하여 생성되는 네모)
  1668. ///
  1669. // 선 스타일
  1670. private void LineShape_BorderStyle(LineShape lineshape, DashStyle dashstyle, Color color, int borderwidth)
  1671. {
  1672. try
  1673. {
  1674. lineshape.BorderStyle = dashstyle;
  1675. lineshape.BorderColor = color;
  1676. lineshape.BorderWidth = borderwidth;
  1677. }
  1678. catch
  1679. {
  1680. }
  1681. }
  1682. // 선 시작점
  1683. private void LineShape_Start(LineShape lineshape, int x, int y)
  1684. {
  1685. try
  1686. {
  1687. lineshape.X1 = x;
  1688. lineshape.Y1 = y;
  1689. }
  1690. catch
  1691. {
  1692. }
  1693. }
  1694. // 선 끝점
  1695. private void LineShape_End(LineShape lineshape, int x, int y)
  1696. {
  1697. try
  1698. {
  1699. lineshape.X2 = x;
  1700. lineshape.Y2 = y;
  1701. }
  1702. catch
  1703. {
  1704. }
  1705. }
  1706. // 배경에 올라온 이미지의 선 스타일 일괄 변경
  1707. private void LineShape_Item_BorderStyle(_PictureBoxItem PictureBoxItem, DashStyle dashstyle, Color color, int borderwidth)
  1708. {
  1709. LineShape_BorderStyle(PictureBoxItem.LineShape_TOP, dashstyle, color, borderwidth);
  1710. LineShape_BorderStyle(PictureBoxItem.LineShape_BOTTOM, dashstyle, color, borderwidth);
  1711. LineShape_BorderStyle(PictureBoxItem.LineShape_LEFT, dashstyle, color, borderwidth);
  1712. LineShape_BorderStyle(PictureBoxItem.LineShape_RIGHT, dashstyle, color, borderwidth);
  1713. }
  1714. // 배경에서 마우스로 드래그하는 경우 생성되는 선 스타일 일괄변경
  1715. private void LineShape_MouseDragBackGrond_BorderStyle(DashStyle dashstyle, Color color, int borderwidth)
  1716. {
  1717. LineShape_BorderStyle(LineShape_MouseDragBackGround_TOP, dashstyle, color, borderwidth);
  1718. LineShape_BorderStyle(LineShape_MouseDragBackGround_BOTTOM, dashstyle, color, borderwidth);
  1719. LineShape_BorderStyle(LineShape_MouseDragBackGround_LEFT, dashstyle, color, borderwidth);
  1720. LineShape_BorderStyle(LineShape_MouseDragBackGround_RIGHT, dashstyle, color, borderwidth);
  1721. }
  1722. // 배경에서 마우스로 드래그하는 경우 생성되는 선 모두 삭제
  1723. private void LineShape_MouseDragBackGrond_Clear()
  1724. {
  1725. if (ShapeContainer_MouseDragBackGround != null) ShapeContainer_MouseDragBackGround.Dispose();
  1726. if (LineShape_MouseDragBackGround_TOP != null) LineShape_MouseDragBackGround_TOP.Dispose();
  1727. if (LineShape_MouseDragBackGround_BOTTOM != null) LineShape_MouseDragBackGround_BOTTOM.Dispose();
  1728. if (LineShape_MouseDragBackGround_LEFT != null) LineShape_MouseDragBackGround_LEFT.Dispose();
  1729. if (LineShape_MouseDragBackGround_RIGHT != null) LineShape_MouseDragBackGround_RIGHT.Dispose();
  1730. }
  1731. ///
  1732. /// 배경
  1733. ///
  1734. // 배경 클릭 (마우스 클릭)
  1735. private void pictureBox_Background_MouseClick(object sender, MouseEventArgs e)
  1736. {
  1737. //// 선택
  1738. //Selected_PictureBoxItem = null;
  1739. //// 상태갱신
  1740. //UI_Status_Initialize(Item_Type.BackGround, this.editBox_Base_BackgrondFilePath.Text);
  1741. //// 나머지 선택 스타일 초기화
  1742. //pictureBox_SeletedStatusInitialize();
  1743. //// 오른쪽 마우스
  1744. //if (e.Button == System.Windows.Forms.MouseButtons.Right)
  1745. //{
  1746. // _Contextmenustrip.Create(this.pictureBox_Background, e.Location,
  1747. // _Text.ButtonAdd + ";" +
  1748. // _Text.ItemAllDel,
  1749. // pictureBox_Background_Menustrip_ItemClicked);
  1750. //}
  1751. //// 왼쪽 마우스
  1752. //else
  1753. //{
  1754. // // 배경 선을 모두 클리어
  1755. // LineShape_MouseDragBackGrond_Clear();
  1756. // MouseDrag = false;
  1757. //}
  1758. }
  1759. // 배경클릭후 팝업창에서 선택
  1760. public void pictureBox_Background_Menustrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  1761. {
  1762. // 호출한 것은 감추기
  1763. ContextMenuStrip menustrip = (ContextMenuStrip)sender;
  1764. // 잔상 삭제
  1765. menustrip.Hide();
  1766. // 버튼 추가
  1767. if (e.ClickedItem.Text == _Text.ButtonAdd)
  1768. {
  1769. OpenFileDialog openFileDialog = new OpenFileDialog();
  1770. // 배경 삽입시에 다이얼로그창은 프로젝트 경로에 따라서 Field 폴더에 곧바로 접근할 수있도록 함
  1771. openFileDialog.InitialDirectory = Default_Field_FullPath;
  1772. if (openFileDialog.ShowDialog() == DialogResult.OK)
  1773. {
  1774. // 아이템 아이디
  1775. string Item_ID = ICON_ID_Order++.ToString();
  1776. // 파일경로, 아이디, 위치, 사이즈 지정
  1777. _PictureBoxItem PictureBoxItem = UI_Create_PictureBoxItem(
  1778. this.pictureBox_Background,
  1779. Item_Type.Button,
  1780. openFileDialog.FileName, //Default_Field_FullPath + "\\" + openFileDialog.SafeFileName,
  1781. openFileDialog.SafeFileName,//ListViewItem.FocusedItem.Text,
  1782. Item_ID,
  1783. 0, 0);
  1784. // 사이즈 제한
  1785. if (PictureBoxItem == null)
  1786. {
  1787. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 450, 150, _Text.SizeLimitOrEtcError, 0);
  1788. return;
  1789. }
  1790. // 아이콘 리스트 와 해쉬에 추가
  1791. if (_Hash.Add(TEMP_HASH_ICON, Item_ID, PictureBoxItem) == true)
  1792. {
  1793. TEMP_LIST_ICON_ID.Add(Item_ID);
  1794. }
  1795. // 상태창 초기화
  1796. UI_Status_Initialize(Item_Type.Button, openFileDialog.FileName);
  1797. // 오브젝트 트리에 추가 - 버튼
  1798. _Tree.NodeAdd_Root_Node_Node(this.treeView_ObjectTree, 0, 0, Item_ID, PictureBoxItem.NodeText(), Object_Type.BUTTON_DETAIL);
  1799. this.treeView_ObjectTree.ExpandAll();
  1800. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  1801. ObjectTree_RootNodeUpdate();
  1802. }
  1803. }
  1804. // 전체 삭제
  1805. else if (e.ClickedItem.Text == _Text.IconAllDel)
  1806. {
  1807. // 버튼 및 디바이스 아이콘 전체 삭제
  1808. Common_IconAllDel();
  1809. }
  1810. }
  1811. // 배경에서 마우스 버튼 누르는 동시에 드래그 시작
  1812. private void pictureBox_Background_MouseDown(object sender, MouseEventArgs e)
  1813. {
  1814. // Work 패널 포커스 이동
  1815. this.uiPanel_Work.Focus();
  1816. // 선택
  1817. Selected_PictureBoxItem = null;
  1818. // 상태갱신
  1819. UI_Status_Initialize(Item_Type.BackGround, this.editBox_Base_BackgrondFilePath.Text);
  1820. // 나머지 선택 스타일 초기화
  1821. pictureBox_SeletedStatusInitialize();
  1822. // 오른쪽 마우스
  1823. if (e.Button == System.Windows.Forms.MouseButtons.Right)
  1824. {
  1825. _Contextmenustrip.Create(this.pictureBox_Background, e.Location,
  1826. _Text.ButtonAdd + ";" +
  1827. _Text.ContextStripSeparator + ";" +
  1828. _Text.IconAllDel,
  1829. pictureBox_Background_Menustrip_ItemClicked);
  1830. }
  1831. // 왼쪽 마우스
  1832. else
  1833. {
  1834. // 배경 선을 모두 클리어
  1835. LineShape_MouseDragBackGrond_Clear();
  1836. //MouseDrag = false;
  1837. // 드래그 시작
  1838. BackGround_MouseDrag = true;
  1839. // 클릭좌표
  1840. BackGround_MouseDrag_Before_X = e.X;
  1841. BackGround_MouseDrag_Before_Y = e.Y;
  1842. // 메모리 해제
  1843. LineShape_MouseDragBackGrond_Clear();
  1844. // 메모리 할당
  1845. ShapeContainer_MouseDragBackGround = new ShapeContainer();
  1846. LineShape_MouseDragBackGround_TOP = new LineShape();
  1847. LineShape_MouseDragBackGround_BOTTOM = new LineShape();
  1848. LineShape_MouseDragBackGround_LEFT = new LineShape();
  1849. LineShape_MouseDragBackGround_RIGHT = new LineShape();
  1850. // 선 스타일 지정
  1851. LineShape_MouseDragBackGrond_BorderStyle(Selected_DashStyle_First, Selected_Color, Selected_BorderWidth_BakcGround);
  1852. }
  1853. }
  1854. // 범위안에 아이콘이 포함되는지 체크함 (선으로 구성한 덕분에 계산이 복잡해졌음)..
  1855. private bool pictureBox_Background_MouseUp_InCheck(string ICON_ID)
  1856. {
  1857. // 왼쪽 상단 -> 오른쪽 하단 드래그시
  1858. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= BackGround_MouseDrag_Before_X
  1859. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= BackGround_MouseDrag_Before_Y
  1860. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Width <= BackGround_MouseDrag_After_X
  1861. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Height <= BackGround_MouseDrag_After_Y)
  1862. {
  1863. return true;
  1864. }
  1865. // 왼쪽 하단 -> 오른쪽 상단 드래그시
  1866. else if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= BackGround_MouseDrag_Before_X
  1867. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= BackGround_MouseDrag_After_Y
  1868. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Width <= BackGround_MouseDrag_After_X
  1869. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Height <= BackGround_MouseDrag_Before_Y)
  1870. {
  1871. return true;
  1872. }
  1873. // 오른쪽 상단 -> 왼쪽 하단 드래그시
  1874. else if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= BackGround_MouseDrag_After_X
  1875. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= BackGround_MouseDrag_Before_Y
  1876. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Width <= BackGround_MouseDrag_Before_X
  1877. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Height <= BackGround_MouseDrag_After_Y)
  1878. {
  1879. return true;
  1880. }
  1881. // 오른쪽 하단 -> 왼쪽 상단 드래그시
  1882. else if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= BackGround_MouseDrag_After_X
  1883. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= BackGround_MouseDrag_After_Y
  1884. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Width <= BackGround_MouseDrag_Before_X
  1885. && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Size.Height <= BackGround_MouseDrag_Before_Y)
  1886. {
  1887. return true;
  1888. }
  1889. return false;
  1890. }
  1891. // 배경에서 마우스 버튼 누르는 동시에 드래그 종료
  1892. private void pictureBox_Background_MouseUp(object sender, MouseEventArgs e)
  1893. {
  1894. // Work 패널 포커스 이동
  1895. this.uiPanel_Work.Focus();
  1896. // 드래그 해제
  1897. BackGround_MouseDrag = false;
  1898. // 드래그 영역안에 아이템이 포함되면 선택한 아이템 모두 선택 표시
  1899. // 범위안의 디바이스 아이콘 및 버튼 아이콘 검색
  1900. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1901. {
  1902. if (pictureBox_Background_MouseUp_InCheck(ICON_ID) == true)
  1903. {
  1904. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected = true;
  1905. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ShapeContainer_Seleted.Visible = true;
  1906. }
  1907. }
  1908. // 배경 선을 모두 클리어
  1909. LineShape_MouseDragBackGrond_Clear();
  1910. }
  1911. // 배경에서 마우스로 드래그하는 동안 선이 생성
  1912. private void pictureBox_Background_MouseMove(object sender, MouseEventArgs e)
  1913. {
  1914. // 배경 드래그 상태
  1915. if (BackGround_MouseDrag == true)
  1916. {
  1917. // 클릭좌표
  1918. BackGround_MouseDrag_After_X = e.X;
  1919. BackGround_MouseDrag_After_Y = e.Y;
  1920. // TOP
  1921. LineShape_Start(LineShape_MouseDragBackGround_TOP, BackGround_MouseDrag_Before_X, BackGround_MouseDrag_Before_Y);
  1922. LineShape_End(LineShape_MouseDragBackGround_TOP, BackGround_MouseDrag_After_X, BackGround_MouseDrag_Before_Y);
  1923. // LEFT
  1924. LineShape_Start(LineShape_MouseDragBackGround_LEFT, BackGround_MouseDrag_Before_X, BackGround_MouseDrag_Before_Y);
  1925. LineShape_End(LineShape_MouseDragBackGround_LEFT, BackGround_MouseDrag_Before_X, BackGround_MouseDrag_After_Y);
  1926. // RIGHT
  1927. LineShape_Start(LineShape_MouseDragBackGround_RIGHT, BackGround_MouseDrag_After_X, BackGround_MouseDrag_Before_Y);
  1928. LineShape_End(LineShape_MouseDragBackGround_RIGHT, BackGround_MouseDrag_After_X, BackGround_MouseDrag_After_Y);
  1929. // BOTTM
  1930. LineShape_Start(LineShape_MouseDragBackGround_BOTTOM, BackGround_MouseDrag_Before_X, BackGround_MouseDrag_After_Y);
  1931. LineShape_End(LineShape_MouseDragBackGround_BOTTOM, BackGround_MouseDrag_After_X, BackGround_MouseDrag_After_Y);
  1932. // 컨테이너에 상위 4개 선 포함
  1933. ShapeContainer_MouseDragBackGround.Shapes.AddRange(new Microsoft.VisualBasic.PowerPacks.Shape[]
  1934. {
  1935. LineShape_MouseDragBackGround_TOP,LineShape_MouseDragBackGround_BOTTOM,LineShape_MouseDragBackGround_LEFT,LineShape_MouseDragBackGround_RIGHT,
  1936. });
  1937. // 배경그림에 컨테이너 포함
  1938. this.pictureBox_Background.Controls.Add(ShapeContainer_MouseDragBackGround);
  1939. }
  1940. }
  1941. ///
  1942. /// 아이콘 관련 공통 루틴
  1943. ///
  1944. // 아이콘 전체 삭제
  1945. private void Common_IconAllDel()
  1946. {
  1947. // 해쉬 및 리스트 전체 삭제
  1948. TEMP_HASH_LIST_Initialize();
  1949. // 상태바 초기화
  1950. UI_Status_Clear();
  1951. // 오브젝트 트리 초기화
  1952. UI_Tree_Initialize();
  1953. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  1954. ObjectTree_RootNodeUpdate();
  1955. // 디바이스 조회창 초기화
  1956. UI_Device_Initialize();
  1957. }
  1958. // 선택된 아이콘 삭제
  1959. private void Common_IconSelDel()
  1960. {
  1961. // 삭제하려는 키리스트 임시로 만듬
  1962. ArrayList RemoveKeyLIst = new ArrayList();
  1963. // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성
  1964. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1965. {
  1966. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  1967. {
  1968. // 선택한 아이콘은 삭제
  1969. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Dispose();
  1970. // 트리에 반영
  1971. _Tree.DelNodeName_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name);
  1972. // 삭제할 키리스트에 할당 , 중복은 배제하도록 함
  1973. if (RemoveKeyLIst.Contains(ICON_ID) == false)
  1974. RemoveKeyLIst.Add(ICON_ID);
  1975. }
  1976. }
  1977. // 삭제할 키리스트에 의해 해쉬와 리스트를 삭제
  1978. _Hash.DelData_ByKey(TEMP_HASH_ICON, RemoveKeyLIst);
  1979. _LIst.Del_ByKeyList(TEMP_LIST_ICON_ID, RemoveKeyLIst);
  1980. // 상태바 초기화
  1981. UI_Status_Clear();
  1982. // 선택된 픽쳐박스 초기화
  1983. Selected_PictureBoxItem = null;
  1984. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  1985. ObjectTree_RootNodeUpdate();
  1986. // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오)
  1987. GridexDevice_ChangeColor_By_TEMP();
  1988. GridexDevice_ChangeColor_By_HASH();
  1989. }
  1990. // 선택된 버튼 아이콘 연동 초기화
  1991. private void Common_ButtonJumpClear()
  1992. {
  1993. // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성
  1994. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  1995. {
  1996. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  1997. {
  1998. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button)
  1999. {
  2000. //
  2001. // 점프 페이지 초기화
  2002. //
  2003. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName = null;
  2004. // 트리 검색
  2005. TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name);
  2006. // 트리에 반영
  2007. EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText();
  2008. // 오브젝트 트리 색상 반영 (버튼)
  2009. _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName);
  2010. }
  2011. }
  2012. }
  2013. // 상태바 초기화
  2014. UI_Status_Clear();
  2015. // 선택된 픽쳐박스 초기화
  2016. Selected_PictureBoxItem = null;
  2017. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  2018. ObjectTree_RootNodeUpdate();
  2019. }
  2020. // 선택된 디바이스 아이콘 연동 초기화
  2021. private void Common_DeviceLinkClear()
  2022. {
  2023. // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성
  2024. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2025. {
  2026. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2027. {
  2028. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device)
  2029. {
  2030. // 초기화
  2031. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID = null;
  2032. // 트리 검색
  2033. TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name);
  2034. // 트리에 반영
  2035. EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText();
  2036. // 오브젝트 트리 색상 반영 (디바이스)
  2037. _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID);
  2038. }
  2039. }
  2040. }
  2041. // 상태바 초기화
  2042. UI_Status_Clear();
  2043. // 선택된 픽쳐박스 초기화
  2044. Selected_PictureBoxItem = null;
  2045. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  2046. ObjectTree_RootNodeUpdate();
  2047. // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오)
  2048. GridexDevice_ChangeColor_By_TEMP();
  2049. GridexDevice_ChangeColor_By_HASH();
  2050. }
  2051. // 버튼 아이콘 전체 삭제
  2052. private void Common_ButtonAllDel()
  2053. {
  2054. // 삭제하려는 키리스트 임시로 만듬
  2055. ArrayList RemoveKeyLIst = new ArrayList();
  2056. // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성
  2057. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2058. {
  2059. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button)
  2060. {
  2061. // 선택한 아이콘은 삭제
  2062. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Dispose();
  2063. // 트리에 반영
  2064. _Tree.DelNodeName_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name);
  2065. // 삭제할 키리스트에 할당 , 중복은 배제하도록 함
  2066. if (RemoveKeyLIst.Contains(ICON_ID) == false)
  2067. RemoveKeyLIst.Add(ICON_ID);
  2068. }
  2069. }
  2070. // 삭제할 키리스트에 의해 해쉬와 리스트를 삭제
  2071. _Hash.DelData_ByKey(TEMP_HASH_ICON, RemoveKeyLIst);
  2072. _LIst.Del_ByKeyList(TEMP_LIST_ICON_ID, RemoveKeyLIst);
  2073. // 상태바 초기화
  2074. UI_Status_Clear();
  2075. // 선택된 픽쳐박스 초기화
  2076. Selected_PictureBoxItem = null;
  2077. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  2078. ObjectTree_RootNodeUpdate();
  2079. }
  2080. // 버튼 아이콘 점프페이지 전체초기화
  2081. private void Common_ButtonJumpAllClear()
  2082. {
  2083. // 버튼 아이콘 전부 검색
  2084. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2085. {
  2086. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button)
  2087. {
  2088. // 점프 페이지 초기화
  2089. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName = null;
  2090. // 트리 검색
  2091. TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name);
  2092. // 트리에 반영
  2093. EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText();
  2094. // 오브젝트 트리 색상 반영 (버튼)
  2095. _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName);
  2096. }
  2097. }
  2098. // 상태바 초기화
  2099. UI_Status_Clear();
  2100. // 선택된 픽쳐박스 초기화
  2101. Selected_PictureBoxItem = null;
  2102. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  2103. ObjectTree_RootNodeUpdate();
  2104. }
  2105. // 디바이스 아이콘 전체 삭제
  2106. private void Common_DeviceAllDel()
  2107. {
  2108. // 삭제하려는 키리스트 임시로 만듬
  2109. ArrayList RemoveKeyLIst = new ArrayList();
  2110. // 삭제는 선택한 모두 삭제 가능하도록 삭제할 키리스트를 생성
  2111. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2112. {
  2113. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device)
  2114. {
  2115. // 선택한 아이콘은 삭제
  2116. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Dispose();
  2117. // 트리에 반영
  2118. _Tree.DelNodeName_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name);
  2119. // 삭제할 키리스트에 할당 , 중복은 배제하도록 함
  2120. if (RemoveKeyLIst.Contains(ICON_ID) == false)
  2121. RemoveKeyLIst.Add(ICON_ID);
  2122. }
  2123. }
  2124. // 삭제할 키리스트에 의해 해쉬와 리스트를 삭제
  2125. _Hash.DelData_ByKey(TEMP_HASH_ICON, RemoveKeyLIst);
  2126. _LIst.Del_ByKeyList(TEMP_LIST_ICON_ID, RemoveKeyLIst);
  2127. // 상태바 초기화
  2128. UI_Status_Clear();
  2129. // 선택된 픽쳐박스 초기화
  2130. Selected_PictureBoxItem = null;
  2131. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  2132. ObjectTree_RootNodeUpdate();
  2133. // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오)
  2134. GridexDevice_ChangeColor_By_TEMP();
  2135. GridexDevice_ChangeColor_By_HASH();
  2136. }
  2137. // 디바이스 아이콘 연동 전체초기화
  2138. private void Common_DeviceLinkAllClear()
  2139. {
  2140. // 디바이스 아이콘 전부 검색
  2141. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2142. {
  2143. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device)
  2144. {
  2145. // 점프 페이지 초기화
  2146. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID = null;
  2147. // 트리 검색
  2148. TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name);
  2149. // 트리에 반영
  2150. EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText();
  2151. // 오브젝트 트리 색상 반영 (디바이스)
  2152. _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID);
  2153. }
  2154. }
  2155. // 상태바 초기화
  2156. UI_Status_Clear();
  2157. // 선택된 픽쳐박스 초기화
  2158. Selected_PictureBoxItem = null;
  2159. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  2160. ObjectTree_RootNodeUpdate();
  2161. // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오)
  2162. GridexDevice_ChangeColor_By_TEMP();
  2163. GridexDevice_ChangeColor_By_HASH();
  2164. }
  2165. ///
  2166. /// 맵디자이너 공통 타이머
  2167. ///
  2168. // 사용용도는 크게 2가지이다.
  2169. // 1. 배경에서 드래그하는 경우 스타일이 토글되면서 변경
  2170. // 2. 아이템 (디바이스 아이콘, 버튼 아이콘) 을 선택하는 경우 스타일이 초단위로 토글되면서 변경
  2171. private void timer_MapDesignerConfig_Tick(object sender, EventArgs e)
  2172. {
  2173. MapDesigner_Count++;
  2174. // 스타일 지정 (초단위로)
  2175. if (MapDesigner_Count % 2 == 0)
  2176. {
  2177. // 배경에서 드래그한 네모 스타일 변경 옵션 1
  2178. LineShape_MouseDragBackGrond_BorderStyle(Selected_DashStyle_First, Selected_Color, Selected_BorderWidth_BakcGround);
  2179. // 선택한 아이콘 스타일 변경 옵션 1
  2180. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2181. {
  2182. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2183. {
  2184. LineShape_Item_BorderStyle(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]), Selected_DashStyle_First, Selected_Color, Selected_BorderWidth_Item);
  2185. }
  2186. }
  2187. // 홀짝 순으로 토글하기 위한 초기화
  2188. MapDesigner_Count = 0;
  2189. }
  2190. else
  2191. {
  2192. // 배경에서 드래그한 네모 스타일 변경 옵션 2
  2193. LineShape_MouseDragBackGrond_BorderStyle(Selected_DashStyle_Second, Selected_Color, Selected_BorderWidth_BakcGround);
  2194. // 선택한 아이콘 스타일 변경 옵션 2
  2195. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2196. {
  2197. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2198. {
  2199. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ShapeContainer_Seleted.Visible = true;
  2200. LineShape_Item_BorderStyle(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]), Selected_DashStyle_Second, Selected_Color, Selected_BorderWidth_Item);
  2201. }
  2202. }
  2203. }
  2204. }
  2205. ///
  2206. /// 키보드 이벤트
  2207. ///
  2208. private void Form_MapDesigner_KeyUp(object sender, KeyEventArgs e)
  2209. {
  2210. KeyDown_ALTKEY = e.Alt;
  2211. KeyDown_SHIFTKEY = e.Shift;
  2212. }
  2213. private void Form_MapDesigner_KeyDown(object sender, KeyEventArgs e)
  2214. {
  2215. // 복사 : Alt 키를 누르면 마우스 드래그하면서 아이템을 복사 할수 있다
  2216. KeyDown_ALTKEY = e.Alt;
  2217. // 반드시 워크 작업 뷰에 포커스가 있을 경우에만
  2218. if (this.uiPanel_Work.Focused == true || this.uiPanel_WorkContainer.Focused == true)
  2219. {
  2220. switch (e.KeyCode)
  2221. {
  2222. // 삭제 : 현재 1개만 삭제 가능하다 (선택되어 있는 아이템 전부 삭제 루틴은 차후 개발 -> 현재 배경에서 오른쪽 마우스 버튼으로 전체 삭제로 일단 대체함)
  2223. case Keys.Delete:
  2224. {
  2225. // 선택된 아이콘 삭제
  2226. Common_IconSelDel();
  2227. }
  2228. break;
  2229. case Keys.W:
  2230. case Keys.NumPad8:
  2231. case Keys.S:
  2232. case Keys.NumPad2:
  2233. case Keys.A:
  2234. case Keys.NumPad4:
  2235. case Keys.D:
  2236. case Keys.NumPad6:
  2237. {
  2238. uiPanel_WorkContainer_KeyDown_UpDownLeftRight(e.KeyCode);
  2239. }
  2240. break;
  2241. default:
  2242. break;
  2243. }
  2244. }
  2245. // 일반적인 상황에서 핫키가 필요한 경우
  2246. switch (e.KeyCode)
  2247. {
  2248. // Operation : 디바이스 연동 루틴이 너무 많아서 단축키가 필요하다 O 를 2번 누르도록 유도하자
  2249. case Keys.O:
  2250. // 디바이스창에서 선택한 아이템이 1개이며, 워크뷰에서도 선택한 아이템이 1개인지
  2251. if (uiButton_Device_Apply_Verify() != null)
  2252. {
  2253. uiButton_Device_Apply_Click(this.uiButton_Device_Apply, EventArgs.Empty);
  2254. }
  2255. break;
  2256. }
  2257. }
  2258. private void uiPanel_WorkContainer_KeyDown_UpDownLeftRight(Keys KeyCode)
  2259. {
  2260. // 아이콘 잠금 기능 활성화 체크
  2261. if (this.uiCheckBox_IconLock.Checked == true)
  2262. {
  2263. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0);
  2264. return;
  2265. }
  2266. _PictureBoxItem PictureBoxItem = null;
  2267. int Selected_Icon_Count = 0;
  2268. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2269. {
  2270. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2271. {
  2272. // 선택된 아이콘이라면 카운트
  2273. Selected_Icon_Count++;
  2274. // 선택된 아이콘 위치 조절
  2275. PictureBoxItem = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]);
  2276. switch (KeyCode)
  2277. {
  2278. case Keys.W:
  2279. case Keys.NumPad8:
  2280. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(PictureBoxItem.Location.X, PictureBoxItem.Location.Y - 1);
  2281. break;
  2282. case Keys.S:
  2283. case Keys.NumPad2:
  2284. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(PictureBoxItem.Location.X, PictureBoxItem.Location.Y + 1);
  2285. break;
  2286. case Keys.A:
  2287. case Keys.NumPad4:
  2288. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(PictureBoxItem.Location.X - 1, PictureBoxItem.Location.Y);
  2289. break;
  2290. case Keys.D:
  2291. case Keys.NumPad6:
  2292. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(PictureBoxItem.Location.X + 1, PictureBoxItem.Location.Y);
  2293. break;
  2294. }
  2295. }
  2296. }
  2297. // 단순히 1개만 선택했을 경우에만 바로 상태바에 표시된다
  2298. if (Selected_Icon_Count == 1)
  2299. {
  2300. // 좌표만 갱신한다
  2301. switch (KeyCode)
  2302. {
  2303. case Keys.W:
  2304. case Keys.NumPad8:
  2305. UI_Status_Write(PictureBoxItem.Location.X, PictureBoxItem.Location.Y - 1);
  2306. break;
  2307. case Keys.S:
  2308. case Keys.NumPad2:
  2309. UI_Status_Write(PictureBoxItem.Location.X, PictureBoxItem.Location.Y + 1);
  2310. break;
  2311. case Keys.A:
  2312. case Keys.NumPad4:
  2313. UI_Status_Write(PictureBoxItem.Location.X - 1, PictureBoxItem.Location.Y);
  2314. break;
  2315. case Keys.D:
  2316. case Keys.NumPad6:
  2317. UI_Status_Write(PictureBoxItem.Location.X + 1, PictureBoxItem.Location.Y);
  2318. break;
  2319. }
  2320. }
  2321. this.pictureBox_Background.ResumeLayout();
  2322. }
  2323. ///
  2324. /// 정렬
  2325. ///
  2326. // 왼쪽 정렬
  2327. private void PictureBoxItem_LeftSort()
  2328. {
  2329. // 아이콘 잠금 기능 활성화 체크
  2330. if (this.uiCheckBox_IconLock.Checked == true)
  2331. {
  2332. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0);
  2333. return;
  2334. }
  2335. // 1. 제일 왼쪽에 있는 아이콘이 기준
  2336. // 2. 나머지 아이콘은 X 좌표만 정렬 , Y 좌표 고정됨
  2337. // 기준 X 좌표
  2338. int Criteria_X = this.pictureBox_Background.Width;
  2339. // 제일 왼쪽에 있는 아이콘
  2340. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2341. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2342. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X <= Criteria_X)
  2343. Criteria_X = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X;
  2344. // 선택된 아이콘 위치 변경
  2345. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2346. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2347. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(Criteria_X, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y);
  2348. }
  2349. // 오른쪽 정렬
  2350. private void PictureBoxItem_RightSort()
  2351. {
  2352. // 아이콘 잠금 기능 활성화 체크
  2353. if (this.uiCheckBox_IconLock.Checked == true)
  2354. {
  2355. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0);
  2356. return;
  2357. }
  2358. // 1. 제일 오른쪽에 있는 아이콘이 기준
  2359. // 2. 나머지 아이콘은 X 좌표만 정렬 , Y 좌표 고정됨
  2360. // 기준 X 좌표
  2361. int Criteria_X = 0;
  2362. // 제일 오른쪽에 있는 아이콘
  2363. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2364. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2365. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= Criteria_X)
  2366. Criteria_X = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X;
  2367. // 선택된 아이콘 위치 변경
  2368. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2369. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2370. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(Criteria_X, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y);
  2371. }
  2372. // 위 정렬
  2373. private void PictureBoxItem_TopSort()
  2374. {
  2375. // 아이콘 잠금 기능 활성화 체크
  2376. if (this.uiCheckBox_IconLock.Checked == true)
  2377. {
  2378. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0);
  2379. return;
  2380. }
  2381. // 1. 제일 위쪽에 있는 아이콘이 기준
  2382. // 2. 나머지 아이콘은 Y 좌표만 정렬 , X 좌표 고정됨
  2383. // 기준 Y 좌표
  2384. int Criteria_Y = this.pictureBox_Background.Height;
  2385. // 제일 위쪽에 있는 아이콘
  2386. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2387. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2388. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y <= Criteria_Y)
  2389. Criteria_Y = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y;
  2390. // 선택된 아이콘 위치 변경
  2391. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2392. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2393. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X, Criteria_Y);
  2394. }
  2395. // 아래 정렬
  2396. private void PictureBoxItem_BottomSort()
  2397. {
  2398. // 아이콘 잠금 기능 활성화 체크
  2399. if (this.uiCheckBox_IconLock.Checked == true)
  2400. {
  2401. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.IconLockEnableCheck, 0);
  2402. return;
  2403. }
  2404. // 1. 제일 아래쪽에 있는 아이콘이 기준
  2405. // 2. 나머지 아이콘은 Y 좌표만 정렬 , X 좌표 고정됨
  2406. // 기준 Y 좌표
  2407. int Criteria_Y = 0;
  2408. // 제일 위쪽에 있는 아이콘
  2409. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2410. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2411. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= Criteria_Y)
  2412. Criteria_Y = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y;
  2413. // 선택된 아이콘 위치 변경
  2414. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2415. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2416. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X, Criteria_Y);
  2417. }
  2418. //private void PictureBoxItem_HorizontalSort()
  2419. //{
  2420. // ///
  2421. // /// 왼쪽 정렬
  2422. // /// 1. 제일 왼쪽에 있는 아이콘이 기준
  2423. // /// 2. 나머지 아이콘은 X 좌표만 정렬 , Y 좌표 고정됨
  2424. // ///
  2425. // // 최소값
  2426. // int Min_Value = 0;
  2427. // // 최대값
  2428. // int Max_Value = 0;
  2429. // // 간격
  2430. // int Margin = 0;
  2431. // // 기준 Y 좌표
  2432. // int Criteria_Y = 0;
  2433. // // 선택된 아이콘 리스트
  2434. // ArrayList Order = new ArrayList();
  2435. // // 선택된 아이콘이 1개 이상인 경우에 적용됨
  2436. // if (TEMP_LIST_ICON_ID.Count > 1)
  2437. // {
  2438. // // 제일 오른쪽에 있는 아이콘
  2439. // foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2440. // {
  2441. // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2442. // {
  2443. // // 최대값 구하기
  2444. // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X >= Max_Value)
  2445. // {
  2446. // Max_Value = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X;
  2447. // }
  2448. // // 선택 되어있는 리스트
  2449. // Order.Add(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X);
  2450. // }
  2451. // }
  2452. // // 아이콘 위치에 의해 정렬 (오름차순)
  2453. // Order.Sort();
  2454. // // 최소값을 최대값으로 치환
  2455. // Min_Value = Max_Value;
  2456. // // 제일 왼쪽에 있는 아이콘
  2457. // foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2458. // {
  2459. // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2460. // {
  2461. // // 최소값 구하기
  2462. // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X <= Min_Value)
  2463. // {
  2464. // // X 기준 좌표
  2465. // Min_Value = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X;
  2466. // // Y 기준 좌표
  2467. // Criteria_Y = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y;
  2468. // }
  2469. // }
  2470. // }
  2471. // // 제일 왼쪽에 있는 아이콘을 기준으로 정렬하되 아래와 같이 간격을 지정한다
  2472. // // 간격 = (최대값 - 최소값 사이즈) / (총개수 - 1)
  2473. // Margin = (Max_Value - Min_Value) / (TEMP_LIST_ICON_ID.Count-1);
  2474. // // 단, 디바이스 아이콘의 사이즈는 초과하도록 한다 (마진값이 1이상 나지 않다면 의미가 없다)
  2475. // if (Margin < 24) Margin = 25;
  2476. // // 오름차순으로 정렬된 리스트를 기준으로 차례대로 간격을 계산해서 정렬한다
  2477. // for (int j = 0; j<Order.Count; j++)
  2478. // {
  2479. // foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2480. // {
  2481. // // Order 의 X 값과 일치하는 것만 찾아서
  2482. // if (Int32.Parse(Order[j].ToString()) == ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X)
  2483. // {
  2484. // // X 좌표 : 기준점(최소값) + 마진
  2485. // // Y 좌표 : 기준점(최소값)
  2486. // ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(Min_Value+(j * Margin), Criteria_Y);
  2487. // break;
  2488. // }
  2489. // }
  2490. // }
  2491. // }
  2492. //}
  2493. //private void PictureBoxItem_VerticalSort()
  2494. //{
  2495. // ///
  2496. // /// 평균값 세로 정렬
  2497. // ///
  2498. // // 최소값
  2499. // int Min_Value = 0;
  2500. // // 최대값
  2501. // int Max_Value = 0;
  2502. // // 간격
  2503. // int Margin = 0;
  2504. // // 기준 X 좌표
  2505. // int Criteria_X = 0;
  2506. // // 선택된 아이콘 리스트
  2507. // ArrayList Order = new ArrayList();
  2508. // // 선택된 아이콘이 1개 이상인 경우에 적용됨
  2509. // if (TEMP_LIST_ICON_ID.Count > 1)
  2510. // {
  2511. // // 제일 위쪽에 있는 아이콘
  2512. // foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2513. // {
  2514. // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2515. // {
  2516. // // 최대값 구하기
  2517. // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y >= Max_Value)
  2518. // {
  2519. // Max_Value = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y;
  2520. // }
  2521. // // 선택 되어있는 리스트
  2522. // Order.Add(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y);
  2523. // }
  2524. // }
  2525. // // 아이콘 위치에 의해 정렬 (오름차순)
  2526. // Order.Sort();
  2527. // // 최소값을 최대값으로 치환
  2528. // Min_Value = Max_Value;
  2529. // // 제일 아래쪽에 있는 아이콘
  2530. // foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2531. // {
  2532. // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2533. // {
  2534. // // 최소값 구하기
  2535. // if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y <= Min_Value)
  2536. // {
  2537. // // Y 기준 좌표
  2538. // Min_Value = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y;
  2539. // // X 기준 좌표
  2540. // Criteria_X = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.X;
  2541. // }
  2542. // }
  2543. // }
  2544. // // 제일 왼쪽에 있는 아이콘을 기준으로 정렬하되 아래와 같이 간격을 지정한다
  2545. // // 간격 = (최대값 - 최소값 사이즈) / (총개수 - 1)
  2546. // Margin = (Max_Value - Min_Value) / (TEMP_LIST_ICON_ID.Count - 1);
  2547. // // 단, 디바이스 아이콘의 사이즈는 초과하도록 한다 (마진값이 1이상 나지 않다면 의미가 없다)
  2548. // if (Margin < 24) Margin = 25;
  2549. // // 오름차순으로 정렬된 리스트를 기준으로 차례대로 간격을 계산해서 정렬한다
  2550. // for (int j = 0; j < Order.Count; j++)
  2551. // {
  2552. // foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2553. // {
  2554. // // Order 의 Y 값과 일치하는 것만 찾아서
  2555. // if (Int32.Parse(Order[j].ToString()) == ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location.Y)
  2556. // {
  2557. // // X 좌표 : 기준점(최소값) + 마진
  2558. // // Y 좌표 : 기준점(최소값)
  2559. // ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Location = new Point(Criteria_X, Min_Value + (j * Margin));
  2560. // break;
  2561. // }
  2562. // }
  2563. // }
  2564. // }
  2565. //}
  2566. ///
  2567. /// 마우스 범위 벗어남
  2568. ///
  2569. private void Check_Icon_Location(_PictureBoxItem PictureBoxItem)
  2570. {
  2571. if (PictureBoxItem.Location.X < 0)
  2572. PictureBoxItem.Location = new Point(0, PictureBoxItem.Location.Y);
  2573. if (PictureBoxItem.Location.Y < 0)
  2574. PictureBoxItem.Location = new Point(PictureBoxItem.Location.X, 0);
  2575. if (PictureBoxItem.Location.X + PictureBoxItem.Size.Width > this.pictureBox_Background.Width)
  2576. PictureBoxItem.Location = new Point(this.pictureBox_Background.Width - PictureBoxItem.Size.Width, PictureBoxItem.Location.Y);
  2577. if (PictureBoxItem.Location.Y + PictureBoxItem.Size.Height > this.pictureBox_Background.Height)
  2578. PictureBoxItem.Location = new Point(PictureBoxItem.Location.X, this.pictureBox_Background.Height - PictureBoxItem.Size.Height);
  2579. }
  2580. //
  2581. // 디바이스
  2582. //
  2583. // 조회버튼
  2584. private void uiButton_Device_Inq_Click(object sender, EventArgs e)
  2585. {
  2586. //** 디바이스가 IN인지 OUT인지 설정
  2587. string Device_InOut = null;
  2588. if (UiComboBox_Device_InOut.Text == "IN") Device_InOut = "I";
  2589. else if (UiComboBox_Device_InOut.Text == "OUT") Device_InOut = "O";
  2590. else Device_InOut = "";
  2591. // 그리드이엑스 클리어 시키고 다시 조회
  2592. GridEX_Device.ClearItems();
  2593. // No.를 출력하기 위해서
  2594. int i = 1;
  2595. // CheckedComboBox_DeviceType콤보박스에서 선택한 항목들은 OR조건으로 검색, 나머지는 AND조건 검색
  2596. int number = DeviceType.Count;
  2597. // CheckedComboBox_DeviceType콤보박스에서 선택한 항목이 없을 경우
  2598. if (number == 0)
  2599. {
  2600. // 아래와 같이 하는 이유는 통신보드를 1~14까지만 조회하기 위해서다
  2601. // 조회하려는 통신보드에 값이 없으면 if문을 타고 값이 있으면 else 문을 탄다. SQL문이 달라지는 것이다
  2602. DataRowCollection DB_TABLE_TB_DEVICE = null;
  2603. if (UiComboBox_Board.Text.Length == 0)
  2604. {
  2605. // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  2606. if (((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).MODEL == "IFC3300")
  2607. {
  2608. DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable_NoneBoardID_BigReceiver("1", Device_InOut, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, "", EditBox_DeviceName.Text, Seleted_RECEIVER_ID));
  2609. }
  2610. else
  2611. {
  2612. DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable("1", Device_InOut, "15", _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, "", EditBox_DeviceName.Text, Seleted_RECEIVER_ID));
  2613. }
  2614. }
  2615. else
  2616. {
  2617. DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DeviceTable("1", Device_InOut, UiComboBox_Board.Text, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, "", EditBox_DeviceName.Text, Seleted_RECEIVER_ID));
  2618. }
  2619. if (DB_TABLE_TB_DEVICE != null)
  2620. {
  2621. foreach (DataRow dr in DB_TABLE_TB_DEVICE)
  2622. {
  2623. if (_Convert.Exception_Into_object(dr[3], dr[4], dr[5], dr[6], dr[7]) == true)
  2624. {
  2625. // 매개변수 순서 => COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE
  2626. MskDeviceIDString dev_s = new MskDeviceIDString(
  2627. _Convert.Null_to_IntZero(dr[3].ToString()),
  2628. _Convert.Null_to_IntZero(dr[4].ToString()),
  2629. _Convert.Null_to_IntZero(dr[5].ToString()),
  2630. _Convert.Null_to_IntZero(dr[6].ToString()),
  2631. _Convert.Null_to_IntZero(dr[7].ToString()),
  2632. dr[8].ToString(), Seleted_RECEIVER_ID); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  2633. GridEXRow row;
  2634. row = GridEX_Device.AddItem();
  2635. row.BeginEdit();
  2636. row.Cells["Number"].Value = i++;
  2637. row.Cells["ID"].Value = dev_s.MskId;
  2638. row.Cells["DeviceType"].Value = dr[0].ToString();
  2639. row.Cells["Position"].Value = dr[1].ToString();
  2640. row.Cells["DeviceName"].Value = dr[2].ToString();
  2641. row.EndEdit();
  2642. }
  2643. }
  2644. }
  2645. }
  2646. // CheckedComboBox_DeviceType콤보박스에서 선택한 항목이 있을 경우 선택한 항목만큼 For문을 돌려 검색해서 출력
  2647. else
  2648. {
  2649. for (int search = 0; search < number; search++)
  2650. {
  2651. // 아래와 같이 하는 이유는 통신보드를 1~14까지만 조회하기 위해서다
  2652. // 조회하려는 통신보드에 값이 없으면 if문을 타고 값이 있으면 else 문을 탄다. SQL문이 달라지는 것이다
  2653. DataRowCollection DB_TABLE_TB_DEVICE = null;
  2654. if (UiComboBox_Board.Text.Length == 0)
  2655. {
  2656. // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  2657. if (((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).MODEL == "IFC3300")
  2658. {
  2659. DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable_NoneBoardID_BigReceiver("1", Device_InOut, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, DeviceType[search].ToString(), EditBox_DeviceName.Text, Seleted_RECEIVER_ID));
  2660. }
  2661. else
  2662. {
  2663. DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DEVICETable("1", Device_InOut, "15", _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, DeviceType[search].ToString(), EditBox_DeviceName.Text, Seleted_RECEIVER_ID));
  2664. }
  2665. }
  2666. else
  2667. {
  2668. DB_TABLE_TB_DEVICE = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_DeviceTable("1", Device_InOut, UiComboBox_Board.Text, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), UiComboBox_Repeater.Text, EditBox_Position.Text, DeviceType[search].ToString(), EditBox_DeviceName.Text, Seleted_RECEIVER_ID));
  2669. }
  2670. if (DB_TABLE_TB_DEVICE != null)
  2671. {
  2672. foreach (DataRow dr in DB_TABLE_TB_DEVICE)
  2673. {
  2674. if (_Convert.Exception_Into_object(dr[3], dr[4], dr[5], dr[6], dr[7]) == true)
  2675. {
  2676. // 매개변수 순서 => COMM_ID, BOARD_ID, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE
  2677. MskDeviceIDString dev_s = new MskDeviceIDString(
  2678. _Convert.Null_to_IntZero(dr[3].ToString()),
  2679. _Convert.Null_to_IntZero(dr[4].ToString()),
  2680. _Convert.Null_to_IntZero(dr[5].ToString()),
  2681. _Convert.Null_to_IntZero(dr[6].ToString()),
  2682. _Convert.Null_to_IntZero(dr[7].ToString()),
  2683. dr[8].ToString(), Seleted_RECEIVER_ID); // cyim 2016.12.05 : 수신기 모델별 내부 로직 변경
  2684. GridEXRow row;
  2685. row = GridEX_Device.AddItem();
  2686. row.BeginEdit();
  2687. row.Cells["Number"].Value = i++;
  2688. row.Cells["ID"].Value = dev_s.MskId;
  2689. row.Cells["DeviceType"].Value = dr[0].ToString();
  2690. row.Cells["Position"].Value = dr[1].ToString();
  2691. row.Cells["DeviceName"].Value = dr[2].ToString();
  2692. row.EndEdit();
  2693. }
  2694. }
  2695. }
  2696. }
  2697. }
  2698. // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오)
  2699. GridexDevice_ChangeColor_By_TEMP();
  2700. GridexDevice_ChangeColor_By_HASH();
  2701. }
  2702. // 디바이스창에서 회로번호를 토대로 색상 반영
  2703. // 단, 이렇게 사용하면 느려질수 있다. 하지만 현재 색상을 적용하려면 이 방법외에 데이타베이스에 직접 필드를 추가하여 현재 적용된것인지 아닌지를 판단해야하는데
  2704. // 현재 데이타베이스를 직접 수정하는 것은 지양하므로 퍼포먼스에 영향이 있을지 모르나 일단 이렇게 구현한다
  2705. // 향후 이 루틴에서 속도가 현저하게 떨어지는 상황이 발생한다면 데이타베이스에서 처리하도록 해야한다
  2706. // 디바이스 조회창 색상 반영 (임시 저장소 정보를 토대로 보여준다)
  2707. public void GridexDevice_ChangeColor_By_TEMP()
  2708. {
  2709. //
  2710. // 부하가 걸린다..구조상 어쩔수없다.. 삭제하려면 Device_Oper_ID 가 널인 조건인데 이미 돌리고 있는 디바이스 아이콘 리스트에는 그 정보가 없다. (상위 설명과 동일함)
  2711. //
  2712. GridEXRow[] GridEx_Rows = this.GridEX_Device.GetRows();
  2713. foreach (GridEXRow row in GridEx_Rows)
  2714. {
  2715. row.BeginEdit();
  2716. row.Cells["Apply"].Value = "NOT";
  2717. row.EndEdit();
  2718. }
  2719. //
  2720. // 현재 임시 리스트를 모두 뒤져보자
  2721. //
  2722. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2723. {
  2724. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device)
  2725. {
  2726. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID != null)
  2727. _Gridex.Column_Data_Edit(this.GridEX_Device, "ID=" + ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID, "Apply=" + "TEMP");
  2728. }
  2729. }
  2730. this.GridEX_Device.ResumeLayout();
  2731. }
  2732. // 디바이스 조회창 색상 반영 (임시 저장소가 아닌 진짜 해쉬테이블 정보를 토대로 보여준다)
  2733. public void GridexDevice_ChangeColor_By_HASH()
  2734. {
  2735. //
  2736. // 전 페이지를 모두 뒤져보자.
  2737. //
  2738. foreach (string PAGE_ID in ((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).LIST_PAGE_ID)
  2739. {
  2740. ArrayList temp_list_icon_id = ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[PAGE_ID]).LIST_ICON_ID;
  2741. Hashtable temp_hash_icon = ((_Page)((_RECEIVER)_Data.HASH_RECEIVER[Seleted_RECEIVER_ID]).HASH_PAGE[PAGE_ID]).HASH_ICON;
  2742. foreach (string ICON_ID in temp_list_icon_id)
  2743. {
  2744. if (((_PictureBoxItem)temp_hash_icon[ICON_ID]).ItemType == Item_Type.Device)
  2745. {
  2746. if (((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_Oper_ID != null)
  2747. _Gridex.Column_Data_Edit(this.GridEX_Device, "ID=" + ((_PictureBoxItem)temp_hash_icon[ICON_ID]).Device_Oper_ID, "Apply=" + "HASH");
  2748. }
  2749. }
  2750. }
  2751. this.GridEX_Device.ResumeLayout();
  2752. }
  2753. //** 디바이스 클리어버튼
  2754. private void uiButton_Device_Clear_Click(object sender, EventArgs e)
  2755. {
  2756. UiComboBox_Device_InOut.Text = null;
  2757. UiComboBox_Board.Text = null;
  2758. UiComboBox_Channel.Text = null;
  2759. UiComboBox_Repeater.Text = null;
  2760. EditBox_Position.Text = null;
  2761. CheckedComboBox_DeviceType.Text = null;
  2762. EditBox_DeviceName.Text = null;
  2763. GridEX_Device.ClearItems();
  2764. }
  2765. //** 통신보드 콤보박스 Changing
  2766. private void UiComboBox_Board_SelectedValueChanged(object sender, EventArgs e)
  2767. {
  2768. // 먼저 UiComboBox_Channel 콤보박스를 클리어시킴
  2769. UiComboBox_Channel.Items.Clear();
  2770. UiComboBox_Channel.Text = null;
  2771. // UiComboBox_Board.Text가 공백이면 리턴
  2772. if (UiComboBox_Board.Text.Length == 0) return;
  2773. DataRowCollection DB_TABLE_TB_BOARD = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_BoardTable("1", UiComboBox_Board.Text, "Y", Seleted_RECEIVER_ID));
  2774. if (DB_TABLE_TB_BOARD != null)
  2775. {
  2776. // 공백도 하나 넣어둠
  2777. if (UiComboBox_Channel.Items.Contains("") == false) UiComboBox_Channel.Items.Add("");
  2778. foreach (DataRow dr in DB_TABLE_TB_BOARD)
  2779. {
  2780. if (dr[4].ToString() == "Y")
  2781. {
  2782. if (UiComboBox_Channel.Items.Contains("0") == false)
  2783. UiComboBox_Channel.Items.Add("CH1");
  2784. }
  2785. if (dr[5].ToString() == "Y")
  2786. {
  2787. if (UiComboBox_Channel.Items.Contains("1") == false)
  2788. UiComboBox_Channel.Items.Add("CH2");
  2789. }
  2790. if (dr[16].ToString() == "Y")
  2791. {
  2792. if (UiComboBox_Channel.Items.Contains("1") == false)
  2793. UiComboBox_Channel.Items.Add("CH3");
  2794. }
  2795. if (dr[17].ToString() == "Y")
  2796. {
  2797. if (UiComboBox_Channel.Items.Contains("1") == false)
  2798. UiComboBox_Channel.Items.Add("CH4");
  2799. }
  2800. }
  2801. // 정렬
  2802. UiComboBox_Channel.Items.Sort();
  2803. }
  2804. }
  2805. //** 채널 콤보박스 Changing
  2806. private void UiComboBox_Channel_SelectedValueChanged(object sender, EventArgs e)
  2807. {
  2808. // 먼저 UiComboBox_Repeater 콤보박스를 클리어시킴
  2809. UiComboBox_Repeater.Items.Clear();
  2810. UiComboBox_Repeater.Text = null;
  2811. // UiComboBox_Board.Text 및 UiComboBox_Channel.Text가 공백이면 리턴
  2812. if (UiComboBox_Board.Text.Length == 0) return;
  2813. if (UiComboBox_Channel.Text.Length == 0) return;
  2814. DataRowCollection DB_TABLE_TB_REPEATER = _Db.ExecuteRead_SqlDataAdapter(_Sql.Search_RepeaterTable("1", UiComboBox_Board.Text, _Data.UI_CH_TO_LOOP(UiComboBox_Channel.Text), Seleted_RECEIVER_ID));
  2815. if (DB_TABLE_TB_REPEATER != null)
  2816. {
  2817. // 공백도 하나 넣어둠
  2818. if (UiComboBox_Repeater.Items.Contains("") == false) UiComboBox_Repeater.Items.Add("");
  2819. foreach (DataRow dr in DB_TABLE_TB_REPEATER)
  2820. {
  2821. if (UiComboBox_Repeater.Items.Contains(dr[4].ToString()) == false)
  2822. UiComboBox_Repeater.Items.Add(dr[4].ToString());
  2823. }
  2824. // 정렬
  2825. UiComboBox_Repeater.Items.Sort();
  2826. }
  2827. }
  2828. //** CheckedComboBox_DeviceType콤보박스에 체크가 변경될때마다 발생하는 이벤트
  2829. private void CheckedComboBox_DeviceType_CheckedValuesChanged(object sender, EventArgs e)
  2830. {
  2831. //** DeviceType을 ArrayList에 저장하기 위해서
  2832. DeviceType.Clear();
  2833. //** sender을 이용하는 이유는 clear를 했을때를 알기 위해서
  2834. CheckedComboBox checkedcombobox = (CheckedComboBox)sender;
  2835. //** 이렇게 하는 이유는 clear버튼을 사용해 텍스트를 클리어 했을 때에, 콤보박스는 이전에 선택했을 값을 가지고 있다고 여김
  2836. // 그래서 아래의 속성으로 clear버튼을 클릭했을 때에는 해당 루틴을 타지 못하게 함
  2837. if (checkedcombobox.Text.Length != 0)
  2838. {
  2839. // 아래와 같이 포커스를 주는 이유는 야누스 콤포넌트의 에러 때문이다
  2840. uiButton_Device_Inq.Focus();
  2841. // 콤보박스에 체크되어 있는 것만 알기 위해서
  2842. GridEXRow[] GridEx_Rows = this.CheckedComboBox_DeviceType.DropDownList.GetRows();
  2843. foreach (GridEXRow row in GridEx_Rows)
  2844. {
  2845. if (row.Cells["Check"].Value.ToString() == "True")
  2846. DeviceType.Add(row.Cells["Device_Type"].Value.ToString());
  2847. }
  2848. }
  2849. }
  2850. // 연동버튼 클릭 전에 사전 검사 (정상인 경우에만 디바이스명이 리턴됨, 아니라면 null)
  2851. private string uiButton_Device_Apply_Verify()
  2852. {
  2853. // 디바이스 연동알림 팝업창이 켜져있는 경우에는 실행 못함
  2854. if (Popup_DeviceOper == null || Popup_DeviceOper.Visible == true)
  2855. return null;
  2856. // 리스트에 포커스는 반드시 1개
  2857. if (GridEX_Device.SelectedItems.Count != 1)
  2858. {
  2859. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.OnlyOneSelectedGridEx, 0);
  2860. return null;
  2861. }
  2862. // 워크뷰에서 선택한 아이템이 없다면 클릭해도 소용없다, 단 1개만 선택되어야 한다 또한 반드시 디바이스 아이콘이어야 한다
  2863. int Selected_ICON_Count = 0;
  2864. string Selected_ICON_Name = null;
  2865. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2866. {
  2867. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true && ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device)
  2868. {
  2869. Selected_ICON_Count++;
  2870. Selected_ICON_Name = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Icon_NAME;
  2871. }
  2872. }
  2873. // 반드시 아이콘은 1개만 사용, 또한 선택
  2874. if (Selected_ICON_Count != 1 || Selected_ICON_Name == null)
  2875. {
  2876. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.OnlyOneSelectedICON, 0);
  2877. return null;
  2878. }
  2879. return Selected_ICON_Name;
  2880. }
  2881. // 연동버튼 클릭
  2882. private void uiButton_Device_Apply_Click(object sender, EventArgs e)
  2883. {
  2884. string result = uiButton_Device_Apply_Verify();
  2885. if (result != null)
  2886. {
  2887. // 회로번호
  2888. string Temp_Selected_DeviceInfo = this.GridEX_Device.CurrentRow.Cells["ID"].Value.ToString();
  2889. // 아이템명
  2890. string Temp_Selected_PictureBoxItem = result;
  2891. // 팝업창 준비
  2892. if (Popup_DeviceOper != null) Popup_DeviceOper.Close();
  2893. Popup_DeviceOper = new Form();
  2894. // 선택한 아이템과 디바이스를 연동하시겠습니까
  2895. Popup_DeviceOper = _Popup.Create(Popup_Type.Dialog, Popup_Style.Normal, _Text.OK, 600, 150,
  2896. _Text.DeviceOperSave + " [" + _Text.DeviceOperSave_OperID + Temp_Selected_DeviceInfo + "] = ["
  2897. + _Text.DeviceOperSave_Item + Temp_Selected_PictureBoxItem + " ]", 0);
  2898. // 대화 팝업은 특별처리
  2899. _Event.PopupClose_SendMessage_Event += new _Event.PopupClose_SendMessage_Handler(_Event_DeviceOperSave_PopupClose_SendMessage_Event);
  2900. }
  2901. }
  2902. // 디바이스 연동 적용 이벤트
  2903. public void _Event_DeviceOperSave_PopupClose_SendMessage_Event(object sender, object etc)
  2904. {
  2905. // 대화 팝업 주체
  2906. Form popup = (Form)sender;
  2907. if (Popup_DeviceOper.Name == popup.Name && etc.ToString() == _Text.OK)
  2908. {
  2909. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2910. {
  2911. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Selected == true)
  2912. {
  2913. // 상태창 반영
  2914. UI_Status_Write(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]));
  2915. // 트리에 반영
  2916. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button)
  2917. {
  2918. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 350, 150, _Text.OnlyButtonSelectedICON, 0);
  2919. return;
  2920. }
  2921. else
  2922. {
  2923. // 디바이스 아이디가 회로번호이므로 반영
  2924. // 트리 검색
  2925. TreeNode EditNode = _Tree.GetNode_By_Name(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name);
  2926. ///
  2927. /// 동적 할당 변수 처리
  2928. ///
  2929. // 디바이스 연동 회로 아이디
  2930. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID = this.GridEX_Device.CurrentRow.Cells["ID"].Value.ToString();
  2931. // 디바이스 연동 명칭
  2932. ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_DB_Name = this.GridEX_Device.CurrentRow.Cells["DeviceName"].Value.ToString();
  2933. // 트리에 반영
  2934. EditNode.Text = ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).NodeText();
  2935. // 오브젝트 트리 색상 반영 (디바이스)
  2936. _Tree.ChangeColor_By_Data(this.treeView_ObjectTree, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Name, ((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID);
  2937. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  2938. ObjectTree_RootNodeUpdate();
  2939. // 디바이스 조회창 색상 반영 초기화 (순서는 절대 바꾸지 마십시오)
  2940. GridexDevice_ChangeColor_By_TEMP();
  2941. GridexDevice_ChangeColor_By_HASH();
  2942. }
  2943. break;
  2944. }
  2945. }
  2946. }
  2947. // 대화 팝업은 특별처리
  2948. _Event.PopupClose_SendMessage_Event -= new _Event.PopupClose_SendMessage_Handler(_Event_DeviceOperSave_PopupClose_SendMessage_Event);
  2949. }
  2950. ///
  2951. /// 오브젝트 트리 노드
  2952. ///
  2953. // 노드를 선택하면 해당 아이콘이 점멸된다
  2954. private void treeView_ObjetTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  2955. {
  2956. // 선택한 노드 정보와 일치하는 픽쳐박스
  2957. _PictureBoxItem PictureBoxItem = null;
  2958. // 오른쪽마우스를 누르면 왼쪽마우스 버튼을 누른것처럼 포커스를 이동한다
  2959. treeView_ObjectTree.SelectedNode = treeView_ObjectTree.GetNodeAt(e.X, e.Y);
  2960. // 아이템 (디바이스 아이콘 혹은 버튼 아이콘 선택 초기화)
  2961. pictureBox_SeletedStatusInitialize();
  2962. // 선택한 노드의 아이디를 토대로 아이템을 찾는다
  2963. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  2964. {
  2965. if (e.Node.Name == ICON_ID)
  2966. {
  2967. PictureBoxItem = (_PictureBoxItem)TEMP_HASH_ICON[ICON_ID];
  2968. break;
  2969. }
  2970. }
  2971. // 노드를 찾지 못하면 실행 안함
  2972. if (PictureBoxItem != null)
  2973. {
  2974. // 선택
  2975. Selected_PictureBoxItem = null;
  2976. // 상태갱신
  2977. UI_Status_Write(PictureBoxItem);
  2978. // 선택
  2979. Selected_PictureBoxItem = PictureBoxItem;
  2980. // 선택시 스타일 변경 (주변에 네모박스 보이도록 출력)
  2981. Selected_PictureBoxItem.Selected = true;
  2982. Selected_PictureBoxItem.ShapeContainer_Seleted.Visible = true;
  2983. }
  2984. // 오른쪽 마우스 버튼
  2985. if (e.Button == System.Windows.Forms.MouseButtons.Right)
  2986. {
  2987. // 페이지 노드
  2988. if (e.Node.Level == 0)
  2989. {
  2990. // 아이콘 전체삭제
  2991. _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location,
  2992. _Text.IconAllDel,
  2993. treeView_ObjectTree_Menustrip_ItemClicked);
  2994. }
  2995. else if (e.Node.Level == 1)
  2996. {
  2997. if (e.Node.Name == "DEVICE")
  2998. {
  2999. // 디바이스 전체삭제
  3000. // 디바이스연동 전체초기화
  3001. _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location,
  3002. _Text.DeviceLinkAllClear + ";" +
  3003. _Text.ContextStripSeparator + ";" +
  3004. _Text.DeviceAllDel,
  3005. treeView_ObjectTree_Menustrip_ItemClicked);
  3006. }
  3007. else if (e.Node.Name == "BUTTON")
  3008. {
  3009. // 버튼 전체삭제
  3010. // 점프페이지 전체초기화
  3011. _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location,
  3012. _Text.ButtonJumpAllClear + ";" +
  3013. _Text.ContextStripSeparator + ";" +
  3014. _Text.ButtonAllDel,
  3015. treeView_ObjectTree_Menustrip_ItemClicked);
  3016. }
  3017. }
  3018. else if (e.Node.Level == 2)
  3019. {
  3020. if (e.Node.ImageIndex == (int)Object_Type.DEVICE_DETAIL)
  3021. {
  3022. // 디바이스 삭제
  3023. // 디바이스연동 초기화
  3024. _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location,
  3025. _Text.DeviceLinkClear + ";" +
  3026. _Text.ContextStripSeparator + ";" +
  3027. _Text.DeviceDel,
  3028. treeView_ObjectTree_Menustrip_ItemClicked);
  3029. }
  3030. else if (e.Node.ImageIndex == (int)Object_Type.BUTTON_DETAIL)
  3031. {
  3032. // 버튼 삭제
  3033. // 점프페이지 초기화
  3034. _Contextmenustrip.Create(this.treeView_ObjectTree, e.Location,
  3035. _Text.ButtonJumpClear + ";" +
  3036. _Text.ContextStripSeparator + ";" +
  3037. _Text.ButtonDel,
  3038. treeView_ObjectTree_Menustrip_ItemClicked);
  3039. }
  3040. }
  3041. }
  3042. // 왼쪽 마우스 버튼
  3043. else
  3044. {
  3045. if (Selected_PictureBoxItem != null)
  3046. {
  3047. // 버튼 아이콘이라면 상태바에서 점프페이지 선택가능함
  3048. if (Selected_PictureBoxItem.ItemType == Item_Type.Button)
  3049. {
  3050. this.uiComboBox_Status_Jump.ReadOnly = false;
  3051. this.uiComboBox_Status_Jump.BackColor = System.Drawing.Color.White;
  3052. if (Selected_PictureBoxItem.Button_JumpPageName != null
  3053. && Selected_PictureBoxItem.Button_JumpPageName.Length != 0
  3054. && Selected_PictureBoxItem.Button_JumpPageName != _Text.None)
  3055. this.uiComboBox_Status_Jump.Text = Selected_PictureBoxItem.Button_JumpPageName;
  3056. else
  3057. this.uiComboBox_Status_Jump.Text = _Text.None;
  3058. }
  3059. // 디바이스 아이콘이라면 상태바에서 점프페이지 선택불가
  3060. else
  3061. {
  3062. this.uiComboBox_Status_Jump.ReadOnly = true;
  3063. this.uiComboBox_Status_Jump.BackColor = System.Drawing.SystemColors.MenuBar;
  3064. this.uiComboBox_Status_Jump.Text = _Text.None;
  3065. }
  3066. }
  3067. }
  3068. }
  3069. public void treeView_ObjectTree_Menustrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  3070. {
  3071. // 호출한 것은 감추기
  3072. ContextMenuStrip menustrip = (ContextMenuStrip)sender;
  3073. // 잔상 삭제
  3074. menustrip.Hide();
  3075. // 아이콘 전체삭제
  3076. if (e.ClickedItem.Text == _Text.IconAllDel)
  3077. {
  3078. Common_IconAllDel();
  3079. }
  3080. // 디바이스 전체삭제
  3081. else if (e.ClickedItem.Text == _Text.DeviceAllDel)
  3082. {
  3083. Common_DeviceAllDel();
  3084. }
  3085. // 디바이스연동 전체초기화
  3086. else if (e.ClickedItem.Text == _Text.DeviceLinkAllClear)
  3087. {
  3088. Common_DeviceLinkAllClear();
  3089. }
  3090. // 버튼 전체삭제
  3091. else if (e.ClickedItem.Text == _Text.ButtonAllDel)
  3092. {
  3093. Common_ButtonAllDel();
  3094. }
  3095. // 점프페이지 전체초기화
  3096. else if (e.ClickedItem.Text == _Text.ButtonJumpAllClear)
  3097. {
  3098. Common_ButtonJumpAllClear();
  3099. }
  3100. // 디바이스 삭제
  3101. else if (e.ClickedItem.Text == _Text.DeviceDel)
  3102. {
  3103. Common_IconSelDel();
  3104. }
  3105. // 디바이스연동 초기화
  3106. else if (e.ClickedItem.Text == _Text.DeviceLinkClear)
  3107. {
  3108. Common_DeviceLinkClear();
  3109. }
  3110. // 버튼 삭제
  3111. else if (e.ClickedItem.Text == _Text.ButtonDel)
  3112. {
  3113. Common_IconSelDel();
  3114. }
  3115. // 점프페이지 초기화
  3116. else if (e.ClickedItem.Text == _Text.ButtonJumpClear)
  3117. {
  3118. Common_ButtonJumpClear();
  3119. }
  3120. }
  3121. //
  3122. // 오브젝트 트리 부모 노드에 총개수 와 연동 개수를 표시한다
  3123. //
  3124. public void ObjectTree_RootNodeUpdate()
  3125. {
  3126. // 아이콘의 총 개수 및 적용 개수를 파악하기 위한 변수
  3127. int ButtonIcon_AllCnt = 0;
  3128. int ButtonIcon_ApplyCnt = 0;
  3129. int DeviceIcon_AllCnt = 0;
  3130. int DeviceIcon_ApplyCnt = 0;
  3131. foreach (string ICON_ID in TEMP_LIST_ICON_ID)
  3132. {
  3133. // 버튼 아이콘의 경우 처리
  3134. if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Button)
  3135. {
  3136. // 개수 파악
  3137. ButtonIcon_AllCnt++;
  3138. if (_Data.Get_Verify_ID(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Button_JumpPageName) != "0") ButtonIcon_ApplyCnt++;
  3139. }
  3140. // 디바이스 아이콘의 경우 처리
  3141. else if (((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).ItemType == Item_Type.Device)
  3142. {
  3143. // 개수 파악
  3144. DeviceIcon_AllCnt++;
  3145. if (_Data.Get_Verify_ID(((_PictureBoxItem)TEMP_HASH_ICON[ICON_ID]).Device_Oper_ID) != "0") DeviceIcon_ApplyCnt++;
  3146. }
  3147. }
  3148. // 트리에 표시
  3149. _Tree.SetNodeText_By_Name(this.treeView_ObjectTree, _Text.UI_TREE_BUTTON_ICON,
  3150. string.Format("{0} [총합:{1} 적용:{2}]", _Text.UI_TREE_BUTTON_ICON, ButtonIcon_AllCnt, ButtonIcon_ApplyCnt));
  3151. _Tree.SetNodeText_By_Name(this.treeView_ObjectTree, _Text.UI_TREE_DEVICE_ICON,
  3152. string.Format("{0} [총합:{1} 적용:{2}]", _Text.UI_TREE_DEVICE_ICON, DeviceIcon_AllCnt, DeviceIcon_ApplyCnt));
  3153. }
  3154. // 아이콘 잠금 기능
  3155. private void UI_Base_IconLock(bool Enable)
  3156. {
  3157. if (Enable == true)
  3158. {
  3159. this.uiCheckBox_IconLock.Checked = true;
  3160. this.uiCheckBox_IconLock.Text = "LOCK";
  3161. this.uiCheckBox_IconLock.BackColor = Color.Red;
  3162. }
  3163. else
  3164. {
  3165. this.uiCheckBox_IconLock.Checked = false;
  3166. this.uiCheckBox_IconLock.Text = "UNLOCK";
  3167. this.uiCheckBox_IconLock.BackColor = Color.Transparent;
  3168. }
  3169. }
  3170. // 아이콘 잠금
  3171. private void uiCheckBox_IconLock_CheckedChanged(object sender, EventArgs e)
  3172. {
  3173. UI_Base_IconLock(this.uiCheckBox_IconLock.Checked);
  3174. }
  3175. // 디바이스 조회창에서 카운트 결과 표시
  3176. private void uiButton_Device_Result_Click(object sender, EventArgs e)
  3177. {
  3178. // 현재 조회창
  3179. GridEXRow[] GridEx_Rows = this.GridEX_Device.GetRows();
  3180. // 조회창의 총개수
  3181. int Cnt_All = 0;
  3182. // 조회창의 연동미적용수
  3183. int Cnt_OperNot = 0;
  3184. // 조회창의 연동미적용 중의 마지막 순번
  3185. string Last_Number = null;
  3186. foreach (GridEXRow row in GridEx_Rows)
  3187. {
  3188. Cnt_All++;
  3189. if (row.Cells["Apply"].Value == null
  3190. || row.Cells["Apply"].Value.ToString().Trim().Length == 0
  3191. || row.Cells["Apply"].Value.ToString() == "NOT"
  3192. || row.Cells["Apply"].Value.ToString() == _Text.Blank)
  3193. {
  3194. Cnt_OperNot++;
  3195. Last_Number = row.Cells["Number"].Value.ToString();
  3196. }
  3197. }
  3198. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 500, 150, string.Format(_Text.DeviceOperResult, Cnt_All, Cnt_OperNot, Last_Number), 0);
  3199. }
  3200. }
  3201. }