MDIParent.cs 252 KB

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