c5933aa5dbda005c7c6ebbadec62fd5805aa0ce1.svn-base 245 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using Microsoft.Win32;
  9. using System.Net;
  10. using System.Diagnostics;
  11. using System.IO;
  12. using System.Collections;
  13. using System.Threading;
  14. using System.Media;
  15. // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
  16. using MouseKeyboardActivityMonitor;
  17. using MouseKeyboardActivityMonitor.WinApi;
  18. using System.Runtime.InteropServices;
  19. using FirebirdSql.Data.FirebirdClient;
  20. namespace FPER
  21. {
  22. // cyim 2015.7.6 : 불필요한 파일 및 소스를 정리
  23. // 기존 코드들이 중복되거나 사용되지 않는 함수와 변수가 너무 많음
  24. //-> _Timet.cs, Data.cs, Form_AnalogDetecter.cs 추가
  25. //-> frmModalIDInput.cs, frmmainsetting.cs frmConfigFileRead.cs frmBatteryTest.cs frmAlarmLogPost.cs, frmAlarmLog.cs 삭제
  26. //-> MDIParent_btnMeneConst.cs frmReceiverConfig_repeaterTab.cs 병합
  27. public partial class MDIParent : Form
  28. {
  29. //선택한 메뉴항목
  30. private int selectMenuIndex = -1;
  31. public string temptxtBoardID, temptxtLoopNo;
  32. // cyim 2013.6.27 : 수신기 설정 -> 중계기 쓰기 버튼 이후 데몬 초기화 되지 않는 문제
  33. public SocketUI socketUI;
  34. // 1280 * 1024모드가 아닌경우 화면이동을 위해
  35. private Boolean MDIMove = false;
  36. private Point mouseOffset;
  37. // 수신기 아이디 정보
  38. public int myReceiverID = -1;
  39. public int MyReceiverID { get { return this.myReceiverID; } set { this.myReceiverID = value; } } // cyim 2015.7.29 인덱서 읽기전용이였지만, 수신반루틴을 위해 삭제 // cyim 2015.8.4 수신반을 위한 static 클래스 정리 : 경고 삭제
  40. // 백업 (60분 타이머)
  41. private DateTime myDbBackUpDate = DateTime.Parse("1999-01-01");
  42. //mdi
  43. IWin32Window window;
  44. IWin32Window winMsg;
  45. IWin32Window winLogin;
  46. IWin32Window winWaittingMsg;
  47. public IWin32Window winBatteryTestMsg;
  48. frmWarningBox warningForm;
  49. frmWarningBox warningForm2;
  50. frmWarningBox warningForm3 = null;
  51. frmLogin loginForm;
  52. frmWaitingMsg waittingForm;
  53. // 예비 시험 테스트 화면
  54. public frmDriveTest winDriveTestForm; //k.s.d 20101023, drivertest form class.
  55. // cyim 2015.7.6 속도개선작업 : 이벤트로그용 데이타 (현재내역용)
  56. // 기존 코드 분석 결과... 컨셉은 디바이스 정보와 EventType 이 동일한 것만 따진다고 볼 수 있다.
  57. // EventType 의 경우 OM, OR 과 같은 이벤트 Length 2 인 일종의 명령어 타입이라고 이해해야 한다
  58. // 기존의 코드가 이렇게 구성되어 있어서 일단 유지하지만, 이벤트 리스트를 Full Scan 해야되므로 성능 저하를 시킬수 있는 요지가 있다
  59. // 대안은 Hash 를 이용해야 하면 되는데 고유 디바이스 정보를 해쉬 키로 두고, 이에 대한 현재 명령어 값을 보기만 하면 된다.
  60. // 해쉬 리스트 구현 방법은 아래와 같다
  61. // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  62. // 데이타 : EventLogInfo 클래스
  63. public Hashtable arrayListLog = new Hashtable();
  64. public Hashtable AryEventLogs { get { return this.arrayListLog; } }
  65. // 화면 오른쪽상단의 상태 라벨에 표시
  66. public ArrayList LEDList = new ArrayList();
  67. // 화재 표시용 리스트
  68. public ArrayList FireList = new ArrayList();
  69. // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
  70. public ArrayList FireList_Accumulation = new ArrayList();
  71. // 설비 동작 표시용 리스트
  72. public ArrayList EquipList = new ArrayList();
  73. // 상태 라벨 카운트
  74. public int LEDCount = 0;
  75. // cyim 2017.01.18 : 신규 스위치 정보 표시
  76. // 펌프 스위치 상태 (0 : 정지, 1 : 자동 2 : 수동)
  77. public int Pump_1 = 0;
  78. public int Pump_2 = 0;
  79. public int Pump_3 = 0;
  80. public int Pump_4 = 0;
  81. public int Pump_5 = 0;
  82. public int Pump_6 = 0;
  83. public int Pump_7 = 0;
  84. public int Pump_8 = 0;
  85. // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
  86. public bool CheckBtn_Current_Status = false;
  87. // cyim 2014.7.18 : 데몬이 늦게 출력되어 포커스를 잃어버리면 작업바가 나타난다
  88. public int timer_MdiParent_TopMost_Cnt = 0;
  89. public bool timer_MdiParent_TopMost = false;
  90. // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
  91. public bool MonitorDaemon_Enable = false; // 모니터데몬에 접속할 수 있는지 옵션 체크 정보
  92. public string MonitorDaemon_IP = null; // 모니터데몬 아이피
  93. public bool MonitorDaemon_ComStatus = true; // 모니터데몬 통신상태 // 특별테스트
  94. public Hashtable NetworkReceiver_ID_ComStatus = new Hashtable(); // 타수신기 아이피와 통신상태 (해쉬)
  95. public ArrayList NetworkReceiver_ID_List = new ArrayList(); // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
  96. public int MonitorDaemon_Chk_Cnt = 0; // 특정 주기마다 모니터데몬에 접속
  97. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  98. public bool Before_MonitorDaemon_ComStatus = true; // 모니터데몬의 이전값
  99. public Hashtable Before_NetworkReceiver_ID_ComStatus = new Hashtable();
  100. // cyim 2014.8.12 네트워크 수신기 통신상태 문제 수정 (동시에 이벤트 발생시 UI 에서 처리하려면 큐가 아니라서 결국 CriticalSection 으로 처리해야함)
  101. public object CS_MonitorDaemon_ComStatus = new object();
  102. // cyim 2015.2.9 데몬 연결 상태 체크
  103. public bool CommDaemon_ComStatus = true;
  104. //
  105. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  106. //
  107. // 폼활성화 여부 변수
  108. public bool Form_Active_frmDriveTest = false;
  109. // 예비전원 이상
  110. public bool Battery_TestError = false;
  111. // 교류전원 이상
  112. public bool AC_TestError = false;
  113. // 아날로그 감지기
  114. public _AnalogDetect AnalogDetect = new _AnalogDetect();
  115. // 팝업창
  116. public _Popup Popup = null;
  117. // cyim 2016.12.06 : 강제쿼리 - 추가로 필요한 데이타베이스 정리
  118. public _ExternalInitial ExternalInitial = new _ExternalInitial();
  119. // 이벤트 타입 정의
  120. public _EventTypeName EventTypeName = new _EventTypeName();
  121. // 스레드
  122. public _Thread Thread = new _Thread();
  123. // 클라이언트
  124. public _TcpComClient TcpComClient = null;
  125. // 타이머
  126. public _Timer_WindowBase Timer_WindowBase = new _Timer_WindowBase();
  127. // 이벤트
  128. public _Event Event = new _Event();
  129. // cyim 2015.9.23 시간정보 표시 오류 (갱신을 안함)
  130. public string MyTime = null;
  131. //
  132. //화면에 누적카운트 표시하는 대리자
  133. //
  134. delegate void SetVoidCallback();
  135. delegate void SetTextCallback(int cnt);
  136. delegate void SetVoltageCallback(float cnt);
  137. delegate void SetMsgCntCallback(string msg, int processValue);
  138. delegate void SetBoolCallback(bool mode);
  139. delegate void SetBoolIntCallback(bool mode, int status);
  140. //메세지박스를 띄우는 대리자
  141. delegate void ShowFormCallback(MappingStatus sta, String msg, String deviceMsg);
  142. //로그인화면을 띄우는 대리자
  143. delegate void ShowFormLogin(Form frm);
  144. //수신기 기본설정정보 VO(축적여부,화재모드,관리자ID....)
  145. private ReceiverConfigVo ConfigVO;
  146. // cyim 2016.03.21 : 전원값 화면에 표시못하는 문제 보완
  147. public string Power_Main_vol24 = null;
  148. // cyim 2016.06.15 : 화재 음원 출력
  149. //public SoundPlayer SoundPlayer_AlarmPopupSound = new SoundPlayer(Properties.Resources.emergency);
  150. public SoundPlayer SoundPlayer_AlarmPopupSound = null;
  151. public int SoundPlayer_AlarmPopupSound_Count = 0;
  152. // cyim 2016.12.06 : 수신기 모델 변수 추가
  153. public string ReceiverModel = "";
  154. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  155. public bool MDIReceiverConfig_Change_Flag = false;
  156. // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
  157. public static KeyboardHookListener m_KeyboardHookManager;
  158. // cyim 2016.12.28 : 예외처리 추가
  159. public _Ethernet Ethernet = new _Ethernet();
  160. LogFileCreate LFC = new LogFileCreate();
  161. // 생성자
  162. public MDIParent(int ID, _Event evt)
  163. {
  164. InitializeComponent();
  165. // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
  166. if (_Data.FireDeskMode == false && _Data.Hook_Enable != "OFF")
  167. {
  168. _Hook.Disable_TaskMgr();
  169. _Hook.Disable_NoClose();
  170. GimmeTray();
  171. m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker());
  172. m_KeyboardHookManager.Enabled = true;
  173. }
  174. // cyim 2016.11.11 : 비상 음원 출력 음원 파일 없을때 대응 코드 추가
  175. if (File.Exists(Environment.CurrentDirectory + "\\emergency.wav") == true)
  176. SoundPlayer_AlarmPopupSound = new SoundPlayer(Environment.CurrentDirectory + "\\emergency.wav");// cyim 2016.06.24 : 음원 출력시 교체 가능
  177. // cyim 2015.7.29 수신반 루틴을 위해 외부 파라미터로 동작하도록 수정
  178. myReceiverID = ID;
  179. this.ImgChangeBtnMenu6n();//ImgChangeBtnMenu6o,n,d
  180. // cyim 2015.8.4 수신반을 위한 static 클래스 정리 : fDesk 가 메인이다.
  181. if (evt != null)
  182. Event = evt;
  183. // cyim 2016.12.16 : 수신반의 경우 MDIParent의 숨김 버튼을 닫기 버튼으로 대체한다
  184. //else
  185. // this.button_Hide.Visible = false; // cyim 2015.8.19 수신반모드가 아닐때는 최소화버튼이 필요없다
  186. }
  187. // 선택한 메뉴 인덱스에 따라 버튼 이미지를 변경함
  188. public int SelectMenuIndex
  189. {
  190. get { return this.selectMenuIndex; }
  191. set
  192. {
  193. this.selectMenuIndex = value; //이전버튼은 선택해제 시킨다.
  194. if (this.selectMenuIndex != 1) { this.ImgChangeBtnMenu1n(); }
  195. if (this.selectMenuIndex != 2) { this.ImgChangeBtnMenu2n(); }
  196. if (this.selectMenuIndex != 3) { this.ImgChangeBtnMenu3n(); }
  197. if (this.selectMenuIndex != 4) { this.ImgChangeBtnMenu4n(); }
  198. if (this.selectMenuIndex != 5) { this.ImgChangeBtnMenu5n(); }
  199. if (this.selectMenuIndex != 6) { this.ImgChangeBtnMenu6n(); }
  200. if (this.selectMenuIndex != 7) { this.ImgChangeBtnMenu7n(); }
  201. if (this.selectMenuIndex == 1) { this.ImgChangeBtnMenu1o(); }
  202. if (this.selectMenuIndex == 2) { this.ImgChangeBtnMenu2o(); }
  203. if (this.selectMenuIndex == 3) { this.ImgChangeBtnMenu3o(); }
  204. if (this.selectMenuIndex == 4) { this.ImgChangeBtnMenu4o(); }
  205. if (this.selectMenuIndex == 5) { this.ImgChangeBtnMenu5o(); }
  206. if (this.selectMenuIndex == 6) { this.ImgChangeBtnMenu6o(); }
  207. if (this.selectMenuIndex == 7) { this.ImgChangeBtnMenu7o(); }
  208. }
  209. }
  210. //
  211. // 환경설정내용
  212. //
  213. public SocketUI ui { get { return this.socketUI; } }
  214. public ReceiverConfigVo MyConfigVO
  215. {
  216. get { return this.ConfigVO; }
  217. set
  218. {
  219. ReceiverConfigVo ConfigVO2 = value;
  220. this.ConfigVO.Fire_accumulation_mode = ConfigVO2.Fire_accumulation_mode;
  221. this.ConfigVO.Fire_accumulation_time = ConfigVO2.Fire_accumulation_time;
  222. this.ConfigVO.Fire_process_mode = ConfigVO2.Fire_process_mode;
  223. this.ConfigVO.Master_user_id = ConfigVO2.Master_user_id;
  224. this.ConfigVO.Master_password = ConfigVO2.Master_password;
  225. this.ConfigVO.Building_name = ConfigVO2.Building_name;
  226. this.ConfigVO.Background_image = ConfigVO2.Background_image;
  227. // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
  228. this.ConfigVO.Jump_field_flag = ConfigVO2.Jump_field_flag;
  229. // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
  230. this.ConfigVO.Test_run_flag = ConfigVO2.Test_run_flag;
  231. // cyim 2014.8.11 화면에 마스터인지 슬레이브인지 표시
  232. this.ConfigVO.Master_flag = ConfigVO2.Master_flag;
  233. //이미 축적일경우에는 RESET하지 않는다.
  234. if (this.ConfigVO.Fire_accumulation_start == false)
  235. {
  236. this.ConfigVO.Fire_accumulation_reset();
  237. this.Display_AccumulSecond();
  238. }
  239. this.Display_FireMode(this.ConfigVO.Fire_process_mode);
  240. //건물명표시
  241. LblBuildingName.Text = this.ConfigVO.Building_name;
  242. // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
  243. if (this.ConfigVO.Test_run_flag == "Y") label_TestRunFlag.Visible = true;
  244. else label_TestRunFlag.Visible = false;
  245. //건물이미지
  246. if (this.ConfigVO.Background_image != null)
  247. {
  248. try
  249. {
  250. Image img = new Bitmap(this.ConfigVO.Background_image);//Image.FromStream(ms);
  251. this.BackgroundImage = img;
  252. }
  253. catch (Exception ex)
  254. {
  255. Util.UErrorMessage(ex, 0, 0);
  256. }
  257. }
  258. }
  259. }
  260. //
  261. // DB 에서 보드, 중계기, 디바이스 정보를 가져온다
  262. //
  263. // 보드
  264. DataTable dtBoardList = null;
  265. public void GetBoardDB()
  266. {
  267. DacBoardConfig dacBoardConfig = new DacBoardConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  268. this.dtBoardList = dacBoardConfig.SelectBoard(this.myReceiverID);
  269. }
  270. // 중계기
  271. DataTable dtRepeaterList2 = null;
  272. public void GetRepeaterDB()
  273. {
  274. DacRepeaterConfig dacRepeaterConfig = new DacRepeaterConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  275. this.dtRepeaterList2 = dacRepeaterConfig.SelectRepeater2(this.myReceiverID);
  276. }
  277. // 아날로그감지기 레벨
  278. DataTable dtAnalogDetecterLevel = null;
  279. public void GetAnalogDetecterLevelDB()
  280. {
  281. DacRepeaterConfig dacRepeaterConfig = new DacRepeaterConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  282. this.dtAnalogDetecterLevel = dacRepeaterConfig.SelectRepeater_AnalogDetecterLevel(this.myReceiverID);
  283. }
  284. // 디바이스
  285. DataTable dtDeviceDBList2 = null;
  286. public void GetDeviceDB()
  287. {
  288. DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  289. this.dtDeviceDBList2 = dacDeviceConfig.SelectDevice2(this.myReceiverID);
  290. }
  291. // cyim 2015.7.1 속도개선작업
  292. // 데이타베이스 파일을 미리 읽도록 하되, DataTable 에 한해서 Foreach -> Select 으로 대체
  293. // DataTable 에서 정보를 가져온다
  294. // 중계기 이름을 얻어온다.
  295. public string GetDeviceName(int BOARD_ID, int LOOP_NO, int REPEATER_ID)
  296. {
  297. string ret = "";
  298. if (this.dtRepeaterList2 != null)
  299. {
  300. // cyim 2015.7.1 속도개선작업
  301. DataRow[] result = this.dtRepeaterList2.Select(
  302. string.Format("BOARD_ID={0} AND LOOP_NO={1} AND REPEATER_ID={2}", BOARD_ID, LOOP_NO, REPEATER_ID));
  303. if (result != null && result.Length > 0)
  304. ret = result[0]["REPEATER_NAME"].ToString();
  305. //foreach (DataRow dr in this.dtRepeaterList2.Rows)
  306. //{
  307. // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["LOOP_NO"].ToString() == LOOP_NO.ToString()
  308. // && dr["REPEATER_ID"].ToString() == REPEATER_ID.ToString())
  309. // {
  310. // ret = dr["REPEATER_NAME"].ToString();
  311. // break;
  312. // }
  313. //}
  314. }
  315. return ret;
  316. }
  317. // 보드명을 가져온다
  318. public string GetDeviceName(int BOARD_ID, int CommID)
  319. {
  320. string ret = "";
  321. if (this.dtBoardList != null)
  322. {
  323. // cyim 2015.7.1 속도개선작업
  324. DataRow[] result = this.dtBoardList.Select(
  325. string.Format("BOARD_ID={0} AND COMM_ID={1}", BOARD_ID, CommID));
  326. if (result != null && result.Length > 0)
  327. ret = result[0]["BOARD_NAME"].ToString();
  328. //foreach (DataRow dr in this.dtBoardList.Rows)
  329. //{
  330. // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["COMM_ID"].ToString() == CommID.ToString())
  331. // {
  332. // ret = dr["BOARD_NAME"].ToString();
  333. // break;
  334. // }
  335. //}
  336. }
  337. return ret;
  338. }
  339. // 회로명을 가져온다
  340. public string GetDeviceName(int BOARD_ID, int LOOP_NO, int REPEATER_ID, int DEVICE_ID, String INOUT_TYPE)
  341. {
  342. string ret = "";
  343. if (this.dtDeviceDBList2 != null)
  344. {
  345. // cyim 2015.7.1 속도개선작업
  346. DataRow[] result = this.dtDeviceDBList2.Select(
  347. string.Format("BOARD_ID={0} AND COMM_ID={1} AND LOOP_NO={2} AND REPEATER_ID={3} AND DEVICE_ID={4} AND INOUT_TYPE='{5}'", // cyim 2015.7.8 쿼리수정 , Inout 타입의 경우 ' ' 작은따옴표를 사용해야함, 이벤트로그가 안보이게됨
  348. BOARD_ID, 1, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE));
  349. if (result != null && result.Length > 0)
  350. ret = result[0]["DEVICE_NAME"].ToString();
  351. //foreach (DataRow dr in this.dtDeviceDBList2.Rows)
  352. //{
  353. // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["LOOP_NO"].ToString() == LOOP_NO.ToString()
  354. // && dr["REPEATER_ID"].ToString() == REPEATER_ID.ToString() && dr["DEVICE_ID"].ToString() == DEVICE_ID.ToString()
  355. // && dr["INOUT_TYPE"].ToString() == INOUT_TYPE.ToString() && dr["COMM_ID"].ToString() == "1")
  356. // {
  357. // ret = dr["DEVICE_NAME"].ToString();
  358. // break;
  359. // }
  360. //}
  361. }
  362. return ret;
  363. }
  364. // 조건에 맞는 중계기의 위치명 / 위치 코드 / 중계기 명칭을 리턴한다.
  365. public string GetDevicePositionName(int BOARD_ID, int LOOP_NO, int REPEATER_ID)
  366. {
  367. string ret = "";
  368. if (this.dtRepeaterList2 != null)
  369. {
  370. // cyim 2015.7.1 속도개선작업
  371. DataRow[] result = this.dtRepeaterList2.Select(
  372. string.Format("BOARD_ID={0} AND LOOP_NO={2} AND REPEATER_ID={3}",
  373. BOARD_ID, 1, LOOP_NO, REPEATER_ID));
  374. if (result != null && result.Length > 0)
  375. {
  376. // 만약 위치 명이 있으면, 위치명으로 리턴한다.
  377. if (result[0]["POSITION_NAME"].ToString() != "")
  378. ret = result[0]["POSITION_NAME"].ToString();
  379. // 위치명이 없고.. 위치 코드가 있으면, 위치 코드를 리턴하도록 한다.
  380. else if (result[0]["POSITION_CODE"].ToString() != "")
  381. ret = result[0]["POSITION_CODE"].ToString();
  382. // 기본값 RepeaterName을 리턴할 준비를 한다.
  383. else
  384. ret = result[0]["REPEATER_NAME"].ToString();
  385. }
  386. //foreach (DataRow dr in this.dtRepeaterList2.Rows)
  387. //{
  388. // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["LOOP_NO"].ToString() == LOOP_NO.ToString()
  389. // && dr["REPEATER_ID"].ToString() == REPEATER_ID.ToString())
  390. // {
  391. // // 조건에 맞으면 일단 RepeaterName을 리턴할 준비를 한다.
  392. // ret = dr["REPEATER_NAME"].ToString();
  393. // // 만약 위치 명이 있으면, 위치명으로 리턴한다.
  394. // if (dr["POSITION_NAME"].ToString() != "")
  395. // {
  396. // ret = dr["POSITION_NAME"].ToString();
  397. // break;
  398. // }
  399. // // 위치명이 없고.. 위치 코드가 있으면, 위치 코드를 리턴하도록 한다.
  400. // if (dr["POSITION_CODE"].ToString() != "")
  401. // {
  402. // ret = dr["POSITION_CODE"].ToString();
  403. // }
  404. // break;
  405. // }
  406. //}
  407. }
  408. return ret;
  409. }
  410. // 디바이스 위치를 리턴한다. 만약 맞는 위치명이 없으면.. 위치 코드라도 리턴한다.
  411. public string GetDevicePositionName(int BOARD_ID, int LOOP_NO, int REPEATER_ID, int DEVICE_ID, String INOUT_TYPE)
  412. {
  413. string ret = "";
  414. if (this.dtDeviceDBList2 != null)
  415. {
  416. // cyim 2015.7.1 속도개선작업
  417. string SQL = string.Format("BOARD_ID={0} AND COMM_ID={1} AND LOOP_NO={2} AND REPEATER_ID={3} AND DEVICE_ID={4} AND INOUT_TYPE='{5}'", // cyim 2015.7.8 쿼리수정 , Inout 타입의 경우 ' ' 작은따옴표를 사용해야함, 이벤트로그가 안보이게됨
  418. BOARD_ID, 1, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE);
  419. DataRow[] result = this.dtDeviceDBList2.Select(SQL);
  420. if (result != null && result.Length > 0)
  421. {
  422. // 만약 위치 명이 있으면, 위치명으로 리턴한다.
  423. if (result[0]["POSITION_NAME"].ToString() != "")
  424. ret = result[0]["POSITION_NAME"].ToString();
  425. // 위치명이 없고.. 위치 코드가 있으면, 위치 코드를 리턴하도록 한다.
  426. else if (result[0]["POSITION_CODE"].ToString() != "")
  427. ret = result[0]["POSITION_CODE"].ToString();
  428. // 기본값 Device Name을 리턴할 준비를 한다.
  429. else
  430. ret = result[0]["DEVICE_NAME"].ToString();
  431. }
  432. //foreach (DataRow dr in this.dtDeviceDBList2.Rows)
  433. //{
  434. // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["LOOP_NO"].ToString() == LOOP_NO.ToString()
  435. // && dr["REPEATER_ID"].ToString() == REPEATER_ID.ToString() && dr["DEVICE_ID"].ToString() == DEVICE_ID.ToString()
  436. // && dr["INOUT_TYPE"].ToString() == INOUT_TYPE.ToString() && dr["COMM_ID"].ToString() == "1")
  437. // {
  438. // ret = dr["DEVICE_NAME"].ToString(); // 일단.. DeviceName을 찜해둔다.
  439. // // 만약 위치 명이 있으면, 위치명으로 리턴한다.
  440. // if (dr["POSITION_NAME"].ToString() != "")
  441. // {
  442. // ret = dr["POSITION_NAME"].ToString();
  443. // break;
  444. // }
  445. // // 위치명이 없고.. 위치 코드가 있으면, 위치 코드를 리턴하도록 한다.
  446. // if (dr["POSITION_CODE"].ToString() != "")
  447. // {
  448. // if (dr["POSITION_CODE"].ToString() != "000000") // cyim 2014.8.18 위치정보 000000 제외
  449. // ret = dr["POSITION_CODE"].ToString();
  450. // }
  451. // break;
  452. // }
  453. //}
  454. }
  455. return ret;
  456. }
  457. // cyim 2015.7.1 속도개선작업
  458. // 해쉬테이블을 사용해서 아날로그 감지기를 미리 저장해두어야 한다
  459. // 아날로그감지기 아이디를 모두 가져온다 (아이디로 구성된 키를 가지고, 데이터는 레벨값 FAULT_VALUE;PREFIRE_VALUE;FIRED_VALUE;FIREN_VALUE)
  460. public Hashtable GetAnalogDetecterRepeaterID(int RECEIVER_ID, int BOARD_ID, int LOOP_NO)
  461. {
  462. Hashtable ret = new Hashtable();
  463. try
  464. {
  465. if (this.dtAnalogDetecterLevel != null)
  466. {
  467. DataRow[] result = this.dtAnalogDetecterLevel.Select(
  468. string.Format("RECEIVER_ID={0} AND BOARD_ID={1} AND LOOP_NO={2}", RECEIVER_ID, BOARD_ID, LOOP_NO));
  469. if (result.Length > 0)
  470. {
  471. foreach (DataRow Data in result)
  472. {
  473. string key = Data["REPEATER_ID"].ToString();
  474. AnalogLevel data = new AnalogLevel(
  475. Int32.Parse(Data["FAULT_VALUE"].ToString()),
  476. Int32.Parse(Data["PREFIRE_VALUE"].ToString()),
  477. Int32.Parse(Data["FIRED_VALUE"].ToString()),
  478. Int32.Parse(Data["FIREN_VALUE"].ToString()));
  479. ret.Add(key, data);
  480. }
  481. }
  482. }
  483. }
  484. catch (Exception ex)
  485. {
  486. Util.UErrorMessage(ex, 0, 0);
  487. }
  488. return ret;
  489. }
  490. // cyim 2016.01.07 아날로그 감지기 이력 조회시 표시 수정 : 중계기 타입을 조회할수 있도록 한다
  491. public string GetRepeaterType(int BOARD_ID, int LOOP_NO, int REPEATER_ID)
  492. {
  493. string ret = "";
  494. if (this.dtRepeaterList2 != null)
  495. {
  496. // cyim 2015.7.1 속도개선작업
  497. DataRow[] result = this.dtRepeaterList2.Select(
  498. string.Format("BOARD_ID={0} AND LOOP_NO={2} AND REPEATER_ID={3}",
  499. BOARD_ID, 1, LOOP_NO, REPEATER_ID));
  500. if (result != null && result.Length > 0)
  501. {
  502. ret = result[0]["REPEATER_TYPE"].ToString();
  503. }
  504. }
  505. return ret;
  506. }
  507. //
  508. // 현재 이벤트 관리
  509. //
  510. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  511. // 이벤트 로그용 해쉬테이블 키 생성 함수
  512. public string Get_EventLog_Key(EventLogInfo log)
  513. {
  514. return string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}",
  515. log.ReceiverID, log.CommId, log.BoardNo, log.LoopNo, log.RepeaterNo, log.DeviceId, log.InoutType, log.EventType);
  516. }
  517. // 이벤트 발생시 리스트 추가
  518. public void EventLogAdd(EventLogInfo log)
  519. {
  520. try
  521. {
  522. // cyim 2015.7.6 속도개선작업
  523. // 해쉬 리스트 구현 방법은 아래와 같다
  524. // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  525. // 데이타 : EventLogInfo 클래스
  526. // 해쉬테이블 키 추출
  527. string[] tmp_keys = new string[this.arrayListLog.Keys.Count];
  528. this.arrayListLog.Keys.CopyTo(tmp_keys, 0);
  529. // 현재내역에 필요없는 메세지는 삭제한다.
  530. if (tmp_keys != null && tmp_keys.Length != 0)
  531. {
  532. for (int i = tmp_keys.Length - 1; i >= 0; i--)
  533. {
  534. EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[tmp_keys[i]];
  535. if (!eventLogMsg.LiveMsgFlag)
  536. {
  537. if (this.arrayListLog.ContainsKey(tmp_keys[i]) == true)
  538. {
  539. this.arrayListLog.Remove(tmp_keys[i]);
  540. }
  541. }
  542. eventLogMsg = null;
  543. }
  544. }
  545. //해당 이벤트가 이미 있다면 넣지 않는다.
  546. if (log.LiveMsgFlag)
  547. if (this.arrayListLog.ContainsKey(Get_EventLog_Key(log)) == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  548. this.arrayListLog.Add(Get_EventLog_Key(log), log);
  549. //
  550. // 아래는 원본
  551. //
  552. // 현재내역에 필요없는 메세지는 삭제한다
  553. //for (int i = this.arrayListLog.Count - 1; i >= 0; i--)
  554. //{
  555. // EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[i];
  556. // if (!eventLogMsg.LiveMsgFlag)
  557. // {
  558. // this.arrayListLog.Remove(i);
  559. // eventLogMsg = null;
  560. // }
  561. //}
  562. ////해당 이벤트가 이미 있다면 넣지 않는다.
  563. //if (log.LiveMsgFlag)
  564. //{
  565. // bool res_existYes = false;
  566. // for (int i = 0; i < this.arrayListLog.Count; i++)
  567. // {
  568. // EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[i];
  569. // if ((eventLogMsg.ReceiverID == log.ReceiverID) && (eventLogMsg.CommId == log.CommId) &&
  570. // (eventLogMsg.BoardNo == log.BoardNo) && (eventLogMsg.LoopNo == log.LoopNo) &&
  571. // (eventLogMsg.RepeaterNo == log.RepeaterNo) && (eventLogMsg.DeviceId == log.DeviceId) &&
  572. // (eventLogMsg.InoutType == log.InoutType) && (eventLogMsg.EventType == log.EventType))
  573. // {
  574. // res_existYes = true;
  575. // break;
  576. // }
  577. // }
  578. // if (!res_existYes)
  579. // this.arrayListLog.Add(log);
  580. //}
  581. }
  582. catch (Exception ex)
  583. {
  584. Util.UErrorMessage(ex, 0, 0);
  585. }
  586. finally
  587. {
  588. // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
  589. CheckBtn_Current_Status = BtnCheck_Info_Get();
  590. }
  591. // cyim 2013.7.18 속도개선작업 : UI 갱신이 너무 많음
  592. // 현재 500 msec 마다 UI 를 셋팅하게 되어있다. 문제는 여기에 서로 Invoke 를 호출하게 되어 오히려 속도가 저하되버리게 되는 결과가 나옵니다
  593. // 시스템 구조상 통신으로 받은 데이타를 처리하는것이 invoke 로 crossthread 를 벗어나려고 하였는데 여기에서 점유율이 높아집니다
  594. //FireFacilityEventCheck();
  595. }
  596. // 검색자
  597. private string Search = null;
  598. // 이벤트 타입을 제외한 이벤트 조회
  599. private bool CurrentEvent_ExceptType(string keys)
  600. {
  601. string Compare = keys.Substring(0, keys.Length - 2);
  602. if (Search == Compare)
  603. {
  604. return true;
  605. }
  606. else
  607. {
  608. return false;
  609. }
  610. }
  611. // 이벤트 발생시 리스트 삭제
  612. public void EventLogDel(EventLogInfo log)
  613. {
  614. try
  615. {
  616. // cyim 2015.7.6 속도개선작업
  617. // 해쉬 리스트 구현 방법은 아래와 같다
  618. // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  619. // 데이타 : EventLogInfo 클래스
  620. if (this.arrayListLog == null || this.arrayListLog.Count == 0)
  621. return;
  622. // 삭제 컨셉은 코드 분석 결과, 현재 이벤트 타입과 과거 이벤트 타입을 검색해보고
  623. // 정상-이상이 짝이 맞으면 삭제하도록 되어있다.
  624. // 키리스트정보 끝에는 이벤트 정보가 있다. 결국 이벤트 타입만 추려내서 최소한의 루틴으로 돌린다.
  625. // 삭제하려는 이벤트의 타입
  626. string res_eventType = log.EventType;
  627. // 현재 이벤트
  628. string eventType = "";
  629. // 모든 키리스트를 추출한다
  630. string[] tmp_keys = new string[arrayListLog.Keys.Count];
  631. this.arrayListLog.Keys.CopyTo(tmp_keys, 0);
  632. // 검색자에 삭제하려는 이벤트 타입만 제거
  633. string key = Get_EventLog_Key(log); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  634. Search = key.Substring(0, key.Length - 2);
  635. // 현재 이벤트중에 정보가 있다
  636. string[] Search_Keys = Array.FindAll(tmp_keys, CurrentEvent_ExceptType);
  637. // 일치하는 현재 이벤트를 찾았다면
  638. if (Search_Keys != null && Search_Keys.Length != 0)
  639. {
  640. foreach (string Search_Key in Search_Keys)
  641. {
  642. EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[Search_Key];
  643. // 이벤트 타입을 제외하고 일치하는 현재 이벤트가 있다
  644. eventType = eventLogMsg.EventType;
  645. // 비교 결과
  646. bool eventTypeBoth = false;
  647. //OM-통신모듈 통신정상-LOOP 통신정상,XM-통신모듈 통신이상-LOOP 통신이상
  648. if ((res_eventType.Equals("OM") || res_eventType.Equals("XM")) && (eventType.Equals("OM") || eventType.Equals("XM")))
  649. eventTypeBoth = true;
  650. //OR-중계기 통신정상,XR-중계기 통신이상
  651. else if ((res_eventType.Equals("OR") || res_eventType.Equals("XR")) && (eventType.Equals("OR") || eventType.Equals("XR")))
  652. eventTypeBoth = true;
  653. //OI-I/O 모듈 통신정상,XI-I/O 모듈 통신이상
  654. else if ((res_eventType.Equals("OI") || res_eventType.Equals("XI")) && (eventType.Equals("OI") || eventType.Equals("XI")))
  655. eventTypeBoth = true;
  656. //OK-키패드모듈 통신정상,XK-키패드모듈 통신이상
  657. else if ((res_eventType.Equals("OK") || res_eventType.Equals("XK")) && (eventType.Equals("OK") || eventType.Equals("XK")))
  658. eventTypeBoth = true;
  659. //OL-중계기 단선발생,XL-중계기 단선복구
  660. else if ((res_eventType.Equals("OL") || res_eventType.Equals("XL")) && (eventType.Equals("OL") || eventType.Equals("XL")))
  661. eventTypeBoth = true;
  662. //OA-화재축적상태 발생,XA-화재축적상태 해제
  663. else if ((res_eventType.Equals("OA") || res_eventType.Equals("XA")) && (eventType.Equals("OA") || eventType.Equals("XA")))
  664. eventTypeBoth = true;
  665. //OF-화재상태 발생,XF-화재상태 해제
  666. else if ((res_eventType.Equals("OF") || res_eventType.Equals("XF")) && (eventType.Equals("OF") || eventType.Equals("XF")))
  667. eventTypeBoth = true;
  668. //OE-설비작동상태 발생,XE-설비작동상태 해제
  669. else if ((res_eventType.Equals("OE") || res_eventType.Equals("XE")) && (eventType.Equals("OE") || eventType.Equals("XE")))
  670. eventTypeBoth = true;
  671. //AV-출력전압 이상,NV-출력전압 정상
  672. else if ((res_eventType.Equals("AV") || res_eventType.Equals("NV")) && (eventType.Equals("AV") || eventType.Equals("NV")))
  673. eventTypeBoth = true;
  674. //AR-예비전원 이상,NR-예비전원 정상
  675. else if ((res_eventType.Equals("AR") || res_eventType.Equals("NR")) && (eventType.Equals("AR") || eventType.Equals("NR")))
  676. eventTypeBoth = true;
  677. //AA-교류전원 이상,NA-교류전원 정상
  678. else if ((res_eventType.Equals("AA") || res_eventType.Equals("NA")) && (eventType.Equals("AA") || eventType.Equals("NA")))
  679. eventTypeBoth = true;
  680. //OP-전화설정,XP-전화해제
  681. else if ((res_eventType.Equals("OP") || res_eventType.Equals("XP")) && (eventType.Equals("OP") || eventType.Equals("XP")))
  682. eventTypeBoth = true;
  683. //OT-발신기설정,XT-발신기해제
  684. else if ((res_eventType.Equals("OT") || res_eventType.Equals("XT")) && (eventType.Equals("OT") || eventType.Equals("XT")))
  685. eventTypeBoth = true;
  686. //PO-통신(POLLING) 시작,PF-통신(POLLING) 종료
  687. else if ((res_eventType.Equals("PO") || res_eventType.Equals("PF")) && (eventType.Equals("PO") || eventType.Equals("PF")))
  688. eventTypeBoth = true;
  689. //OD-데몬연결이상,XD-데몬연결정상
  690. else if ((res_eventType.Equals("OD") || res_eventType.Equals("XD")) && (eventType.Equals("OD") || eventType.Equals("XD")))
  691. eventTypeBoth = true;
  692. //OU-UI프로그램시작,XU-UI프로그램종료
  693. else if ((res_eventType.Equals("OU") || res_eventType.Equals("XU")) && (eventType.Equals("OU") || eventType.Equals("XU")))
  694. eventTypeBoth = true;
  695. //OX-중계기전원이상발생,XX-중계기전원이상해제
  696. else if ((res_eventType.Equals("OX") || res_eventType.Equals("XX")) && (eventType.Equals("OX") || eventType.Equals("XX")))
  697. eventTypeBoth = true;
  698. // BA-통신보드루프교류전원이상, BR-통신보드루프예비전원이상, BN-통신보드루프정상
  699. else if ((res_eventType.Equals("BA") || res_eventType.Equals("BR") || res_eventType.Equals("BN"))
  700. && (eventType.Equals("BA") || eventType.Equals("BR") || eventType.Equals("BN")))
  701. eventTypeBoth = true;
  702. // cyim 2013.12.31 : 비상방송 현재이력에 남아있는 문제
  703. //XC-비상방송 이상,OC-비상방송 정상
  704. else if ((res_eventType.Equals("XC") || res_eventType.Equals("OC")) && (eventType.Equals("XC") || eventType.Equals("OC")))
  705. eventTypeBoth = true;
  706. // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
  707. else if ((res_eventType.Equals("FA") || res_eventType.Equals("FN")) && (eventType.Equals("FA") || eventType.Equals("FN")))
  708. eventTypeBoth = true;
  709. // cyim 2015.7.9 PreFire 표시 문제
  710. else if ((res_eventType.Equals("WA") || res_eventType.Equals("WN")) && (eventType.Equals("WA") || eventType.Equals("WN")))
  711. eventTypeBoth = true;
  712. // 이벤트를 삭제한다
  713. if (eventTypeBoth == true)
  714. this.arrayListLog.Remove(Search_Key);
  715. }
  716. }
  717. //
  718. // 아래는 원본
  719. //
  720. //string res_eventType = log.EventType;
  721. //if (this.arrayListLog != null)
  722. //{
  723. // //int eventLogCnt = this.arrayListLog.Count;
  724. // for (int i = this.arrayListLog.Count - 1; i > -1; i--)
  725. // {
  726. // if (this.arrayListLog.Count < 1)
  727. // break;
  728. // EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[i];
  729. // string eventType = eventLogMsg.EventType;
  730. // if ((eventLogMsg.ReceiverID == log.ReceiverID) && (eventLogMsg.CommId == log.CommId) &&
  731. // (eventLogMsg.BoardNo == log.BoardNo) && (eventLogMsg.LoopNo == log.LoopNo) &&
  732. // (eventLogMsg.RepeaterNo == log.RepeaterNo) && (eventLogMsg.DeviceId == log.DeviceId) &&
  733. // (eventLogMsg.InoutType == log.InoutType))
  734. // {
  735. // bool eventTypeBoth = false;
  736. // //OM-통신모듈 통신정상-LOOP 통신정상,XM-통신모듈 통신이상-LOOP 통신이상
  737. // if ((res_eventType.Equals("OM") || res_eventType.Equals("XM")) && (eventType.Equals("OM") || eventType.Equals("XM")))
  738. // eventTypeBoth = true;
  739. // //OR-중계기 통신정상,XR-중계기 통신이상
  740. // if ((res_eventType.Equals("OR") || res_eventType.Equals("XR")) && (eventType.Equals("OR") || eventType.Equals("XR")))
  741. // eventTypeBoth = true;
  742. // //OI-I/O 모듈 통신정상,XI-I/O 모듈 통신이상
  743. // if ((res_eventType.Equals("OI") || res_eventType.Equals("XI")) && (eventType.Equals("OI") || eventType.Equals("XI")))
  744. // eventTypeBoth = true;
  745. // //OK-키패드모듈 통신정상,XK-키패드모듈 통신이상
  746. // if ((res_eventType.Equals("OK") || res_eventType.Equals("XK")) && (eventType.Equals("OK") || eventType.Equals("XK")))
  747. // eventTypeBoth = true;
  748. // //OL-중계기 단선발생,XL-중계기 단선복구
  749. // if ((res_eventType.Equals("OL") || res_eventType.Equals("XL")) && (eventType.Equals("OL") || eventType.Equals("XL")))
  750. // eventTypeBoth = true;
  751. // //OA-화재축적상태 발생,XA-화재축적상태 해제
  752. // if ((res_eventType.Equals("OA") || res_eventType.Equals("XA")) && (eventType.Equals("OA") || eventType.Equals("XA")))
  753. // eventTypeBoth = true;
  754. // //OF-화재상태 발생,XF-화재상태 해제
  755. // if ((res_eventType.Equals("OF") || res_eventType.Equals("XF")) && (eventType.Equals("OF") || eventType.Equals("XF")))
  756. // eventTypeBoth = true;
  757. // //OE-설비작동상태 발생,XE-설비작동상태 해제
  758. // if ((res_eventType.Equals("OE") || res_eventType.Equals("XE")) && (eventType.Equals("OE") || eventType.Equals("XE")))
  759. // eventTypeBoth = true;
  760. // //AV-출력전압 이상,NV-출력전압 정상
  761. // if ((res_eventType.Equals("AV") || res_eventType.Equals("NV")) && (eventType.Equals("AV") || eventType.Equals("NV")))
  762. // eventTypeBoth = true;
  763. // //AR-예비전원 이상,NR-예비전원 정상
  764. // if ((res_eventType.Equals("AR") || res_eventType.Equals("NR")) && (eventType.Equals("AR") || eventType.Equals("NR")))
  765. // eventTypeBoth = true;
  766. // //AA-교류전원 이상,NA-교류전원 정상
  767. // if ((res_eventType.Equals("AA") || res_eventType.Equals("NA")) && (eventType.Equals("AA") || eventType.Equals("NA")))
  768. // eventTypeBoth = true;
  769. // //OP-전화설정,XP-전화해제
  770. // if ((res_eventType.Equals("OP") || res_eventType.Equals("XP")) && (eventType.Equals("OP") || eventType.Equals("XP")))
  771. // eventTypeBoth = true;
  772. // //OT-발신기설정,XT-발신기해제
  773. // if ((res_eventType.Equals("OT") || res_eventType.Equals("XT")) && (eventType.Equals("OT") || eventType.Equals("XT")))
  774. // eventTypeBoth = true;
  775. // //PO-통신(POLLING) 시작,PF-통신(POLLING) 종료
  776. // if ((res_eventType.Equals("PO") || res_eventType.Equals("PF")) && (eventType.Equals("PO") || eventType.Equals("PF")))
  777. // eventTypeBoth = true;
  778. // //OD-데몬연결이상,XD-데몬연결정상
  779. // if ((res_eventType.Equals("OD") || res_eventType.Equals("XD")) && (eventType.Equals("OD") || eventType.Equals("XD")))
  780. // eventTypeBoth = true;
  781. // //OU-UI프로그램시작,XU-UI프로그램종료
  782. // if ((res_eventType.Equals("OU") || res_eventType.Equals("XU")) && (eventType.Equals("OU") || eventType.Equals("XU")))
  783. // eventTypeBoth = true;
  784. // //OX-중계기전원이상발생,XX-중계기전원이상해제
  785. // if ((res_eventType.Equals("OX") || res_eventType.Equals("XX")) && (eventType.Equals("OX") || eventType.Equals("XX")))
  786. // eventTypeBoth = true;
  787. // // BA-통신보드루프교류전원이상, BR-통신보드루프예비전원이상, BN-통신보드루프정상
  788. // if ((res_eventType.Equals("BA") || res_eventType.Equals("BR") || res_eventType.Equals("BN")) && (eventType.Equals("BA") || eventType.Equals("BR") || eventType.Equals("BN")))
  789. // eventTypeBoth = true;
  790. // // cyim 2013.12.31 : 비상방송 현재이력에 남아있는 문제
  791. // //XC-비상방송 이상,OC-비상방송 정상
  792. // if ((res_eventType.Equals("XC") || res_eventType.Equals("OC")) && (eventType.Equals("XC") || eventType.Equals("OC")))
  793. // eventTypeBoth = true;
  794. // if (eventTypeBoth ||
  795. // ((eventLogMsg.ReceiverID == log.ReceiverID) && (eventLogMsg.CommId == log.CommId) &&
  796. // (eventLogMsg.BoardNo == log.BoardNo) && (eventLogMsg.LoopNo == log.LoopNo) &&
  797. // (eventLogMsg.RepeaterNo == log.RepeaterNo) && (eventLogMsg.DeviceId == log.DeviceId) &&
  798. // (eventLogMsg.InoutType == log.InoutType) && (eventLogMsg.EventType == log.EventType)))
  799. // {
  800. // if (eventLogMsg.LiveMsgFlag)
  801. // {
  802. // eventLogMsg.LiveMsgFlag = false;
  803. // // cyim 2015.7.6 속도개선작업
  804. // // 해쉬 리스트 구현 방법은 아래와 같다
  805. // // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  806. // // 데이타 : EventLogInfo 클래스
  807. // //this.arrayListLog.RemoveAt(i); // 삭제
  808. // this.arrayListLog.Remove(_Data.Get_EventLog_Key(eventLogMsg));
  809. // }
  810. // }
  811. // }
  812. // }
  813. //}
  814. }
  815. catch (Exception ex)
  816. {
  817. Util.UErrorMessage(ex, 0, 0);
  818. }
  819. finally
  820. {
  821. // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
  822. CheckBtn_Current_Status = BtnCheck_Info_Get();
  823. }
  824. // cyim 2013.7.18 속도개선작업 : UI 갱신이 너무 많음
  825. // 현재 500 msec 마다 UI 를 셋팅하게 되어있다. 문제는 여기에 서로 Invoke 를 호출하게 되어 오히려 속도가 저하되버리게 되는 결과가 나옵니다
  826. // 시스템 구조상 통신으로 받은 데이타를 처리하는것이 invoke 로 crossthread 를 벗어나려고 하였는데 여기에서 점유율이 높아집니다
  827. //FireFacilityEventCheck();
  828. }
  829. // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
  830. public bool BtnCheck_Info_Get()
  831. {
  832. try
  833. {
  834. // 이벤트가 없다면 false , 즉 점검카운터 내용이 없다고 표시하면 된다
  835. if (this.arrayListLog.Count < 1)
  836. return false;
  837. // cyim 2015.7.6 속도개선작업
  838. // 해쉬 리스트 구현 방법은 아래와 같다
  839. // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  840. // 데이타 : EventLogInfo 클래스
  841. // 해쉬리스트를 Full Scan 할 수 밖에 없다. 속도 개선작업에 따라 해쉬테이블에 접근하는 루틴을 적용한다
  842. // cyim 2017.01.04 : 점검출력이 안되는 문제 수정
  843. Hashtable arrayListLog_temp = (Hashtable)arrayListLog.Clone();
  844. foreach (DictionaryEntry d in arrayListLog_temp)
  845. {
  846. bool Temp = false;
  847. EventLogInfo eventLogMsg = (EventLogInfo)d.Value;
  848. // 내용 존재 여부 (점검에 표시되는 항목은 아래와 같다)
  849. switch (eventLogMsg.EventType)
  850. {
  851. case "XM"://통신모듈 통신이상
  852. case "XI"://I/O 모듈 통신이상
  853. case "XK"://키패드모듈 통신이상
  854. case "AV"://출력전압 이상
  855. case "AR"://예비전원 이상
  856. case "AA"://교류전원 이상
  857. case "OD"://데몬연결이상
  858. case "OB"://DB연결이상
  859. case "BA"://통신보드루프교류전원이상
  860. case "BR"://통신보드루프예비전원이상
  861. case "XC"://비상방송 통신이상
  862. Temp = true;
  863. break;
  864. case "":
  865. ;
  866. break;
  867. }
  868. // 내용이 있다면
  869. if (Temp == true)
  870. return true;
  871. }
  872. // 내용이 없다면
  873. return false;
  874. }
  875. catch
  876. {
  877. return false;
  878. }
  879. }
  880. // 이전폼제거 후 Child Form 생성
  881. public Form ShowChildForm(Form chForm)
  882. {
  883. Boolean IsNewForm = true;
  884. try
  885. {
  886. foreach (Form childForm in MdiChildren)
  887. {
  888. if (childForm.Name == chForm.Name)
  889. {
  890. chForm = childForm;
  891. childForm.Select();
  892. IsNewForm = false;
  893. }
  894. else if (childForm is frmWarningBox)
  895. {
  896. }
  897. else
  898. {
  899. // 각해당폼에는 많은 리소스 및 스레드가 돌리므로 시작 및 종료하기까지는 시간이 걸림
  900. // cyim 2013.8.1 : 화면전환시 잔상이 남아서 UI 깨짐 현상 문제 수정
  901. childForm.Hide();
  902. childForm.Close();
  903. }
  904. }
  905. if (IsNewForm)
  906. {
  907. //CloseFormAll();
  908. Size sz = new Size(1078, 824);
  909. // 이 인스턴스를 표시하기 전에 MDI 폼의 자식으로 만듭니다.
  910. chForm.MdiParent = this;
  911. chForm.Text = "";
  912. //DirText("시작 > 테스트화면" + childFormNumber++);
  913. chForm.Size = sz;
  914. chForm.Show();
  915. if (this.winMsg != null)
  916. {
  917. //this.warningForm.Select();
  918. //this.warningForm2.Select();
  919. //this.warningForm.Owner = chForm;
  920. }
  921. }
  922. }
  923. catch (Exception ex)
  924. {
  925. Util.UErrorMessage(ex, 0, 0);
  926. }
  927. return chForm;
  928. }
  929. // Child 폼제거 후 프로그램 종료
  930. private void ApplicationExit()
  931. {
  932. try
  933. {
  934. if (MdiChildren.Length > 0)
  935. MdiChildren[MdiChildren.Length - 1].Close();
  936. //경고화면창 닫기
  937. if (this.warningForm != null)
  938. this.warningForm.Close();
  939. //경고화면창 닫기
  940. if (this.warningForm2 != null)
  941. this.warningForm2.Close();
  942. //로그인창닫기
  943. if (this.loginForm != null)
  944. this.loginForm.Close();
  945. //잠시만 기다리는 창 화면 닫기
  946. if (this.waittingForm != null)
  947. this.waittingForm.Close();
  948. Application.Exit();
  949. }
  950. catch (Exception ex)
  951. {
  952. Util.UErrorMessage(ex, 0, 0);
  953. }
  954. }
  955. // Child 폼제거
  956. private void CloseFormAll()
  957. {
  958. try
  959. {
  960. foreach (Form childForm in MdiChildren)
  961. {
  962. if (childForm is frmWarningBox)
  963. {
  964. }
  965. else
  966. {
  967. childForm.Close();
  968. }
  969. }
  970. }
  971. catch (Exception ex)
  972. {
  973. Util.UErrorMessage(ex, 0, 0);
  974. }
  975. }
  976. public void MessageProcess(EventLogInfo eventLog)
  977. {
  978. try
  979. {
  980. if (eventLog.EventStatus != MappingStatus.Normal)
  981. {
  982. if (eventLog.EventStatus == MappingStatus.FaultOn ||
  983. eventLog.EventStatus == MappingStatus.FaultOff
  984. )
  985. {
  986. //ShowMessageForm2(eventLog.EventStatus, eventLog.Message, eventLog.DeviceMessage);
  987. }
  988. else
  989. {
  990. //ShowMessageForm(eventLog.EventStatus, eventLog.Message, eventLog.DeviceMessage);
  991. }
  992. }
  993. foreach (Form childForm in MdiChildren)
  994. {
  995. if (childForm is FormLogView)
  996. {
  997. FormLogView frm = (FormLogView)childForm;
  998. //frm.DataLoadProcess();
  999. if (frm.Live == true)
  1000. {
  1001. frm.UpdateData();
  1002. //frm.InitFormLogView(true);
  1003. //frm.SetSearchCondition("ALL");
  1004. }
  1005. }
  1006. }
  1007. }
  1008. catch (Exception ex)
  1009. {
  1010. Util.UErrorMessage(ex, 0, 0);
  1011. //MessageBox.Show(ex.Message, Application.ProductName);
  1012. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1013. }
  1014. }
  1015. //로그인화면창
  1016. public void ShowLogin(Form nextForm)
  1017. {
  1018. try
  1019. {
  1020. if (this.InvokeRequired)
  1021. {
  1022. ShowFormLogin d = new ShowFormLogin(ShowLogin);
  1023. this.Invoke(d, new object[] { nextForm });
  1024. }
  1025. else
  1026. {
  1027. if (this.winLogin == null)
  1028. {
  1029. this.loginForm = new frmLogin();
  1030. this.loginForm.TopMost = true;
  1031. this.loginForm.Text = "관리자로그인";
  1032. Point loc = new Point((1280 - this.loginForm.Size.Width) / 2
  1033. + this.Location.X, (1024 - this.loginForm.Size.Height) / 2 + this.Location.Y);
  1034. this.loginForm.Location = loc;
  1035. this.loginForm.setParent(this);
  1036. this.loginForm.SetShowForm(nextForm);
  1037. this.winLogin = this.loginForm;
  1038. //this.loginForm.Show(this.window);
  1039. this.loginForm.ShowDialog(this.window);
  1040. }
  1041. else
  1042. {
  1043. this.loginForm.ShowDialog(this.window);
  1044. }
  1045. }
  1046. }
  1047. catch (Exception ex)
  1048. {
  1049. Util.UErrorMessage(ex, 0, 0);
  1050. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1051. }
  1052. }
  1053. //로그인 창이 닫히면 호출한다..
  1054. public void CloseLoginForm()
  1055. {
  1056. try
  1057. {
  1058. this.winLogin = null;
  1059. }
  1060. catch (Exception ex)
  1061. {
  1062. Util.UErrorMessage(ex, 0, 0);
  1063. }
  1064. }
  1065. //화재발생.. 설비작동 메세지 창을 띄운다..
  1066. public void ShowMessageForm(MappingStatus ErrStatus, string message, string deviceMessage)
  1067. {
  1068. try
  1069. {
  1070. if (this.InvokeRequired)
  1071. {
  1072. ShowFormCallback d = new ShowFormCallback(ShowMessageForm);
  1073. this.Invoke(d, new object[] { ErrStatus, message, deviceMessage });
  1074. }
  1075. else
  1076. {
  1077. if (this.warningForm == null || this.winMsg == null)
  1078. {
  1079. //this.warningForm = new frmWarningBox();
  1080. //this.warningForm.TopMost = true;
  1081. //this.warningForm.Text = "경고!";
  1082. //Point loc = new Point((1280 - this.warningForm.Size.Width) / 2
  1083. // + this.Location.X, (1024 - this.warningForm.Size.Height) / 2 + this.Location.Y);
  1084. //this.warningForm.Location = loc;
  1085. //this.warningForm.setParent(this);
  1086. //this.warningForm.setMessage(ErrStatus, message, deviceMessage);
  1087. //this.winMsg = this.warningForm;
  1088. ////this.warningForm.Show(this.window);
  1089. //this.warningForm.ShowDialog(this.window);
  1090. this.warningForm = new frmWarningBox();
  1091. this.warningForm.MdiParent = this;
  1092. this.warningForm.Text = "";//2010.11.11,k.s.d, call alram window , display 경고 bug fix.
  1093. //Point loc = new Point((1280 - this.warningForm.Size.Width) / 2
  1094. // + this.Location.X, (1024 - this.warningForm.Size.Height) / 2 + this.Location.Y);
  1095. Point loc = new Point((1078 - this.warningForm.Size.Width) / 2, (900 - this.warningForm.Size.Height) / 2);
  1096. this.warningForm.Location = loc;
  1097. this.warningForm.setParent(this);
  1098. this.warningForm.setMessage(ErrStatus, message, deviceMessage);
  1099. this.warningForm.TopMost = true;
  1100. this.winMsg = this.warningForm;
  1101. this.warningForm.Show();
  1102. }
  1103. else
  1104. {
  1105. this.warningForm.setMessage(ErrStatus, message, deviceMessage);
  1106. if (this.warningForm.Visible == false)
  1107. {
  1108. Point loc = new Point((1078 - this.warningForm.Size.Width) / 2, (900 - this.warningForm.Size.Height) / 2);
  1109. this.warningForm.Location = loc;
  1110. this.warningForm.Show();
  1111. }
  1112. this.warningForm.Activate(); //k.s.d 20101023, warning message window active.
  1113. }
  1114. }
  1115. }
  1116. catch (Exception ex)
  1117. {
  1118. Util.UErrorMessage(ex, 0, 0);
  1119. //MessageBox.Show(ex.Message, Application.ProductName);
  1120. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1121. }
  1122. }
  1123. //화재발생.. 설비작동 메세지 창을 띄운다..
  1124. public void ShowMessageForm2(MappingStatus ErrStatus, string message, string deviceMessage)
  1125. {
  1126. try
  1127. {
  1128. if (this.InvokeRequired)
  1129. {
  1130. ShowFormCallback d = new ShowFormCallback(ShowMessageForm2);
  1131. this.Invoke(d, new object[] { ErrStatus, message, deviceMessage });
  1132. }
  1133. else
  1134. {
  1135. if (this.warningForm2 == null || this.winMsg == null)
  1136. {
  1137. this.warningForm2 = new frmWarningBox();
  1138. this.warningForm2.MdiParent = this;
  1139. this.warningForm2.faultmode = true;
  1140. this.warningForm2.Text = "";//2010.11.11,k.s.d, call alram window , display 경고 bug fix.
  1141. //Point loc = new Point((1280 - this.warningForm.Size.Width) / 2
  1142. // + this.Location.X, (1024 - this.warningForm.Size.Height) / 2 + this.Location.Y);
  1143. Point loc = new Point((1078 - this.warningForm2.Size.Width) / 2, (400 - this.warningForm2.Size.Height) / 2);
  1144. this.warningForm2.Location = loc;
  1145. this.warningForm2.setParent(this);
  1146. this.warningForm2.setMessage(ErrStatus, message, deviceMessage);
  1147. this.warningForm2.TopMost = true;
  1148. this.winMsg = this.warningForm2;
  1149. this.warningForm2.Show();
  1150. }
  1151. else
  1152. {
  1153. this.warningForm2.setMessage(ErrStatus, message, deviceMessage);
  1154. if (this.warningForm2.Visible == false)
  1155. {
  1156. Point loc = new Point((1078 - this.warningForm2.Size.Width) / 2, (400 - this.warningForm2.Size.Height) / 2);
  1157. this.warningForm2.Location = loc;
  1158. this.warningForm2.Show();
  1159. }
  1160. this.warningForm2.Activate(); //k.s.d 20101023, warning message window active.
  1161. }
  1162. }
  1163. }
  1164. catch (Exception ex)
  1165. {
  1166. Util.UErrorMessage(ex, 0, 0);
  1167. //MessageBox.Show(ex.Message, Application.ProductName);
  1168. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1169. }
  1170. }
  1171. // 통신데몬초기화 시작시 실행
  1172. public void CloseMessageForm3()
  1173. {
  1174. try
  1175. {
  1176. if (this.InvokeRequired)
  1177. {
  1178. SetVoidCallback d = new SetVoidCallback(CloseMessageForm3);
  1179. this.Invoke(d);
  1180. }
  1181. if (this.warningForm3 != null)
  1182. {
  1183. this.warningForm3.Hide();
  1184. }
  1185. }
  1186. catch (Exception ex)
  1187. {
  1188. Util.UErrorMessage(ex, 0, 0);
  1189. }
  1190. }
  1191. //
  1192. // cyim 2013.7.19 수신기 데이타 처리중 팝업창 (수정사항없음 - 분석작업)
  1193. //
  1194. public void ShowMessageForm3(MappingStatus ErrStatus, string message, string deviceMessage)
  1195. {
  1196. try
  1197. {
  1198. if (this.InvokeRequired)
  1199. {
  1200. ShowFormCallback d = new ShowFormCallback(ShowMessageForm3);
  1201. this.Invoke(d, new object[] { ErrStatus, message, deviceMessage });
  1202. }
  1203. else
  1204. {
  1205. if (this.warningForm3 == null || !this.warningForm3.Created)
  1206. {
  1207. this.warningForm3 = new frmWarningBox();
  1208. this.warningForm3.MdiParent = this;
  1209. this.warningForm3.Text = "";
  1210. Point loc = new Point((1078 - this.warningForm3.Size.Width) / 2, (900 - this.warningForm3.Size.Height) / 2);
  1211. this.warningForm3.Location = loc;
  1212. this.warningForm3.setParent(this);
  1213. this.warningForm3.setMessage2(ErrStatus, message, deviceMessage);
  1214. this.warningForm3.TopMost = true;
  1215. }
  1216. else
  1217. {
  1218. this.warningForm3.setMessage2(ErrStatus, message, deviceMessage);
  1219. if (this.warningForm3.Visible == false)
  1220. {
  1221. Point loc = new Point((1078 - this.warningForm3.Size.Width) / 2, (900 - this.warningForm3.Size.Height) / 2);
  1222. this.warningForm3.Location = loc;
  1223. }
  1224. }
  1225. this.warningForm3.Show();
  1226. this.warningForm3.Activate(); //k.s.d 20101023, warning message window active.
  1227. }
  1228. }
  1229. catch (Exception ex)
  1230. {
  1231. Util.UErrorMessage(ex, 0, 0);
  1232. }
  1233. }
  1234. //화재발생.. 설비작동 메세지 창을 띄운다..
  1235. public void ShowMCCMessageForm(MappingStatus ErrStatus, string message, string deviceMessage)
  1236. {
  1237. try
  1238. {
  1239. if (this.InvokeRequired)
  1240. {
  1241. ShowFormCallback d = new ShowFormCallback(ShowMCCMessageForm);
  1242. this.Invoke(d, new object[] { ErrStatus, message, deviceMessage });
  1243. }
  1244. else
  1245. {
  1246. if (this.warningForm2 == null || this.winMsg == null)
  1247. {
  1248. this.warningForm2 = new frmWarningBox();
  1249. this.warningForm2.MdiParent = this;
  1250. this.warningForm2.faultmode = true;
  1251. this.warningForm2.Text = "";//2010.11.11,k.s.d, call alram window , display 경고 bug fix.
  1252. //Point loc = new Point((1280 - this.warningForm.Size.Width) / 2
  1253. // + this.Location.X, (1024 - this.warningForm.Size.Height) / 2 + this.Location.Y);
  1254. Point loc = new Point((1078 - this.warningForm2.Size.Width) / 2, (400 - this.warningForm2.Size.Height) / 2);
  1255. this.warningForm2.Location = loc;
  1256. this.warningForm2.setParent(this);
  1257. this.warningForm2.setMCCMessage(ErrStatus, message, deviceMessage);
  1258. this.warningForm2.TopMost = true;
  1259. this.winMsg = this.warningForm2;
  1260. this.warningForm2.Show();
  1261. }
  1262. else
  1263. {
  1264. this.warningForm2.setMCCMessage(ErrStatus, message, deviceMessage);
  1265. if (this.warningForm2.Visible == false)
  1266. {
  1267. Point loc = new Point((1078 - this.warningForm2.Size.Width) / 2, (400 - this.warningForm2.Size.Height) / 2);
  1268. this.warningForm2.Location = loc;
  1269. this.warningForm2.Show();
  1270. }
  1271. this.warningForm2.Activate(); //k.s.d 20101023, warning message window active.
  1272. }
  1273. }
  1274. }
  1275. catch (Exception ex)
  1276. {
  1277. Util.UErrorMessage(ex, 0, 0);
  1278. //MessageBox.Show(ex.Message, Application.ProductName);
  1279. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1280. }
  1281. }
  1282. //메세지 창이 닫히면 호출한다..
  1283. public void CloseMessageForm()
  1284. {
  1285. try
  1286. {
  1287. this.winMsg = null;
  1288. }
  1289. catch (Exception ex)
  1290. {
  1291. Util.UErrorMessage(ex, 0, 0);
  1292. }
  1293. }
  1294. //잠시만기다리십시요. 창을 띄운다.
  1295. public void ShowWaittingMsgForm(string message, int processValue)
  1296. {
  1297. // cyim 2015.7.31 수신반 팝업창은 별도로 존재
  1298. if (_Data.FireDeskMode == true)
  1299. {
  1300. Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "Popup", message, processValue); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1301. return;
  1302. }
  1303. if (this.InvokeRequired)
  1304. {
  1305. SetMsgCntCallback d = new SetMsgCntCallback(ShowWaittingMsgForm);
  1306. this.Invoke(d, new object[] { message, processValue });
  1307. }
  1308. else
  1309. {
  1310. if (this.winWaittingMsg == null)
  1311. {
  1312. this.waittingForm = new frmWaitingMsg();
  1313. this.waittingForm.Text = Application.ProductName;
  1314. this.waittingForm.TopMost = true;
  1315. Point loc = new Point((1280 - this.waittingForm.Size.Width) / 2
  1316. + this.Location.X, (1024 - this.waittingForm.Size.Height) / 2 + this.Location.Y);
  1317. this.waittingForm.Location = loc;
  1318. this.waittingForm.Show(this.window);
  1319. this.waittingForm.setParent(this);
  1320. this.waittingForm.setMessage(message, processValue);
  1321. this.winWaittingMsg = this.waittingForm;
  1322. }
  1323. else
  1324. {
  1325. this.waittingForm.setMessage(message, processValue);
  1326. }
  1327. }
  1328. }
  1329. //메세지 창이 닫히면 호출한다..
  1330. public void CloseWaittingMsgForm()
  1331. {
  1332. try
  1333. {
  1334. this.winWaittingMsg = null;
  1335. }
  1336. catch (Exception ex)
  1337. {
  1338. Util.UErrorMessage(ex, 0, 0);
  1339. }
  1340. }
  1341. //배터리 테스트(예비전원시작버튼 클릭시). 창을 띄운다.
  1342. public void ShowBatteryTestForm(Boolean testStart)
  1343. {
  1344. try
  1345. {
  1346. if (this.InvokeRequired)
  1347. {
  1348. SetBoolCallback d = new SetBoolCallback(ShowBatteryTestForm);
  1349. this.Invoke(d, new object[] { testStart });
  1350. }
  1351. else
  1352. {
  1353. // cyim 2013.8.21 키패드->예비전원테스트버튼 누르는 경우 화면 전환안되는 문제 수정
  1354. // 키패드에서 입력받아서 실행하는 경우에는 테스트 시작 조건이 아니더라도 무조건 보이도록 수정한다
  1355. // 단, 리소스가 해제된 경우에는 메모리를 할당하도록 한다
  1356. if (winDriveTestForm == null || winDriveTestForm.IsDisposed == true)
  1357. {
  1358. winDriveTestForm = new frmDriveTest();
  1359. }
  1360. ShowChildForm(winDriveTestForm);
  1361. if (testStart)
  1362. {
  1363. // testStart가 True이면.. (키패드에서 깜빡임.)
  1364. // cyim 2013.8.21 키패드->예비전원테스트버튼 누르는 경우 화면 전환안되는 문제 수정 : 하단 주석처리
  1365. //if (winDriveTestForm == null)
  1366. //{
  1367. // winDriveTestForm = new frmDriveTest();
  1368. //}
  1369. //ShowChildForm(winDriveTestForm);
  1370. winDriveTestForm.DoBatteryTest2(testStart);
  1371. }
  1372. else
  1373. {
  1374. winDriveTestForm.DoBatteryTest2(testStart);// cyim 2015.3.31 예비전원 테스트 루틴 통일
  1375. }
  1376. //if (this.winBatteryTestMsg == null)
  1377. //{
  1378. // this.winBatteryTestForm = new frmBatteryTest();
  1379. // this.winBatteryTestForm.Text = Application.ProductName;
  1380. // this.winBatteryTestForm.TopMost = false;
  1381. // Point loc = new Point((1280 - this.winBatteryTestForm.Size.Width) / 2
  1382. // + this.Location.X, (1024 - this.winBatteryTestForm.Size.Height) / 2 + this.Location.Y);
  1383. // this.winBatteryTestForm.Location = loc;
  1384. // this.winBatteryTestForm.Show(this.window);
  1385. // this.winBatteryTestForm.setParent(this);
  1386. // this.winBatteryTestForm.BatteryTestStart(testStart);
  1387. // this.winBatteryTestMsg = this.winBatteryTestForm;
  1388. //}
  1389. //else
  1390. //{
  1391. // this.winBatteryTestForm.BatteryTestStart(testStart);
  1392. //}
  1393. //if (this.winMsg != null)
  1394. //{
  1395. // this.warningForm.Select();
  1396. // //this.warningForm.Owner = chForm;
  1397. //}
  1398. }
  1399. }
  1400. catch (Exception ex)
  1401. {
  1402. Util.UErrorMessage(ex, 0, 0);
  1403. //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
  1404. }
  1405. }
  1406. //초기화
  1407. private void Init()
  1408. {
  1409. try
  1410. {
  1411. //
  1412. // ----------------------- 1. 화면에 시간보여주는 타이머 기능 시작 -----------------------
  1413. //
  1414. timerDateTime_Tick(null, EventArgs.Empty);
  1415. timerDateTime.Enabled = true;
  1416. timerEventCheck.Enabled = true;
  1417. //
  1418. // ----------------------- 2. 레지스트리에서 수신기ID정보 읽어오기 -----------------------
  1419. //
  1420. // cyim 2015.7.29 수신반 루틴을 위해 외부 파라미터로 동작하도록 수정
  1421. // 레지스트리 값 읽는 루틴을 전부 주석처리함
  1422. //RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\I_FPER_COMM_DAEMON", false);
  1423. //if (rk == null)
  1424. // throw new Exception("레지스트리 읽기 실패!");
  1425. //this.myReceiverID = Convert.ToInt16(rk.GetValue("RECEIVER_ID").ToString());
  1426. if (_Data.FireDeskMode == false) // 수신반이 아닐때는 레지스트리 값 이용
  1427. {
  1428. this.socketUI = new SocketUI(this, this.myReceiverID, lblDemonStatus, _Data.Registry_DATABASE_NAME_IP);
  1429. }
  1430. else
  1431. {
  1432. _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[this.myReceiverID.ToString()];
  1433. this.socketUI = new SocketUI(this, this.myReceiverID, lblDemonStatus, FireDesk_Receiver.DATABASE_NAME_IP);
  1434. }
  1435. // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
  1436. // 모니터데몬이 사용중인지, 그리고 모니터데몬의 아이피가 무엇인지 알아낸다
  1437. //this.MonitorDaemon_Enable = (rk.GetValue("MAIN_MONITOR_ACTIVE").ToString() == "1") ? true : false;
  1438. //this.MonitorDaemon_IP = rk.GetValue("MAIN_MONITOR_SERVER_IP").ToString();
  1439. this.MonitorDaemon_Enable = _Data.Registry_MonitorDaemon_Enable;
  1440. this.MonitorDaemon_IP = _Data.Registry_MonitorDaemon_IP;
  1441. ShowWaittingMsgForm("수신기 디바이스 DB를 읽고 있습니다..", 20);
  1442. this.GetDeviceDB();
  1443. ShowWaittingMsgForm("수신기 중계기 DB를 읽고 있습니다..", 30);
  1444. this.GetRepeaterDB();
  1445. AnalogDetect.Get_TB_DAYTIME(this.myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경 // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1446. this.GetAnalogDetecterLevelDB();
  1447. ShowWaittingMsgForm("수신기 통신 보드 설정을 읽고 있습니다..", 40);
  1448. this.GetBoardDB();
  1449. ShowWaittingMsgForm("수신기 기본 설정값을 읽고 있습니다..", 50);
  1450. //
  1451. // ----------------------- 3. 수신기의 기본설정값 읽어오기 -----------------------
  1452. //
  1453. try
  1454. {
  1455. UIReceiverInfo cfg = new UIReceiverInfo(this.myReceiverID);
  1456. this.ConfigVO = cfg.ReadConfig();
  1457. this.lblAccumulSecond.Text = String.Format("{0}", this.ConfigVO.Fire_accumulation_time);
  1458. //this.lblAccumulSecond.Image = null;//sdkim, 20120129, [MTS-47]
  1459. //this.lblAccumulSecond.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
  1460. Display_FireMode(this.ConfigVO.Fire_process_mode); //화재모드 표시
  1461. //Display_SoundMode(this.ConfigVO.Sound_process_mode); //지구음향모드 표시
  1462. this.txtFirstFireWarnningMessage.Text = ""; //제1보 TEXT 초기화
  1463. this.txtFirstFireWarnningMessage.Tag = ""; //제1보 이벤트ID 초기화
  1464. cboSecondFireWarnningMessage.Items.Clear(); //제2보 메세지 초기화
  1465. cboWriteWarningMessage.Items.Clear(); //제경보 메세지 초기화
  1466. // 화재 리스트 초기화.
  1467. FireList.Clear();
  1468. FireList_Accumulation.Clear(); // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
  1469. PreFireList.Clear(); // cyim 2015.7.9 PreFire 표시 문제
  1470. LblBuildingName.Text = this.ConfigVO.Building_name; //건물명표시
  1471. // cyim 2014.8.11 화면에 마스터인지 슬레이브인지 표시
  1472. if (this.ConfigVO.Master_flag == "N")
  1473. {
  1474. this.LblBuildingName.ForeColor = Color.Gold; // 운전설정에서 바꿀수 없도록함 (마스터 수신기는 현장에 1개만 설정되어야 하므로 주의해야함)
  1475. this.LblBuildingName.Font = new System.Drawing.Font("맑은 고딕", 24F, System.Drawing.FontStyle.Bold);
  1476. }
  1477. // sdkim , 1보,2보 안보이는 현상 수정 , 이슈번호 #0000017
  1478. this.labelFireAlert.Visible = false;
  1479. this.txtFirstFireWarnningMessage.Visible = false;
  1480. this.labelFireAlert_inform_1th.Visible = false;
  1481. this.cboSecondFireWarnningMessage.Visible = false;
  1482. this.labelFireAlert_inform_2th.Visible = false;
  1483. // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
  1484. if (this.ConfigVO.Test_run_flag == "Y") label_TestRunFlag.Visible = true;
  1485. else label_TestRunFlag.Visible = false;
  1486. // cyim 2013.8.7 타수신기 화재 정보 팝업창 출력
  1487. // 현재 데이타베이스에 타수신기 정보를 알아내기위해 TB_RECEIVER 를 모두 찾아온다
  1488. DacReceiverConfig dacReceiverConfig = new DacReceiverConfig(this.myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  1489. DataTable dt = dacReceiverConfig.Receiver_Select();
  1490. if (dt.Rows.Count > 0)
  1491. {
  1492. foreach (DataRow dr in dt.Rows)
  1493. {
  1494. // 자기 아이디는 제외
  1495. if (this.myReceiverID.ToString() != dr["RECEIVER_ID"].ToString())
  1496. {
  1497. // 폼 클래스 생성
  1498. Form_Popup_OtherFireAlarm OtherFireAlarm = new Form_Popup_OtherFireAlarm(dr["RECEIVER_ID"].ToString(), this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1499. // 수신기 정보
  1500. OtherFireAlarm.POPUP_RECEIVER_ID = dr["RECEIVER_ID"].ToString();
  1501. OtherFireAlarm.POPUP_RECEIVER_NAME = dr["RECEIVER_NAME"].ToString();
  1502. OtherFireAlarm.POPUP_RECEIVER_IP = dr["IP_ADDRESS"].ToString();
  1503. // 해쉬테이블에 추가
  1504. Popup.HASH_EtcReceiverFireAlarmPopup.Add(OtherFireAlarm.POPUP_RECEIVER_ID, OtherFireAlarm); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1505. // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
  1506. // 현재 데이타베이스에 있는 TB_RECEIVER 의 IP 들을 모두 조회한다, 단 자신의 아이피는 알필요가 없다
  1507. NetworkReceiver_ID_ComStatus.Add(dr["RECEIVER_ID"].ToString(), true); // 처음 데이타베이스에 읽은 내용은 통신이 된다고 가정한다 // 특별테스트
  1508. NetworkReceiver_ID_List.Add(dr["RECEIVER_ID"].ToString()); // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
  1509. Before_NetworkReceiver_ID_ComStatus.Add(dr["RECEIVER_ID"].ToString(), true); // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  1510. }
  1511. }
  1512. }
  1513. // cyim 2017.01.24 : 사용중인 펌프만 표시하도록 한다
  1514. dt = dacReceiverConfig.Pump_Select(1);
  1515. if (dt == null || dt.Rows.Count == 0) { this.label_P1.Visible = false; };
  1516. dt = dacReceiverConfig.Pump_Select(2);
  1517. if (dt == null || dt.Rows.Count == 0) { this.label_P2.Visible = false; };
  1518. dt = dacReceiverConfig.Pump_Select(3);
  1519. if (dt == null || dt.Rows.Count == 0) { this.label_P3.Visible = false; };
  1520. dt = dacReceiverConfig.Pump_Select(4);
  1521. if (dt == null || dt.Rows.Count == 0) { this.label_P4.Visible = false; };
  1522. dt = dacReceiverConfig.Pump_Select(5);
  1523. if (dt == null || dt.Rows.Count == 0) { this.label_P5.Visible = false; };
  1524. dt = dacReceiverConfig.Pump_Select(6);
  1525. if (dt == null || dt.Rows.Count == 0) { this.label_P6.Visible = false; };
  1526. dt = dacReceiverConfig.Pump_Select(7);
  1527. if (dt == null || dt.Rows.Count == 0) { this.label_P7.Visible = false; };
  1528. dt = dacReceiverConfig.Pump_Select(8);
  1529. if (dt == null || dt.Rows.Count == 0) { this.label_P8.Visible = false; };
  1530. }
  1531. catch (Exception ex)
  1532. {
  1533. Util.UErrorMessage(ex, 0, 0);
  1534. throw new Exception("DB연결 실패!");
  1535. }
  1536. ShowWaittingMsgForm("수신기 도면 설정을 읽고 있습니다..", 60);
  1537. //
  1538. // 중요사항
  1539. //
  1540. // 네트워크 수신기에서 수신기아이디가 2인경우에도 Receiver1 폴더로 접근하도록 수정한다
  1541. // 폴더명과 ODBC 를 바꿔서 설정해야하는 불편함이 있다. 또한 런쳐가 실행되는 경로가 틀려져서 윈도우 부팅후 시작할수가 없다
  1542. // 결국 무조건 수신기 아이디와는 상관없이 폴더명은 Receiver1로 고정한다
  1543. // cyim 2014.8.6 Receiver1 로 폴더고정
  1544. //string sProjectPath = Path.Combine(rk.GetValue("PROJECT_DIR").ToString(), string.Format("Receiver{0}", this.myReceiverID));
  1545. // cyim 2015.7.29 수신반 루틴을 위해 외부 파라미터로 동작하도록 수정
  1546. //string sProjectPath = Path.Combine(rk.GetValue("PROJECT_DIR").ToString(), "Receiver1");
  1547. string sProjectPath = "";
  1548. if (_Data.FireDeskMode == false) // 수신반이 아닐때는 레지스트리 값 이용
  1549. {
  1550. sProjectPath = _Data.Registry_Project_Directory + "\\Receiver1";
  1551. }
  1552. else
  1553. {
  1554. _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[this.myReceiverID.ToString()];
  1555. // cyim 2015.7.30 ini 파일에서 Receiver 지정폴더사용
  1556. // 즉 레지스트리에서는 D:\FireTest 로 끝났지만 ini 파일에서는 D:\FireTest\Receiver1 같이 구체적인 폴더명을 지정한다
  1557. // 결국 아래와 같이 수신기 아이디별로 ini 파일대로 예상하는 프로젝트 경로는 아래와 같다
  1558. // 예시
  1559. // 수신기1 = D:\FireTest\Receiver1
  1560. // 수신기2 = D:\FireTest\Receiver2
  1561. // 수신기3 = D:\FireTest\Receiver3
  1562. sProjectPath = FireDesk_Receiver.PROJECT_DIRECTORY;
  1563. }
  1564. this.ConfigVO.Background_image = sProjectPath + "\\mapview\\field\\title.jpg";
  1565. if (File.Exists(this.ConfigVO.Background_image))
  1566. {
  1567. Image img = new Bitmap(this.ConfigVO.Background_image);//Image.FromStream(ms);
  1568. this.BackgroundImage = img;
  1569. }
  1570. if (InitXFieldData(sProjectPath) <= 0)
  1571. {
  1572. btnMenu7.Enabled = false;
  1573. }
  1574. }
  1575. // cyim 2015.9.1 1개의 수신기가 접속이 안되더라도 나머지는 접속시도할수 있도록 수정
  1576. catch (Exception ex)
  1577. {
  1578. Util.UErrorMessage(ex, 0, 0);
  1579. MessageBox.Show(ex.Message + "\r\r\n\n수신기정보를 읽을수 없습니다. 관리자에게 문의하십시요!\r\n프로그램 동작할 수 없습니다"
  1580. , Application.ProductName
  1581. , MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1582. //Application.Exit();
  1583. }
  1584. }
  1585. /********************************************************/
  1586. /* MDIParent 시작 */
  1587. /********************************************************/
  1588. // 버퍼
  1589. //private ArrayList Buffer = new ArrayList();
  1590. //// 패킷
  1591. //private object[] Packet = new object[1000];
  1592. //// 데이타큐
  1593. //private Queue DataQueue = new Queue();
  1594. //// CS
  1595. //private Object CS = new object();
  1596. private void MDIParent_Load(object sender, EventArgs e)
  1597. {
  1598. try
  1599. {
  1600. this.Hide();
  1601. this.Cursor = Cursors.WaitCursor;
  1602. this.window = this;
  1603. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1604. TcpComClient = new _TcpComClient(this);
  1605. Popup = new _Popup(this);
  1606. //
  1607. // 이벤트 핸들러 등록 - cyim
  1608. //
  1609. Event.SocketBufferError_Inform_Event += new _Event.SocketBufferError_Inform_Handler(_Event_SocketBufferError_Inform_Event); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1610. // cyim 2014.8.8 통신점검 시나리오 신규 작업
  1611. Event.ClientSocketReceive_SendMessage_Event += new _Event.ClientSocketReceive_SendMessage_Handler(_Event_ClientSocketReceive_SendMessage_Event); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1612. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  1613. //TcpComClient.SocketConnect_Inform_Event += new TcpComClient.SocketConnect_Inform_Message_Handler(_TcpComClient_SocketConnect_Inform_Event);
  1614. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1615. TcpComClient.SocketConnect_Inform_Event += new _TcpComClient.SocketConnect_Inform_Message_Handler(_TcpComClient_SocketConnect_Inform_Event);
  1616. // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트
  1617. Event.TimeSync_Setup_SendMessage_Event += new _Event.TimeSync_Setup_SendMessage_Handler(Event_TimeSync_Setup_SendMessage_Event);
  1618. ShowWaittingMsgForm("수신기 데몬연결 설정을 읽고 있습니다..", 10);
  1619. //CheckForIllegalCrossThreadCalls = false; //크로스작업 무시
  1620. //수신기 초기화.. DB접속.. 필수 연결안되면 프로그램 종료
  1621. Init();
  1622. ShowWaittingMsgForm("수신기 데몬연결 설정 읽기를 완료하였습니다.", 70);
  1623. // cyim 2015.2.9 프로그램 시작
  1624. CommandLog(MappingStatus.ProgramStart, string.Format("{0}가 시작되었습니다. Ver.{1}", Application.ProductName, Application.ProductVersion));
  1625. // ----------------------- 4. TCP/IP 통신연동 & 데몬 RESET 명령-----------------------
  1626. ShowWaittingMsgForm("환경정보를 읽고 있습니다..", 80);
  1627. this.socketUI.ReceiverDBRead(); //DB에서 설정 읽어몸
  1628. ShowWaittingMsgForm("환경정보 읽기를 완료하였습니다.", 90);
  1629. // ----------------------- 4. TCP/IP 통신연동 & 데몬 RESET 명령-----------------------
  1630. // cyim 2015.8.12 데이타베이스 용량 문제 : 파일복사 문제 수정하기 위해 아래 주석 처리
  1631. // 아래의 타이머가 동작되면서 한달에 한번씩 파일DB를 복사한다. 결국 하드디스크 용량문제가 발생하므로 삭제한다
  1632. //timerMaintance.Enabled = true;
  1633. //timerMaintance.Start();
  1634. // cyim 2015.8.12 데이타베이스 용량 문제 : 아래 주석 처리 해제
  1635. timerLogDelete.Start();
  1636. //timerVoltage.Start();
  1637. this.SetEmergencyBroadCastSetatus(true);
  1638. ShowWaittingMsgForm("데몬연결을 시도합니다..", 95);
  1639. this.socketUI.ServiceStart(); //TCP/IP 통신 시작
  1640. //this.socketUI.ReceiverDemonReset(); //데몬 RESET 명령
  1641. // Application.DoEvents();
  1642. //this.socketUI.CountReadStart(); //차단설정 카운트 표시--->this.socketUI.ServiceStart();안으로 이동
  1643. // cyim 2015.2.9 시작시에 데몬이 연결되었는지 확인하고 문구를 결정
  1644. if (CommDaemon_ComStatus == true)
  1645. {
  1646. ShowWaittingMsgForm("데몬 연결이 완료되었습니다.", 100);
  1647. // 통신데몬 통신상태는 처음시작시 연결정상이 기본값이므로 토글된 상태일때만 로그를 남기는 구조에서는 어쩔수 없이 여기서 남기도록 한다
  1648. CommandLog(MappingStatus.CommConnectNormal, string.Format("통신데몬 연결 정상"));
  1649. }
  1650. else
  1651. {
  1652. ShowWaittingMsgForm("데몬 연결이 안됩니다.", 100);
  1653. }
  1654. // cyim 2016.12.16 : 수신반을 통한 MDIParent 창은 윈도우창이 존재한다
  1655. if (_Data.FireDeskMode == true)
  1656. {
  1657. this.WindowState = FormWindowState.Normal;
  1658. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  1659. this.ControlBox = true;
  1660. this.MinimizeBox = false;
  1661. this.MaximizeBox = false;
  1662. }
  1663. else
  1664. {
  1665. if (_Data.Hook_Enable != "OFF")
  1666. {
  1667. // cyim 2017.01.23 : Explorer 프로세스 제어 루틴 추가
  1668. _Diagnostics.taskkill_explorer();
  1669. }
  1670. }
  1671. }
  1672. catch (Exception ex)
  1673. {
  1674. Util.UErrorMessage(ex, 0, 0);
  1675. // cyim 2015.2.9 통신데몬 연결 실패
  1676. //CommandLog(MappingStatus.CommConnectError, string.Format("데몬연결이상!\r\n {0}", ex.Message));
  1677. }
  1678. finally
  1679. {
  1680. // cyim 2015.7.30 수신반인 경우 기본으로 숨겨짐
  1681. if (_Data.FireDeskMode == false)
  1682. this.Show();
  1683. //잠시만 기다리는 창 화면 닫기
  1684. if (this.waittingForm != null)
  1685. this.waittingForm.Close();
  1686. //---------------------------------------------------
  1687. //1280*1024모드를 체크하여 화면이동을 가능하게 한다....
  1688. //---------------------------------------------------
  1689. Size sz = Screen.PrimaryScreen.WorkingArea.Size;
  1690. if (sz.Width > 1280 && sz.Height > 1024)
  1691. {
  1692. this.WindowState = FormWindowState.Normal;
  1693. this.Size = new Size(1280, 1024);
  1694. this.StartPosition = FormStartPosition.CenterScreen;
  1695. MDIMove = true;
  1696. }
  1697. //else if (sz.Width == 1280 && sz.Height == 1024)
  1698. else if (sz.Width == 1280)
  1699. {
  1700. this.WindowState = FormWindowState.Normal;
  1701. this.Size = new Size(1280, 1024);
  1702. this.StartPosition = FormStartPosition.CenterScreen;
  1703. MDIMove = true;
  1704. }
  1705. else
  1706. {
  1707. MessageBox.Show(string.Format("1280*1024 화면모드 버젼입니다. 먼저 해상도를 변경하십시요..\r\n 현재해상도 : {0}*{1}", sz.Width, sz.Height));
  1708. this.WindowState = FormWindowState.Normal;
  1709. this.Size = new Size(1280, 1024);
  1710. this.StartPosition = FormStartPosition.CenterScreen;
  1711. MDIMove = true;
  1712. //this.Close();
  1713. }
  1714. //MessageBox.Show(string.Format("width:{0} height:{1} WindowState:{2} StartPosition:{3} ", this.Size.Width, this.Size.Height, this.WindowState, this.StartPosition));
  1715. //---------------------------------------------------
  1716. //중계기상태보기를 보여준다..
  1717. //ShowChildForm(new frmRepeaterGroup());
  1718. this.Cursor = Cursors.Default;
  1719. // cyim 2015.7.7 속도개선작업 : 중복호출 방지
  1720. // SetLikageBtnStatus 함수의 경우 FormField 가 활성화되면서 의미없이 중복으로 계속 호출되버린다.
  1721. // 결국 메뉴 인덱스가 변경되기전에 미리 데이타를 읽어야 한다. 위치를 FormField 생성자 위에서 미리 실행해둔다.
  1722. // cyim 2013.7.19 속도개선작업
  1723. // MDIParent.cs 의 SetLikageBtnStatus 가 최대 문제임을 발견!!!
  1724. // -> CheckOutputDeviceTypeStop 안에 쿼리를 날리는데 order by 를 남용하여 속도가 저하되었다
  1725. this.SetLikageBtnStatus();
  1726. // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
  1727. //if (bJumpField)
  1728. if (MyConfigVO.Jump_field_flag == "Y")
  1729. {
  1730. if (this.xField.Count > 0)
  1731. {//moon, 11.11.01 , init filed form
  1732. FormField formField = (FormField)ShowChildForm(new FormField(this.xField, this.DataType_Set));
  1733. formField.JumpField(0);
  1734. }
  1735. }
  1736. // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
  1737. // MDIParent 가 준비되면 이벤트 발생 (수신반 메인화면에서 다른 메인화면을 열어야함)
  1738. Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "FormLoad", "MDIParentComplete", 0); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1739. }
  1740. }
  1741. /********************************************************/
  1742. /********************************************************/
  1743. /* MDIParent 화면 닫기전 */
  1744. /********************************************************/
  1745. void MDIParent_FormClosing(object sender, FormClosingEventArgs e)
  1746. {
  1747. try
  1748. {
  1749. // cyim 2016.12.16 : 수신반의 경우 MDIParent의 숨김 버튼을 닫기 버튼으로 대체한다
  1750. if (_Data.FireDeskMode == true)
  1751. {
  1752. // 이벤트 해제
  1753. e.Cancel = true;
  1754. // 창을 닫는 대신, 보이지 않게만 한다
  1755. this.Visible = false;
  1756. }
  1757. else
  1758. {
  1759. //
  1760. // cyim 2015.7.29 수신반의 경우 MDIParent 가 항상 켜져있지 않을수도 있으므로 이벤트 핸들러 삭제 코드 추가
  1761. //
  1762. Event.SocketBufferError_Inform_Event -= new _Event.SocketBufferError_Inform_Handler(_Event_SocketBufferError_Inform_Event);
  1763. // cyim 2014.8.8 통신점검 시나리오 신규 작업
  1764. Event.ClientSocketReceive_SendMessage_Event -= new _Event.ClientSocketReceive_SendMessage_Handler(_Event_ClientSocketReceive_SendMessage_Event);
  1765. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  1766. //TcpComClient.SocketConnect_Inform_Event -= new TcpComClient.SocketConnect_Inform_Message_Handler(_TcpComClient_SocketConnect_Inform_Event);
  1767. // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  1768. TcpComClient.SocketConnect_Inform_Event -= new _TcpComClient.SocketConnect_Inform_Message_Handler(_TcpComClient_SocketConnect_Inform_Event);
  1769. // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트
  1770. Event.TimeSync_Setup_SendMessage_Event -= new _Event.TimeSync_Setup_SendMessage_Handler(Event_TimeSync_Setup_SendMessage_Event);
  1771. // cyim 2015.2.9 프로그램 종료
  1772. CommandLog(MappingStatus.ProgramEnd, string.Format("{0}가 종료되었습니다. Ver.{1}", Application.ProductName, Application.ProductVersion));
  1773. //TCP/IP 통신 종료
  1774. if (this.socketUI != null)
  1775. {
  1776. this.socketUI.ServiceStop();
  1777. }
  1778. // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
  1779. if (_Data.Hook_Enable != "OFF")
  1780. {
  1781. // cyim 2017.01.23 : Explorer 프로세스 제어 루틴 추가
  1782. _Diagnostics.start_explorer();
  1783. _Hook.Enable_TaskMgr();
  1784. _Hook.Enable_NoClose();
  1785. }
  1786. Environment.Exit(0);
  1787. }
  1788. }
  1789. catch
  1790. {
  1791. Environment.Exit(0);
  1792. }
  1793. }
  1794. /********************************************************/
  1795. /********************************************************/
  1796. /* 프로그램 종료 버튼 */
  1797. /********************************************************/
  1798. private void btnChildClose_Click(object sender, EventArgs e)
  1799. {
  1800. try
  1801. {
  1802. // 테스트 코드
  1803. //this.Cursor = Cursors.WaitCursor;
  1804. //ApplicationExit();
  1805. //this.Cursor = Cursors.Default;
  1806. EventLogInfo eventLog = new EventLogInfo("1234");
  1807. //essage = String.Format("{0}", EventTypeName(resData.EventType, "FIRE ACCUMULATION ON!"));
  1808. //eventLog.Message = message;
  1809. //eventLog.EventStatus = MappingStatus.AccumulateOn;
  1810. ////Live 메세지 생성
  1811. //eventLog.LiveMsgFlag = true;
  1812. // 이벤트 추가
  1813. EventLogAdd(eventLog);
  1814. //축적모드 시작
  1815. Accumulate_Start();
  1816. // cyim 2016.12.12 축적화재 재동작 컨셉 변경
  1817. // 축적화재 발생도중에 축적화재가 또 발생한 경우에는 카운터는 그대로 유지한다. 만약 기존의 축적화재가 사라지더라도 축적화재 상태가 해제되지 않기 때문이다
  1818. //////////////////////////////////////////// cyim 2014.7.9 : 축적화재 표시 : KFI 요청사항
  1819. //main.Display_FireCnt(resData.Count); //화재카운트 표시안함
  1820. fireCount_Accumulation = 0;//resData.Count;
  1821. // 기존 화재 리스트에 있는지 확인하고, 없는 경우에 새로 추가한다.
  1822. string sEventLog = string.Format("{0}", eventLog.DeviceMessage);
  1823. if (FireList_Accumulation.Contains(sEventLog))
  1824. {
  1825. // 중복 메시지가 있음.
  1826. }
  1827. else
  1828. {
  1829. // 화재 리스트에 추가.
  1830. FireList_Accumulation.Add(string.Format("{0}", eventLog.DeviceMessage));
  1831. FireEventProcess();
  1832. }
  1833. //////////////////////////////////////////// cyim 2014.7.9 : 축적화재 표시 : KFI 요청사항
  1834. //화면에 메세지 표시--축적시작 : 추가 2010.10.28 탁은임
  1835. MessageProcess(eventLog);//2010.10.29,k.s.d, message level bug fix => MessageProcess before UpdateEventMessage.
  1836. }
  1837. catch (Exception ex)
  1838. {
  1839. Util.UErrorMessage(ex, 0, 0);
  1840. }
  1841. }
  1842. /********************************************************/
  1843. /********************************************************/
  1844. /* 이벤트 버튼이미지 변경 */
  1845. /********************************************************/
  1846. //public void btnMenu_MouseHover(object sender, EventArgs e) {
  1847. // try {
  1848. // Button btn = (Button)sender;
  1849. // switch (btn.Name) {
  1850. // case "btnMenu1":
  1851. // btn.ImageIndex = cstBtnMenu1_Over;
  1852. // break;
  1853. // case "btnMenu2":
  1854. // btn.ImageIndex = cstBtnMenu2_Over;
  1855. // break;
  1856. // case "btnMenu3":
  1857. // btn.ImageIndex = cstBtnMenu3_Over;
  1858. // break;
  1859. // case "btnMenu4":
  1860. // btn.ImageIndex = cstBtnMenu4_Over;
  1861. // break;
  1862. // case "btnMenu5":
  1863. // btn.ImageIndex = cstBtnMenu5_Over;
  1864. // break;
  1865. // case "btnMenu6":
  1866. // btn.ImageIndex = cstBtnMenu6_Over;
  1867. // break;
  1868. // case "btnMenu7":
  1869. // btn.ImageIndex = cstBtnMenu7_Over;
  1870. // break;
  1871. // }
  1872. // }
  1873. // catch (Exception ex) {
  1874. // Util.UErrorMessage(ex, 0, 0);
  1875. // }
  1876. //}
  1877. public void btnMenu_MouseHover(object sender, EventArgs e)
  1878. {
  1879. try
  1880. {
  1881. Button btn = (Button)sender;
  1882. switch (btn.Name)
  1883. {
  1884. case "btnMenu1": { this.ImgChangeBtnMenu1o(); break; }
  1885. case "btnMenu2": { this.ImgChangeBtnMenu2o(); break; }
  1886. case "btnMenu3": { this.ImgChangeBtnMenu3o(); break; }
  1887. case "btnMenu4": { this.ImgChangeBtnMenu4o(); break; }
  1888. case "btnMenu5": { this.ImgChangeBtnMenu5o(); break; }
  1889. case "btnMenu6": { this.ImgChangeBtnMenu6o(); break; }
  1890. case "btnMenu7": { this.ImgChangeBtnMenu7o(); break; }
  1891. }
  1892. }
  1893. catch (Exception ex)
  1894. {
  1895. Util.UErrorMessage(ex, 0, 0);
  1896. }
  1897. }
  1898. //public void btnMenu_MouseLeave(object sender, EventArgs e) {
  1899. // try {
  1900. // Button btn = (Button)sender;
  1901. // switch (btn.Name) {
  1902. // case "btnMenu1":
  1903. // btn.ImageIndex = this.selectMenuIndex == 1 ? cstBtnMenu1_Over : imgIndexbtnMenu1_normal/*cstBtnMenu1*/;
  1904. // break;
  1905. // case "btnMenu2":
  1906. // btn.ImageIndex = this.selectMenuIndex == 2 ? cstBtnMenu2_Over : cstBtnMenu2;
  1907. // break;
  1908. // case "btnMenu3":
  1909. // btn.ImageIndex = this.selectMenuIndex == 3 ? cstBtnMenu3_Over : cstBtnMenu3;
  1910. // break;
  1911. // case "btnMenu4":
  1912. // btn.ImageIndex = this.selectMenuIndex == 4 ? cstBtnMenu4_Over : cstBtnMenu4;
  1913. // break;
  1914. // case "btnMenu5":
  1915. // btn.ImageIndex = this.selectMenuIndex == 5 ? cstBtnMenu5_Over : cstBtnMenu5;
  1916. // break;
  1917. // case "btnMenu6":
  1918. // btn.ImageIndex = this.selectMenuIndex == 6 ? cstBtnMenu6_Over : cstBtnMenu6;
  1919. // break;
  1920. // case "btnMenu7":
  1921. // btn.ImageIndex = this.selectMenuIndex == 7 ? cstBtnMenu7_Over : cstBtnMenu7;
  1922. // break;
  1923. // }
  1924. // }
  1925. // catch (Exception ex) {
  1926. // Util.UErrorMessage(ex, 0, 0);
  1927. // }
  1928. //}
  1929. public void btnMenu_MouseLeave(object sender, EventArgs e)
  1930. {
  1931. try
  1932. {
  1933. Button btn = (Button)sender;
  1934. switch (btn.Name)
  1935. {
  1936. case "btnMenu1":
  1937. if (this.selectMenuIndex == 1)
  1938. {
  1939. this.ImgChangeBtnMenu1o();
  1940. }
  1941. else
  1942. {
  1943. this.ImgChangeBtnMenu1n();
  1944. }
  1945. break;
  1946. case "btnMenu2":
  1947. if (this.selectMenuIndex == 2)
  1948. {
  1949. this.ImgChangeBtnMenu2o();
  1950. }
  1951. else
  1952. {
  1953. this.ImgChangeBtnMenu2n();
  1954. }
  1955. break;
  1956. case "btnMenu3":
  1957. if (this.selectMenuIndex == 3)
  1958. {
  1959. this.ImgChangeBtnMenu3o();
  1960. }
  1961. else
  1962. {
  1963. this.ImgChangeBtnMenu3n();
  1964. }
  1965. break;
  1966. case "btnMenu4":
  1967. if (this.selectMenuIndex == 4)
  1968. {
  1969. this.ImgChangeBtnMenu4o();
  1970. }
  1971. else
  1972. {
  1973. this.ImgChangeBtnMenu4n();
  1974. }
  1975. break;
  1976. case "btnMenu5":
  1977. if (this.selectMenuIndex == 5)
  1978. {
  1979. this.ImgChangeBtnMenu5o();
  1980. }
  1981. else
  1982. {
  1983. this.ImgChangeBtnMenu5n();
  1984. }
  1985. break;
  1986. case "btnMenu6":
  1987. if (this.selectMenuIndex == 6)
  1988. {
  1989. this.ImgChangeBtnMenu6o();
  1990. }
  1991. else
  1992. {
  1993. this.ImgChangeBtnMenu6n();
  1994. }
  1995. break;
  1996. case "btnMenu7":
  1997. if (this.selectMenuIndex == 7)
  1998. {
  1999. this.ImgChangeBtnMenu7o();
  2000. }
  2001. else
  2002. {
  2003. this.ImgChangeBtnMenu7n();
  2004. }
  2005. break;
  2006. }
  2007. }
  2008. catch (Exception ex)
  2009. {
  2010. Util.UErrorMessage(ex, 0, 0);
  2011. }
  2012. }
  2013. //private void btnMenu_MouseDown(object sender, MouseEventArgs e) {
  2014. // try {
  2015. // if (e.Button == MouseButtons.Left) {
  2016. // Button btn = (Button)sender;
  2017. // switch (btn.Name) {
  2018. // case "btnMenu1":
  2019. // btn.ImageIndex = cstBtnMenu1_Down;
  2020. // break;
  2021. // case "btnMenu2":
  2022. // btn.ImageIndex = cstBtnMenu2_Down;
  2023. // break;
  2024. // case "btnMenu3":
  2025. // btn.ImageIndex = cstBtnMenu3_Down;
  2026. // break;
  2027. // case "btnMenu4":
  2028. // btn.ImageIndex = cstBtnMenu4_Down;
  2029. // break;
  2030. // case "btnMenu5":
  2031. // btn.ImageIndex = cstBtnMenu5_Down;
  2032. // break;
  2033. // case "btnMenu6":
  2034. // btn.ImageIndex = cstBtnMenu6_Down;
  2035. // break;
  2036. // case "btnMenu7":
  2037. // btn.ImageIndex = cstBtnMenu7_Down;
  2038. // break;
  2039. // }
  2040. // }
  2041. // }
  2042. // catch (Exception ex) {
  2043. // Util.UErrorMessage(ex, 0, 0);
  2044. // }
  2045. //}
  2046. private void btnMenu_MouseDown(object sender, MouseEventArgs e)
  2047. {
  2048. try
  2049. {
  2050. if (e.Button == MouseButtons.Left)
  2051. {
  2052. Button btn = (Button)sender;
  2053. switch (btn.Name)
  2054. {
  2055. case "btnMenu1": { this.ImgChangeBtnMenu1d(); break; }
  2056. case "btnMenu2": { this.ImgChangeBtnMenu2d(); break; }
  2057. case "btnMenu3": { this.ImgChangeBtnMenu3d(); break; }
  2058. case "btnMenu4": { this.ImgChangeBtnMenu4d(); break; }
  2059. case "btnMenu5": { this.ImgChangeBtnMenu5d(); break; }
  2060. case "btnMenu6": { this.ImgChangeBtnMenu6d(); break; }
  2061. case "btnMenu7": { this.ImgChangeBtnMenu7d(); break; }
  2062. }
  2063. }
  2064. }
  2065. catch (Exception ex)
  2066. {
  2067. Util.UErrorMessage(ex, 0, 0);
  2068. }
  2069. }
  2070. private void btnMenu_MouseUp(object sender, MouseEventArgs e)
  2071. {
  2072. try
  2073. {
  2074. if (e.Button == MouseButtons.Left)
  2075. {
  2076. Button btn = (Button)sender;
  2077. switch (btn.Name)
  2078. {
  2079. case "btnMenu1": { this.ImgChangeBtnMenu1o(); break; }
  2080. case "btnMenu2": { this.ImgChangeBtnMenu2o(); break; }
  2081. case "btnMenu3": { this.ImgChangeBtnMenu3o(); break; }
  2082. case "btnMenu4": { this.ImgChangeBtnMenu4o(); break; }
  2083. case "btnMenu5": { this.ImgChangeBtnMenu5o(); break; }
  2084. case "btnMenu6": { this.ImgChangeBtnMenu6o(); break; }
  2085. case "btnMenu7": { this.ImgChangeBtnMenu7o(); break; }
  2086. }
  2087. }
  2088. }
  2089. catch (Exception ex)
  2090. {
  2091. Util.UErrorMessage(ex, 0, 0);
  2092. }
  2093. }
  2094. /********************************************************/
  2095. /********************************************************/
  2096. /* 설비제어--테스트화면 */
  2097. /********************************************************/
  2098. // cyim 2015.8.18 주경종정지 기능 추가 : 델리게이트 선언 및 생성자 변경
  2099. // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
  2100. // 0 : Default, 1 : 전체정지, 2 : 전체연동
  2101. public void ShowControlWrite(bool MainSoundStop, int EquipmentAllOperationStatus)
  2102. {
  2103. try
  2104. {
  2105. if (this.InvokeRequired)
  2106. {
  2107. SetBoolIntCallback d = new SetBoolIntCallback(ShowControlWrite);
  2108. this.Invoke(d, new object[] { MainSoundStop, EquipmentAllOperationStatus });
  2109. }
  2110. else
  2111. {
  2112. Form f = ShowChildForm(new frmControlWrite(MainSoundStop, EquipmentAllOperationStatus));
  2113. }
  2114. }
  2115. catch (Exception ex)
  2116. {
  2117. Util.UErrorMessage(ex, 0, 0);
  2118. }
  2119. }
  2120. // 설비 연동 버튼 클릭 이벤트
  2121. public void btnMenu1_Click(object sender, EventArgs e)
  2122. {
  2123. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  2124. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  2125. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  2126. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  2127. LFC.Log("타입: 수신기 조작 로그, 메세지: 설비연동 메뉴 클릭");
  2128. ShowControlWrite(false, 0); // cyim 2015.8.18 주경종정지 기능 추가 : 기본값은 false
  2129. }
  2130. /********************************************************/
  2131. /********************************************************/
  2132. /* 시스템정보 버튼 클릭시 메뉴 표시 */
  2133. /********************************************************/
  2134. private void btnMenu3_Click(object sender, EventArgs e)
  2135. {
  2136. try
  2137. {
  2138. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  2139. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  2140. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  2141. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  2142. int mnSizeW = MenuStripStatus.Size.Width;
  2143. mnSizeW = 1280 - mnSizeW - 196;
  2144. MenuStripStatus.Show(this.Location.X + mnSizeW, this.Location.Y + 308);
  2145. }
  2146. catch (Exception ex)
  2147. {
  2148. Util.UErrorMessage(ex, 0, 0);
  2149. }
  2150. }
  2151. /********************************************************/
  2152. /********************************************************/
  2153. /* 시스템정보>중계반상태보기 Form 생성 */
  2154. /********************************************************/
  2155. private void RepeaterGroupToolStripMenuItem_Click(object sender, EventArgs e)
  2156. {
  2157. try
  2158. {
  2159. // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
  2160. if (ReceiverModel == "IFC3300")
  2161. {
  2162. LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-중계반 상태보기 메뉴 클릭");
  2163. Form f = ShowChildForm(new frmBoardGroup_BigReceiver());
  2164. }
  2165. else
  2166. {
  2167. LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-중계반 상태보기 메뉴 클릭");
  2168. Form f = ShowChildForm(new frmBoardGroup());
  2169. }
  2170. }
  2171. catch (Exception ex)
  2172. {
  2173. Util.UErrorMessage(ex, 0, 0);
  2174. }
  2175. }
  2176. /********************************************************/
  2177. /********************************************************/
  2178. /* 시간표시 및 통신연결상태 표시 */
  2179. /********************************************************/
  2180. //int imgIndexbtnMenu1_normal = cstBtnMenu1;
  2181. public int updatebutton1timer = 0;
  2182. private void timerDateTime_Tick(object sender, EventArgs e)
  2183. {
  2184. try
  2185. {
  2186. // cyim 2015.7.3 감지기 레벨중 FireDay, FireNight 구분을 위한 현재 시간 정보 조회
  2187. AnalogDetect.FireDayTime_Check_Timer_Tick(); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2188. // cyim 2016.12.28 : 예외처리 추가: 수신반에 불필요한 이벤트는 발생하지 않는다
  2189. if (_Data.FireDeskMode == false)
  2190. {
  2191. // cyim 2014.7.18 : 데몬이 늦게 출력되어 포커스를 잃어버리면 작업바가 나타난다
  2192. if (timer_MdiParent_TopMost == false)
  2193. {
  2194. timer_MdiParent_TopMost_Cnt++;
  2195. if (timer_MdiParent_TopMost_Cnt == 5)
  2196. {
  2197. this.TopMost = false;
  2198. }
  2199. // cyim 2014.7.23 마우스 이벤트 강제로 발생
  2200. else if (timer_MdiParent_TopMost_Cnt == 60)
  2201. {
  2202. _MouseEvent.Click(10, 10);
  2203. // 1회만 실행
  2204. timer_MdiParent_TopMost = true;
  2205. }
  2206. }
  2207. }
  2208. // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
  2209. this.MonitorDaemon_Chk_Cnt++;
  2210. if (this.MonitorDaemon_Chk_Cnt >= 20) // cyim 2015.10.23 네트워크 수신기 통신 상태 폴링 주기 변경 : 30 -> 20
  2211. {
  2212. this.MonitorDaemon_Chk_Cnt = 0;
  2213. // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트 : 시간정보를 보내는 루틴과 폴링하는 루틴이 별개로 존재하게 되어 공통 루틴으로 일단 함수로 처리함
  2214. ReadRegister_And_SendToPacket_MonitorDaemon("ComStatus");
  2215. //// 레지스트리 값을 다시 읽어온다
  2216. //RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\I_FPER_COMM_DAEMON", false);
  2217. //if (rk != null)
  2218. //{
  2219. // this.MonitorDaemon_Enable = (rk.GetValue("MAIN_MONITOR_ACTIVE").ToString() == "1") ? true : false;
  2220. // this.MonitorDaemon_IP = rk.GetValue("MAIN_MONITOR_SERVER_IP").ToString();
  2221. // // 모니터데몬을 사용하지 않으면 모두 true 로 전환
  2222. // if (this.MonitorDaemon_Enable == false)
  2223. // {
  2224. // this.MonitorDaemon_ComStatus = true;
  2225. // foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
  2226. // NetworkReceiver_ID_ComStatus[ReceiverID] = true;
  2227. // // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  2228. // Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
  2229. // // 스레드 중지
  2230. // Thread.Abort("TcpComClient"); // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정 // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2231. // }
  2232. // else
  2233. // {
  2234. // if (this.MonitorDaemon_IP != null && this.MonitorDaemon_IP.Length != 0)
  2235. // {
  2236. // // cyim 2014.8.11 : Connect 루틴은 스레드로 돌림 (접속이 안되는 PC 라면 프로그램이 멈춤현상이 발생함) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2237. // Thread.Abort("TcpComClient");
  2238. // Thread.Create("TcpComClient", TcpComClient_byThread, "ComStatus");
  2239. // }
  2240. // }
  2241. //}
  2242. }
  2243. try
  2244. {
  2245. // cyim 2015.9.23 시간정보 표시 오류 (갱신을 안함)
  2246. MyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  2247. //시간표시
  2248. String strTime = string.Format("{0:yyyy}년 {0:MM}월 {0:dd}일 {0:HH}:{0:mm}:{0:ss}", DateTime.Now);
  2249. LblTime.Text = strTime;
  2250. //LblTime.Image = null; //sdkim, 20120129, [MTS-47]
  2251. //LblTime.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
  2252. //if ((updatebutton1timer++ % 2 )== 0) {
  2253. // this.Setmenu1Button();
  2254. //}
  2255. }
  2256. catch (Exception ex)
  2257. {
  2258. Util.UErrorMessage(ex, 0, 0);
  2259. }
  2260. //if (this.MdiChildren.Length < 1) this.SelectMenuIndex = 0;
  2261. //축적시간표시
  2262. if (this.ConfigVO != null)
  2263. {
  2264. if (this.ConfigVO.Fire_accumulation_mode && this.ConfigVO.Fire_accumulation_start)
  2265. {
  2266. this.ConfigVO.Fire_accumulation_second--;
  2267. Display_AccumulSecond();
  2268. }
  2269. }
  2270. //통신데몬연결상태 화면에 표시
  2271. if (this.socketUI != null)
  2272. this.socketUI.ReadDeamonInfo();
  2273. }
  2274. catch (Exception ex)
  2275. {
  2276. Util.UErrorMessage(ex, 0, 0);
  2277. //MessageBox.Show(ex.Message, Application.ProductName);
  2278. }
  2279. }
  2280. /********************************************************/
  2281. // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트 : 시간정보를 보내는 루틴과 폴링하는 루틴이 별개로 존재하게 되어 공통 루틴으로 일단 함수로 처리함
  2282. private void ReadRegister_And_SendToPacket_MonitorDaemon(string Data) // 레지스트리값을 읽고 주기적으로 모니터데몬에게 메세지를 보내는 함수
  2283. {
  2284. // 수신반은 의미없다
  2285. if (_Data.FireDeskMode == true)
  2286. return;
  2287. // 레지스트리 값을 다시 읽어온다
  2288. RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\I_FPER_COMM_DAEMON", false);
  2289. if (rk != null)
  2290. {
  2291. this.MonitorDaemon_Enable = (rk.GetValue("MAIN_MONITOR_ACTIVE").ToString() == "1") ? true : false;
  2292. this.MonitorDaemon_IP = rk.GetValue("MAIN_MONITOR_SERVER_IP").ToString();
  2293. // 모니터데몬을 사용하지 않으면 모두 true 로 전환
  2294. if (this.MonitorDaemon_Enable == false)
  2295. {
  2296. this.MonitorDaemon_ComStatus = true;
  2297. foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
  2298. NetworkReceiver_ID_ComStatus[ReceiverID] = true;
  2299. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  2300. Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
  2301. // 스레드 중지
  2302. Thread.Abort("TcpComClient"); // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정 // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2303. }
  2304. else
  2305. {
  2306. if (this.MonitorDaemon_IP != null && this.MonitorDaemon_IP.Length != 0)
  2307. {
  2308. // cyim 2014.8.11 : Connect 루틴은 스레드로 돌림 (접속이 안되는 PC 라면 프로그램이 멈춤현상이 발생함) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2309. Thread.Abort("TcpComClient");
  2310. Thread.Create("TcpComClient", TcpComClient_byThread, Data);
  2311. }
  2312. }
  2313. }
  2314. }
  2315. // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트 (데이타를 파라미터로 변환)
  2316. // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
  2317. private void TcpComClient_byThread(object Data)
  2318. {
  2319. // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
  2320. // 어느순간 갑자기 레지스트리값이 변경될수도 있으므로 안전하게 임시변수를 이용
  2321. string temp_MonitorDaemon_IP = this.MonitorDaemon_IP;
  2322. // 모니터데몬에 접속해본다
  2323. if (TcpComClient.Ping_SyncCheck(temp_MonitorDaemon_IP) == true && TcpComClient.Socket_Connect(temp_MonitorDaemon_IP, "9004") == true) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2324. {
  2325. // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
  2326. lock (CS_MonitorDaemon_ComStatus)
  2327. {
  2328. // 모니터데몬은 통신이 잘됨
  2329. this.MonitorDaemon_ComStatus = true;
  2330. // cyim 2015.10.23 통신이 정상인데도 불구하고 30초마다 통신오류가 표시됨 : 주석처리
  2331. //foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
  2332. // NetworkReceiver_ID_ComStatus[ReceiverID] = false;
  2333. // 메세지 송출
  2334. byte[] data = _Convert.EncodingData(_Convert.Coding.UTF8, Data.ToString());
  2335. TcpComClient.Socket_Send(temp_MonitorDaemon_IP, "9004", data); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2336. }
  2337. }
  2338. else
  2339. {
  2340. // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
  2341. lock (CS_MonitorDaemon_ComStatus)
  2342. {
  2343. // 모니터데몬은 통신이 안됨
  2344. this.MonitorDaemon_ComStatus = false;
  2345. // 원래있던 수신기의 통신상태는 true 로 돌려놓는다
  2346. foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
  2347. NetworkReceiver_ID_ComStatus[ReceiverID] = false; // cyim 2015.10.23 통신이 정상인데도 불구하고 30초마다 통신오류가 표시됨 : true -> false 해야된다
  2348. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  2349. Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
  2350. }
  2351. }
  2352. }
  2353. /********************************************************/
  2354. /* 시스템설정버튼 클릭시 메뉴 표시 */
  2355. /********************************************************/
  2356. private void btnMenu2_Click(object sender, EventArgs e)
  2357. {
  2358. try
  2359. {
  2360. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  2361. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  2362. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  2363. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  2364. int mnSizeW = MenuStripSystem.Size.Width;
  2365. mnSizeW = 1280 - mnSizeW - 196;
  2366. MenuStripSystem.Show(this.Location.X + mnSizeW, this.Location.Y + 244);
  2367. }
  2368. catch (Exception ex)
  2369. {
  2370. Util.UErrorMessage(ex, 0, 0);
  2371. }
  2372. }
  2373. /********************************************************/
  2374. /********************************************************/
  2375. /* 시스템설정>수신기설정 Form 생성 */
  2376. /********************************************************/
  2377. private void toolStripMenuItem1_Click(object sender, EventArgs e)
  2378. {
  2379. try
  2380. {
  2381. LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템설정-수신기설정 메뉴 클릭");
  2382. ShowLogin(new frmReceiverConfig());
  2383. //ShowChildForm(new frmReceiverConfig());
  2384. }
  2385. catch (Exception ex)
  2386. {
  2387. Util.UErrorMessage(ex, 0, 0);
  2388. }
  2389. }
  2390. /********************************************************/
  2391. /********************************************************/
  2392. /* 이력점검버튼 클릭시 메뉴 표시 */
  2393. /********************************************************/
  2394. private void btnMenu4_Click(object sender, EventArgs e)
  2395. {
  2396. try
  2397. {
  2398. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  2399. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  2400. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  2401. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  2402. int mnSizeW = MenuStripLog.Size.Width;
  2403. mnSizeW = 1280 - mnSizeW - 196;
  2404. MenuStripLog.Show(this.Location.X + mnSizeW, this.Location.Y + 372);
  2405. }
  2406. catch (Exception ex)
  2407. {
  2408. Util.UErrorMessage(ex, 0, 0);
  2409. }
  2410. }
  2411. /********************************************************/
  2412. /********************************************************/
  2413. /* 시스템정보>중계기상태보기 Form 생성 */
  2414. /********************************************************/
  2415. private void RepeaterToolStripMenuItem_Click(object sender, EventArgs e)
  2416. {
  2417. try
  2418. {
  2419. LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-중계기 상태보기 메뉴 클릭");
  2420. Form f = ShowChildForm(new frmRepeaterGroup());
  2421. }
  2422. catch (Exception ex)
  2423. {
  2424. Util.UErrorMessage(ex, 0, 0);
  2425. }
  2426. }
  2427. /********************************************************/
  2428. /********************************************************/
  2429. /* 이력점검>현재내역보기 Form 생성 */
  2430. /********************************************************/
  2431. public void toolStripMenuItem4_Click(object sender, EventArgs e)
  2432. {
  2433. try
  2434. {
  2435. LFC.Log("타입: 수신기 조작 로그, 메세지: 이력점검-현재내역 클릭");
  2436. FormLogView frm = new FormLogView(true);
  2437. frm = (FormLogView)ShowChildForm(frm);
  2438. frm.InitFormLogView(true);
  2439. //Form f = ShowChildForm(new FormLogView(true));
  2440. frm.SetSearchCondition("ALL");
  2441. }
  2442. catch (Exception ex)
  2443. {
  2444. Util.UErrorMessage(ex, 0, 0);
  2445. }
  2446. }
  2447. /********************************************************/
  2448. /********************************************************/
  2449. /* 이력점검>과거내역보기 Form 생성 */
  2450. /********************************************************/
  2451. private void toolStripMenuItem5_Click(object sender, EventArgs e)
  2452. {
  2453. try
  2454. {
  2455. LFC.Log("타입: 수신기 조작 로그, 메세지: 이력점검-과거내역 클릭");
  2456. FormLogView frm = new FormLogView(false);
  2457. frm = (FormLogView)ShowChildForm(frm);
  2458. frm.InitFormLogView(false);
  2459. //Form f = ShowChildForm(new FormLogView(false));
  2460. }
  2461. catch (Exception ex)
  2462. {
  2463. Util.UErrorMessage(ex, 0, 0);
  2464. }
  2465. }
  2466. /********************************************************/
  2467. /* MdiParent 화면이동 */
  2468. /********************************************************/
  2469. private void MdiParent_MouseDown(object sender, MouseEventArgs e)
  2470. {
  2471. try
  2472. {
  2473. if (MDIMove)
  2474. {
  2475. mouseOffset = new Point(-e.X, -e.Y);
  2476. }
  2477. }
  2478. catch (Exception ex)
  2479. {
  2480. Util.UErrorMessage(ex, 0, 0);
  2481. }
  2482. }
  2483. private void MdiParent_MouseMove(object sender, MouseEventArgs e)
  2484. {
  2485. try
  2486. {
  2487. if (MDIMove && (e.Button == MouseButtons.Left))
  2488. {
  2489. Point mousePos = Control.MousePosition;
  2490. mousePos.Offset(mouseOffset.X, mouseOffset.Y);
  2491. this.Location = mousePos;
  2492. }
  2493. }
  2494. catch (Exception ex)
  2495. {
  2496. Util.UErrorMessage(ex, 0, 0);
  2497. }
  2498. }
  2499. /********************************************************/
  2500. //카운트 라벨에 표시
  2501. public void Count_Display(int cnt_DeviceFire, int cnt_DeviceWrite, int cnt_ConnetError, int cnt_RepeaterBlocking, int cnt_ReceiverCut)
  2502. {
  2503. try
  2504. {//화재, 설비, 통신, 단선, 차단
  2505. Display_FireCnt(cnt_DeviceFire); //화재입력값 count
  2506. Display_WriteCnt(cnt_DeviceWrite); //설비입력값 count
  2507. Display_ErrorCnt(cnt_ConnetError); //통신에러 count
  2508. Display_BlockingCnt(cnt_RepeaterBlocking); //단선 count
  2509. //Display_CutCnt(cnt_ReceiverCut); //차단 count
  2510. }
  2511. catch (Exception ex)
  2512. {
  2513. Util.UErrorMessage(ex, 0, 0);
  2514. }
  2515. }
  2516. // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
  2517. public void Display_Check(bool Enable)
  2518. {
  2519. try
  2520. {
  2521. if (this.btnCheck.InvokeRequired)
  2522. {
  2523. SetBoolCallback d = new SetBoolCallback(Display_Check);
  2524. this.btnCheck.Invoke(d, new object[] { Enable });
  2525. }
  2526. else
  2527. {
  2528. Color CheckBtnColor = Color.Transparent;
  2529. if (Enable == true) // 점검내용이 있다
  2530. CheckBtnColor = Color.Red;
  2531. else
  2532. CheckBtnColor = Color.Transparent;
  2533. this.btnCheck.BackColor = CheckBtnColor;
  2534. }
  2535. }
  2536. catch (Exception ex)
  2537. {
  2538. Util.UErrorMessage(ex, 0, 0);
  2539. }
  2540. }
  2541. //
  2542. // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblDeviceFireCnt 는 루틴에서 제외한다.
  2543. //
  2544. // 화재입력값 표시
  2545. public int fireCount = 0;
  2546. // 축적 화재입력값 표시
  2547. public int fireCount_Accumulation = 0;
  2548. // cyim 2015.7.9 PreFire 표시 문제
  2549. public ArrayList PreFireList = new ArrayList();
  2550. public void Display_FireCnt(int cnt)
  2551. {
  2552. try
  2553. {
  2554. if (this.btnFireCount.InvokeRequired)
  2555. {
  2556. SetTextCallback d = new SetTextCallback(Display_FireCnt);
  2557. this.btnFireCount.Invoke(d, new object[] { cnt });
  2558. }
  2559. else
  2560. {
  2561. this.fireCount = cnt;
  2562. // cyim 2013.11.19 : 카운트 사라지는 문제
  2563. if (cnt > 9999)
  2564. this.btnFireCount.Text = String.Format("화재 : {0:00000}", cnt);
  2565. else
  2566. this.btnFireCount.Text = String.Format("화재 : {0:0000}", cnt);
  2567. //this.lblDeviceFireCnt.Text = String.Format("{0:0000}", cnt);
  2568. //this.btnFireCount.Image = null;//sdkim, 20120129, [MTS-47]
  2569. //this.btnFireCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
  2570. // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
  2571. Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "FireDetect", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2572. }
  2573. }
  2574. catch (Exception ex)
  2575. {
  2576. Util.UErrorMessage(ex, 0, 0);
  2577. }
  2578. }
  2579. //
  2580. // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblDeviceWriteCnt 는 루틴에서 제외한다.
  2581. //
  2582. //설비입력값 표시
  2583. public int facilityCount = 0; // cyim 2015.7.30 수신반 메인에서 카운터 정보를 접근해야함
  2584. public void Display_WriteCnt(int cnt)
  2585. {
  2586. try
  2587. {
  2588. if (this.btnDevCount.InvokeRequired)
  2589. {
  2590. SetTextCallback d = new SetTextCallback(Display_WriteCnt);
  2591. this.btnDevCount.Invoke(d, new object[] { cnt });
  2592. }
  2593. else
  2594. {
  2595. this.facilityCount = cnt;
  2596. // cyim 2013.11.19 : 카운트 사라지는 문제
  2597. if (cnt > 9999)
  2598. this.btnDevCount.Text = String.Format("설비 : {0:00000}", cnt);
  2599. else
  2600. this.btnDevCount.Text = String.Format("설비 : {0:0000}", cnt);
  2601. //this.lblDeviceWriteCnt.Text = String.Format("{0:0000}", cnt);
  2602. //this.btnDevCount.Image = null;//sdkim, 20120129, [MTS-47]
  2603. //this.btnDevCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
  2604. // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
  2605. Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "DeviceInput", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2606. }
  2607. }
  2608. catch (Exception ex)
  2609. {
  2610. Util.UErrorMessage(ex, 0, 0);
  2611. }
  2612. }
  2613. //
  2614. // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblConnetErrorCnt 는 루틴에서 제외한다.
  2615. //
  2616. //통신에러 표시
  2617. public int errorCount = 0; // cyim 2015.7.30 수신반 메인에서 카운터 정보를 접근해야함
  2618. public void Display_ErrorCnt(int cnt)
  2619. {
  2620. try
  2621. {
  2622. if (this.btnErrorCount.InvokeRequired)
  2623. {
  2624. SetTextCallback d = new SetTextCallback(Display_ErrorCnt);
  2625. this.btnErrorCount.Invoke(d, new object[] { cnt });
  2626. }
  2627. else
  2628. {
  2629. this.errorCount = cnt;
  2630. // cyim 2013.11.19 : 카운트 사라지는 문제
  2631. if (cnt > 9999)
  2632. this.btnErrorCount.Text = String.Format("통신 : {0:00000}", cnt);
  2633. else
  2634. this.btnErrorCount.Text = String.Format("통신 : {0:0000}", cnt);
  2635. //this.lblConnetErrorCnt.Text = String.Format("{0:0000}", cnt);
  2636. //this.btnErrorCount.Image = null;//sdkim, 20120129, [MTS-47]
  2637. //this.btnErrorCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
  2638. // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
  2639. Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "RepeaterError", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2640. }
  2641. }
  2642. catch (Exception ex)
  2643. {
  2644. Util.UErrorMessage(ex, 0, 0);
  2645. }
  2646. }
  2647. //
  2648. // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblRepeaterBlockingCnt 는 루틴에서 제외한다.
  2649. //
  2650. //단선 표시
  2651. public int blockingCount = 0; // cyim 2015.7.30 수신반 메인에서 카운터 정보를 접근해야함
  2652. public void Display_BlockingCnt(int cnt)
  2653. {
  2654. try
  2655. {
  2656. if (this.btnDevCutCount.InvokeRequired)
  2657. {
  2658. SetTextCallback d = new SetTextCallback(Display_BlockingCnt);
  2659. this.btnDevCutCount.Invoke(d, new object[] { cnt });
  2660. }
  2661. else
  2662. {
  2663. this.blockingCount = cnt;
  2664. // cyim 2013.11.19 : 카운트 사라지는 문제
  2665. if (cnt > 9999)
  2666. this.btnDevCutCount.Text = String.Format("단선 : {0:00000}", cnt);
  2667. else
  2668. this.btnDevCutCount.Text = String.Format("단선 : {0:0000}", cnt);
  2669. //this.lblRepeaterBlockingCnt.Text = String.Format("{0:0000}", cnt);
  2670. //this.btnDevCutCount.Image = null;//sdkim, 20120129, [MTS-47]
  2671. //this.btnDevCutCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
  2672. // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
  2673. Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "DeviceCut", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2674. }
  2675. }
  2676. catch (Exception ex)
  2677. {
  2678. Util.UErrorMessage(ex, 0, 0);
  2679. }
  2680. }
  2681. //
  2682. // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblReceiverCutCnt 는 루틴에서 제외한다.
  2683. //
  2684. //차단 표시
  2685. public int CutCnt = 0; // cyim 2015.7.30 수신반 메인에서 카운터 정보를 접근해야함
  2686. public void Display_CutCnt(int cnt)
  2687. {
  2688. try
  2689. {
  2690. if (this.btnDisableCount.InvokeRequired)
  2691. {
  2692. SetTextCallback d = new SetTextCallback(Display_CutCnt);
  2693. this.btnDisableCount.Invoke(d, new object[] { cnt });
  2694. }
  2695. else
  2696. {
  2697. this.CutCnt = cnt;
  2698. // cyim 2013.11.19 : 카운트 사라지는 문제
  2699. if (cnt > 9999)
  2700. this.btnDisableCount.Text = String.Format("차단 : {0:00000}", cnt);
  2701. else
  2702. this.btnDisableCount.Text = String.Format("차단 : {0:0000}", cnt);
  2703. //this.lblReceiverCutCnt.Text = String.Format("{0:0000}", cnt);
  2704. //this.btnDisableCount.Image = null;//sdkim, 20120129, [MTS-47]
  2705. //this.btnDisableCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
  2706. // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
  2707. Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "DeviceNotuse", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  2708. }
  2709. }
  2710. catch (Exception ex)
  2711. {
  2712. Util.UErrorMessage(ex, 0, 0);
  2713. }
  2714. }
  2715. // 전압 표시 (메인)
  2716. public void Display_Voltage(float vol24, float vol33, float vol50)
  2717. {
  2718. try
  2719. {
  2720. // cyim 2013.3.6
  2721. // MDIParent 와 frmDriveTest 를 동시에 처리 하도록 유도하는 것으로 예상
  2722. // Socket Thread Cross Error 수정
  2723. // MDIParent
  2724. Display_24Voltage(vol24);
  2725. //this.lbl24Voltage.Text = String.Format("{0:00.00}V", vol24);
  2726. // cyim 2016.03.21 : 전원값 화면에 표시못하는 문제 보완
  2727. Power_Main_vol24 = String.Format("{0:00.00}V", vol24);
  2728. // frmDriveTest
  2729. foreach (Form childForm in MdiChildren)
  2730. {
  2731. if (childForm is frmDriveTest)
  2732. {
  2733. frmDriveTest frm = (frmDriveTest)childForm;
  2734. frm.Display_24Voltage(vol24);
  2735. //frm.Display_3Voltage(vol33);
  2736. //frm.Display_5Voltage(vol50);
  2737. break;
  2738. }
  2739. }
  2740. }
  2741. catch (Exception ex)
  2742. {
  2743. Util.UErrorMessage(ex, 0, 0);
  2744. }
  2745. }
  2746. //전압 표시 (서브)
  2747. public void Display_24Voltage(float vol)
  2748. {
  2749. try
  2750. {
  2751. if (this.lbl24Voltage.InvokeRequired)
  2752. {
  2753. SetVoltageCallback d = new SetVoltageCallback(Display_24Voltage);
  2754. this.lbl24Voltage.Invoke(d, new object[] { vol }); // cyim
  2755. }
  2756. else
  2757. {
  2758. this.lbl24Voltage.Text = String.Format("{0:00.00}V", vol);
  2759. //this.lbl24Voltage.Image = null;//sdkim, 20120129, [MTS-47]
  2760. //this.lbl24Voltage.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
  2761. }
  2762. }
  2763. catch (Exception ex)
  2764. {
  2765. Util.UErrorMessage(ex, 0, 0);
  2766. }
  2767. }
  2768. //축적시간표시
  2769. private void Display_AccumulSecond()
  2770. {
  2771. try
  2772. {
  2773. if (this.lblAccumulSecond.InvokeRequired)
  2774. {
  2775. SetVoidCallback d = new SetVoidCallback(Display_AccumulSecond);
  2776. // cyim 2013.7.19 속도개선작업
  2777. this.lblAccumulSecond.Invoke(d, new object[] { });
  2778. }
  2779. else
  2780. {
  2781. if (this.ConfigVO.Fire_accumulation_second < 0)
  2782. {
  2783. this.ConfigVO.Fire_accumulation_second = 0;
  2784. this.ConfigVO.Fire_accumulation_start = false;
  2785. this.ConfigVO.Fire_accumulation_reset();
  2786. }
  2787. if (this.ConfigVO.Fire_accumulation_start)
  2788. this.lblAccumulSecond.ForeColor = System.Drawing.Color.Red;
  2789. else
  2790. this.lblAccumulSecond.ForeColor = System.Drawing.Color.Black;
  2791. this.lblAccumulSecond.Text = String.Format("{0}", this.ConfigVO.Fire_accumulation_second);
  2792. this.lblAccumulSecond.Image = null;
  2793. this.lblAccumulSecond.BackColor = Color.Transparent;
  2794. }
  2795. }
  2796. catch (Exception ex)
  2797. {
  2798. Util.UErrorMessage(ex, 0, 0);
  2799. }
  2800. }
  2801. //축적시작-초기값설정
  2802. public void Accumulate_ReStart(int second)
  2803. {
  2804. try
  2805. {
  2806. this.ConfigVO.Fire_accumulation_second = second;
  2807. this.ConfigVO.Fire_accumulation_start = true;
  2808. }
  2809. catch (Exception ex)
  2810. {
  2811. Util.UErrorMessage(ex, 0, 0);
  2812. }
  2813. }
  2814. //축적시작
  2815. public void Accumulate_Start()
  2816. {
  2817. try
  2818. {
  2819. //이미 축적일경우에는 RESET하지 않는다.
  2820. if (!this.ConfigVO.Fire_accumulation_start)
  2821. {
  2822. this.ConfigVO.Fire_accumulation_reset();
  2823. this.ConfigVO.Fire_accumulation_start = true;
  2824. }
  2825. }
  2826. catch (Exception ex)
  2827. {
  2828. Util.UErrorMessage(ex, 0, 0);
  2829. }
  2830. }
  2831. //축적종료
  2832. public void Accumulate_Stop()
  2833. {
  2834. try
  2835. {
  2836. this.ConfigVO.Fire_accumulation_start = false;
  2837. this.ConfigVO.Fire_accumulation_reset();
  2838. Display_AccumulSecond();
  2839. }
  2840. catch (Exception ex)
  2841. {
  2842. Util.UErrorMessage(ex, 0, 0);
  2843. }
  2844. }
  2845. //
  2846. // cyim 2013.7.18 속도개선작업 : this.invoke 제외
  2847. //
  2848. //화재홀딩모드 표시
  2849. public void Display_FireMode(bool mode)
  2850. {
  2851. try
  2852. {
  2853. if (this.lblFireMode.InvokeRequired)
  2854. {
  2855. SetBoolCallback d = new SetBoolCallback(Display_FireMode);
  2856. this.lblFireMode.Invoke(d, new object[] { mode });
  2857. }
  2858. else
  2859. {
  2860. if (mode)
  2861. this.lblFireMode.Text = "지속";//2010.11.08, k.s.d , 홀딩 -> 지속
  2862. else
  2863. this.lblFireMode.Text = "자동";
  2864. //this.lblFireMode.Image = null;//sdkim, 20120129, [MTS-47]
  2865. //this.lblFireMode.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
  2866. }
  2867. }
  2868. catch (Exception ex)
  2869. {
  2870. Util.UErrorMessage(ex, 0, 0);
  2871. }
  2872. }
  2873. //화재복구 처리
  2874. public void FireReset_Process()//2010.10.29, k.s.d , demon db reset cmd by T.E.I(UB)
  2875. {
  2876. try
  2877. {
  2878. //화재홀딩 모드
  2879. //if (this.ConfigVO.Fire_process_mode)//2010.12.03, k.s.d, demon reset when all case(past code : only fire holding mode demon reset)
  2880. // {
  2881. this.SetInputTestMode(false);
  2882. //경고화면창 닫기
  2883. if (this.warningForm != null)
  2884. {
  2885. this.warningForm.Close();
  2886. this.warningForm = null;
  2887. this.winMsg = null;
  2888. }
  2889. //경고화면창 닫기
  2890. if (this.warningForm2 != null)
  2891. {
  2892. this.warningForm2.Close();
  2893. this.warningForm2 = null;
  2894. this.winMsg = null;
  2895. }
  2896. this.arrayListLog.Clear(); //현재 이벤트 제거
  2897. Count_Display(0, 0, 0, 0, 0); //카운트 표시 0으로
  2898. this.fireCount_Accumulation = 0; // cyim 2014.7.10 : 축적화재 카운터 도중 복구버튼누르면 축적상태알람표시가 남아있음
  2899. FireList.Clear();
  2900. FireList_Accumulation.Clear(); // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
  2901. FireEventProcess();
  2902. // cyim 2015.7.9 PreFire 표시 문제
  2903. PreFireList.Clear();
  2904. PreFireEventProcess();
  2905. EquipList.Clear();
  2906. EquipEventProcess();
  2907. this.Accumulate_Stop(); //축적모드 종료 // cyim 2014.7.10 : 축적화재 카운터 도중 복구버튼누르면 카운터표시가 남아있음
  2908. //CloseChildForm_Except_InitForm(); //19.04.09 초기화 폼 일찍 오류 삭제 : 화재 복구 - "BS" 단계에서 초기화폼 닫기
  2909. // Display_FireEventComboDel(null); //제1보,2보 제거
  2910. //Display_WriteEventComboDel(null); //제경보 제거
  2911. // csw 2013.2.15 (복구가 두번 호출되는 현상 제거)
  2912. //this.socketUI.ReceiverDemonReset(); //데몬 RESET 명령 // sdkim, 20111206 , delete demon reload command ( with CSW bj, jws - ubi )
  2913. // }
  2914. // cyim 2015.9.15 수신반 하단 이벤트 표시 : 복구
  2915. if (_Data.FireDeskMode == true)
  2916. {
  2917. Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "EventProcess", "Reset", 0);
  2918. }
  2919. }
  2920. catch (Exception ex)
  2921. {
  2922. Util.UErrorMessage(ex, 0, 0);
  2923. //Debug.WriteLine(string.Format("[{0}]\r\n{1}",ex.Message,ex.Source));
  2924. }
  2925. }
  2926. public void ClaerAllEventListAndCount()
  2927. {
  2928. try
  2929. {
  2930. if (this.InvokeRequired)
  2931. {
  2932. dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(ClaerAllEventListAndCount);
  2933. this.Invoke(d, new object[] { });
  2934. }
  2935. else
  2936. {
  2937. this.SetEmergencyBroadCastSetatus(true);
  2938. this.arrayListLog.Clear(); //현재 이벤트 제거
  2939. this.Count_Display(0, 0, 0, 0, 0); //카운트 표시 0으로
  2940. this.fireCount_Accumulation = 0; // cyim 2014.7.10 : 축적화재 카운터 도중 복구버튼누르면 축적상태알람표시가 남아있음
  2941. FireList.Clear();
  2942. FireList_Accumulation.Clear(); // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
  2943. FireEventProcess();
  2944. // cyim 2015.7.9 PreFire 표시 문제
  2945. PreFireList.Clear();
  2946. PreFireEventProcess();
  2947. EquipList.Clear();
  2948. EquipEventProcess();
  2949. //this.Display_FireEventComboDel(null); //제1보,2보 제거
  2950. //this.Display_WriteEventComboDel(null); //제경보 제거
  2951. this.Accumulate_Stop(); //축적모드 종료
  2952. }
  2953. }
  2954. catch (Exception ex)
  2955. {
  2956. Util.UErrorMessage(ex, 0, 0);
  2957. }
  2958. }
  2959. //
  2960. // cyim 2013.7.18 속도개선작업 : this.invoke 제외하고 화재 처리는 textbox 1보처리는 따로한다
  2961. //
  2962. public void FireEventProcess()
  2963. {
  2964. // 일반화재
  2965. int iFireEventCount = FireList.Count;
  2966. // 축적화재
  2967. int iFireEventCount_Accumulation = FireList_Accumulation.Count;
  2968. try
  2969. {
  2970. if (this.cboSecondFireWarnningMessage.InvokeRequired)
  2971. {
  2972. dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(FireEventProcess);
  2973. this.cboSecondFireWarnningMessage.Invoke(d, new object[] { });
  2974. }
  2975. else
  2976. {
  2977. this.Focus(); // cyim 2014.5.15 : OutofRangeException
  2978. this.cboSecondFireWarnningMessage.Items.Clear();
  2979. this.cboSecondFireWarnningMessage.Text = "";
  2980. if (iFireEventCount > 0)
  2981. {
  2982. // 2보 정리
  2983. for (int iLoop = 1; iLoop < iFireEventCount; iLoop++)
  2984. this.cboSecondFireWarnningMessage.Items.Add(FireList[iLoop].ToString());
  2985. if (this.cboSecondFireWarnningMessage.Items.Count > 0)
  2986. this.cboSecondFireWarnningMessage.Text = this.cboSecondFireWarnningMessage.Items[0].ToString();
  2987. // 1보 정리
  2988. FireEventProcess_Text(this.txtFirstFireWarnningMessage, FireList[0].ToString());
  2989. // 화재 타입
  2990. FireEventProcess_Text(this.labelFireAlert, "화재발생");
  2991. }
  2992. // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
  2993. else if (iFireEventCount_Accumulation > 0)
  2994. {
  2995. // 2보 정리
  2996. for (int iLoop = 1; iLoop < iFireEventCount_Accumulation; iLoop++)
  2997. this.cboSecondFireWarnningMessage.Items.Add(FireList_Accumulation[iLoop].ToString());
  2998. if (this.cboSecondFireWarnningMessage.Items.Count > 0)
  2999. this.cboSecondFireWarnningMessage.Text = this.cboSecondFireWarnningMessage.Items[0].ToString();
  3000. // 1보 정리
  3001. FireEventProcess_Text(this.txtFirstFireWarnningMessage, FireList_Accumulation[0].ToString());
  3002. // 화재 타입
  3003. FireEventProcess_Text(this.labelFireAlert, "화재축적상태 발생");
  3004. }
  3005. // cyim 2015.9.15 수신반 하단 이벤트 표시 : 화재 및 축적화재
  3006. if (_Data.FireDeskMode == true)
  3007. {
  3008. Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "EventProcess", "Fire", 0);
  3009. }
  3010. }
  3011. }
  3012. catch (Exception ex)
  3013. {
  3014. Util.UErrorMessage(ex, 0, 0);
  3015. }
  3016. }
  3017. //
  3018. // cyim 2015.7.9 PreFire 표시 문제
  3019. //
  3020. public delegate void dCommandFuctionCallEvent_PreFireEventProcess();
  3021. public void PreFireEventProcess()
  3022. {
  3023. // PreFire
  3024. int iPreFireListCount = PreFireList.Count;
  3025. if (this.cboPreFireWarnningMessage.InvokeRequired)
  3026. {
  3027. dCommandFuctionCallEvent_PreFireEventProcess d = new dCommandFuctionCallEvent_PreFireEventProcess(PreFireEventProcess);
  3028. this.cboPreFireWarnningMessage.Invoke(d, new object[] { });
  3029. }
  3030. else
  3031. {
  3032. this.Focus(); // OutofRangeException 문제 수정
  3033. this.cboPreFireWarnningMessage.Items.Clear();
  3034. this.cboPreFireWarnningMessage.Text = "";
  3035. if (PreFireList.Count > 0)
  3036. {
  3037. for (int i = 0; i < iPreFireListCount; i++)
  3038. this.cboPreFireWarnningMessage.Items.Add(PreFireList[i].ToString());
  3039. this.cboPreFireWarnningMessage.Text = PreFireList[0].ToString();
  3040. }
  3041. // cyim 2015.9.15 수신반 하단 이벤트 표시 : 아날로그감지기의 PreFire 처리
  3042. if (_Data.FireDeskMode == true)
  3043. {
  3044. Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "EventProcess", "PreFire", 0);
  3045. }
  3046. }
  3047. }
  3048. //
  3049. // cyim 2013.7.18 속도개선작업 : 화재 처리는 textbox 는 여기서 처리하도록 한다
  3050. //
  3051. public delegate void dCommandFuctionCallEvent_Text(Control Target, string Data); // cyim 2014.7.10 : 화면 하단 라벨을 화재발생 및 축적화재발생으로 구분한다 : Textbox -> Control
  3052. public void FireEventProcess_Text(Control Target, string Data)
  3053. {
  3054. try
  3055. {
  3056. if (Target.InvokeRequired)
  3057. {
  3058. dCommandFuctionCallEvent_Text d = new dCommandFuctionCallEvent_Text(FireEventProcess_Text);
  3059. Target.Invoke(d, new object[] { Target, Data });
  3060. }
  3061. else
  3062. {
  3063. Target.Text = Data;
  3064. }
  3065. }
  3066. catch (Exception ex)
  3067. {
  3068. Util.UErrorMessage(ex, 0, 0);
  3069. }
  3070. }
  3071. //
  3072. // cyim 2013.7.18 속도개선작업 : this.invoke 제외
  3073. //
  3074. public void EquipEventProcess()
  3075. {
  3076. int iEquipEventCount = EquipList.Count;
  3077. try
  3078. {
  3079. if (this.cboWriteWarningMessage.InvokeRequired)
  3080. {
  3081. dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(EquipEventProcess);
  3082. this.cboWriteWarningMessage.Invoke(d, new object[] { });
  3083. }
  3084. else
  3085. {
  3086. this.Focus(); // cyim 2014.5.15 : OutofRangeException
  3087. this.cboWriteWarningMessage.Items.Clear();
  3088. this.cboWriteWarningMessage.Text = "";
  3089. if (iEquipEventCount > 0)
  3090. {
  3091. for (int iLoop = 0; iLoop < iEquipEventCount; iLoop++)
  3092. {
  3093. this.cboWriteWarningMessage.Items.Add(EquipList[iLoop].ToString());
  3094. }
  3095. if (this.cboWriteWarningMessage.Items.Count > 0)
  3096. {
  3097. this.cboWriteWarningMessage.Text = this.cboWriteWarningMessage.Items[0].ToString();
  3098. }
  3099. }
  3100. // cyim 2015.9.15 수신반 하단 이벤트 표시 : 설비
  3101. if (_Data.FireDeskMode == true)
  3102. {
  3103. Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "EventProcess", "Equip", 0);
  3104. }
  3105. }
  3106. }
  3107. catch (Exception ex)
  3108. {
  3109. Util.UErrorMessage(ex, 0, 0);
  3110. }
  3111. }
  3112. //핫키-F3:창사이즈 최소,F4:프로그램종료
  3113. public void MDIParent_KeyDown(object sender, KeyEventArgs e)
  3114. {
  3115. try
  3116. {
  3117. if (e.KeyCode == Keys.F3)
  3118. {
  3119. //창사이즈최소
  3120. btnWinMinimum_Click(btnWinMinimum, System.EventArgs.Empty);
  3121. }
  3122. }
  3123. catch (Exception ex)
  3124. {
  3125. Util.UErrorMessage(ex, 0, 0);
  3126. }
  3127. }
  3128. /********************************************************/
  3129. /* 시스템설정>운전설정 Form 생성 */
  3130. /********************************************************/
  3131. private void toolStripMenuItem2_Click(object sender, EventArgs e)
  3132. {
  3133. try
  3134. {
  3135. //로그인후 화면SHOW
  3136. LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템설정-운전설정 메뉴 클릭");
  3137. ShowLogin(new frmModeConfig());
  3138. //ShowChildForm(new frmModeConfig());
  3139. }
  3140. catch (Exception ex)
  3141. {
  3142. Util.UErrorMessage(ex, 0, 0);
  3143. }
  3144. }
  3145. /********************************************************/
  3146. /********************************************************/
  3147. /* 시스템설정>맵설정 Form 생성 */
  3148. /********************************************************/
  3149. private void toolStripMenuItem3_Click(object sender, EventArgs e)
  3150. {
  3151. try
  3152. {
  3153. LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템설정-맵설정 메뉴 클릭");
  3154. ShowLogin(new frmMapConfig());
  3155. //Form f = ShowChildForm(new frmMapConfig());
  3156. }
  3157. catch (Exception ex)
  3158. {
  3159. Util.UErrorMessage(ex, 0, 0);
  3160. }
  3161. }
  3162. /********************************************************/
  3163. /********************************************************/
  3164. /* 예비전원 시험 Form 생성 */
  3165. /********************************************************/
  3166. private void btnMenu5_Click(object sender, EventArgs e)
  3167. {
  3168. //Form f = ShowChildForm(new frmDriveTest());
  3169. try //k.s.d 20101023, form init error bug fix & management form class handle.
  3170. {
  3171. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  3172. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  3173. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  3174. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  3175. LFC.Log("타입: 수신기 조작 로그, 메세지: 예비전원시험 클릭");
  3176. winDriveTestForm = new frmDriveTest();
  3177. ShowChildForm(winDriveTestForm);
  3178. }
  3179. catch (Exception ex)
  3180. {
  3181. Util.UErrorMessage(ex, 0, 0);
  3182. }
  3183. }
  3184. /********************************************************/
  3185. /********************************************************/
  3186. /* 제어 Form 생성 */
  3187. /********************************************************/
  3188. private void btnMenu6_Click(object sender, EventArgs e)
  3189. {
  3190. try
  3191. {
  3192. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  3193. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  3194. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  3195. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  3196. // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
  3197. if (ReceiverModel == "IFC3300")
  3198. {
  3199. LFC.Log("타입: 수신기 조작 로그, 메세지: 차단 메뉴 클릭");
  3200. Form f = ShowChildForm(new frmControlMode_BigReceiver());
  3201. }
  3202. else
  3203. {
  3204. LFC.Log("타입: 수신기 조작 로그, 메세지: 차단 메뉴 클릭");
  3205. Form f = ShowChildForm(new frmControlMode());
  3206. }
  3207. }
  3208. catch (Exception ex)
  3209. {
  3210. Util.UErrorMessage(ex, 0, 0);
  3211. }
  3212. }
  3213. private void btnWinMinimum_Click(object sender, EventArgs e)
  3214. {
  3215. try
  3216. {
  3217. this.WindowState = FormWindowState.Minimized;
  3218. }
  3219. catch (Exception ex)
  3220. {
  3221. Util.UErrorMessage(ex, 0, 0);
  3222. }
  3223. }
  3224. //command log 생성
  3225. public void CommandLog(MappingStatus EventStatus, string message)
  3226. {
  3227. try
  3228. {
  3229. string commandType = "";
  3230. string commandLogType = "";
  3231. switch (EventStatus)
  3232. {
  3233. case MappingStatus.ProgramStart:
  3234. {
  3235. commandType = "OU";
  3236. commandLogType = "UI프로그램시작";
  3237. EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", false, EventStatus, message);
  3238. break;
  3239. }
  3240. case MappingStatus.ProgramEnd:
  3241. {
  3242. commandType = "XU";
  3243. commandLogType = "UI프로그램종료";
  3244. EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", false, EventStatus, message);
  3245. break;
  3246. }
  3247. case MappingStatus.CommConnectError:
  3248. {
  3249. commandType = "OD";
  3250. commandLogType = "데몬연결이상";
  3251. EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", true, EventStatus, message);
  3252. EventLogAdd(info);
  3253. MessageProcess(info);
  3254. break;
  3255. }
  3256. case MappingStatus.CommConnectNormal:
  3257. {
  3258. commandType = "XD";
  3259. commandLogType = "데몬연결정상";
  3260. EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", false, EventStatus, message);
  3261. EventLogDel(info); // cyim 2015.7.7 통신 데몬 연결 정상시에는 기존 실패 이벤트 삭제처리
  3262. //MessageProcess(info);
  3263. break;
  3264. }
  3265. // cyim 2015.2.10 LOG
  3266. case MappingStatus.Log:
  3267. {
  3268. commandType = "LG";
  3269. commandLogType = "수신기 조작 로그";
  3270. EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", false, EventStatus, message);
  3271. }
  3272. break;
  3273. }
  3274. if (EventStatus == MappingStatus.Log)
  3275. {
  3276. if (message.Substring(0, 3) == "키패드")
  3277. {
  3278. LFC.Log("타입: 키패드 조작 로그, 메세지: " + message);
  3279. }
  3280. else
  3281. {
  3282. if (message != "비상방송 연결 정상")
  3283. LFC.Log("타입: " + commandLogType + ", 메세지: " + message);
  3284. }
  3285. }
  3286. else
  3287. {
  3288. LFC.Log("타입: " + commandLogType);
  3289. }
  3290. }
  3291. catch (Exception ex)
  3292. {
  3293. Util.UErrorMessage(ex, 0, 0);
  3294. }
  3295. }
  3296. //이벤트 로그 메세지 생성
  3297. private EventLogInfo CreateCommandMessage(String Command_type, int Receiver_id
  3298. , int Comm_id, int Board_id, int Loop_no, int Repeater_id, int Device_id, String Inout_type
  3299. , bool LiveMsgFlag, MappingStatus EventStatus, string message
  3300. )
  3301. {
  3302. EventLogInfo eventLogInfo = null;
  3303. //try
  3304. {
  3305. DateTime commandTime = DateTime.Now;
  3306. // * 'L' 밀리 세컨드. 필요에 따라서 0을 선두에 추가해, 3 자리수로 표현합니다 (000 - 999).
  3307. //* 'N' 나노초. 필요에 따라서 0을 선두에 추가해, 9 자리수로 표현합니다 (000000000 - 999999999).
  3308. string commandId = String.Format("{0:yyyy}{0:MM}{0:dd}{0:HH}{0:mm}{0:ss}{9:00000}{1}{2:00}{3:0}{4:00}{5:0}{6:000}{7:00}{8}", commandTime, Command_type
  3309. , Receiver_id, Comm_id, Board_id, Loop_no, Repeater_id, Device_id, Inout_type, commandTime.Millisecond);
  3310. eventLogInfo = new EventLogInfo(commandId);
  3311. //MskDeviceIDString device_str = new MskDeviceIDString(
  3312. // Comm_id, Board_id, Loop_no, Repeater_id, Device_id, Inout_type);
  3313. string eventTypeName = this.socketUI.EventTypeName(Command_type, "");
  3314. //string message = String.Format("[{0}]{1} ", Command_type, eventTypeName);
  3315. string command_time = String.Format("{0:yyyy}{0:MM}{0:dd}{0:HH}{0:mm}{0:ss}{1:00000}", commandTime, commandTime.Millisecond);
  3316. //eventLogInfo.EventTime = command_time;
  3317. eventLogInfo.EventTime = commandTime;
  3318. eventLogInfo.EventType = Command_type; //-----------------------
  3319. eventLogInfo.EventTypeName = eventTypeName; //-----------------------
  3320. eventLogInfo.Message = message; //-----------------------
  3321. eventLogInfo.EventStatus = EventStatus;
  3322. eventLogInfo.LiveMsgFlag = LiveMsgFlag;
  3323. eventLogInfo.ReceiverID = Receiver_id;
  3324. eventLogInfo.CommId = Comm_id;
  3325. eventLogInfo.BoardNo = Board_id;
  3326. eventLogInfo.LoopNo = Loop_no;
  3327. eventLogInfo.RepeaterNo = Repeater_id;
  3328. eventLogInfo.DeviceId = Device_id;
  3329. eventLogInfo.InoutType = Inout_type;
  3330. eventLogInfo.DeviceMessage = Util.device_message(Inout_type, Receiver_id, Comm_id, Board_id, Loop_no, Repeater_id, Device_id);
  3331. //eventLogInfo.Confirm_flag = "N";
  3332. //eventLogInfo.Confirm_remark = message;
  3333. //command 로그 생성
  3334. DacUIProcess dacUIProcess = new DacUIProcess(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  3335. dacUIProcess.Command_Log_UPDATE(QUERYMode.insert, commandId, command_time, Command_type, Receiver_id
  3336. , Comm_id, Board_id, Loop_no, Repeater_id, Device_id, Inout_type, message);
  3337. }
  3338. //catch (Exception ex)
  3339. //{
  3340. // Util.UErrorMessage(ex, 0, 0);
  3341. //}
  3342. return eventLogInfo;
  3343. }
  3344. // 현장 도면 버튼 Click Event
  3345. private void btnMenu7_Click(object sender, EventArgs e)
  3346. {
  3347. try
  3348. {
  3349. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  3350. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  3351. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  3352. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  3353. LFC.Log("타입: 수신기 조작 로그, 메세지: 현장도면 클릭");
  3354. Form f = ShowChildForm(new FormField(this.xField, this.DataType_Set));
  3355. }
  3356. catch (Exception ex)
  3357. {
  3358. Util.UErrorMessage(ex, 0, 0);
  3359. }
  3360. }
  3361. //화재발생내역
  3362. private void label5_Click(object sender, EventArgs e)
  3363. {
  3364. try
  3365. {
  3366. FormLogView frm = new FormLogView(true);
  3367. frm = (FormLogView)ShowChildForm(frm);
  3368. frm.InitFormLogView(true);
  3369. //frm.SetSearchCondition("OF");
  3370. frm.SearchType(0);
  3371. //frm.DataLoadProcess();
  3372. }
  3373. catch (Exception ex)
  3374. {
  3375. Util.UErrorMessage(ex, 0, 0);
  3376. }
  3377. }
  3378. //설비가동내역
  3379. private void label6_Click(object sender, EventArgs e)
  3380. {
  3381. try
  3382. {
  3383. FormLogView frm = new FormLogView(true);
  3384. frm = (FormLogView)ShowChildForm(frm);
  3385. frm.InitFormLogView(true);
  3386. //frm.SetSearchCondition("OE");
  3387. frm.SearchType(1);
  3388. //frm.DataLoadProcess();
  3389. }
  3390. catch (Exception ex)
  3391. {
  3392. Util.UErrorMessage(ex, 0, 0);
  3393. }
  3394. }
  3395. //통신에러내역
  3396. private void label9_Click(object sender, EventArgs e)
  3397. {
  3398. //OM-통신모듈 통신정상-LOOP 통신정상,XM-통신모듈 통신이상-LOOP 통신이상
  3399. //OR-중계기 통신정상,XR-중계기 통신이상
  3400. //OI-I/O 모듈 통신정상,XI-I/O 모듈 통신이상
  3401. //OK-키패드모듈 통신정상,XK-키패드모듈 통신이상
  3402. try
  3403. {
  3404. FormLogView frm = new FormLogView(true);
  3405. frm = (FormLogView)ShowChildForm(frm);
  3406. frm.InitFormLogView(true);
  3407. //frm.SetSearchCondition("XMXRXIXK");
  3408. frm.SearchType(2);
  3409. //frm.DataLoadProcess();
  3410. }
  3411. catch (Exception ex)
  3412. {
  3413. Util.UErrorMessage(ex, 0, 0);
  3414. }
  3415. }
  3416. //단선발생내역
  3417. private void label7_Click(object sender, EventArgs e)
  3418. {
  3419. try
  3420. {
  3421. FormLogView frm = new FormLogView(true);
  3422. frm = (FormLogView)ShowChildForm(frm);
  3423. frm.InitFormLogView(true);
  3424. //frm.SetSearchCondition("OL");
  3425. frm.SearchType(3);
  3426. //frm.DataLoadProcess();
  3427. }
  3428. catch (Exception ex)
  3429. {
  3430. Util.UErrorMessage(ex, 0, 0);
  3431. }
  3432. }
  3433. //차단내역
  3434. private void label8_Click(object sender, EventArgs e)
  3435. {
  3436. try
  3437. {
  3438. //FormLogView frm = new FormLogView(true);
  3439. //frm = (FormLogView)ShowChildForm(frm);
  3440. //frm.InitFormLogView(true);
  3441. //frm.SetSearchCondition("CE");
  3442. //UIReceiverInfo cfg = new UIReceiverInfo(this.myReceiverID);
  3443. ////int cut_cnt = cfg.Count_ReceiverCut(this.myReceiverTypeInfo);
  3444. //ArrayList ary = new ArrayList();
  3445. //ary = cfg.Array_ReceiverCut(this.ui.MyReceiverTypeInfo);
  3446. //frm.EventLogInfos = ary;
  3447. //frm.DataLoadProcess();
  3448. // cyim 2013.9.26 중계기차단 보완 // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  3449. if (Popup.Form_Popup_CutInfo_Enable == false)
  3450. {
  3451. Popup.Form_Popup_CutInfo_Main = new Form_Popup_CutInfo(this);
  3452. Popup.Form_Popup_CutInfo_Main.Show();
  3453. }
  3454. else
  3455. {
  3456. Popup.Form_Popup_CutInfo_Main.Select();
  3457. }
  3458. }
  3459. catch (Exception ex)
  3460. {
  3461. Util.UErrorMessage(ex, 0, 0);
  3462. }
  3463. }
  3464. // 점검 카운터 클릭
  3465. private void lblCheckCnt_Click(object sender, EventArgs e)
  3466. {
  3467. // cyim 2014.1.10 : 점검카운터 추가
  3468. try
  3469. {
  3470. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  3471. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  3472. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  3473. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  3474. LFC.Log("타입: 수신기 조작 로그, 메세지: 점검 카운터 클릭");
  3475. // 창을 표시
  3476. FormLogView frm = new FormLogView(true);
  3477. frm = (FormLogView)ShowChildForm(frm);
  3478. frm.InitFormLogView(true);
  3479. // 점검 : 보드이상
  3480. frm.SearchType(4);
  3481. }
  3482. catch (Exception ex)
  3483. {
  3484. Util.UErrorMessage(ex, 0, 0);
  3485. }
  3486. }
  3487. // 화재 카운터 클릭
  3488. private void lblDeviceFireCnt_Click(object sender, EventArgs e)
  3489. {
  3490. try
  3491. {
  3492. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  3493. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  3494. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  3495. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  3496. LFC.Log("타입: 수신기 조작 로그, 메세지: 화재 카운터 클릭");
  3497. label5_Click(label5, System.EventArgs.Empty);
  3498. }
  3499. catch (Exception ex)
  3500. {
  3501. Util.UErrorMessage(ex, 0, 0);
  3502. }
  3503. }
  3504. // 설비 카운터 클릭
  3505. private void lblDeviceWriteCnt_Click(object sender, EventArgs e)
  3506. {
  3507. try
  3508. {
  3509. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  3510. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  3511. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  3512. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  3513. LFC.Log("타입: 수신기 조작 로그, 메세지: 설비 카운터 클릭");
  3514. label6_Click(label6, System.EventArgs.Empty);
  3515. }
  3516. catch (Exception ex)
  3517. {
  3518. Util.UErrorMessage(ex, 0, 0);
  3519. }
  3520. }
  3521. // 통신 카운터 클릭
  3522. private void lblConnetErrorCnt_Click(object sender, EventArgs e)
  3523. {
  3524. try
  3525. {
  3526. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  3527. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  3528. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  3529. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  3530. LFC.Log("타입: 수신기 조작 로그, 메세지: 통신 카운터 클릭");
  3531. label9_Click(label9, System.EventArgs.Empty);
  3532. }
  3533. catch (Exception ex)
  3534. {
  3535. Util.UErrorMessage(ex, 0, 0);
  3536. }
  3537. }
  3538. // 단선 카운터 클릭
  3539. private void lblRepeaterBlockingCnt_Click(object sender, EventArgs e)
  3540. {
  3541. try
  3542. {
  3543. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  3544. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  3545. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  3546. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  3547. LFC.Log("타입: 수신기 조작 로그, 메세지: 단선 카운터 클릭");
  3548. label7_Click(label7, System.EventArgs.Empty);
  3549. }
  3550. catch (Exception ex)
  3551. {
  3552. Util.UErrorMessage(ex, 0, 0);
  3553. }
  3554. }
  3555. // 차단 카운터 클릭
  3556. private void lblReceiverCutCnt_Click(object sender, EventArgs e)
  3557. {
  3558. try
  3559. {
  3560. // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
  3561. if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
  3562. // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
  3563. if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
  3564. LFC.Log("타입: 수신기 조작 로그, 메세지: 차단 카운터 클릭");
  3565. label8_Click(label8, System.EventArgs.Empty);
  3566. }
  3567. catch (Exception ex)
  3568. {
  3569. Util.UErrorMessage(ex, 0, 0);
  3570. }
  3571. }
  3572. // 1시간 단위로 실행.
  3573. // Firebird 파일을 Backup.
  3574. private void timerMaintance_Tick(object sender, EventArgs e)
  3575. {
  3576. try
  3577. {
  3578. //1시간마다..
  3579. if (myDbBackUpDate == DateTime.Parse("1999-01-01"))
  3580. {
  3581. myDbBackUpDate = Util.getBackUpLastDateTime(); // cyim 2015.8.12 데이타베이스 용량 문제 : 분석 - 레지스트리값을 읽기
  3582. }
  3583. TimeSpan sp = DateTime.Now - myDbBackUpDate;
  3584. if (sp.TotalDays >= 30)
  3585. {
  3586. myDbBackUpDate = DateTime.Now;
  3587. // cyim 2015.7.29 수신반 루틴을 위해 외부 파라미터로 동작하도록 수정
  3588. //string filePath = Util.FirebirdPath();
  3589. string filePath = _Data.Registry_DATABASE_NAME_PATH;
  3590. if (filePath.Length > 0)
  3591. {
  3592. FileInfo f = new FileInfo(filePath);
  3593. if (f.Exists)
  3594. {
  3595. FireDbBackup(filePath);
  3596. Util.setBackUpLastDateTime(myDbBackUpDate); // cyim 2015.8.12 데이타베이스 용량 문제 : 분석 - 레지스트리값을 쓰기
  3597. }
  3598. }
  3599. }
  3600. }
  3601. catch (Exception ex)
  3602. {
  3603. Util.UErrorMessage(ex, 0, 0);
  3604. }
  3605. }
  3606. //파이어버드 DB 백업 저장..
  3607. private void FireDbBackup(string filePath)
  3608. {
  3609. try
  3610. {
  3611. if (filePath.Length > 0)
  3612. {
  3613. int pos = filePath.LastIndexOf(".");
  3614. string fileName = filePath.Substring(0, pos);
  3615. string ext = filePath.Substring(pos + 1, filePath.Length - pos - 1);
  3616. ext = ext.ToUpper();
  3617. if (File.Exists(filePath))
  3618. {
  3619. int no = 0;
  3620. string filePath2 = string.Format("{0}_{1:yyyyMMdd_HHmmss}.{2}", fileName, DateTime.Now, ext);
  3621. while (File.Exists(filePath2))
  3622. {
  3623. ++no;
  3624. filePath2 = string.Format("{0}_{1:yyyyMMdd}_HHmmss_{2}.{3}", fileName, DateTime.Now, no, ext);
  3625. }
  3626. File.Copy(filePath, filePath2);
  3627. }
  3628. }
  3629. }
  3630. catch (Exception ex)
  3631. {
  3632. Util.UErrorMessage(ex, 0, 0);
  3633. }
  3634. }
  3635. //2010.11.08, k.s.d , ll child window close.
  3636. public void CloseChildForm()
  3637. {
  3638. try
  3639. {
  3640. // cyim 2015.7.10 크로스 스레드 예외처리
  3641. if (this.InvokeRequired)
  3642. {
  3643. SetVoidCallback d = new SetVoidCallback(CloseChildForm);
  3644. this.Invoke(d, new object[] { });
  3645. }
  3646. else
  3647. {
  3648. foreach (Form childForm in MdiChildren)
  3649. {
  3650. childForm.Close();
  3651. }
  3652. }
  3653. }
  3654. catch (Exception ex)
  3655. {
  3656. Util.UErrorMessage(ex, 0, 0);
  3657. }
  3658. }
  3659. //2010.11.08, k.s.d , ll child window close.
  3660. public void CloseChildForm_Except_InitForm()
  3661. {
  3662. try
  3663. {
  3664. // cyim 2015.7.10 크로스 스레드 예외처리
  3665. if (this.InvokeRequired)
  3666. {
  3667. SetVoidCallback d = new SetVoidCallback(CloseChildForm_Except_InitForm);
  3668. this.Invoke(d, new object[] { });
  3669. }
  3670. else
  3671. {
  3672. foreach (Form childForm in MdiChildren)
  3673. {
  3674. if (childForm is frmWarningBox)
  3675. {
  3676. ;
  3677. }
  3678. else
  3679. {
  3680. childForm.Close();
  3681. }
  3682. }
  3683. //System.Threading.Thread.Sleep(30000);
  3684. }
  3685. }
  3686. catch (Exception ex)
  3687. {
  3688. Util.UErrorMessage(ex, 0, 0);
  3689. }
  3690. }
  3691. //
  3692. // cyim 2013.7.19 속도개선작업
  3693. //
  3694. // 최초로 쿼리 되는 결과 테이블을 저장해두고 이를 이용해서 결과를 도출하면 제일 빠르지/만 현재 사용하는 루틴이 많으므로
  3695. // 정렬조건을 삭제하여 속도를 향상한다. 여기에서는 정렬이 의미없으므로 새로운 쿼리를 적용해도 무방하다
  3696. private bool CheckOutputDeviceTypeStop()
  3697. {
  3698. bool ret = false;
  3699. DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  3700. DataTable dt = dacDeviceConfig.Device_type_Select_NotOrdering(code_InOutType.Output, null);
  3701. // cyim 2016.12.28 : 예외처리 추가 : 사용빈도수가 엄청 높은 함수는 방어코드가 필요함 : 특히 수신반처럼 네트워크 DB 를 이용하는 상황에서는 필요함
  3702. if (dt != null && dt.Rows.Count != 0)
  3703. {
  3704. foreach (DataRow dr in dt.Rows)
  3705. {
  3706. // cyim 2015.7.7 주경종 허용에 따른 쿼리변경
  3707. // 즉, 설비연동에서도 주경종이 추가될수 있도록 컨셉이 바뀌었다.
  3708. //if (dr["USE_FLAG"].ToString() == "N" && dr["DEVICE_TYPE"].ToString() != "OA")
  3709. if (dr["USE_FLAG"].ToString() == "N")
  3710. {
  3711. ret = true;
  3712. break;
  3713. }
  3714. }
  3715. }
  3716. return ret;
  3717. }
  3718. //public void SetLikageBtnStatus() {
  3719. // if (this.InvokeRequired) {
  3720. // dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(SetLikageBtnStatus);
  3721. // this.Invoke(d, new object[] { });
  3722. // }
  3723. // else {
  3724. // if (this.CheckOutputDeviceTypeStop()) {
  3725. // imgIndexbtnMenu1_normal = 21;
  3726. // if (btnMenu1.ImageIndex == cstBtnMenu1) {
  3727. // btnMenu1.ImageIndex = imgIndexbtnMenu1_normal;
  3728. // }
  3729. // }
  3730. // else {
  3731. // imgIndexbtnMenu1_normal = cstBtnMenu1;
  3732. // if (btnMenu1.ImageIndex == 21) {
  3733. // btnMenu1.ImageIndex = imgIndexbtnMenu1_normal;
  3734. // }
  3735. // }
  3736. // }
  3737. //}
  3738. //
  3739. // cyim 2013.7.18 속도개선작업 : 여기 함수에서 접근가능한 변수는 Component 가 아니다. 불필요한 invoke 는 삭제한다
  3740. //
  3741. private bool likageBtnStatus = false;
  3742. public void SetLikageBtnStatus()
  3743. {
  3744. //if (this.InvokeRequired)
  3745. //{
  3746. // dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(SetLikageBtnStatus);
  3747. // this.Invoke(d, new object[] { });
  3748. //}
  3749. //else
  3750. {
  3751. // cyim 2015.7.7 속도개선작업
  3752. // 속도에 악영향을 미치는 대표적인 함수이다. 남용이 많은 현재 프로그램에서 대표적인 사례이다.
  3753. // 설비연동이 주용도가 될것같은데, 주경종을 제외하고 출력타입의 디바이스중 한개라도 사용하지 않는다면 true 를 반환한다
  3754. // 결국 설비연동정지가 한개라도 눌려진 경우에는 likageBtnStatus 변수가 true 로 변경된다
  3755. if (this.CheckOutputDeviceTypeStop())
  3756. {
  3757. this.likageBtnStatus = true;
  3758. }
  3759. else
  3760. {
  3761. this.likageBtnStatus = false;
  3762. }
  3763. //this.SelectMenuIndex = this.SelectMenuIndex;
  3764. }
  3765. }
  3766. private void toolStripMenuItem7_Click(object sender, EventArgs e)
  3767. {
  3768. try
  3769. {
  3770. // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
  3771. if (ReceiverModel == "IFC3300")
  3772. {
  3773. LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-버전 정보 보기 메뉴 클릭");
  3774. Form f = ShowChildForm(new frmVersion_BigReceiver());
  3775. }
  3776. else
  3777. {
  3778. LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-버전 정보 보기 메뉴 클릭");
  3779. Form f = ShowChildForm(new frmVersion());
  3780. }
  3781. }
  3782. catch (Exception ex)
  3783. {
  3784. Util.UErrorMessage(ex, 0, 0);
  3785. }
  3786. }
  3787. int togglecont = 0;
  3788. // 500 ms 단위
  3789. private void timerEventCheck_Tick(object sender, EventArgs e)
  3790. {
  3791. if (this.togglecont++ > 10)
  3792. {
  3793. this.togglecont = 0;
  3794. }
  3795. // this.FireCheck();
  3796. // this.FacilityCheck();
  3797. FireFacilityEventCheck();
  3798. // cyim 2016.06.15 : 화재 음원 출력
  3799. if (SoundPlayer_AlarmPopupSound_Count > 6)
  3800. {
  3801. SoundPlayer_AlarmPopupSound_Count = 0; // 3초마다
  3802. AlarmPopup_PlaySound_Check();
  3803. }
  3804. else
  3805. {
  3806. SoundPlayer_AlarmPopupSound_Count++;
  3807. }
  3808. //System.GC.Collect();
  3809. //Application.DoEvents();
  3810. // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
  3811. if (CheckBtn_Current_Status == true || MonitorDaemon_ComErrorCheck() == false) // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
  3812. {
  3813. if (togglecont % 2 == 0)
  3814. Display_Check(true);
  3815. else
  3816. Display_Check(false);
  3817. }
  3818. else
  3819. {
  3820. Display_Check(false);
  3821. }
  3822. }
  3823. // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
  3824. public bool MonitorDaemon_ComErrorCheck()
  3825. {
  3826. lock (CS_MonitorDaemon_ComStatus)
  3827. {
  3828. // 타수신기가 존재하고 모니터데몬에 접속중인 경우
  3829. if (this.NetworkReceiver_ID_ComStatus.Count > 0 && this.MonitorDaemon_Enable == true)
  3830. {
  3831. // 모니터데몬에 접속을 못하는 경우
  3832. if (this.MonitorDaemon_ComStatus == false)
  3833. {
  3834. return false;
  3835. }
  3836. // 타수신기의 통신상태가 이상인 경우
  3837. else
  3838. {
  3839. // cyim 2014.8.12 네트워크 수신기 통신상태 문제 수정 (해쉬테이블은 DirectionEntry 를 이용하여 데이타를 추출하면 중간에 그 데이타가 변경되면 오류 발생됨)
  3840. foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
  3841. {
  3842. if ((bool)NetworkReceiver_ID_ComStatus[ReceiverID] == false)
  3843. return false;
  3844. }
  3845. }
  3846. }
  3847. }
  3848. return true;
  3849. }
  3850. // 화재 처리와 설비 동작 처리를 한번에 수행한다.
  3851. public delegate void dCommandFuctionCallEvent();
  3852. public void FireFacilityEventCheck()
  3853. {
  3854. if (this.InvokeRequired)
  3855. {
  3856. dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(FireFacilityEventCheck);
  3857. this.Invoke(d, new object[] { });
  3858. }
  3859. else
  3860. {
  3861. //
  3862. // 화재
  3863. //
  3864. if (this.fireCount > 0)
  3865. {
  3866. this.labelFireAlert.Visible = true;
  3867. //this.labelFireAlert.Image = null;//sdkim, 20120129, [MTS-47]
  3868. this.labelFireAlert_inform_1th.Visible = true;
  3869. this.txtFirstFireWarnningMessage.Visible = true;
  3870. if (this.fireCount > 1)
  3871. {
  3872. this.labelFireAlert_inform_2th.Visible = true;
  3873. this.cboSecondFireWarnningMessage.Visible = true;
  3874. }
  3875. else
  3876. {
  3877. this.labelFireAlert_inform_2th.Visible = false;
  3878. this.cboSecondFireWarnningMessage.Visible = false;
  3879. }
  3880. if (togglecont % 2 == 0)
  3881. {
  3882. this.labelFireAlert.BackColor = Color.Red;
  3883. this.labelFireAlert.ForeColor = Color.Black;
  3884. }
  3885. else
  3886. {
  3887. this.labelFireAlert.BackColor = Color.Transparent;
  3888. this.labelFireAlert.ForeColor = Color.Red;
  3889. }
  3890. }
  3891. // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
  3892. else if (this.fireCount_Accumulation > 0)
  3893. {
  3894. // 상위 화재와 동일한 코드이다. 굳이 상위와 합치지 않은 이유는 우선순위는 무조건 일반 화재가 높기 때문이다. (위험도 고려)
  3895. this.labelFireAlert.Visible = true;
  3896. //this.labelFireAlert.Image = null;//sdkim, 20120129, [MTS-47]
  3897. this.labelFireAlert_inform_1th.Visible = true;
  3898. this.txtFirstFireWarnningMessage.Visible = true;
  3899. if (this.fireCount_Accumulation > 1)
  3900. {
  3901. this.labelFireAlert_inform_2th.Visible = true;
  3902. this.cboSecondFireWarnningMessage.Visible = true;
  3903. }
  3904. else
  3905. {
  3906. this.labelFireAlert_inform_2th.Visible = false;
  3907. this.cboSecondFireWarnningMessage.Visible = false;
  3908. }
  3909. if (togglecont % 2 == 0)
  3910. {
  3911. this.labelFireAlert.BackColor = Color.Red;
  3912. this.labelFireAlert.ForeColor = Color.Black;
  3913. }
  3914. else
  3915. {
  3916. this.labelFireAlert.BackColor = Color.Transparent;
  3917. this.labelFireAlert.ForeColor = Color.Red;
  3918. }
  3919. }
  3920. else
  3921. {
  3922. this.labelFireAlert.Visible = false;
  3923. this.txtFirstFireWarnningMessage.Visible = false;
  3924. this.labelFireAlert_inform_1th.Visible = false;
  3925. this.cboSecondFireWarnningMessage.Visible = false;
  3926. this.cboSecondFireWarnningMessage.Items.Clear();
  3927. this.labelFireAlert_inform_2th.Visible = false;
  3928. }
  3929. //
  3930. // cyim 2015.7.9 PreFire 표시 문제 : 아날로그 감지기는 PreFire 단계가 있다
  3931. //
  3932. if (this.PreFireList.Count > 0)
  3933. {
  3934. this.labelPreFireAlert.Visible = true;
  3935. this.cboPreFireWarnningMessage.Visible = true;
  3936. if (togglecont % 2 == 0)
  3937. {
  3938. this.labelPreFireAlert.BackColor = Color.Red;
  3939. this.labelPreFireAlert.ForeColor = Color.Black;
  3940. }
  3941. else
  3942. {
  3943. this.labelPreFireAlert.BackColor = Color.Transparent;
  3944. this.labelPreFireAlert.ForeColor = Color.Red;
  3945. }
  3946. }
  3947. else
  3948. {
  3949. this.labelPreFireAlert.Visible = false;
  3950. this.cboPreFireWarnningMessage.Visible = false;
  3951. this.cboPreFireWarnningMessage.Items.Clear();
  3952. }
  3953. //
  3954. // 설비
  3955. //
  3956. if (this.facilityCount > 0)
  3957. {
  3958. this.labelFacilityAlert.Visible = true;
  3959. //this.labelFacilityAlert.Image = null;//sdkim, 20120129, [MTS-47]
  3960. this.cboWriteWarningMessage.Visible = true;
  3961. this.labelFacilityAlert_inform_1th.Visible = true;
  3962. if (togglecont % 2 == 0)
  3963. {
  3964. this.labelFacilityAlert.BackColor = Color.Blue;
  3965. this.labelFacilityAlert.ForeColor = Color.White;
  3966. }
  3967. else
  3968. {
  3969. this.labelFacilityAlert.BackColor = Color.Transparent;
  3970. this.labelFacilityAlert.ForeColor = Color.LightSkyBlue;
  3971. }
  3972. }
  3973. else
  3974. {
  3975. this.labelFacilityAlert.Visible = false;
  3976. this.cboWriteWarningMessage.Visible = false;
  3977. this.cboWriteWarningMessage.Items.Clear();
  3978. this.labelFacilityAlert_inform_1th.Visible = false;
  3979. }
  3980. //
  3981. // cyim 2017.01.18 : 신규 스위치 정보 표시
  3982. //
  3983. //LEDCount = LEDList.Count;
  3984. //if (this.LEDCount > 0)
  3985. //{
  3986. // this.lblLEDText.Text = LEDList[LEDCount - 1].ToString();
  3987. // this.lblLEDText.Visible = true;
  3988. // if (togglecont % 2 == 0)
  3989. // {
  3990. // this.lblLEDText.BackColor = Color.LightPink;
  3991. // this.lblLEDText.ForeColor = Color.White;
  3992. // }
  3993. // else
  3994. // {
  3995. // this.lblLEDText.BackColor = Color.Transparent;
  3996. // this.lblLEDText.ForeColor = Color.LightPink;
  3997. // }
  3998. //}
  3999. //else
  4000. //{
  4001. // this.lblLEDText.Visible = false;
  4002. //}
  4003. // cyim 2017.01.24 : 자동아님 상태면 펌프 점멸 표시하도록 한다
  4004. PumpSwitchStatusLabel(this.label_P1, Pump_1, 1);
  4005. PumpSwitchStatusLabel(this.label_P2, Pump_2, 2);
  4006. PumpSwitchStatusLabel(this.label_P3, Pump_3, 3);
  4007. PumpSwitchStatusLabel(this.label_P4, Pump_4, 4);
  4008. PumpSwitchStatusLabel(this.label_P5, Pump_5, 5);
  4009. PumpSwitchStatusLabel(this.label_P6, Pump_6, 6);
  4010. PumpSwitchStatusLabel(this.label_P7, Pump_7, 7);
  4011. PumpSwitchStatusLabel(this.label_P8, Pump_8, 8);
  4012. }
  4013. }
  4014. // 펌프 스위치 상태 (0 : 정지, 1 : 자동 2 : 수동)
  4015. public void PumpSwitchStatusLabel(Label label, int status, int no)
  4016. {
  4017. switch (status)
  4018. {
  4019. case 0:
  4020. if (togglecont % 2 == 0)
  4021. {
  4022. label.BackColor = Color.WhiteSmoke;
  4023. label.Text = string.Format("P{0} ", no);
  4024. }
  4025. else
  4026. {
  4027. label.BackColor = Color.DarkGray;
  4028. label.Text = string.Format("P{0} ", no);
  4029. }
  4030. break;
  4031. case 1:
  4032. {
  4033. label.BackColor = Color.YellowGreen;
  4034. label.Text = string.Format(" P{0} 자동", no);
  4035. }
  4036. break;
  4037. case 2:
  4038. if (togglecont % 2 == 0)
  4039. {
  4040. label.BackColor = Color.LightBlue;
  4041. label.Text = string.Format(" P{0} 수동", no);
  4042. }
  4043. else
  4044. {
  4045. label.BackColor = Color.DarkGray;
  4046. label.Text = string.Format(" P{0} 수동", no);
  4047. }
  4048. break;
  4049. }
  4050. }
  4051. private List<XMLField> xField = null;
  4052. private Dev_Type_Set DataType_Set = null;
  4053. public int InitXFieldData(string sPrjPath)
  4054. {//xml data 초기화
  4055. XMLReader xmlR = null;
  4056. xmlR = new XMLReader();
  4057. DacFieldConfig db = new DacFieldConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  4058. xmlR.SetXML_BasePath(sPrjPath, this.dtDeviceDBList2);
  4059. this.DataType_Set = xmlR.GetXMLDevTypeData("DevType.xml");
  4060. this.xField = xmlR.GetXMLFieldData("FieldSetting.xml");
  4061. return xField.Count;
  4062. }
  4063. // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
  4064. //public bool bJumpField = true;
  4065. public delegate void dCommandFuctionCall(EventLogInfo eventLog);
  4066. public void FireDetect(EventLogInfo eventLog)
  4067. {
  4068. // 화재 감시 이벤트 처리
  4069. try
  4070. {
  4071. if (this.InvokeRequired)
  4072. {
  4073. dCommandFuctionCall d = new dCommandFuctionCall(FireDetect);
  4074. this.Invoke(d, new object[] { eventLog });
  4075. }
  4076. else
  4077. {
  4078. // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
  4079. //if (bJumpField)
  4080. if (this.ConfigVO.Jump_field_flag == "Y")
  4081. {
  4082. // 도면 전환 설정시
  4083. DataTable Dt = null;
  4084. DacDeviceConfig db = new DacDeviceConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  4085. try
  4086. {
  4087. Dt = db.SelectDevice(eventLog.ReceiverID, eventLog.BoardNo, eventLog.LoopNo, eventLog.RepeaterNo, eventLog.DeviceId, eventLog.InoutType);
  4088. }
  4089. catch (Exception ex)
  4090. {
  4091. Util.UErrorMessage(ex, 0, 0);
  4092. }
  4093. if (Dt != null && Dt.Rows.Count > 0)
  4094. {
  4095. DataRow dr = Dt.Rows[0];
  4096. string sTemp = dr["JUMP_FIELD_ID"].ToString();
  4097. if (sTemp.Length != 0)
  4098. {
  4099. int id = Int32.Parse(dr["JUMP_FIELD_ID"].ToString());
  4100. //Util.UDebugMessage(string.Format("FireDetect JUMP_FIELD_ID = {0}", id), 0, 0);
  4101. FormField formField = (FormField)ShowChildForm(new FormField(this.xField, this.DataType_Set));
  4102. formField.JumpField(id);
  4103. }
  4104. }
  4105. }
  4106. }
  4107. }
  4108. catch (Exception ex)
  4109. {
  4110. Util.UErrorMessage(ex, 0, 0);
  4111. }
  4112. }
  4113. // 카운트 업데이트 타이머
  4114. private void timerCountRead_Tick(object sender, EventArgs e)
  4115. {
  4116. if (this.ui.Connected)
  4117. {
  4118. this.IdleCountCheck();
  4119. }
  4120. }
  4121. // private bool ISIdle { get { return (this.ui.TermEventReciveTime > 0 && this.ui.TermEventReciveTime > 1000 * 30); } }
  4122. private bool countValueCheckFalse = false; //화재, 설비, 통신, 단선, 차단
  4123. public void CountValueCheck(int cnt_DeviceFire, int cnt_DeviceWrite, int cnt_ConnetError, int cnt_RepeaterBlocking, int cnt_ReceiverCut)
  4124. {
  4125. try
  4126. {
  4127. if ((this.fireCount != cnt_DeviceFire) || (this.facilityCount != cnt_DeviceWrite) || (this.errorCount != cnt_ConnetError) || (this.blockingCount != cnt_RepeaterBlocking))
  4128. {
  4129. //if (this.ui.TermEventReciveTime > 1000 * 60) {// count error, reload event list if get event term over 60 sec
  4130. if (this.countValueCheckFalse == true)
  4131. {
  4132. //Util.UDebugMessage(string.Format("CountValueCheck False (Event_Read) (this.fireCount={0} ,cnt_DeviceFire={1}, this.facilityCount={2},cnt_DeviceWrite={3}, this.errorCount={4},cnt_ConnetError={5}, this.blockingCount={6},cnt_RepeaterBlocking={7})", this.fireCount, cnt_DeviceFire, this.facilityCount, cnt_DeviceWrite, this.errorCount, cnt_ConnetError, this.blockingCount, cnt_RepeaterBlocking), 0, 0);
  4133. this.ClaerAllEventListAndCount();
  4134. this.ui.Event_Read(null);
  4135. }
  4136. else
  4137. {
  4138. this.countValueCheckFalse = true;
  4139. //Util.UDebugMessage(string.Format("CountValueCheck False (this.fireCount={0} ,cnt_DeviceFire={1}, this.facilityCount={2},cnt_DeviceWrite={3}, this.errorCount={4},cnt_ConnetError={5}, this.blockingCount={6},cnt_RepeaterBlocking={7})", this.fireCount, cnt_DeviceFire, this.facilityCount, cnt_DeviceWrite, this.errorCount, cnt_ConnetError, this.blockingCount, cnt_RepeaterBlocking), 0, 0);
  4140. }
  4141. }
  4142. else
  4143. {// check ok
  4144. this.countValueCheckFalse = false;
  4145. //Util.UDebugMessage("CountValueCheck OK", 0, 0);
  4146. }
  4147. }
  4148. catch (Exception ex)
  4149. {
  4150. Util.UErrorMessage(ex, 0, 0);
  4151. }
  4152. }
  4153. void IdleCountCheck()
  4154. {// 카운터 체크 호출 함수
  4155. this.ui.CountRead();
  4156. }
  4157. private void timerLoading_Tick(object sender, EventArgs e)
  4158. {// 사용안함
  4159. //if (this.ui.Connected) {
  4160. // if (this.ui.TermEventReciveTime > 0 && this.ui.TermEventReciveTime < 5000) {
  4161. // if (!this.pictureBoxLoading.Visible) {
  4162. // this.ImageLoadingPBoxLaoding();
  4163. // }
  4164. // this.pictureBoxLoading.Visible = true;
  4165. // }
  4166. // else {
  4167. // this.pictureBoxLoading.Visible = false;
  4168. // }
  4169. //}
  4170. //else {
  4171. // this.pictureBoxLoading.Visible = false;
  4172. //}
  4173. }
  4174. private void lblDemonStatus_Click(object sender, EventArgs e)
  4175. {// 데몬 통신이상시 강제 재연결
  4176. this.ui.ServiceStart();
  4177. }
  4178. class DataEventLog
  4179. {// 로그 이벤트 임시저장 데이터 클래스
  4180. public string eventID = "";
  4181. public string eventTime = "";
  4182. public string eventType = "";
  4183. public int receverID = 0;
  4184. public int commID = 0;
  4185. public int boardID = 0;
  4186. public int loopNo = 0;
  4187. public int repeaterID = 0;
  4188. public int deviceID = 0;
  4189. public string inoutType = "";
  4190. public int dataValue = 0;
  4191. public string eventRemark = "";
  4192. public string sendFlag = "";
  4193. public DataEventLog(DataRow dr)
  4194. {
  4195. this.eventID = dr["EVENT_ID"].ToString();
  4196. this.eventTime = dr["EVENT_TIME"].ToString();
  4197. this.eventType = dr["EVENT_TYPE"].ToString();
  4198. this.receverID = Int32.Parse(dr["RECEIVER_ID"].ToString());
  4199. this.commID = Int32.Parse(dr["COMM_ID"].ToString());
  4200. this.boardID = Int32.Parse(dr["BOARD_ID"].ToString());
  4201. this.loopNo = Int32.Parse(dr["LOOP_NO"].ToString());
  4202. this.repeaterID = Int32.Parse(dr["REPEATER_ID"].ToString());
  4203. this.deviceID = Int32.Parse(dr["DEVICE_ID"].ToString());
  4204. this.inoutType = dr["INOUT_TYPE"].ToString();
  4205. this.dataValue = Int32.Parse(dr["DATA_VALUE"].ToString());
  4206. this.eventRemark = dr["EVENT_REMARK"].ToString();
  4207. this.sendFlag = dr["SEND_FLAG"].ToString();
  4208. }
  4209. }
  4210. // cyim 2015.8.12 데이타베이스 용량 문제 : 30000 건이 넘었는지는 항상 새벽 3시에 검사하고, 넘었다고 가정하는 기준은 1.1 배이다
  4211. void EventLogDeleteProc(int deleteLogCount)
  4212. {
  4213. // 특정 이상 넘는 DB 이력 삭제 함수
  4214. DacUIProcess db = new DacUIProcess(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  4215. int logCount = db.GetEventLogCount(this.myReceiverID);
  4216. //for (int i = 0; i < this.arrayListLog.Count; i++) {
  4217. // EventLogInfo elog = (EventLogInfo)this.arrayListLog[i];
  4218. // if (elog.EventId != "000000000000000000000000000000000" && elog.LiveMsgFlag) {
  4219. // logCount++;
  4220. // }
  4221. //}
  4222. if (logCount > deleteLogCount * 1.1)
  4223. {// 삭제 건수의 1.1배 이상이면 동작
  4224. string logTime = db.GetEventLogTime(this.myReceiverID, deleteLogCount - 1);
  4225. ////Util.UDebugMessage(string.Format("EventLogDeleteProc logCount = {0}, logTime = {1}", logCount, logTime), 0, 0);
  4226. if (logTime.Length == 19)
  4227. {// 이력 ID 길이 체크
  4228. string event_time_s = String.Format("{0}-{1}-{2} {3}:{4}:{5}.{6}", logTime.Substring(0, 4), logTime.Substring(4, 2),
  4229. logTime.Substring(6, 2), logTime.Substring(8, 2), logTime.Substring(10, 2), logTime.Substring(12, 2), logTime.Substring(14));
  4230. DateTime eventTime = DateTime.Parse(event_time_s);
  4231. // cyim 2015.8.12 데이타베이스 용량 문제 : 하위 루틴 제거
  4232. // 아래의 루틴은 이해할수가 없다. 왜 하루에 1번 그것도 새벽 3시에 미업데이트된 이벤트를 체크하고 현재이벤트 리스트에 넣어야되는가?
  4233. // 우선은 여기 함수는 그동안 사용되지 않았던 함수이므로 보수적으로 접근한다. 주석 처리함
  4234. //////Util.UDebugMessage(string.Format("EventLogDeleteProc logTime = {0}", logTime), 0, 0);
  4235. //List<DataEventLog> eventLog = new List<DataEventLog>();
  4236. //// cyim 2015.7.6 속도개선작업
  4237. //// 해쉬 리스트 구현 방법은 아래와 같다
  4238. //// 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
  4239. //// 데이타 : EventLogInfo 클래스
  4240. //foreach (DictionaryEntry d in arrayListLog)
  4241. //{
  4242. // EventLogInfo elog = (EventLogInfo)d.Value;
  4243. ////for (int i = 0; i < this.arrayListLog.Count; i++)
  4244. ////{
  4245. //// EventLogInfo elog = (EventLogInfo)this.arrayListLog[i];
  4246. // if (elog.EventId != "000000000000000000000000000000000" && elog.LiveMsgFlag)
  4247. // {// 미 업데이트 이벤트 체크
  4248. // if (eventTime > elog.EventTime)
  4249. // {
  4250. // ////Util.UDebugMessage(string.Format("EventLogDeleteProc add elog.EventId = {0}", elog.EventId), 0, 0);
  4251. // DataTable dt = db.SelectLogEvnetID(elog.EventId);
  4252. // if (dt.Rows.Count > 0)
  4253. // {
  4254. // eventLog.Add(new DataEventLog(dt.Rows[0]));
  4255. // }
  4256. // }
  4257. // }
  4258. //}
  4259. db.DeleteEventLogDataTime(logTime);
  4260. db.DeleteCommandLogData(logTime);// cyim 2015.8.20 조작로그도 이벤트로그와 동일하게 삭제됨
  4261. // cyim 2015.8.12 데이타베이스 용량 문제 : 하위 루틴 제거
  4262. //foreach (DataEventLog log in eventLog)
  4263. //{
  4264. // db.AddEventLogData(log.eventID, log.eventTime, log.eventType, log.receverID, log.commID, log.boardID, log.loopNo,
  4265. // log.repeaterID, log.deviceID, log.inoutType, log.dataValue, log.eventRemark, log.sendFlag);
  4266. //}
  4267. }
  4268. }
  4269. }
  4270. //
  4271. // 이벤트 삭제 타이머
  4272. //
  4273. private void timerLogDelete_Tick(object sender, EventArgs e)
  4274. {
  4275. try
  4276. {
  4277. // cyim 분석 : 1시간마다 실행되는 타이머이므로 1일에 1번 실행된다.
  4278. // 0부터 23 사이의 값으로 표시되는 시간 구성 요소입니다.
  4279. if (DateTime.Now.Hour == 3)
  4280. {
  4281. // cyim 2015.8.20 이벤트로그는 50000건 : 새벽 3시에 1회 실행됨
  4282. this.EventLogDeleteProc(50000);
  4283. // cyim 2015.8.20 외부파일 로그 삭제
  4284. string FireBirdLogPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles, Environment.SpecialFolderOption.None);
  4285. FireBirdLogPath += "\\Firebird\\Firebird_2_5\\firebird.log";
  4286. if (File.Exists(FireBirdLogPath) == true)
  4287. File.Delete(FireBirdLogPath);
  4288. //
  4289. // cyim 2015.8.20 조작로그도 이벤트로그와 동일하게 삭제됨 : 하위루틴 제거
  4290. //
  4291. //if (this.pictureBoxLoading.Visible == false) // 의미없다
  4292. //{
  4293. //idle status
  4294. //this.EventLogDeleteProc(30000);
  4295. //}
  4296. //// cyim 2015.2.13 로그는 2년 유지
  4297. //DacUIProcess db = new DacUIProcess(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  4298. //DateTime commandTime = DateTime.Now;
  4299. //commandTime = commandTime.AddYears(-2); // 2년 전
  4300. //string command_time = String.Format("{0:yyyy}{0:MM}{0:dd}{0:HH}{0:mm}{0:ss}{1:00000}", commandTime, commandTime.Millisecond);
  4301. //db.DeleteCommandLogData(command_time);
  4302. }
  4303. }
  4304. catch (Exception ex)
  4305. {
  4306. Util.UErrorMessage(ex, 0, 0);
  4307. }
  4308. }
  4309. private void timerVoltage_Tick(object sender, EventArgs e)
  4310. {// 전압 읽는 타이머
  4311. this.ui.Voltage_Read(null);
  4312. }
  4313. // cyim 2015.7.31 비상방송 및 통신데몬도 점검으로 표시함
  4314. public bool lblEmergencyBoardStatus_Visible = false;
  4315. public void SetEmergencyBroadCastSetatus(bool status)
  4316. {
  4317. // 비상방송 에러 표시 함수
  4318. try
  4319. {
  4320. if (this.InvokeRequired)
  4321. {
  4322. SetBoolCallback d = new SetBoolCallback(SetEmergencyBroadCastSetatus);
  4323. this.Invoke(d, new object[] { status });
  4324. }
  4325. else
  4326. {
  4327. // 비상방송 통신이상 일경우 라벨이 표시됨
  4328. if (status == false)
  4329. {
  4330. this.lblEmergencyBoardStatus_Visible = this.lblEmergencyBoardStatus.Visible = true;
  4331. }
  4332. else
  4333. this.lblEmergencyBoardStatus_Visible = this.lblEmergencyBoardStatus.Visible = false;
  4334. }
  4335. }
  4336. catch (Exception ex)
  4337. {
  4338. Util.UErrorMessage(ex, 0, 0);
  4339. }
  4340. }
  4341. public bool inputTestMode = false;
  4342. public void SetInputTestMode(bool testmode)
  4343. {// 입력 강제 테스트 모드 진입 함수
  4344. if (testmode == true)
  4345. {
  4346. this.labelinputTestMode.Visible = true;
  4347. this.inputTestMode = true;
  4348. this.timerTestMode.Start();
  4349. }
  4350. else
  4351. {
  4352. this.labelinputTestMode.BackColor = Color.Transparent;
  4353. this.labelinputTestMode.Visible = false;
  4354. this.inputTestMode = false;
  4355. this.timerTestMode.Stop();
  4356. }
  4357. }
  4358. private void timerTestMode_Tick(object sender, EventArgs e)
  4359. {// 입력 강제 테스트 모드 화면 표시 함수
  4360. if (this.labelinputTestMode.BackColor == Color.Transparent)
  4361. {
  4362. this.labelinputTestMode.BackColor = Color.Red;
  4363. this.labelinputTestMode.Visible = true;
  4364. }
  4365. else
  4366. {
  4367. this.labelinputTestMode.BackColor = Color.Transparent;
  4368. }
  4369. }
  4370. private void picCI_Click(object sender, EventArgs e)
  4371. {
  4372. }
  4373. private void button1_Click(object sender, EventArgs e)
  4374. {
  4375. ui.ReadIO15Input();
  4376. }
  4377. // cyim 2013.7.19 버퍼 초과 경고창
  4378. private void _Event_SocketBufferError_Inform_Event(string ErrorText)
  4379. {
  4380. this.ShowMessageForm3(MappingStatus.CommConnectError, "통신오류", ErrorText);
  4381. }
  4382. // cyim 2014.4.7 : 마우스 포커스가 점검 버튼 위에 있을때 동작 추가
  4383. private void btnCheck_MouseEnter(object sender, EventArgs e)
  4384. {
  4385. if (CheckBtn_Current_Status == true || MonitorDaemon_ComErrorCheck() == false) // cyim 2014.8.8 통신점검 시나리오 신규 작업
  4386. this.btnCheck.FlatAppearance.MouseOverBackColor = Color.Red;
  4387. else
  4388. this.btnCheck.FlatAppearance.MouseOverBackColor = Color.Transparent;
  4389. this.btnCheck.Update();
  4390. }
  4391. // cyim 2014.8.8 통신점검 시나리오 신규 작업
  4392. private void _Event_ClientSocketReceive_SendMessage_Event(string data)
  4393. {
  4394. try
  4395. {
  4396. // 메세지를 수신하는 내용에 따라 데몬의 상태가 결정된다
  4397. // 예시 : "1,0:2,1" 는 수신기 아이디 1은 통신 안됨, 2는 통신 잘됨
  4398. string[] datas = data.Trim().Split(':');
  4399. foreach (string id_status in datas)
  4400. {
  4401. string[] temp = id_status.Split(',');
  4402. if (NetworkReceiver_ID_ComStatus[temp[0]] != null)
  4403. {
  4404. if (temp[1] == "1")
  4405. NetworkReceiver_ID_ComStatus[temp[0]] = true;
  4406. else
  4407. NetworkReceiver_ID_ComStatus[temp[0]] = false;
  4408. }
  4409. }
  4410. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  4411. Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
  4412. }
  4413. catch (Exception ex)
  4414. {
  4415. Util.UErrorMessage(ex, 0, 0);
  4416. }
  4417. }
  4418. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  4419. private void _TcpComClient_SocketConnect_Inform_Event(object data, bool Connect)
  4420. {
  4421. try // cyim 2015.10.23 보완 코드 추가
  4422. {
  4423. // 갑자기 소켓이 종료됨
  4424. if (Connect == false)
  4425. {
  4426. // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
  4427. lock (CS_MonitorDaemon_ComStatus)
  4428. {
  4429. // 모니터데몬은 통신이 안됨
  4430. this.MonitorDaemon_ComStatus = false;
  4431. // 원래있던 수신기의 통신상태는 true 로 돌려놓는다
  4432. foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
  4433. NetworkReceiver_ID_ComStatus[ReceiverID] = true;
  4434. // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
  4435. Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
  4436. }
  4437. }
  4438. }
  4439. catch
  4440. { }
  4441. }
  4442. // 현재이력을 무작정 갱신하면 부하확률이 높다. 네트워크 수신기 상태가 변경되었을 경우에만 갱신하도록 하자
  4443. private void Check_EtcMonitorDaemon_for_Update_FormLogView(bool pMonitorDaemon_ComStatus, Hashtable pNetworkReceiver_ID_ComStatus)
  4444. {
  4445. // cyim 2014.8.12 네트워크 수신기 통신상태 문제 수정 (동시에 이벤트 발생시 UI 에서 처리하려면 큐가 아니라서 결국 CriticalSection 으로 처리해야함)
  4446. lock (CS_MonitorDaemon_ComStatus)
  4447. {
  4448. try // cyim 2015.10.23 보완 코드 추가
  4449. {
  4450. bool update = false;
  4451. if (pMonitorDaemon_ComStatus != Before_MonitorDaemon_ComStatus)
  4452. {
  4453. update = true;
  4454. }
  4455. foreach (string ReceiverID in NetworkReceiver_ID_List)
  4456. {
  4457. if (pNetworkReceiver_ID_ComStatus[ReceiverID].ToString() != Before_NetworkReceiver_ID_ComStatus[ReceiverID].ToString())
  4458. update = true;
  4459. }
  4460. if (update == true)
  4461. Event.FormLogView_Update_SendMessage_Write(); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
  4462. // 모니터데몬의 이전값
  4463. Before_MonitorDaemon_ComStatus = pMonitorDaemon_ComStatus;
  4464. // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
  4465. foreach (string ReceiverID in NetworkReceiver_ID_List)
  4466. Before_NetworkReceiver_ID_ComStatus[ReceiverID] = NetworkReceiver_ID_ComStatus[ReceiverID];
  4467. }
  4468. catch
  4469. { }
  4470. }
  4471. }
  4472. // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트
  4473. private void Event_TimeSync_Setup_SendMessage_Event(string data)
  4474. {
  4475. // 마스터 수신기에서 시간정보를 셋팅한다
  4476. if (this.ConfigVO.Master_flag == "Y")
  4477. ReadRegister_And_SendToPacket_MonitorDaemon("TS " + data);
  4478. }
  4479. // cyim 2016.06.15 : 화재 음원 출력
  4480. public void AlarmPopup_PlaySound_Check()
  4481. {
  4482. if (SoundPlayer_AlarmPopupSound != null) // cyim 2016.11.11 : 비상 음원 출력 음원 파일 없을때 대응 코드 추가
  4483. {
  4484. if (this.labelFireAlert.Visible == true || this.labelFacilityAlert.Visible == true) // cyim 2016.06.16 : 설비동작 발생시 음원 출력 포함
  4485. SoundPlayer_AlarmPopupSound.Play();
  4486. else
  4487. SoundPlayer_AlarmPopupSound.Stop();
  4488. }
  4489. }
  4490. //
  4491. // 버튼 이미지 정리
  4492. //
  4493. private string strImgPathBtnMenu1n = "btnMenu1.png";
  4494. private string strImgPathBtnMenu1o = "btnMenu1_ov.png";
  4495. private string strImgPathBtnMenu1d = "btnMenu1_dn.png";
  4496. private string strImgPathBtnMenu1s = "btnMenu1_red.png";
  4497. private string strImgPathBtnMenu2n = "btnMenu2.png";
  4498. private string strImgPathBtnMenu2o = "btnMenu2_ov.png";
  4499. private string strImgPathBtnMenu2d = "btnMenu2_dn.png";
  4500. private string strImgPathBtnMenu3n = "btnMenu3.png";
  4501. private string strImgPathBtnMenu3o = "btnMenu3_ov.png";
  4502. private string strImgPathBtnMenu3d = "btnMenu3_dn.png";
  4503. private string strImgPathBtnMenu4n = "btnMenu4.png";
  4504. private string strImgPathBtnMenu4o = "btnMenu4_ov.png";
  4505. private string strImgPathBtnMenu4d = "btnMenu4_dn.png";
  4506. private string strImgPathBtnMenu5n = "btnMenu5.png";
  4507. private string strImgPathBtnMenu5o = "btnMenu5_ov.png";
  4508. private string strImgPathBtnMenu5d = "btnMenu5_dn.png";
  4509. private string strImgPathBtnMenu6n = "btnMenu6.png";
  4510. private string strImgPathBtnMenu6o = "btnMenu6_ov.png";
  4511. private string strImgPathBtnMenu6d = "btnMenu6_dn.png";
  4512. private string strImgPathBtnMenu7n = "btnMenu7.png";
  4513. private string strImgPathBtnMenu7o = "btnMenu7_ov.png";
  4514. private string strImgPathBtnMenu7d = "btnMenu7_dn.png";
  4515. private string strImgBasePath = "image";
  4516. private string ImgBasePath { get { return Path.Combine(Directory.GetCurrentDirectory(), this.strImgBasePath); } }
  4517. private string ImgPathBtnMenu1n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu1n); } }
  4518. private string ImgPathBtnMenu1o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu1o); } }
  4519. private string ImgPathBtnMenu1d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu1d); } }
  4520. private string ImgPathBtnMenu1s { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu1s); } }
  4521. private string ImgPathBtnMenu2n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu2n); } }
  4522. private string ImgPathBtnMenu2o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu2o); } }
  4523. private string ImgPathBtnMenu2d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu2d); } }
  4524. private string ImgPathBtnMenu3n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu3n); } }
  4525. private string ImgPathBtnMenu3o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu3o); } }
  4526. private string ImgPathBtnMenu3d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu3d); } }
  4527. private string ImgPathBtnMenu4n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu4n); } }
  4528. private string ImgPathBtnMenu4o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu4o); } }
  4529. private string ImgPathBtnMenu4d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu4d); } }
  4530. private string ImgPathBtnMenu5n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu5n); } }
  4531. private string ImgPathBtnMenu5o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu5o); } }
  4532. private string ImgPathBtnMenu5d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu5d); } }
  4533. private string ImgPathBtnMenu6n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu6n); } }
  4534. private string ImgPathBtnMenu6o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu6o); } }
  4535. private string ImgPathBtnMenu6d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu6d); } }
  4536. private string ImgPathBtnMenu7n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu7n); } }
  4537. private string ImgPathBtnMenu7o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu7o); } }
  4538. private string ImgPathBtnMenu7d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu7d); } }
  4539. private Image ImgLoad(string path)
  4540. {
  4541. Image ret = null;
  4542. try
  4543. {
  4544. ret = Image.FromFile(path);
  4545. }
  4546. catch (Exception e)
  4547. {
  4548. Util.UErrorMessage(e, 0, 0);
  4549. }
  4550. return ret;
  4551. }
  4552. private void ImgChangeBtnMenu1n()
  4553. {
  4554. if (this.likageBtnStatus)
  4555. {
  4556. this.ImgChangeBtnMenu1s();
  4557. }
  4558. else
  4559. {
  4560. this.ImgChangeBtnMenu1n2();
  4561. }
  4562. }
  4563. private void ImgChangeBtnMenu1n2()
  4564. {
  4565. Image img = ImgLoad(this.ImgPathBtnMenu1n);
  4566. if (img != null)
  4567. {
  4568. this.btnMenu1.Image = img;
  4569. }
  4570. }
  4571. private void ImgChangeBtnMenu1o()
  4572. {
  4573. Image img = ImgLoad(this.ImgPathBtnMenu1o);
  4574. if (img != null)
  4575. {
  4576. this.btnMenu1.Image = img;
  4577. }
  4578. }
  4579. private void ImgChangeBtnMenu1d()
  4580. {
  4581. Image img = ImgLoad(this.ImgPathBtnMenu1d);
  4582. if (img != null)
  4583. {
  4584. this.btnMenu1.Image = img;
  4585. }
  4586. }
  4587. private void ImgChangeBtnMenu1s()
  4588. {
  4589. Image img = ImgLoad(this.ImgPathBtnMenu1s);
  4590. if (img != null)
  4591. {
  4592. this.btnMenu1.Image = img;
  4593. }
  4594. }
  4595. private void ImgChangeBtnMenu2n()
  4596. {
  4597. Image img = ImgLoad(this.ImgPathBtnMenu2n);
  4598. if (img != null)
  4599. {
  4600. this.btnMenu2.Image = img;
  4601. }
  4602. }
  4603. private void ImgChangeBtnMenu2o()
  4604. {
  4605. Image img = ImgLoad(this.ImgPathBtnMenu2o);
  4606. if (img != null)
  4607. {
  4608. this.btnMenu2.Image = img;
  4609. }
  4610. }
  4611. private void ImgChangeBtnMenu2d()
  4612. {
  4613. Image img = ImgLoad(this.ImgPathBtnMenu2d);
  4614. if (img != null)
  4615. {
  4616. this.btnMenu2.Image = img;
  4617. }
  4618. }
  4619. private void ImgChangeBtnMenu3n()
  4620. {
  4621. Image img = ImgLoad(this.ImgPathBtnMenu3n);
  4622. if (img != null)
  4623. {
  4624. this.btnMenu3.Image = img;
  4625. }
  4626. }
  4627. private void ImgChangeBtnMenu3o()
  4628. {
  4629. Image img = ImgLoad(this.ImgPathBtnMenu3o);
  4630. if (img != null)
  4631. {
  4632. this.btnMenu3.Image = img;
  4633. }
  4634. }
  4635. private void ImgChangeBtnMenu3d()
  4636. {
  4637. Image img = ImgLoad(this.ImgPathBtnMenu3d);
  4638. if (img != null)
  4639. {
  4640. this.btnMenu3.Image = img;
  4641. }
  4642. }
  4643. private void ImgChangeBtnMenu4n()
  4644. {
  4645. Image img = ImgLoad(this.ImgPathBtnMenu4n);
  4646. if (img != null)
  4647. {
  4648. this.btnMenu4.Image = img;
  4649. }
  4650. }
  4651. private void ImgChangeBtnMenu4o()
  4652. {
  4653. Image img = ImgLoad(this.ImgPathBtnMenu4o);
  4654. if (img != null)
  4655. {
  4656. this.btnMenu4.Image = img;
  4657. }
  4658. }
  4659. private void ImgChangeBtnMenu4d()
  4660. {
  4661. Image img = ImgLoad(this.ImgPathBtnMenu4d);
  4662. if (img != null)
  4663. {
  4664. this.btnMenu4.Image = img;
  4665. }
  4666. }
  4667. private void ImgChangeBtnMenu5n()
  4668. {
  4669. Image img = ImgLoad(this.ImgPathBtnMenu5n);
  4670. if (img != null)
  4671. {
  4672. this.btnMenu5.Image = img;
  4673. }
  4674. }
  4675. private void ImgChangeBtnMenu5o()
  4676. {
  4677. Image img = ImgLoad(this.ImgPathBtnMenu5o);
  4678. if (img != null)
  4679. {
  4680. this.btnMenu5.Image = img;
  4681. }
  4682. }
  4683. private void ImgChangeBtnMenu5d()
  4684. {
  4685. Image img = ImgLoad(this.ImgPathBtnMenu5d);
  4686. if (img != null)
  4687. {
  4688. this.btnMenu5.Image = img;
  4689. }
  4690. }
  4691. private void ImgChangeBtnMenu6n()
  4692. {
  4693. Image img = ImgLoad(this.ImgPathBtnMenu6n);
  4694. if (img != null)
  4695. {
  4696. this.btnMenu6.Image = img;
  4697. }
  4698. }
  4699. private void ImgChangeBtnMenu6o()
  4700. {
  4701. Image img = ImgLoad(this.ImgPathBtnMenu6o);
  4702. if (img != null)
  4703. {
  4704. this.btnMenu6.Image = img;
  4705. }
  4706. }
  4707. private void ImgChangeBtnMenu6d()
  4708. {
  4709. Image img = ImgLoad(this.ImgPathBtnMenu6d);
  4710. if (img != null)
  4711. {
  4712. this.btnMenu6.Image = img;
  4713. }
  4714. }
  4715. private void ImgChangeBtnMenu7n()
  4716. {
  4717. Image img = ImgLoad(this.ImgPathBtnMenu7n);
  4718. if (img != null)
  4719. {
  4720. this.btnMenu7.Image = img;
  4721. }
  4722. }
  4723. private void ImgChangeBtnMenu7o()
  4724. {
  4725. Image img = ImgLoad(this.ImgPathBtnMenu7o);
  4726. if (img != null)
  4727. {
  4728. this.btnMenu7.Image = img;
  4729. }
  4730. }
  4731. private void ImgChangeBtnMenu7d()
  4732. {
  4733. Image img = ImgLoad(this.ImgPathBtnMenu7d);
  4734. if (img != null)
  4735. {
  4736. this.btnMenu7.Image = img;
  4737. }
  4738. }
  4739. // cyim 2015.8.20 이벤트로그는 50000건 : 하위 불필요한 루틴 제거
  4740. //private string strImagePathPBoxLoading = "loading.gif";
  4741. //private string ImagePathPBoxLoading { get { return Path.Combine(this.ImgBasePath, this.strImagePathPBoxLoading); } }
  4742. //private void ImageLoadingPBoxLoading()
  4743. //{
  4744. // Image img = ImgLoad(this.ImagePathPBoxLoading);
  4745. // if (img != null)
  4746. // {
  4747. // this.pictureBoxLoading.Image = img;
  4748. // }
  4749. //}
  4750. // cyim 2015.7.30 오른쪽 상단에 숨김버튼 추가
  4751. private void button_Hide_Click(object sender, EventArgs e)
  4752. {
  4753. this.Visible = false;
  4754. }
  4755. //
  4756. // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
  4757. //
  4758. // Tray ===============================================================================================================
  4759. private NotifyIcon trayIcon;
  4760. private ContextMenu trayMenu;
  4761. private void GimmeTray()
  4762. {
  4763. // Create a simple tray menu with only one item.
  4764. trayMenu = new ContextMenu();
  4765. trayMenu.MenuItems.Add("Exit", OnExit);
  4766. // Create a tray icon.
  4767. trayIcon = new NotifyIcon();
  4768. trayIcon.Text = "Windows System Key Blocker";
  4769. trayIcon.Icon = new Icon(SystemIcons.Shield, 40, 40);
  4770. // Add menu to tray icon and show it.
  4771. trayIcon.ContextMenu = trayMenu;
  4772. trayIcon.Visible = true;
  4773. }
  4774. private void OnExit(object sender, EventArgs e)
  4775. {
  4776. Console.WriteLine(" ! OSK exited.");
  4777. trayIcon.Dispose();
  4778. m_KeyboardHookManager.Dispose();
  4779. Application.Exit();
  4780. ShowToolbars();
  4781. }
  4782. // Toolbars ===============================================================================================================
  4783. private const int SW_HIDE = 0;
  4784. private const int SW_SHOW = 1;
  4785. [DllImport("user32.dll")]
  4786. private static extern int FindWindow(string className, string windowText);
  4787. [DllImport("user32.dll")]
  4788. private static extern int ShowWindow(int hwnd, int command);
  4789. private void HideToolbars()
  4790. {
  4791. int hWnd = FindWindow("Shell_TrayWnd", "");
  4792. ShowWindow(hWnd, SW_HIDE);
  4793. }
  4794. private void ShowToolbars()
  4795. {
  4796. int hWnd = FindWindow("Shell_TrayWnd", "");
  4797. ShowWindow(hWnd, SW_SHOW);
  4798. }
  4799. private void ManualOpenMenuItem_Click(object sender, EventArgs e)//(매뉴얼 파일 열기) 클릭 함수
  4800. {
  4801. LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-매뉴얼 파일 열기 클릭");
  4802. String openPDFFile = Environment.CurrentDirectory + "\\manual\\FireManual.docx";
  4803. System.IO.FileInfo fi = new System.IO.FileInfo(openPDFFile);
  4804. if (fi.Exists)
  4805. {
  4806. System.Diagnostics.Process.Start("explorer.exe", openPDFFile);
  4807. }
  4808. else
  4809. {
  4810. MessageBox.Show("매뉴얼 파일이 없습니다.", "매뉴얼", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  4811. return;
  4812. }
  4813. }
  4814. // 디버깅 클릭
  4815. private void Button_Debug_Click(object sender, EventArgs e)
  4816. {
  4817. if (_Data.Enable_Form_Debug == false)
  4818. {
  4819. _Data.Enable_Form_Debug = true;
  4820. Form_Debug _Form_Debug = new Form_Debug();
  4821. _Form_Debug.Show();
  4822. }
  4823. }
  4824. public FbConnection connection = null;
  4825. public static int iOpenCount = 0;
  4826. public static int iAccessCount = 0;
  4827. private void button1_Click_1(object sender, EventArgs e)
  4828. {
  4829. DBlabel.Text = "시작";
  4830. try
  4831. {
  4832. int tempcnt = Convert.ToInt32(DBbox.Text);
  4833. if (tempcnt > 9999)
  4834. tempcnt = 9999;
  4835. for (var i = 0; i < tempcnt; i++)
  4836. {
  4837. DBlabel.Text = i.ToString();
  4838. string temp;
  4839. if (i < 10)
  4840. {
  4841. temp = "000" + i.ToString();
  4842. }
  4843. else if (i < 100)
  4844. {
  4845. temp = "00" + i.ToString();
  4846. }
  4847. else if (i < 1000)
  4848. {
  4849. temp = "0" + i.ToString();
  4850. }
  4851. else
  4852. {
  4853. temp = i.ToString();
  4854. }
  4855. String SQL = "INSERT INTO TB_EVENT_LOG (EVENT_ID,EVENT_TIME,EVENT_TYPE,RECEIVER_ID,COMM_ID,"
  4856. + "BOARD_ID,LOOP_NO,REPEATER_ID,DEVICE_ID,INOUT_TYPE,DATA_VALUE, EVENT_REMARK,SEND_FLAG)"
  4857. + " VALUES ('" + DateTime.Now.ToString("yyyyMMddHHmmss0") + i + "OF01110000101I','" + DateTime.Now.ToString("yyyyMMddHHmmss0") + i + "','OF',1,1,10,0,1,1,'I',1,'FIRE ON!','N')";
  4858. ExecuteNonQuery(SQL); //2019 04 26 08 29 45 001 66
  4859. }
  4860. DBlabel.Text = "완료";
  4861. }
  4862. //연,월,일, 시, 분,1,2,3
  4863. catch (Exception ex)
  4864. {
  4865. DBlabel.Text = "실패";
  4866. Util.UErrorMessage(ex, 0, 0);
  4867. }
  4868. }
  4869. public bool Connect()
  4870. {
  4871. bool ret = false;
  4872. try
  4873. {
  4874. // 사용자와 암호는 고정시킨다
  4875. String strConnection = string.Format("Server={0};User={1};Password={2};Database={3};Charset={4};ServerType={5}",
  4876. "127.0.0.1", // IP ex)192.168.63.22
  4877. "SYSDBA", // 사용자
  4878. "masterkey", // 암호
  4879. @"C:\FireTest\Receiver1\DB\FPER.FDB", // 절대위치.. ex) C:\TEST\TEST.FDB
  4880. "KSC_5601", // KSC_5601 같은 문자셋을 지정
  4881. "0"); // 0이면 Classic/Super Server, 1이면 Embedded Server를 지정하신다음...
  4882. connection = new FbConnection(strConnection);
  4883. connection.Open();
  4884. iOpenCount++;
  4885. iAccessCount++;
  4886. if (iAccessCount > 100000)
  4887. {
  4888. iAccessCount = 0;
  4889. }
  4890. ret = (this.connection.State == ConnectionState.Open);
  4891. }
  4892. catch (Exception ex)
  4893. {
  4894. Util.UErrorMessage(ex, 0, 0);
  4895. }
  4896. return ret;
  4897. }
  4898. // 쿼리명령
  4899. public void ExecuteNonQuery(String sqlSyntax)
  4900. {
  4901. if (connection == null || connection.State != ConnectionState.Open)
  4902. {
  4903. Connect();
  4904. }
  4905. FbTransaction transaction = connection.BeginTransaction();
  4906. try
  4907. {
  4908. FbCommand command = new FbCommand(sqlSyntax, connection, transaction);
  4909. command.CommandType = CommandType.Text;
  4910. command.CommandTimeout = 2147483647;
  4911. command.ExecuteNonQuery();
  4912. transaction.Commit();
  4913. command.Dispose();
  4914. }
  4915. catch (Exception ex)
  4916. {
  4917. Util.UErrorMessage(ex, 0, 0);
  4918. transaction.Rollback();
  4919. throw ex;
  4920. }
  4921. }
  4922. // 접속종료
  4923. public void DisConnect()
  4924. {
  4925. try
  4926. {
  4927. if (connection != null)
  4928. connection.Close();
  4929. iOpenCount--;
  4930. }
  4931. catch (Exception ex)
  4932. {
  4933. Util.UErrorMessage(ex, 0, 0);
  4934. }
  4935. }
  4936. private void DBlabel_Click(object sender, EventArgs e)
  4937. {
  4938. DBlabel.Text = "0";
  4939. }
  4940. }
  4941. }