1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using Microsoft.Win32;
- using System.Net;
- using System.Diagnostics;
- using System.IO;
- using System.Collections;
- using System.Threading;
- using System.Media;
- // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
- using MouseKeyboardActivityMonitor;
- using MouseKeyboardActivityMonitor.WinApi;
- using System.Runtime.InteropServices;
- using FirebirdSql.Data.FirebirdClient;
- namespace FPER
- {
- // cyim 2015.7.6 : 불필요한 파일 및 소스를 정리
- // 기존 코드들이 중복되거나 사용되지 않는 함수와 변수가 너무 많음
- //-> _Timet.cs, Data.cs, Form_AnalogDetecter.cs 추가
- //-> frmModalIDInput.cs, frmmainsetting.cs frmConfigFileRead.cs frmBatteryTest.cs frmAlarmLogPost.cs, frmAlarmLog.cs 삭제
- //-> MDIParent_btnMeneConst.cs frmReceiverConfig_repeaterTab.cs 병합
- public partial class MDIParent : Form
- {
- //선택한 메뉴항목
- private int selectMenuIndex = -1;
- public string temptxtBoardID, temptxtLoopNo;
- // cyim 2013.6.27 : 수신기 설정 -> 중계기 쓰기 버튼 이후 데몬 초기화 되지 않는 문제
- public SocketUI socketUI;
- Form_Popup_OtherFireAlarm OtherFireAlarm_ME;
- // 1280 * 1024모드가 아닌경우 화면이동을 위해
- private Boolean MDIMove = false;
- private Point mouseOffset;
- // 수신기 아이디 정보
- public int myReceiverID = -1;
- public int MyReceiverID { get { return this.myReceiverID; } set { this.myReceiverID = value; } } // cyim 2015.7.29 인덱서 읽기전용이였지만, 수신반루틴을 위해 삭제 // cyim 2015.8.4 수신반을 위한 static 클래스 정리 : 경고 삭제
- // 백업 (60분 타이머)
- private DateTime myDbBackUpDate = DateTime.Parse("1999-01-01");
- //mdi
- IWin32Window window;
- IWin32Window winMsg;
- IWin32Window winLogin;
- IWin32Window winWaittingMsg;
- public IWin32Window winBatteryTestMsg;
- frmWarningBox warningForm;
- frmWarningBox warningForm2;
- public frmWarningBox warningForm3 = null;
- frmLogin loginForm;
- frmWaitingMsg waittingForm;
- // 예비 시험 테스트 화면
- public frmDriveTest winDriveTestForm; //k.s.d 20101023, drivertest form class.
- // cyim 2015.7.6 속도개선작업 : 이벤트로그용 데이타 (현재내역용)
- // 기존 코드 분석 결과... 컨셉은 디바이스 정보와 EventType 이 동일한 것만 따진다고 볼 수 있다.
- // EventType 의 경우 OM, OR 과 같은 이벤트 Length 2 인 일종의 명령어 타입이라고 이해해야 한다
- // 기존의 코드가 이렇게 구성되어 있어서 일단 유지하지만, 이벤트 리스트를 Full Scan 해야되므로 성능 저하를 시킬수 있는 요지가 있다
- // 대안은 Hash 를 이용해야 하면 되는데 고유 디바이스 정보를 해쉬 키로 두고, 이에 대한 현재 명령어 값을 보기만 하면 된다.
- // 해쉬 리스트 구현 방법은 아래와 같다
- // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
- // 데이타 : EventLogInfo 클래스
- public Hashtable arrayListLog = new Hashtable();
- public Hashtable AryEventLogs { get { return this.arrayListLog; } }
- // 화면 오른쪽상단의 상태 라벨에 표시
- public ArrayList LEDList = new ArrayList();
- // 화재 표시용 리스트
- public ArrayList FireList = new ArrayList();
- // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
- public ArrayList FireList_Accumulation = new ArrayList();
- // 설비 동작 표시용 리스트
- public ArrayList EquipList = new ArrayList();
- // 상태 라벨 카운트
- public int LEDCount = 0;
- // cyim 2017.01.18 : 신규 스위치 정보 표시
- // 펌프 스위치 상태 (0 : 정지, 1 : 자동 2 : 수동)
- public int Pump_1 = 0;
- public int Pump_2 = 0;
- public int Pump_3 = 0;
- public int Pump_4 = 0;
- public int Pump_5 = 0;
- public int Pump_6 = 0;
- public int Pump_7 = 0;
- public int Pump_8 = 0;
- // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
- public bool CheckBtn_Current_Status = false;
- // cyim 2014.7.18 : 데몬이 늦게 출력되어 포커스를 잃어버리면 작업바가 나타난다
- public int timer_MdiParent_TopMost_Cnt = 0;
- public bool timer_MdiParent_TopMost = false;
- // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
- public bool MonitorDaemon_Enable = false; // 모니터데몬에 접속할 수 있는지 옵션 체크 정보
- public string MonitorDaemon_IP = null; // 모니터데몬 아이피
- public bool MonitorDaemon_ComStatus = true; // 모니터데몬 통신상태 // 특별테스트
- public Hashtable NetworkReceiver_ID_ComStatus = new Hashtable(); // 타수신기 아이피와 통신상태 (해쉬)
- public ArrayList NetworkReceiver_ID_List = new ArrayList(); // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
- public int MonitorDaemon_Chk_Cnt = 0; // 특정 주기마다 모니터데몬에 접속
- // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- public bool Before_MonitorDaemon_ComStatus = true; // 모니터데몬의 이전값
- public Hashtable Before_NetworkReceiver_ID_ComStatus = new Hashtable();
- // cyim 2014.8.12 네트워크 수신기 통신상태 문제 수정 (동시에 이벤트 발생시 UI 에서 처리하려면 큐가 아니라서 결국 CriticalSection 으로 처리해야함)
- public object CS_MonitorDaemon_ComStatus = new object();
- // cyim 2015.2.9 데몬 연결 상태 체크
- public bool CommDaemon_ComStatus = true;
- //
- // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- //
- // 폼활성화 여부 변수
- public bool Form_Active_frmDriveTest = false;
- // 예비전원 이상
- public bool Battery_TestError = false;
- // 교류전원 이상
- public bool AC_TestError = false;
- // 아날로그 감지기
- public _AnalogDetect AnalogDetect = new _AnalogDetect();
- // 팝업창
- public _Popup Popup = null;
- // cyim 2016.12.06 : 강제쿼리 - 추가로 필요한 데이타베이스 정리
- public _ExternalInitial ExternalInitial = new _ExternalInitial();
- // 이벤트 타입 정의
- public _EventTypeName EventTypeName = new _EventTypeName();
- // 스레드
- public _Thread Thread = new _Thread();
- // 클라이언트
- public _TcpComClient TcpComClient = null;
- // 타이머
- public _Timer_WindowBase Timer_WindowBase = new _Timer_WindowBase();
- // 이벤트
- public _Event Event = new _Event();
- // cyim 2015.9.23 시간정보 표시 오류 (갱신을 안함)
- public string MyTime = null;
- //
- //화면에 누적카운트 표시하는 대리자
- //
- delegate void SetVoidCallback();
- delegate void SetTextCallback(int cnt);
- delegate void SetVoltageCallback(float cnt);
- delegate void SetMsgCntCallback(string msg, int processValue);
- delegate void SetBoolCallback(bool mode);
- delegate void SetBoolIntCallback(bool mode, int status);
- //메세지박스를 띄우는 대리자
- delegate void ShowFormCallback(MappingStatus sta, String msg, String deviceMsg);
- //로그인화면을 띄우는 대리자
- delegate void ShowFormLogin(Form frm);
- //수신기 기본설정정보 VO(축적여부,화재모드,관리자ID....)
- private ReceiverConfigVo ConfigVO;
- // cyim 2016.03.21 : 전원값 화면에 표시못하는 문제 보완
- public string Power_Main_vol24 = null;
- // cyim 2016.06.15 : 화재 음원 출력
- //public SoundPlayer SoundPlayer_AlarmPopupSound = new SoundPlayer(Properties.Resources.emergency);
- public SoundPlayer SoundPlayer_AlarmPopupSound = null;
- public int SoundPlayer_AlarmPopupSound_Count = 0;
- // cyim 2016.12.06 : 수신기 모델 변수 추가
- public string ReceiverModel = "";
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- public bool MDIReceiverConfig_Change_Flag = false;
- // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
- public static KeyboardHookListener m_KeyboardHookManager;
- // cyim 2016.12.28 : 예외처리 추가
- public _Ethernet Ethernet = new _Ethernet();
- LogFileCreate LFC = new LogFileCreate();
- // 생성자
- public MDIParent(int ID, _Event evt)
- {
- InitializeComponent();
- // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
- if (_Data.FireDeskMode == false && _Data.Hook_Enable != "OFF")
- {
- _Hook.Disable_TaskMgr();
- _Hook.Disable_NoClose();
- GimmeTray();
- m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker());
- m_KeyboardHookManager.Enabled = true;
- }
- // cyim 2016.11.11 : 비상 음원 출력 음원 파일 없을때 대응 코드 추가
- if (File.Exists(Environment.CurrentDirectory + "\\emergency.wav") == true)
- SoundPlayer_AlarmPopupSound = new SoundPlayer(Environment.CurrentDirectory + "\\emergency.wav");// cyim 2016.06.24 : 음원 출력시 교체 가능
- // cyim 2015.7.29 수신반 루틴을 위해 외부 파라미터로 동작하도록 수정
- myReceiverID = ID;
- this.ImgChangeBtnMenu6n();//ImgChangeBtnMenu6o,n,d
- // cyim 2015.8.4 수신반을 위한 static 클래스 정리 : fDesk 가 메인이다.
- if (evt != null)
- Event = evt;
- // cyim 2016.12.16 : 수신반의 경우 MDIParent의 숨김 버튼을 닫기 버튼으로 대체한다
- //else
- // this.button_Hide.Visible = false; // cyim 2015.8.19 수신반모드가 아닐때는 최소화버튼이 필요없다
- }
- // 선택한 메뉴 인덱스에 따라 버튼 이미지를 변경함
- public int SelectMenuIndex
- {
- get { return this.selectMenuIndex; }
- set
- {
- this.selectMenuIndex = value; //이전버튼은 선택해제 시킨다.
- if (this.selectMenuIndex != 1) { this.ImgChangeBtnMenu1n(); }
- if (this.selectMenuIndex != 2) { this.ImgChangeBtnMenu2n(); }
- if (this.selectMenuIndex != 3) { this.ImgChangeBtnMenu3n(); }
- if (this.selectMenuIndex != 4) { this.ImgChangeBtnMenu4n(); }
- if (this.selectMenuIndex != 5) { this.ImgChangeBtnMenu5n(); }
- if (this.selectMenuIndex != 6) { this.ImgChangeBtnMenu6n(); }
- if (this.selectMenuIndex != 7) { this.ImgChangeBtnMenu7n(); }
- if (this.selectMenuIndex == 1) { this.ImgChangeBtnMenu1o(); }
- if (this.selectMenuIndex == 2) { this.ImgChangeBtnMenu2o(); }
- if (this.selectMenuIndex == 3) { this.ImgChangeBtnMenu3o(); }
- if (this.selectMenuIndex == 4) { this.ImgChangeBtnMenu4o(); }
- if (this.selectMenuIndex == 5) { this.ImgChangeBtnMenu5o(); }
- if (this.selectMenuIndex == 6) { this.ImgChangeBtnMenu6o(); }
- if (this.selectMenuIndex == 7) { this.ImgChangeBtnMenu7o(); }
- }
- }
- //
- // 환경설정내용
- //
- public SocketUI ui { get { return this.socketUI; } }
- public ReceiverConfigVo MyConfigVO
- {
- get { return this.ConfigVO; }
- set
- {
- ReceiverConfigVo ConfigVO2 = value;
- this.ConfigVO.Fire_accumulation_mode = ConfigVO2.Fire_accumulation_mode;
- this.ConfigVO.Fire_accumulation_time = ConfigVO2.Fire_accumulation_time;
- this.ConfigVO.Fire_process_mode = ConfigVO2.Fire_process_mode;
- this.ConfigVO.Master_user_id = ConfigVO2.Master_user_id;
- this.ConfigVO.Master_password = ConfigVO2.Master_password;
- this.ConfigVO.Building_name = ConfigVO2.Building_name;
- this.ConfigVO.Background_image = ConfigVO2.Background_image;
- // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
- this.ConfigVO.Jump_field_flag = ConfigVO2.Jump_field_flag;
- // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- this.ConfigVO.Test_run_flag = ConfigVO2.Test_run_flag;
- // cyim 2014.8.11 화면에 마스터인지 슬레이브인지 표시
- this.ConfigVO.Master_flag = ConfigVO2.Master_flag;
- //이미 축적일경우에는 RESET하지 않는다.
- if (this.ConfigVO.Fire_accumulation_start == false)
- {
- this.ConfigVO.Fire_accumulation_reset();
- this.Display_AccumulSecond();
- }
- this.Display_FireMode(this.ConfigVO.Fire_process_mode);
- //건물명표시
- LblBuildingName.Text = this.ConfigVO.Building_name;
- // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- if (this.ConfigVO.Test_run_flag == "Y") label_TestRunFlag.Visible = true;
- else label_TestRunFlag.Visible = false;
- //건물이미지
- if (this.ConfigVO.Background_image != null)
- {
- try
- {
- Image img = new Bitmap(this.ConfigVO.Background_image);//Image.FromStream(ms);
- this.BackgroundImage = img;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- }
- }
- //
- // DB 에서 보드, 중계기, 디바이스 정보를 가져온다
- //
- // 보드
- DataTable dtBoardList = null;
- public void GetBoardDB()
- {
- DacBoardConfig dacBoardConfig = new DacBoardConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- this.dtBoardList = dacBoardConfig.SelectBoard(this.myReceiverID);
- }
- // 중계기
- DataTable dtRepeaterList2 = null;
- public void GetRepeaterDB()
- {
- DacRepeaterConfig dacRepeaterConfig = new DacRepeaterConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- this.dtRepeaterList2 = dacRepeaterConfig.SelectRepeater2(this.myReceiverID);
- }
- // 아날로그감지기 레벨
- DataTable dtAnalogDetecterLevel = null;
- public void GetAnalogDetecterLevelDB()
- {
- DacRepeaterConfig dacRepeaterConfig = new DacRepeaterConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- this.dtAnalogDetecterLevel = dacRepeaterConfig.SelectRepeater_AnalogDetecterLevel(this.myReceiverID);
- }
- // 디바이스
- DataTable dtDeviceDBList2 = null;
- public void GetDeviceDB()
- {
- DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- this.dtDeviceDBList2 = dacDeviceConfig.SelectDevice2(this.myReceiverID);
- }
- // cyim 2015.7.1 속도개선작업
- // 데이타베이스 파일을 미리 읽도록 하되, DataTable 에 한해서 Foreach -> Select 으로 대체
- // DataTable 에서 정보를 가져온다
- // 중계기 이름을 얻어온다.
- public string GetDeviceName(int BOARD_ID, int LOOP_NO, int REPEATER_ID)
- {
- string ret = "";
- if (this.dtRepeaterList2 != null)
- {
- // cyim 2015.7.1 속도개선작업
- DataRow[] result = this.dtRepeaterList2.Select(
- string.Format("BOARD_ID={0} AND LOOP_NO={1} AND REPEATER_ID={2}", BOARD_ID, LOOP_NO, REPEATER_ID));
- if (result != null && result.Length > 0)
- ret = result[0]["REPEATER_NAME"].ToString();
- //foreach (DataRow dr in this.dtRepeaterList2.Rows)
- //{
- // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["LOOP_NO"].ToString() == LOOP_NO.ToString()
- // && dr["REPEATER_ID"].ToString() == REPEATER_ID.ToString())
- // {
- // ret = dr["REPEATER_NAME"].ToString();
- // break;
- // }
- //}
- }
- return ret;
- }
- // 보드명을 가져온다
- public string GetDeviceName(int BOARD_ID, int CommID)
- {
- string ret = "";
- if (this.dtBoardList != null)
- {
- // cyim 2015.7.1 속도개선작업
- DataRow[] result = this.dtBoardList.Select(
- string.Format("BOARD_ID={0} AND COMM_ID={1}", BOARD_ID, CommID));
- if (result != null && result.Length > 0)
- ret = result[0]["BOARD_NAME"].ToString();
- //foreach (DataRow dr in this.dtBoardList.Rows)
- //{
- // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["COMM_ID"].ToString() == CommID.ToString())
- // {
- // ret = dr["BOARD_NAME"].ToString();
- // break;
- // }
- //}
- }
- return ret;
- }
- // 회로명을 가져온다
- public string GetDeviceName(int BOARD_ID, int LOOP_NO, int REPEATER_ID, int DEVICE_ID, String INOUT_TYPE)
- {
- string ret = "";
- if (this.dtDeviceDBList2 != null)
- {
- // cyim 2015.7.1 속도개선작업
- DataRow[] result = this.dtDeviceDBList2.Select(
- 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 타입의 경우 ' ' 작은따옴표를 사용해야함, 이벤트로그가 안보이게됨
- BOARD_ID, 1, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE));
- if (result != null && result.Length > 0)
- ret = result[0]["DEVICE_NAME"].ToString();
- //foreach (DataRow dr in this.dtDeviceDBList2.Rows)
- //{
- // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["LOOP_NO"].ToString() == LOOP_NO.ToString()
- // && dr["REPEATER_ID"].ToString() == REPEATER_ID.ToString() && dr["DEVICE_ID"].ToString() == DEVICE_ID.ToString()
- // && dr["INOUT_TYPE"].ToString() == INOUT_TYPE.ToString() && dr["COMM_ID"].ToString() == "1")
- // {
- // ret = dr["DEVICE_NAME"].ToString();
- // break;
- // }
- //}
- }
- return ret;
- }
- // 조건에 맞는 중계기의 위치명 / 위치 코드 / 중계기 명칭을 리턴한다.
- public string GetDevicePositionName(int BOARD_ID, int LOOP_NO, int REPEATER_ID)
- {
- string ret = "";
- if (this.dtRepeaterList2 != null)
- {
- // cyim 2015.7.1 속도개선작업
- DataRow[] result = this.dtRepeaterList2.Select(
- string.Format("BOARD_ID={0} AND LOOP_NO={2} AND REPEATER_ID={3}",
- BOARD_ID, 1, LOOP_NO, REPEATER_ID));
- if (result != null && result.Length > 0)
- {
- // 만약 위치 명이 있으면, 위치명으로 리턴한다.
- if (result[0]["POSITION_NAME"].ToString() != "")
- ret = result[0]["POSITION_NAME"].ToString();
- // 위치명이 없고.. 위치 코드가 있으면, 위치 코드를 리턴하도록 한다.
- else if (result[0]["POSITION_CODE"].ToString() != "")
- ret = result[0]["POSITION_CODE"].ToString();
- // 기본값 RepeaterName을 리턴할 준비를 한다.
- else
- ret = result[0]["REPEATER_NAME"].ToString();
- }
- //foreach (DataRow dr in this.dtRepeaterList2.Rows)
- //{
- // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["LOOP_NO"].ToString() == LOOP_NO.ToString()
- // && dr["REPEATER_ID"].ToString() == REPEATER_ID.ToString())
- // {
- // // 조건에 맞으면 일단 RepeaterName을 리턴할 준비를 한다.
- // ret = dr["REPEATER_NAME"].ToString();
- // // 만약 위치 명이 있으면, 위치명으로 리턴한다.
- // if (dr["POSITION_NAME"].ToString() != "")
- // {
- // ret = dr["POSITION_NAME"].ToString();
- // break;
- // }
- // // 위치명이 없고.. 위치 코드가 있으면, 위치 코드를 리턴하도록 한다.
- // if (dr["POSITION_CODE"].ToString() != "")
- // {
- // ret = dr["POSITION_CODE"].ToString();
- // }
- // break;
- // }
- //}
- }
- return ret;
- }
- // 디바이스 위치를 리턴한다. 만약 맞는 위치명이 없으면.. 위치 코드라도 리턴한다.
- public string GetDevicePositionName(int BOARD_ID, int LOOP_NO, int REPEATER_ID, int DEVICE_ID, String INOUT_TYPE)
- {
- string ret = "";
- if (this.dtDeviceDBList2 != null)
- {
- // cyim 2015.7.1 속도개선작업
- 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 타입의 경우 ' ' 작은따옴표를 사용해야함, 이벤트로그가 안보이게됨
- BOARD_ID, 1, LOOP_NO, REPEATER_ID, DEVICE_ID, INOUT_TYPE);
- DataRow[] result = this.dtDeviceDBList2.Select(SQL);
- if (result != null && result.Length > 0)
- {
- // 만약 위치 명이 있으면, 위치명으로 리턴한다.
- if (result[0]["POSITION_NAME"].ToString() != "")
- ret = result[0]["POSITION_NAME"].ToString();
- // 위치명이 없고.. 위치 코드가 있으면, 위치 코드를 리턴하도록 한다.
- else if (result[0]["POSITION_CODE"].ToString() != "")
- ret = result[0]["POSITION_CODE"].ToString();
- // 기본값 Device Name을 리턴할 준비를 한다.
- else
- ret = result[0]["DEVICE_NAME"].ToString();
- }
- //foreach (DataRow dr in this.dtDeviceDBList2.Rows)
- //{
- // if (dr["BOARD_ID"].ToString() == BOARD_ID.ToString() && dr["LOOP_NO"].ToString() == LOOP_NO.ToString()
- // && dr["REPEATER_ID"].ToString() == REPEATER_ID.ToString() && dr["DEVICE_ID"].ToString() == DEVICE_ID.ToString()
- // && dr["INOUT_TYPE"].ToString() == INOUT_TYPE.ToString() && dr["COMM_ID"].ToString() == "1")
- // {
- // ret = dr["DEVICE_NAME"].ToString(); // 일단.. DeviceName을 찜해둔다.
- // // 만약 위치 명이 있으면, 위치명으로 리턴한다.
- // if (dr["POSITION_NAME"].ToString() != "")
- // {
- // ret = dr["POSITION_NAME"].ToString();
- // break;
- // }
- // // 위치명이 없고.. 위치 코드가 있으면, 위치 코드를 리턴하도록 한다.
- // if (dr["POSITION_CODE"].ToString() != "")
- // {
- // if (dr["POSITION_CODE"].ToString() != "000000") // cyim 2014.8.18 위치정보 000000 제외
- // ret = dr["POSITION_CODE"].ToString();
- // }
- // break;
- // }
- //}
- }
- return ret;
- }
- // cyim 2015.7.1 속도개선작업
- // 해쉬테이블을 사용해서 아날로그 감지기를 미리 저장해두어야 한다
- // 아날로그감지기 아이디를 모두 가져온다 (아이디로 구성된 키를 가지고, 데이터는 레벨값 FAULT_VALUE;PREFIRE_VALUE;FIRED_VALUE;FIREN_VALUE)
- public Hashtable GetAnalogDetecterRepeaterID(int RECEIVER_ID, int BOARD_ID, int LOOP_NO)
- {
- Hashtable ret = new Hashtable();
- try
- {
- if (this.dtAnalogDetecterLevel != null)
- {
- DataRow[] result = this.dtAnalogDetecterLevel.Select(
- string.Format("RECEIVER_ID={0} AND BOARD_ID={1} AND LOOP_NO={2}", RECEIVER_ID, BOARD_ID, LOOP_NO));
- if (result.Length > 0)
- {
- foreach (DataRow Data in result)
- {
- string key = Data["REPEATER_ID"].ToString();
- AnalogLevel data = new AnalogLevel(
- Int32.Parse(Data["FAULT_VALUE"].ToString()),
- Int32.Parse(Data["PREFIRE_VALUE"].ToString()),
- Int32.Parse(Data["FIRED_VALUE"].ToString()),
- Int32.Parse(Data["FIREN_VALUE"].ToString()));
- ret.Add(key, data);
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return ret;
- }
- // cyim 2016.01.07 아날로그 감지기 이력 조회시 표시 수정 : 중계기 타입을 조회할수 있도록 한다
- public string GetRepeaterType(int BOARD_ID, int LOOP_NO, int REPEATER_ID)
- {
- string ret = "";
- if (this.dtRepeaterList2 != null)
- {
- // cyim 2015.7.1 속도개선작업
- DataRow[] result = this.dtRepeaterList2.Select(
- string.Format("BOARD_ID={0} AND LOOP_NO={2} AND REPEATER_ID={3}",
- BOARD_ID, 1, LOOP_NO, REPEATER_ID));
- if (result != null && result.Length > 0)
- {
- ret = result[0]["REPEATER_TYPE"].ToString();
- }
- }
- return ret;
- }
- //
- // 현재 이벤트 관리
- //
- // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // 이벤트 로그용 해쉬테이블 키 생성 함수
- public string Get_EventLog_Key(EventLogInfo log)
- {
- return string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}",
- log.ReceiverID, log.CommId, log.BoardNo, log.LoopNo, log.RepeaterNo, log.DeviceId, log.InoutType, log.EventType);
- }
- // 이벤트 발생시 리스트 추가
- public void EventLogAdd(EventLogInfo log)
- {
- try
- {
- // cyim 2015.7.6 속도개선작업
- // 해쉬 리스트 구현 방법은 아래와 같다
- // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
- // 데이타 : EventLogInfo 클래스
- // 해쉬테이블 키 추출
- string[] tmp_keys = new string[this.arrayListLog.Keys.Count];
- this.arrayListLog.Keys.CopyTo(tmp_keys, 0);
- // 현재내역에 필요없는 메세지는 삭제한다.
- if (tmp_keys != null && tmp_keys.Length != 0)
- {
- for (int i = tmp_keys.Length - 1; i >= 0; i--)
- {
- EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[tmp_keys[i]];
- if (!eventLogMsg.LiveMsgFlag)
- {
- if (this.arrayListLog.ContainsKey(tmp_keys[i]) == true)
- {
- this.arrayListLog.Remove(tmp_keys[i]);
- }
- }
- eventLogMsg = null;
- }
- }
- //해당 이벤트가 이미 있다면 넣지 않는다.
- if (log.LiveMsgFlag)
- if (this.arrayListLog.ContainsKey(Get_EventLog_Key(log)) == false) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- this.arrayListLog.Add(Get_EventLog_Key(log), log);
- //
- // 아래는 원본
- //
- // 현재내역에 필요없는 메세지는 삭제한다
- //for (int i = this.arrayListLog.Count - 1; i >= 0; i--)
- //{
- // EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[i];
- // if (!eventLogMsg.LiveMsgFlag)
- // {
- // this.arrayListLog.Remove(i);
- // eventLogMsg = null;
- // }
- //}
- ////해당 이벤트가 이미 있다면 넣지 않는다.
- //if (log.LiveMsgFlag)
- //{
- // bool res_existYes = false;
- // for (int i = 0; i < this.arrayListLog.Count; i++)
- // {
- // EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[i];
- // if ((eventLogMsg.ReceiverID == log.ReceiverID) && (eventLogMsg.CommId == log.CommId) &&
- // (eventLogMsg.BoardNo == log.BoardNo) && (eventLogMsg.LoopNo == log.LoopNo) &&
- // (eventLogMsg.RepeaterNo == log.RepeaterNo) && (eventLogMsg.DeviceId == log.DeviceId) &&
- // (eventLogMsg.InoutType == log.InoutType) && (eventLogMsg.EventType == log.EventType))
- // {
- // res_existYes = true;
- // break;
- // }
- // }
- // if (!res_existYes)
- // this.arrayListLog.Add(log);
- //}
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- finally
- {
- // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
- CheckBtn_Current_Status = BtnCheck_Info_Get();
- }
- // cyim 2013.7.18 속도개선작업 : UI 갱신이 너무 많음
- // 현재 500 msec 마다 UI 를 셋팅하게 되어있다. 문제는 여기에 서로 Invoke 를 호출하게 되어 오히려 속도가 저하되버리게 되는 결과가 나옵니다
- // 시스템 구조상 통신으로 받은 데이타를 처리하는것이 invoke 로 crossthread 를 벗어나려고 하였는데 여기에서 점유율이 높아집니다
- //FireFacilityEventCheck();
- }
- // 검색자
- private string Search = null;
- // 이벤트 타입을 제외한 이벤트 조회
- private bool CurrentEvent_ExceptType(string keys)
- {
- string Compare = keys.Substring(0, keys.Length - 2);
- if (Search == Compare)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- // 이벤트 발생시 리스트 삭제
- public void EventLogDel(EventLogInfo log)
- {
- try
- {
- // cyim 2015.7.6 속도개선작업
- // 해쉬 리스트 구현 방법은 아래와 같다
- // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
- // 데이타 : EventLogInfo 클래스
- if (this.arrayListLog == null || this.arrayListLog.Count == 0)
- return;
- // 삭제 컨셉은 코드 분석 결과, 현재 이벤트 타입과 과거 이벤트 타입을 검색해보고
- // 정상-이상이 짝이 맞으면 삭제하도록 되어있다.
- // 키리스트정보 끝에는 이벤트 정보가 있다. 결국 이벤트 타입만 추려내서 최소한의 루틴으로 돌린다.
- // 삭제하려는 이벤트의 타입
- string res_eventType = log.EventType;
- // 현재 이벤트
- string eventType = "";
- // 모든 키리스트를 추출한다
- string[] tmp_keys = new string[arrayListLog.Keys.Count];
- this.arrayListLog.Keys.CopyTo(tmp_keys, 0);
- // 검색자에 삭제하려는 이벤트 타입만 제거
- string key = Get_EventLog_Key(log); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- Search = key.Substring(0, key.Length - 2);
- // 현재 이벤트중에 정보가 있다
- string[] Search_Keys = Array.FindAll(tmp_keys, CurrentEvent_ExceptType);
- // 일치하는 현재 이벤트를 찾았다면
- if (Search_Keys != null && Search_Keys.Length != 0)
- {
- foreach (string Search_Key in Search_Keys)
- {
- EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[Search_Key];
- // 이벤트 타입을 제외하고 일치하는 현재 이벤트가 있다
- eventType = eventLogMsg.EventType;
- // 비교 결과
- bool eventTypeBoth = false;
- //OM-통신모듈 통신정상-LOOP 통신정상,XM-통신모듈 통신이상-LOOP 통신이상
- if ((res_eventType.Equals("OM") || res_eventType.Equals("XM")) && (eventType.Equals("OM") || eventType.Equals("XM")))
- eventTypeBoth = true;
- //OR-중계기 통신정상,XR-중계기 통신이상
- else if ((res_eventType.Equals("OR") || res_eventType.Equals("XR")) && (eventType.Equals("OR") || eventType.Equals("XR")))
- eventTypeBoth = true;
- //OI-I/O 모듈 통신정상,XI-I/O 모듈 통신이상
- else if ((res_eventType.Equals("OI") || res_eventType.Equals("XI")) && (eventType.Equals("OI") || eventType.Equals("XI")))
- eventTypeBoth = true;
- //OK-키패드모듈 통신정상,XK-키패드모듈 통신이상
- else if ((res_eventType.Equals("OK") || res_eventType.Equals("XK")) && (eventType.Equals("OK") || eventType.Equals("XK")))
- eventTypeBoth = true;
- //OL-중계기 단선발생,XL-중계기 단선복구
- else if ((res_eventType.Equals("OL") || res_eventType.Equals("XL")) && (eventType.Equals("OL") || eventType.Equals("XL")))
- eventTypeBoth = true;
- //OA-화재축적상태 발생,XA-화재축적상태 해제
- else if ((res_eventType.Equals("OA") || res_eventType.Equals("XA")) && (eventType.Equals("OA") || eventType.Equals("XA")))
- eventTypeBoth = true;
- //OF-화재상태 발생,XF-화재상태 해제
- else if ((res_eventType.Equals("OF") || res_eventType.Equals("XF")) && (eventType.Equals("OF") || eventType.Equals("XF")))
- eventTypeBoth = true;
- //OE-설비작동상태 발생,XE-설비작동상태 해제
- else if ((res_eventType.Equals("OE") || res_eventType.Equals("XE")) && (eventType.Equals("OE") || eventType.Equals("XE")))
- eventTypeBoth = true;
- //AV-출력전압 이상,NV-출력전압 정상
- else if ((res_eventType.Equals("AV") || res_eventType.Equals("NV")) && (eventType.Equals("AV") || eventType.Equals("NV")))
- eventTypeBoth = true;
- //AR-예비전원 이상,NR-예비전원 정상
- else if ((res_eventType.Equals("AR") || res_eventType.Equals("NR")) && (eventType.Equals("AR") || eventType.Equals("NR")))
- eventTypeBoth = true;
- //AA-교류전원 이상,NA-교류전원 정상
- else if ((res_eventType.Equals("AA") || res_eventType.Equals("NA")) && (eventType.Equals("AA") || eventType.Equals("NA")))
- eventTypeBoth = true;
- //OP-전화설정,XP-전화해제
- else if ((res_eventType.Equals("OP") || res_eventType.Equals("XP")) && (eventType.Equals("OP") || eventType.Equals("XP")))
- eventTypeBoth = true;
- //OT-발신기설정,XT-발신기해제
- else if ((res_eventType.Equals("OT") || res_eventType.Equals("XT")) && (eventType.Equals("OT") || eventType.Equals("XT")))
- eventTypeBoth = true;
- //PO-통신(POLLING) 시작,PF-통신(POLLING) 종료
- else if ((res_eventType.Equals("PO") || res_eventType.Equals("PF")) && (eventType.Equals("PO") || eventType.Equals("PF")))
- eventTypeBoth = true;
- //OD-데몬연결이상,XD-데몬연결정상
- else if ((res_eventType.Equals("OD") || res_eventType.Equals("XD")) && (eventType.Equals("OD") || eventType.Equals("XD")))
- eventTypeBoth = true;
- //OU-UI프로그램시작,XU-UI프로그램종료
- else if ((res_eventType.Equals("OU") || res_eventType.Equals("XU")) && (eventType.Equals("OU") || eventType.Equals("XU")))
- eventTypeBoth = true;
- //OX-중계기전원이상발생,XX-중계기전원이상해제
- else if ((res_eventType.Equals("OX") || res_eventType.Equals("XX")) && (eventType.Equals("OX") || eventType.Equals("XX")))
- eventTypeBoth = true;
- // BA-통신보드루프교류전원이상, BR-통신보드루프예비전원이상, BN-통신보드루프정상
- else if ((res_eventType.Equals("BA") || res_eventType.Equals("BR") || res_eventType.Equals("BN"))
- && (eventType.Equals("BA") || eventType.Equals("BR") || eventType.Equals("BN")))
- eventTypeBoth = true;
- // cyim 2013.12.31 : 비상방송 현재이력에 남아있는 문제
- //XC-비상방송 이상,OC-비상방송 정상
- else if ((res_eventType.Equals("XC") || res_eventType.Equals("OC")) && (eventType.Equals("XC") || eventType.Equals("OC")))
- eventTypeBoth = true;
- // cyim 2015.7.9 아날로그 감지기 단선 상태가 리스트에 표시되지 않는 문제
- else if ((res_eventType.Equals("FA") || res_eventType.Equals("FN")) && (eventType.Equals("FA") || eventType.Equals("FN")))
- eventTypeBoth = true;
- // cyim 2015.7.9 PreFire 표시 문제
- else if ((res_eventType.Equals("WA") || res_eventType.Equals("WN")) && (eventType.Equals("WA") || eventType.Equals("WN")))
- eventTypeBoth = true;
- // 이벤트를 삭제한다
- if (eventTypeBoth == true)
- this.arrayListLog.Remove(Search_Key);
- }
- }
- //
- // 아래는 원본
- //
- //string res_eventType = log.EventType;
- //if (this.arrayListLog != null)
- //{
- // //int eventLogCnt = this.arrayListLog.Count;
- // for (int i = this.arrayListLog.Count - 1; i > -1; i--)
- // {
- // if (this.arrayListLog.Count < 1)
- // break;
- // EventLogInfo eventLogMsg = (EventLogInfo)this.arrayListLog[i];
- // string eventType = eventLogMsg.EventType;
- // if ((eventLogMsg.ReceiverID == log.ReceiverID) && (eventLogMsg.CommId == log.CommId) &&
- // (eventLogMsg.BoardNo == log.BoardNo) && (eventLogMsg.LoopNo == log.LoopNo) &&
- // (eventLogMsg.RepeaterNo == log.RepeaterNo) && (eventLogMsg.DeviceId == log.DeviceId) &&
- // (eventLogMsg.InoutType == log.InoutType))
- // {
- // bool eventTypeBoth = false;
- // //OM-통신모듈 통신정상-LOOP 통신정상,XM-통신모듈 통신이상-LOOP 통신이상
- // if ((res_eventType.Equals("OM") || res_eventType.Equals("XM")) && (eventType.Equals("OM") || eventType.Equals("XM")))
- // eventTypeBoth = true;
- // //OR-중계기 통신정상,XR-중계기 통신이상
- // if ((res_eventType.Equals("OR") || res_eventType.Equals("XR")) && (eventType.Equals("OR") || eventType.Equals("XR")))
- // eventTypeBoth = true;
- // //OI-I/O 모듈 통신정상,XI-I/O 모듈 통신이상
- // if ((res_eventType.Equals("OI") || res_eventType.Equals("XI")) && (eventType.Equals("OI") || eventType.Equals("XI")))
- // eventTypeBoth = true;
- // //OK-키패드모듈 통신정상,XK-키패드모듈 통신이상
- // if ((res_eventType.Equals("OK") || res_eventType.Equals("XK")) && (eventType.Equals("OK") || eventType.Equals("XK")))
- // eventTypeBoth = true;
- // //OL-중계기 단선발생,XL-중계기 단선복구
- // if ((res_eventType.Equals("OL") || res_eventType.Equals("XL")) && (eventType.Equals("OL") || eventType.Equals("XL")))
- // eventTypeBoth = true;
- // //OA-화재축적상태 발생,XA-화재축적상태 해제
- // if ((res_eventType.Equals("OA") || res_eventType.Equals("XA")) && (eventType.Equals("OA") || eventType.Equals("XA")))
- // eventTypeBoth = true;
- // //OF-화재상태 발생,XF-화재상태 해제
- // if ((res_eventType.Equals("OF") || res_eventType.Equals("XF")) && (eventType.Equals("OF") || eventType.Equals("XF")))
- // eventTypeBoth = true;
- // //OE-설비작동상태 발생,XE-설비작동상태 해제
- // if ((res_eventType.Equals("OE") || res_eventType.Equals("XE")) && (eventType.Equals("OE") || eventType.Equals("XE")))
- // eventTypeBoth = true;
- // //AV-출력전압 이상,NV-출력전압 정상
- // if ((res_eventType.Equals("AV") || res_eventType.Equals("NV")) && (eventType.Equals("AV") || eventType.Equals("NV")))
- // eventTypeBoth = true;
- // //AR-예비전원 이상,NR-예비전원 정상
- // if ((res_eventType.Equals("AR") || res_eventType.Equals("NR")) && (eventType.Equals("AR") || eventType.Equals("NR")))
- // eventTypeBoth = true;
- // //AA-교류전원 이상,NA-교류전원 정상
- // if ((res_eventType.Equals("AA") || res_eventType.Equals("NA")) && (eventType.Equals("AA") || eventType.Equals("NA")))
- // eventTypeBoth = true;
- // //OP-전화설정,XP-전화해제
- // if ((res_eventType.Equals("OP") || res_eventType.Equals("XP")) && (eventType.Equals("OP") || eventType.Equals("XP")))
- // eventTypeBoth = true;
- // //OT-발신기설정,XT-발신기해제
- // if ((res_eventType.Equals("OT") || res_eventType.Equals("XT")) && (eventType.Equals("OT") || eventType.Equals("XT")))
- // eventTypeBoth = true;
- // //PO-통신(POLLING) 시작,PF-통신(POLLING) 종료
- // if ((res_eventType.Equals("PO") || res_eventType.Equals("PF")) && (eventType.Equals("PO") || eventType.Equals("PF")))
- // eventTypeBoth = true;
- // //OD-데몬연결이상,XD-데몬연결정상
- // if ((res_eventType.Equals("OD") || res_eventType.Equals("XD")) && (eventType.Equals("OD") || eventType.Equals("XD")))
- // eventTypeBoth = true;
- // //OU-UI프로그램시작,XU-UI프로그램종료
- // if ((res_eventType.Equals("OU") || res_eventType.Equals("XU")) && (eventType.Equals("OU") || eventType.Equals("XU")))
- // eventTypeBoth = true;
- // //OX-중계기전원이상발생,XX-중계기전원이상해제
- // if ((res_eventType.Equals("OX") || res_eventType.Equals("XX")) && (eventType.Equals("OX") || eventType.Equals("XX")))
- // eventTypeBoth = true;
- // // BA-통신보드루프교류전원이상, BR-통신보드루프예비전원이상, BN-통신보드루프정상
- // if ((res_eventType.Equals("BA") || res_eventType.Equals("BR") || res_eventType.Equals("BN")) && (eventType.Equals("BA") || eventType.Equals("BR") || eventType.Equals("BN")))
- // eventTypeBoth = true;
- // // cyim 2013.12.31 : 비상방송 현재이력에 남아있는 문제
- // //XC-비상방송 이상,OC-비상방송 정상
- // if ((res_eventType.Equals("XC") || res_eventType.Equals("OC")) && (eventType.Equals("XC") || eventType.Equals("OC")))
- // eventTypeBoth = true;
- // if (eventTypeBoth ||
- // ((eventLogMsg.ReceiverID == log.ReceiverID) && (eventLogMsg.CommId == log.CommId) &&
- // (eventLogMsg.BoardNo == log.BoardNo) && (eventLogMsg.LoopNo == log.LoopNo) &&
- // (eventLogMsg.RepeaterNo == log.RepeaterNo) && (eventLogMsg.DeviceId == log.DeviceId) &&
- // (eventLogMsg.InoutType == log.InoutType) && (eventLogMsg.EventType == log.EventType)))
- // {
- // if (eventLogMsg.LiveMsgFlag)
- // {
- // eventLogMsg.LiveMsgFlag = false;
- // // cyim 2015.7.6 속도개선작업
- // // 해쉬 리스트 구현 방법은 아래와 같다
- // // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
- // // 데이타 : EventLogInfo 클래스
- // //this.arrayListLog.RemoveAt(i); // 삭제
- // this.arrayListLog.Remove(_Data.Get_EventLog_Key(eventLogMsg));
- // }
- // }
- // }
- // }
- //}
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- finally
- {
- // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
- CheckBtn_Current_Status = BtnCheck_Info_Get();
- }
- // cyim 2013.7.18 속도개선작업 : UI 갱신이 너무 많음
- // 현재 500 msec 마다 UI 를 셋팅하게 되어있다. 문제는 여기에 서로 Invoke 를 호출하게 되어 오히려 속도가 저하되버리게 되는 결과가 나옵니다
- // 시스템 구조상 통신으로 받은 데이타를 처리하는것이 invoke 로 crossthread 를 벗어나려고 하였는데 여기에서 점유율이 높아집니다
- //FireFacilityEventCheck();
- }
- // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
- public bool BtnCheck_Info_Get()
- {
- try
- {
- // 이벤트가 없다면 false , 즉 점검카운터 내용이 없다고 표시하면 된다
- if (this.arrayListLog.Count < 1)
- return false;
- // cyim 2015.7.6 속도개선작업
- // 해쉬 리스트 구현 방법은 아래와 같다
- // 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
- // 데이타 : EventLogInfo 클래스
- // 해쉬리스트를 Full Scan 할 수 밖에 없다. 속도 개선작업에 따라 해쉬테이블에 접근하는 루틴을 적용한다
- // cyim 2017.01.04 : 점검출력이 안되는 문제 수정
- Hashtable arrayListLog_temp = (Hashtable)arrayListLog.Clone();
- foreach (DictionaryEntry d in arrayListLog_temp)
- {
- bool Temp = false;
- EventLogInfo eventLogMsg = (EventLogInfo)d.Value;
- // 내용 존재 여부 (점검에 표시되는 항목은 아래와 같다)
- switch (eventLogMsg.EventType)
- {
- case "XM"://통신모듈 통신이상
- case "XI"://I/O 모듈 통신이상
- case "XK"://키패드모듈 통신이상
- case "AV"://출력전압 이상
- case "AR"://예비전원 이상
- case "AA"://교류전원 이상
- case "OD"://데몬연결이상
- case "OB"://DB연결이상
- case "BA"://통신보드루프교류전원이상
- case "BR"://통신보드루프예비전원이상
- case "XC"://비상방송 통신이상
- Temp = true;
- break;
- case "":
- ;
- break;
- }
- // 내용이 있다면
- if (Temp == true)
- return true;
- }
- // 내용이 없다면
- return false;
- }
- catch
- {
- return false;
- }
- }
- // 이전폼제거 후 Child Form 생성
- public Form ShowChildForm(Form chForm)
- {
- Boolean IsNewForm = true;
- try
- {
- foreach (Form childForm in MdiChildren)
- {
- if (childForm.Name == chForm.Name)
- {
- chForm = childForm;
- childForm.Select();
- IsNewForm = false;
- }
- else if (childForm is frmWarningBox)
- {
- }
- else
- {
- // 각해당폼에는 많은 리소스 및 스레드가 돌리므로 시작 및 종료하기까지는 시간이 걸림
- // cyim 2013.8.1 : 화면전환시 잔상이 남아서 UI 깨짐 현상 문제 수정
- childForm.Hide();
- childForm.Close();
- }
- }
- if (IsNewForm)
- {
- //CloseFormAll();
- Size sz = new Size(1078, 824);
- // 이 인스턴스를 표시하기 전에 MDI 폼의 자식으로 만듭니다.
- chForm.MdiParent = this;
- chForm.Text = "";
- //DirText("시작 > 테스트화면" + childFormNumber++);
- chForm.Size = sz;
- chForm.Show();
- if (this.winMsg != null)
- {
- //this.warningForm.Select();
- //this.warningForm2.Select();
- //this.warningForm.Owner = chForm;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return chForm;
- }
- // Child 폼제거 후 프로그램 종료
- private void ApplicationExit()
- {
- try
- {
- if (MdiChildren.Length > 0)
- MdiChildren[MdiChildren.Length - 1].Close();
- //경고화면창 닫기
- if (this.warningForm != null)
- this.warningForm.Close();
- //경고화면창 닫기
- if (this.warningForm2 != null)
- this.warningForm2.Close();
- //로그인창닫기
- if (this.loginForm != null)
- this.loginForm.Close();
- //잠시만 기다리는 창 화면 닫기
- if (this.waittingForm != null)
- this.waittingForm.Close();
- Application.Exit();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // Child 폼제거
- private void CloseFormAll()
- {
- try
- {
- foreach (Form childForm in MdiChildren)
- {
- if (childForm is frmWarningBox)
- {
- }
- else
- {
- childForm.Close();
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void MessageProcess(EventLogInfo eventLog)
- {
- try
- {
- if (eventLog.EventStatus != MappingStatus.Normal)
- {
- if (eventLog.EventStatus == MappingStatus.FaultOn ||
- eventLog.EventStatus == MappingStatus.FaultOff
- )
- {
- //ShowMessageForm2(eventLog.EventStatus, eventLog.Message, eventLog.DeviceMessage);
- }
- else
- {
- //ShowMessageForm(eventLog.EventStatus, eventLog.Message, eventLog.DeviceMessage);
- }
- }
- foreach (Form childForm in MdiChildren)
- {
- if (childForm is FormLogView)
- {
- FormLogView frm = (FormLogView)childForm;
- //frm.DataLoadProcess();
- if (frm.Live == true)
- {
- frm.UpdateData();
- //frm.InitFormLogView(true);
- //frm.SetSearchCondition("ALL");
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //로그인화면창
- public void ShowLogin(Form nextForm)
- {
- try
- {
- if (this.InvokeRequired)
- {
- ShowFormLogin d = new ShowFormLogin(ShowLogin);
- this.Invoke(d, new object[] { nextForm });
- }
- else
- {
- if (this.winLogin == null)
- {
- this.loginForm = new frmLogin();
- this.loginForm.TopMost = true;
- this.loginForm.Text = "관리자로그인";
- Point loc = new Point((1280 - this.loginForm.Size.Width) / 2
- + this.Location.X, (1024 - this.loginForm.Size.Height) / 2 + this.Location.Y);
- this.loginForm.Location = loc;
- this.loginForm.setParent(this);
- this.loginForm.SetShowForm(nextForm);
- this.winLogin = this.loginForm;
- //this.loginForm.Show(this.window);
- this.loginForm.ShowDialog(this.window);
- }
- else
- {
- this.loginForm.ShowDialog(this.window);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //로그인 창이 닫히면 호출한다..
- public void CloseLoginForm()
- {
- try
- {
- this.winLogin = null;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //화재발생.. 설비작동 메세지 창을 띄운다..
- public void ShowMessageForm(MappingStatus ErrStatus, string message, string deviceMessage)
- {
- try
- {
- if (this.InvokeRequired)
- {
- ShowFormCallback d = new ShowFormCallback(ShowMessageForm);
- this.Invoke(d, new object[] { ErrStatus, message, deviceMessage });
- }
- else
- {
- if (this.warningForm == null || this.winMsg == null)
- {
- //this.warningForm = new frmWarningBox();
- //this.warningForm.TopMost = true;
- //this.warningForm.Text = "경고!";
- //Point loc = new Point((1280 - this.warningForm.Size.Width) / 2
- // + this.Location.X, (1024 - this.warningForm.Size.Height) / 2 + this.Location.Y);
- //this.warningForm.Location = loc;
- //this.warningForm.setParent(this);
- //this.warningForm.setMessage(ErrStatus, message, deviceMessage);
- //this.winMsg = this.warningForm;
- ////this.warningForm.Show(this.window);
- //this.warningForm.ShowDialog(this.window);
- this.warningForm = new frmWarningBox();
- this.warningForm.MdiParent = this;
- this.warningForm.Text = "";//2010.11.11,k.s.d, call alram window , display 경고 bug fix.
- //Point loc = new Point((1280 - this.warningForm.Size.Width) / 2
- // + this.Location.X, (1024 - this.warningForm.Size.Height) / 2 + this.Location.Y);
- Point loc = new Point((1078 - this.warningForm.Size.Width) / 2, (900 - this.warningForm.Size.Height) / 2);
- this.warningForm.Location = loc;
- this.warningForm.setParent(this);
- this.warningForm.setMessage(ErrStatus, message, deviceMessage);
- this.warningForm.TopMost = true;
- this.winMsg = this.warningForm;
- this.warningForm.Show();
- }
- else
- {
- this.warningForm.setMessage(ErrStatus, message, deviceMessage);
- if (this.warningForm.Visible == false)
- {
- Point loc = new Point((1078 - this.warningForm.Size.Width) / 2, (900 - this.warningForm.Size.Height) / 2);
- this.warningForm.Location = loc;
- this.warningForm.Show();
- }
- this.warningForm.Activate(); //k.s.d 20101023, warning message window active.
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //화재발생.. 설비작동 메세지 창을 띄운다..
- public void ShowMessageForm2(MappingStatus ErrStatus, string message, string deviceMessage)
- {
- try
- {
- if (this.InvokeRequired)
- {
- ShowFormCallback d = new ShowFormCallback(ShowMessageForm2);
- this.Invoke(d, new object[] { ErrStatus, message, deviceMessage });
- }
- else
- {
- if (this.warningForm2 == null || this.winMsg == null)
- {
- this.warningForm2 = new frmWarningBox();
- this.warningForm2.MdiParent = this;
- this.warningForm2.faultmode = true;
- this.warningForm2.Text = "";//2010.11.11,k.s.d, call alram window , display 경고 bug fix.
- //Point loc = new Point((1280 - this.warningForm.Size.Width) / 2
- // + this.Location.X, (1024 - this.warningForm.Size.Height) / 2 + this.Location.Y);
- Point loc = new Point((1078 - this.warningForm2.Size.Width) / 2, (400 - this.warningForm2.Size.Height) / 2);
- this.warningForm2.Location = loc;
- this.warningForm2.setParent(this);
- this.warningForm2.setMessage(ErrStatus, message, deviceMessage);
- this.warningForm2.TopMost = true;
- this.winMsg = this.warningForm2;
- this.warningForm2.Show();
- }
- else
- {
- this.warningForm2.setMessage(ErrStatus, message, deviceMessage);
- if (this.warningForm2.Visible == false)
- {
- Point loc = new Point((1078 - this.warningForm2.Size.Width) / 2, (400 - this.warningForm2.Size.Height) / 2);
- this.warningForm2.Location = loc;
- this.warningForm2.Show();
- }
- this.warningForm2.Activate(); //k.s.d 20101023, warning message window active.
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- // 통신데몬초기화 시작시 실행
- public void CloseMessageForm3()
- {
- try
- {
- if (this.InvokeRequired)
- {
- SetVoidCallback d = new SetVoidCallback(CloseMessageForm3);
- this.Invoke(d);
- }
- if (this.warningForm3 != null)
- {
- this.warningForm3.Hide();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.19 수신기 데이타 처리중 팝업창 (수정사항없음 - 분석작업)
- //
- public void ShowMessageForm3(MappingStatus ErrStatus, string message, string deviceMessage)
- {
- try
- {
- if (this.InvokeRequired)
- {
- ShowFormCallback d = new ShowFormCallback(ShowMessageForm3);
- this.Invoke(d, new object[] { ErrStatus, message, deviceMessage });
- }
- else
- {
- if (this.warningForm3 == null || !this.warningForm3.Created)
- {
- this.warningForm3 = new frmWarningBox();
- this.warningForm3.MdiParent = this;
- this.warningForm3.Text = "";
- Point loc = new Point((1078 - this.warningForm3.Size.Width) / 2, (900 - this.warningForm3.Size.Height) / 4);
- this.warningForm3.Location = loc;
- this.warningForm3.setParent(this);
- this.warningForm3.setMessage2(ErrStatus, message, deviceMessage);
- this.warningForm3.TopMost = true;
- }
- else
- {
- this.warningForm3.setMessage2(ErrStatus, message, deviceMessage);
- if (this.warningForm3.Visible == false)
- {
- Point loc = new Point((1078 - this.warningForm3.Size.Width) / 2, (900 - this.warningForm3.Size.Height) / 3);
- this.warningForm3.Location = loc;
- }
- }
- this.warningForm3.Show();
- this.warningForm3.Activate(); //k.s.d 20101023, warning message window active.
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //화재발생.. 설비작동 메세지 창을 띄운다..
- public void ShowMCCMessageForm(MappingStatus ErrStatus, string message, string deviceMessage)
- {
- try
- {
- if (this.InvokeRequired)
- {
- ShowFormCallback d = new ShowFormCallback(ShowMCCMessageForm);
- this.Invoke(d, new object[] { ErrStatus, message, deviceMessage });
- }
- else
- {
- if (this.warningForm2 == null || this.winMsg == null)
- {
- this.warningForm2 = new frmWarningBox();
- this.warningForm2.MdiParent = this;
- this.warningForm2.faultmode = true;
- this.warningForm2.Text = "";//2010.11.11,k.s.d, call alram window , display 경고 bug fix.
- //Point loc = new Point((1280 - this.warningForm.Size.Width) / 2
- // + this.Location.X, (1024 - this.warningForm.Size.Height) / 2 + this.Location.Y);
- Point loc = new Point((1078 - this.warningForm2.Size.Width) / 2, (400 - this.warningForm2.Size.Height) / 2);
- this.warningForm2.Location = loc;
- this.warningForm2.setParent(this);
- this.warningForm2.setMCCMessage(ErrStatus, message, deviceMessage);
- this.warningForm2.TopMost = true;
- this.winMsg = this.warningForm2;
- this.warningForm2.Show();
- }
- else
- {
- this.warningForm2.setMCCMessage(ErrStatus, message, deviceMessage);
- if (this.warningForm2.Visible == false)
- {
- Point loc = new Point((1078 - this.warningForm2.Size.Width) / 2, (400 - this.warningForm2.Size.Height) / 2);
- this.warningForm2.Location = loc;
- this.warningForm2.Show();
- }
- this.warningForm2.Activate(); //k.s.d 20101023, warning message window active.
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //메세지 창이 닫히면 호출한다..
- public void CloseMessageForm()
- {
- try
- {
- this.winMsg = null;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //잠시만기다리십시요. 창을 띄운다.
- public void ShowWaittingMsgForm(string message, int processValue)
- {
- // cyim 2015.7.31 수신반 팝업창은 별도로 존재
- if (_Data.FireDeskMode == true)
- {
- Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "Popup", message, processValue); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- return;
- }
- if (this.InvokeRequired)
- {
- SetMsgCntCallback d = new SetMsgCntCallback(ShowWaittingMsgForm);
- this.Invoke(d, new object[] { message, processValue });
- }
- else
- {
- if (this.winWaittingMsg == null)
- {
- this.waittingForm = new frmWaitingMsg();
- this.waittingForm.Text = Application.ProductName;
- this.waittingForm.TopMost = true;
- Point loc = new Point((1280 - this.waittingForm.Size.Width) / 2
- + this.Location.X, (1024 - this.waittingForm.Size.Height) / 2 + this.Location.Y);
- this.waittingForm.Location = loc;
- this.waittingForm.Show(this.window);
- this.waittingForm.setParent(this);
- this.waittingForm.setMessage(message, processValue);
- this.winWaittingMsg = this.waittingForm;
- }
- else
- {
- this.waittingForm.setMessage(message, processValue);
- }
- }
- }
- //메세지 창이 닫히면 호출한다..
- public void CloseWaittingMsgForm()
- {
- try
- {
- this.winWaittingMsg = null;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //배터리 테스트(예비전원시작버튼 클릭시). 창을 띄운다.
- public void ShowBatteryTestForm(Boolean testStart)
- {
- try
- {
- if (this.InvokeRequired)
- {
- SetBoolCallback d = new SetBoolCallback(ShowBatteryTestForm);
- this.Invoke(d, new object[] { testStart });
- }
- else
- {
- // cyim 2013.8.21 키패드->예비전원테스트버튼 누르는 경우 화면 전환안되는 문제 수정
- // 키패드에서 입력받아서 실행하는 경우에는 테스트 시작 조건이 아니더라도 무조건 보이도록 수정한다
- // 단, 리소스가 해제된 경우에는 메모리를 할당하도록 한다
- if (winDriveTestForm == null || winDriveTestForm.IsDisposed == true)
- {
- winDriveTestForm = new frmDriveTest();
- }
- ShowChildForm(winDriveTestForm);
- if (testStart)
- {
- // testStart가 True이면.. (키패드에서 깜빡임.)
- // cyim 2013.8.21 키패드->예비전원테스트버튼 누르는 경우 화면 전환안되는 문제 수정 : 하단 주석처리
- //if (winDriveTestForm == null)
- //{
- // winDriveTestForm = new frmDriveTest();
- //}
- //ShowChildForm(winDriveTestForm);
- winDriveTestForm.DoBatteryTest2(testStart);
- }
- else
- {
- winDriveTestForm.DoBatteryTest2(testStart);// cyim 2015.3.31 예비전원 테스트 루틴 통일
- }
- //if (this.winBatteryTestMsg == null)
- //{
- // this.winBatteryTestForm = new frmBatteryTest();
- // this.winBatteryTestForm.Text = Application.ProductName;
- // this.winBatteryTestForm.TopMost = false;
- // Point loc = new Point((1280 - this.winBatteryTestForm.Size.Width) / 2
- // + this.Location.X, (1024 - this.winBatteryTestForm.Size.Height) / 2 + this.Location.Y);
- // this.winBatteryTestForm.Location = loc;
- // this.winBatteryTestForm.Show(this.window);
- // this.winBatteryTestForm.setParent(this);
- // this.winBatteryTestForm.BatteryTestStart(testStart);
- // this.winBatteryTestMsg = this.winBatteryTestForm;
- //}
- //else
- //{
- // this.winBatteryTestForm.BatteryTestStart(testStart);
- //}
- //if (this.winMsg != null)
- //{
- // this.warningForm.Select();
- // //this.warningForm.Owner = chForm;
- //}
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //초기화
- private void Init()
- {
- try
- {
- //
- // ----------------------- 1. 화면에 시간보여주는 타이머 기능 시작 -----------------------
- //
- timerDateTime_Tick(null, EventArgs.Empty);
- timerDateTime.Enabled = true;
- timerEventCheck.Enabled = true;
- //
- // ----------------------- 2. 레지스트리에서 수신기ID정보 읽어오기 -----------------------
- //
- // cyim 2015.7.29 수신반 루틴을 위해 외부 파라미터로 동작하도록 수정
- // 레지스트리 값 읽는 루틴을 전부 주석처리함
- //RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\I_FPER_COMM_DAEMON", false);
- //if (rk == null)
- // throw new Exception("레지스트리 읽기 실패!");
- //this.myReceiverID = Convert.ToInt16(rk.GetValue("RECEIVER_ID").ToString());
-
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[this.myReceiverID.ToString()];
- LFC.Log("FireDesk_Receiver: " + FireDesk_Receiver);
- LFC.Log("FireDeskMode: " + _Data.FireDeskMode);
- if (_Data.FireDeskMode == false) // 수신반이 아닐때는 레지스트리 값 이용
- {
- this.socketUI = new SocketUI(this, this.myReceiverID, lblDemonStatus, _Data.Registry_DATABASE_NAME_IP);
- LFC.Log("Registry_DATABASE_IP: " + _Data.Registry_DATABASE_NAME_IP);
- }
- else
- {
- this.socketUI = new SocketUI(this, this.myReceiverID, lblDemonStatus, FireDesk_Receiver.DATABASE_NAME_IP);
- LFC.Log("FireDesk_Receiver.DATABASE_IP: " + FireDesk_Receiver.DATABASE_NAME_IP);
- }
- LFC.Log(" ");
- // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
- // 모니터데몬이 사용중인지, 그리고 모니터데몬의 아이피가 무엇인지 알아낸다
- //this.MonitorDaemon_Enable = (rk.GetValue("MAIN_MONITOR_ACTIVE").ToString() == "1") ? true : false;
- //this.MonitorDaemon_IP = rk.GetValue("MAIN_MONITOR_SERVER_IP").ToString();
- this.MonitorDaemon_Enable = _Data.Registry_MonitorDaemon_Enable;
- this.MonitorDaemon_IP = _Data.Registry_MonitorDaemon_IP;
- ShowWaittingMsgForm("수신기 디바이스 DB를 읽고 있습니다..", 20);
- this.GetDeviceDB();
- ShowWaittingMsgForm("수신기 중계기 DB를 읽고 있습니다..", 30);
- this.GetRepeaterDB();
- AnalogDetect.Get_TB_DAYTIME(this.myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경 // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- this.GetAnalogDetecterLevelDB();
- ShowWaittingMsgForm("수신기 통신 보드 설정을 읽고 있습니다..", 40);
- this.GetBoardDB();
- ShowWaittingMsgForm("수신기 기본 설정값을 읽고 있습니다..", 50);
- //
- // ----------------------- 3. 수신기의 기본설정값 읽어오기 -----------------------
- //
- try
- {
- UIReceiverInfo cfg = new UIReceiverInfo(this.myReceiverID);
- this.ConfigVO = cfg.ReadConfig();
- this.lblAccumulSecond.Text = String.Format("{0}", this.ConfigVO.Fire_accumulation_time);
- //this.lblAccumulSecond.Image = null;//sdkim, 20120129, [MTS-47]
- //this.lblAccumulSecond.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
- Display_FireMode(this.ConfigVO.Fire_process_mode); //화재모드 표시
- //Display_SoundMode(this.ConfigVO.Sound_process_mode); //지구음향모드 표시
- this.txtFirstFireWarnningMessage.Text = ""; //제1보 TEXT 초기화
- this.txtFirstFireWarnningMessage.Tag = ""; //제1보 이벤트ID 초기화
- cboSecondFireWarnningMessage.Items.Clear(); //제2보 메세지 초기화
- cboWriteWarningMessage.Items.Clear(); //제경보 메세지 초기화
- // 화재 리스트 초기화.
- FireList.Clear();
- FireList_Accumulation.Clear(); // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
- PreFireList.Clear(); // cyim 2015.7.9 PreFire 표시 문제
- LblBuildingName.Text = this.ConfigVO.Building_name; //건물명표시
- // cyim 2014.8.11 화면에 마스터인지 슬레이브인지 표시
- if (this.ConfigVO.Master_flag == "N")
- {
- this.LblBuildingName.ForeColor = Color.Gold; // 운전설정에서 바꿀수 없도록함 (마스터 수신기는 현장에 1개만 설정되어야 하므로 주의해야함)
- this.LblBuildingName.Font = new System.Drawing.Font("맑은 고딕", 24F, System.Drawing.FontStyle.Bold);
- }
- // sdkim , 1보,2보 안보이는 현상 수정 , 이슈번호 #0000017
- this.labelFireAlert.Visible = false;
- this.txtFirstFireWarnningMessage.Visible = false;
- this.labelFireAlert_inform_1th.Visible = false;
- this.cboSecondFireWarnningMessage.Visible = false;
- this.labelFireAlert_inform_2th.Visible = false;
- // cyim 2013.6.27 운전설정시에 시운전 모드 체크박스 추가 및 메인 UI 표시
- if (this.ConfigVO.Test_run_flag == "Y") label_TestRunFlag.Visible = true;
- else label_TestRunFlag.Visible = false;
- // cyim 2013.8.7 타수신기 화재 정보 팝업창 출력
- // 현재 데이타베이스에 타수신기 정보를 알아내기위해 TB_RECEIVER 를 모두 찾아온다
- DacReceiverConfig dacReceiverConfig = new DacReceiverConfig(this.myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacReceiverConfig.Receiver_Select();
- Form_Popup_OtherFireAlarm OtherFireAlarm;
- Boolean init = false;
- //멀티 팝업창 테스트를 위해 구현한 버튼("팝업") 이 버튼을 보이게 하면 자동으로 테스트 수신기 3대가 추가 DB 상
- //2020.06.23
- if (button2.Enabled)
- {
- OtherFireAlarm = new Form_Popup_OtherFireAlarm("2", this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // 수신기 정보
- OtherFireAlarm.POPUP_RECEIVER_ID = "2";
- OtherFireAlarm.POPUP_RECEIVER_NAME = "산성포레스티아(포스코4)";
- OtherFireAlarm.POPUP_RECEIVER_IP = "127.0.0.2";
- // 해쉬테이블에 추가
- Popup.HASH_EtcReceiverFireAlarmPopup.Add(OtherFireAlarm.POPUP_RECEIVER_ID, OtherFireAlarm); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- OtherFireAlarm = new Form_Popup_OtherFireAlarm("3", this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // 수신기 정보
- OtherFireAlarm.POPUP_RECEIVER_ID = "3";
- OtherFireAlarm.POPUP_RECEIVER_NAME = "테스트 수신기3";
- OtherFireAlarm.POPUP_RECEIVER_IP = "127.110.110.113";
- // 해쉬테이블에 추가
- Popup.HASH_EtcReceiverFireAlarmPopup.Add(OtherFireAlarm.POPUP_RECEIVER_ID, OtherFireAlarm); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- OtherFireAlarm = new Form_Popup_OtherFireAlarm("4", this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // 수신기 정보
- OtherFireAlarm.POPUP_RECEIVER_ID = "4";
- OtherFireAlarm.POPUP_RECEIVER_NAME = "테스트 수신기4";
- OtherFireAlarm.POPUP_RECEIVER_IP = "127.0.0.4";
- // 해쉬테이블에 추가
- Popup.HASH_EtcReceiverFireAlarmPopup.Add(OtherFireAlarm.POPUP_RECEIVER_ID, OtherFireAlarm); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- else
- {
- button2.Visible = false;
- }
- if (init == false)
- {
- OtherFireAlarm_ME = new Form_Popup_OtherFireAlarm(myReceiverID.ToString(), this); // 타 수신기 팝업창 단일화!!!!
- // Form_Popup_OtherFireAlarm OtherFireAlarm = new Form_Popup_OtherFireAlarm(dr["RECEIVER_ID"].ToString(), this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // 수신기 정보
- OtherFireAlarm_ME.POPUP_RECEIVER_ID = myReceiverID.ToString();
- // 해쉬테이블에 추가
- Popup.HASH_EtcReceiverFireAlarmPopup.Add(myReceiverID.ToString(), OtherFireAlarm_ME); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- NetworkReceiver_ID_ComStatus.Add(myReceiverID.ToString(), true); // 처음 데이타베이스에 읽은 내용은 통신이 된다고 가정한다 // 특별테스트
- NetworkReceiver_ID_List.Add(myReceiverID.ToString()); // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
- Before_NetworkReceiver_ID_ComStatus.Add(myReceiverID.ToString(), true); // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- init = true;
- }
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- // 자기 아이디는 제외
- if (this.myReceiverID.ToString() != dr["RECEIVER_ID"].ToString())
- {
- // 폼 클래스 생성
- OtherFireAlarm = new Form_Popup_OtherFireAlarm(dr["RECEIVER_ID"].ToString(), this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // Form_Popup_OtherFireAlarm OtherFireAlarm = new Form_Popup_OtherFireAlarm(dr["RECEIVER_ID"].ToString(), this); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // 수신기 정보
- OtherFireAlarm.POPUP_RECEIVER_ID = dr["RECEIVER_ID"].ToString();
- OtherFireAlarm.POPUP_RECEIVER_NAME = dr["RECEIVER_NAME"].ToString();
- OtherFireAlarm.POPUP_RECEIVER_IP = dr["IP_ADDRESS"].ToString();
- // 해쉬테이블에 추가
- Popup.HASH_EtcReceiverFireAlarmPopup.Add(OtherFireAlarm.POPUP_RECEIVER_ID, OtherFireAlarm); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
- // 현재 데이타베이스에 있는 TB_RECEIVER 의 IP 들을 모두 조회한다, 단 자신의 아이피는 알필요가 없다
- NetworkReceiver_ID_ComStatus.Add(dr["RECEIVER_ID"].ToString(), true); // 처음 데이타베이스에 읽은 내용은 통신이 된다고 가정한다 // 특별테스트
- NetworkReceiver_ID_List.Add(dr["RECEIVER_ID"].ToString()); // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
- Before_NetworkReceiver_ID_ComStatus.Add(dr["RECEIVER_ID"].ToString(), true); // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- }
- }
- }
- // cyim 2017.01.24 : 사용중인 펌프만 표시하도록 한다
- dt = dacReceiverConfig.Pump_Select(1);
- if (dt == null || dt.Rows.Count == 0) { this.label_P1.Visible = false; };
- dt = dacReceiverConfig.Pump_Select(2);
- if (dt == null || dt.Rows.Count == 0) { this.label_P2.Visible = false; };
- dt = dacReceiverConfig.Pump_Select(3);
- if (dt == null || dt.Rows.Count == 0) { this.label_P3.Visible = false; };
- dt = dacReceiverConfig.Pump_Select(4);
- if (dt == null || dt.Rows.Count == 0) { this.label_P4.Visible = false; };
- dt = dacReceiverConfig.Pump_Select(5);
- if (dt == null || dt.Rows.Count == 0) { this.label_P5.Visible = false; };
- dt = dacReceiverConfig.Pump_Select(6);
- if (dt == null || dt.Rows.Count == 0) { this.label_P6.Visible = false; };
- dt = dacReceiverConfig.Pump_Select(7);
- if (dt == null || dt.Rows.Count == 0) { this.label_P7.Visible = false; };
- dt = dacReceiverConfig.Pump_Select(8);
- if (dt == null || dt.Rows.Count == 0) { this.label_P8.Visible = false; };
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- throw new Exception("DB연결 실패!");
- }
- ShowWaittingMsgForm("수신기 도면 설정을 읽고 있습니다..", 60);
- //
- // 중요사항
- //
- // 네트워크 수신기에서 수신기아이디가 2인경우에도 Receiver1 폴더로 접근하도록 수정한다
- // 폴더명과 ODBC 를 바꿔서 설정해야하는 불편함이 있다. 또한 런쳐가 실행되는 경로가 틀려져서 윈도우 부팅후 시작할수가 없다
- // 결국 무조건 수신기 아이디와는 상관없이 폴더명은 Receiver1로 고정한다
- // cyim 2014.8.6 Receiver1 로 폴더고정
- //string sProjectPath = Path.Combine(rk.GetValue("PROJECT_DIR").ToString(), string.Format("Receiver{0}", this.myReceiverID));
- // cyim 2015.7.29 수신반 루틴을 위해 외부 파라미터로 동작하도록 수정
- //string sProjectPath = Path.Combine(rk.GetValue("PROJECT_DIR").ToString(), "Receiver1");
- string sProjectPath = "";
- if (_Data.FireDeskMode == false) // 수신반이 아닐때는 레지스트리 값 이용
- {
- sProjectPath = _Data.Registry_Project_Directory + "\\Receiver1";
- }
- else
- {
- // cyim 2015.7.30 ini 파일에서 Receiver 지정폴더사용
- // 즉 레지스트리에서는 D:\FireTest 로 끝났지만 ini 파일에서는 D:\FireTest\Receiver1 같이 구체적인 폴더명을 지정한다
- // 결국 아래와 같이 수신기 아이디별로 ini 파일대로 예상하는 프로젝트 경로는 아래와 같다
- // 예시
- // 수신기1 = D:\FireTest\Receiver1
- // 수신기2 = D:\FireTest\Receiver2
- // 수신기3 = D:\FireTest\Receiver3
- sProjectPath = FireDesk_Receiver.PROJECT_DIRECTORY;
- }
- this.ConfigVO.Background_image = sProjectPath + "\\mapview\\field\\title.jpg";
- if (File.Exists(this.ConfigVO.Background_image))
- {
- Image img = new Bitmap(this.ConfigVO.Background_image);//Image.FromStream(ms);
- this.BackgroundImage = img;
- }
- if (InitXFieldData(sProjectPath) <= 0)
- {
- btnMenu7.Enabled = false;
- }
- }
- // cyim 2015.9.1 1개의 수신기가 접속이 안되더라도 나머지는 접속시도할수 있도록 수정
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- MessageBox.Show(ex.Message + "\r\r\n\n수신기정보를 읽을수 없습니다. 관리자에게 문의하십시요!\r\n프로그램 동작할 수 없습니다"
- , Application.ProductName
- , MessageBoxButtons.OK, MessageBoxIcon.Warning);
- //Application.Exit();
- }
- }
- /********************************************************/
- /* MDIParent 시작 */
- /********************************************************/
- // 버퍼
- //private ArrayList Buffer = new ArrayList();
- //// 패킷
- //private object[] Packet = new object[1000];
- //// 데이타큐
- //private Queue DataQueue = new Queue();
- //// CS
- //private Object CS = new object();
- private void MDIParent_Load(object sender, EventArgs e)
- {
- try
- {
- this.Hide();
- this.Cursor = Cursors.WaitCursor;
- this.window = this;
- // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- TcpComClient = new _TcpComClient(this);
- Popup = new _Popup(this);
- //
- // 이벤트 핸들러 등록 - cyim
- //
- Event.SocketBufferError_Inform_Event += new _Event.SocketBufferError_Inform_Handler(_Event_SocketBufferError_Inform_Event); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // cyim 2014.8.8 통신점검 시나리오 신규 작업
- Event.ClientSocketReceive_SendMessage_Event += new _Event.ClientSocketReceive_SendMessage_Handler(_Event_ClientSocketReceive_SendMessage_Event); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- //TcpComClient.SocketConnect_Inform_Event += new TcpComClient.SocketConnect_Inform_Message_Handler(_TcpComClient_SocketConnect_Inform_Event);
- // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- TcpComClient.SocketConnect_Inform_Event += new _TcpComClient.SocketConnect_Inform_Message_Handler(_TcpComClient_SocketConnect_Inform_Event);
- // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트
- Event.TimeSync_Setup_SendMessage_Event += new _Event.TimeSync_Setup_SendMessage_Handler(Event_TimeSync_Setup_SendMessage_Event);
- ShowWaittingMsgForm("수신기 데몬연결 설정을 읽고 있습니다..", 10);
- //CheckForIllegalCrossThreadCalls = false; //크로스작업 무시
- //수신기 초기화.. DB접속.. 필수 연결안되면 프로그램 종료
- Init();
- ShowWaittingMsgForm("수신기 데몬연결 설정 읽기를 완료하였습니다.", 70);
- // cyim 2015.2.9 프로그램 시작
- CommandLog(MappingStatus.ProgramStart, string.Format("{0}가 시작되었습니다. Ver.{1}", Application.ProductName, Application.ProductVersion));
- // ----------------------- 4. TCP/IP 통신연동 & 데몬 RESET 명령-----------------------
- ShowWaittingMsgForm("환경정보를 읽고 있습니다..", 80);
- this.socketUI.ReceiverDBRead(); //DB에서 설정 읽어몸
- ShowWaittingMsgForm("환경정보 읽기를 완료하였습니다.", 90);
- // ----------------------- 4. TCP/IP 통신연동 & 데몬 RESET 명령-----------------------
- // cyim 2015.8.12 데이타베이스 용량 문제 : 파일복사 문제 수정하기 위해 아래 주석 처리
- // 아래의 타이머가 동작되면서 한달에 한번씩 파일DB를 복사한다. 결국 하드디스크 용량문제가 발생하므로 삭제한다
- //timerMaintance.Enabled = true;
- //timerMaintance.Start();
- // cyim 2015.8.12 데이타베이스 용량 문제 : 아래 주석 처리 해제
- timerLogDelete.Start();
- //timerVoltage.Start();
- this.SetEmergencyBroadCastSetatus(true);
- ShowWaittingMsgForm("데몬연결을 시도합니다..", 95);
- this.socketUI.ServiceStart(); //TCP/IP 통신 시작
- //this.socketUI.ReceiverDemonReset(); //데몬 RESET 명령
- // Application.DoEvents();
- //this.socketUI.CountReadStart(); //차단설정 카운트 표시--->this.socketUI.ServiceStart();안으로 이동
- // cyim 2015.2.9 시작시에 데몬이 연결되었는지 확인하고 문구를 결정
- if (CommDaemon_ComStatus == true)
- {
- ShowWaittingMsgForm("데몬 연결이 완료되었습니다.", 100);
- // 통신데몬 통신상태는 처음시작시 연결정상이 기본값이므로 토글된 상태일때만 로그를 남기는 구조에서는 어쩔수 없이 여기서 남기도록 한다
- CommandLog(MappingStatus.CommConnectNormal, string.Format("통신데몬 연결 정상"));
- }
- else
- {
- ShowWaittingMsgForm("데몬 연결이 안됩니다.", 100);
- }
- // cyim 2016.12.16 : 수신반을 통한 MDIParent 창은 윈도우창이 존재한다
- if (_Data.FireDeskMode == true)
- {
- this.WindowState = FormWindowState.Normal;
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.ControlBox = true;
- this.MinimizeBox = false;
- this.MaximizeBox = false;
- }
- else
- {
- if (_Data.Hook_Enable != "OFF")
- {
- // cyim 2017.01.23 : Explorer 프로세스 제어 루틴 추가
- _Diagnostics.taskkill_explorer();
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- // cyim 2015.2.9 통신데몬 연결 실패
- //CommandLog(MappingStatus.CommConnectError, string.Format("데몬연결이상!\r\n {0}", ex.Message));
- }
- finally
- {
- // cyim 2015.7.30 수신반인 경우 기본으로 숨겨짐
- if (_Data.FireDeskMode == false)
- this.Show();
- //잠시만 기다리는 창 화면 닫기
- if (this.waittingForm != null)
- this.waittingForm.Close();
- //---------------------------------------------------
- //1280*1024모드를 체크하여 화면이동을 가능하게 한다....
- //---------------------------------------------------
- Size sz = Screen.PrimaryScreen.WorkingArea.Size;
- if (sz.Width > 1280 && sz.Height > 1024)
- {
- this.WindowState = FormWindowState.Normal;
- this.Size = new Size(1280, 1024);
- this.StartPosition = FormStartPosition.CenterScreen;
- MDIMove = true;
- }
- //else if (sz.Width == 1280 && sz.Height == 1024)
- else if (sz.Width == 1280)
- {
- this.WindowState = FormWindowState.Normal;
- this.Size = new Size(1280, 1024);
- this.StartPosition = FormStartPosition.CenterScreen;
- MDIMove = true;
- }
- else
- {
- MessageBox.Show(string.Format("1280*1024 화면모드 버젼입니다. 먼저 해상도를 변경하십시요..\r\n 현재해상도 : {0}*{1}", sz.Width, sz.Height));
- this.WindowState = FormWindowState.Normal;
- this.Size = new Size(1280, 1024);
- this.StartPosition = FormStartPosition.CenterScreen;
- MDIMove = true;
- //this.Close();
- }
- //MessageBox.Show(string.Format("width:{0} height:{1} WindowState:{2} StartPosition:{3} ", this.Size.Width, this.Size.Height, this.WindowState, this.StartPosition));
- //---------------------------------------------------
- //중계기상태보기를 보여준다..
- //ShowChildForm(new frmRepeaterGroup());
- this.Cursor = Cursors.Default;
- // cyim 2015.7.7 속도개선작업 : 중복호출 방지
- // SetLikageBtnStatus 함수의 경우 FormField 가 활성화되면서 의미없이 중복으로 계속 호출되버린다.
- // 결국 메뉴 인덱스가 변경되기전에 미리 데이타를 읽어야 한다. 위치를 FormField 생성자 위에서 미리 실행해둔다.
- // cyim 2013.7.19 속도개선작업
- // MDIParent.cs 의 SetLikageBtnStatus 가 최대 문제임을 발견!!!
- // -> CheckOutputDeviceTypeStop 안에 쿼리를 날리는데 order by 를 남용하여 속도가 저하되었다
- this.SetLikageBtnStatus();
- // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
- //if (bJumpField)
- if (MyConfigVO.Jump_field_flag == "Y")
- {
- if (this.xField.Count > 0)
- {//moon, 11.11.01 , init filed form
- FormField formField = (FormField)ShowChildForm(new FormField(this.xField, this.DataType_Set));
- formField.JumpField(0);
- }
- }
- // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
- // MDIParent 가 준비되면 이벤트 발생 (수신반 메인화면에서 다른 메인화면을 열어야함)
- Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "FormLoad", "MDIParentComplete", 0); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- }
- /********************************************************/
- /********************************************************/
- /* MDIParent 화면 닫기전 */
- /********************************************************/
- void MDIParent_FormClosing(object sender, FormClosingEventArgs e)
- {
- try
- {
- // cyim 2016.12.16 : 수신반의 경우 MDIParent의 숨김 버튼을 닫기 버튼으로 대체한다
- if (_Data.FireDeskMode == true)
- {
- // 이벤트 해제
- e.Cancel = true;
- // 창을 닫는 대신, 보이지 않게만 한다
- this.Visible = false;
- }
- else
- {
- //
- // cyim 2015.7.29 수신반의 경우 MDIParent 가 항상 켜져있지 않을수도 있으므로 이벤트 핸들러 삭제 코드 추가
- //
- Event.SocketBufferError_Inform_Event -= new _Event.SocketBufferError_Inform_Handler(_Event_SocketBufferError_Inform_Event);
- // cyim 2014.8.8 통신점검 시나리오 신규 작업
- Event.ClientSocketReceive_SendMessage_Event -= new _Event.ClientSocketReceive_SendMessage_Handler(_Event_ClientSocketReceive_SendMessage_Event);
- // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- //TcpComClient.SocketConnect_Inform_Event -= new TcpComClient.SocketConnect_Inform_Message_Handler(_TcpComClient_SocketConnect_Inform_Event);
- // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- TcpComClient.SocketConnect_Inform_Event -= new _TcpComClient.SocketConnect_Inform_Message_Handler(_TcpComClient_SocketConnect_Inform_Event);
- // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트
- Event.TimeSync_Setup_SendMessage_Event -= new _Event.TimeSync_Setup_SendMessage_Handler(Event_TimeSync_Setup_SendMessage_Event);
- // cyim 2015.2.9 프로그램 종료
- CommandLog(MappingStatus.ProgramEnd, string.Format("{0}가 종료되었습니다. Ver.{1}", Application.ProductName, Application.ProductVersion));
- //TCP/IP 통신 종료
- if (this.socketUI != null)
- {
- this.socketUI.ServiceStop();
- }
- // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
- if (_Data.Hook_Enable != "OFF")
- {
- // cyim 2017.01.23 : Explorer 프로세스 제어 루틴 추가
- _Diagnostics.start_explorer();
- _Hook.Enable_TaskMgr();
- _Hook.Enable_NoClose();
- }
- Environment.Exit(0);
- }
- }
- catch
- {
- Environment.Exit(0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 프로그램 종료 버튼 */
- /********************************************************/
- private void btnChildClose_Click(object sender, EventArgs e)
- {
- try
- {
- // 테스트 코드
- //this.Cursor = Cursors.WaitCursor;
- //ApplicationExit();
- //this.Cursor = Cursors.Default;
- EventLogInfo eventLog = new EventLogInfo("1234");
- //essage = String.Format("{0}", EventTypeName(resData.EventType, "FIRE ACCUMULATION ON!"));
- //eventLog.Message = message;
- //eventLog.EventStatus = MappingStatus.AccumulateOn;
- ////Live 메세지 생성
- //eventLog.LiveMsgFlag = true;
- // 이벤트 추가
- EventLogAdd(eventLog);
- //축적모드 시작
- Accumulate_Start();
- // cyim 2016.12.12 축적화재 재동작 컨셉 변경
- // 축적화재 발생도중에 축적화재가 또 발생한 경우에는 카운터는 그대로 유지한다. 만약 기존의 축적화재가 사라지더라도 축적화재 상태가 해제되지 않기 때문이다
- //////////////////////////////////////////// cyim 2014.7.9 : 축적화재 표시 : KFI 요청사항
- //main.Display_FireCnt(resData.Count); //화재카운트 표시안함
- fireCount_Accumulation = 0;//resData.Count;
- // 기존 화재 리스트에 있는지 확인하고, 없는 경우에 새로 추가한다.
- string sEventLog = string.Format("{0}", eventLog.DeviceMessage);
- if (FireList_Accumulation.Contains(sEventLog))
- {
- // 중복 메시지가 있음.
- }
- else
- {
- // 화재 리스트에 추가.
- FireList_Accumulation.Add(string.Format("{0}", eventLog.DeviceMessage));
- FireEventProcess();
- }
- //////////////////////////////////////////// cyim 2014.7.9 : 축적화재 표시 : KFI 요청사항
- //화면에 메세지 표시--축적시작 : 추가 2010.10.28 탁은임
- MessageProcess(eventLog);//2010.10.29,k.s.d, message level bug fix => MessageProcess before UpdateEventMessage.
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 이벤트 버튼이미지 변경 */
- /********************************************************/
- //public void btnMenu_MouseHover(object sender, EventArgs e) {
- // try {
- // Button btn = (Button)sender;
- // switch (btn.Name) {
- // case "btnMenu1":
- // btn.ImageIndex = cstBtnMenu1_Over;
- // break;
- // case "btnMenu2":
- // btn.ImageIndex = cstBtnMenu2_Over;
- // break;
- // case "btnMenu3":
- // btn.ImageIndex = cstBtnMenu3_Over;
- // break;
- // case "btnMenu4":
- // btn.ImageIndex = cstBtnMenu4_Over;
- // break;
- // case "btnMenu5":
- // btn.ImageIndex = cstBtnMenu5_Over;
- // break;
- // case "btnMenu6":
- // btn.ImageIndex = cstBtnMenu6_Over;
- // break;
- // case "btnMenu7":
- // btn.ImageIndex = cstBtnMenu7_Over;
- // break;
- // }
- // }
- // catch (Exception ex) {
- // Util.UErrorMessage(ex, 0, 0);
- // }
- //}
- public void btnMenu_MouseHover(object sender, EventArgs e)
- {
- try
- {
- Button btn = (Button)sender;
- switch (btn.Name)
- {
- case "btnMenu1": { this.ImgChangeBtnMenu1o(); break; }
- case "btnMenu2": { this.ImgChangeBtnMenu2o(); break; }
- case "btnMenu3": { this.ImgChangeBtnMenu3o(); break; }
- case "btnMenu4": { this.ImgChangeBtnMenu4o(); break; }
- case "btnMenu5": { this.ImgChangeBtnMenu5o(); break; }
- case "btnMenu6": { this.ImgChangeBtnMenu6o(); break; }
- case "btnMenu7": { this.ImgChangeBtnMenu7o(); break; }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //public void btnMenu_MouseLeave(object sender, EventArgs e) {
- // try {
- // Button btn = (Button)sender;
- // switch (btn.Name) {
- // case "btnMenu1":
- // btn.ImageIndex = this.selectMenuIndex == 1 ? cstBtnMenu1_Over : imgIndexbtnMenu1_normal/*cstBtnMenu1*/;
- // break;
- // case "btnMenu2":
- // btn.ImageIndex = this.selectMenuIndex == 2 ? cstBtnMenu2_Over : cstBtnMenu2;
- // break;
- // case "btnMenu3":
- // btn.ImageIndex = this.selectMenuIndex == 3 ? cstBtnMenu3_Over : cstBtnMenu3;
- // break;
- // case "btnMenu4":
- // btn.ImageIndex = this.selectMenuIndex == 4 ? cstBtnMenu4_Over : cstBtnMenu4;
- // break;
- // case "btnMenu5":
- // btn.ImageIndex = this.selectMenuIndex == 5 ? cstBtnMenu5_Over : cstBtnMenu5;
- // break;
- // case "btnMenu6":
- // btn.ImageIndex = this.selectMenuIndex == 6 ? cstBtnMenu6_Over : cstBtnMenu6;
- // break;
- // case "btnMenu7":
- // btn.ImageIndex = this.selectMenuIndex == 7 ? cstBtnMenu7_Over : cstBtnMenu7;
- // break;
- // }
- // }
- // catch (Exception ex) {
- // Util.UErrorMessage(ex, 0, 0);
- // }
- //}
- public void btnMenu_MouseLeave(object sender, EventArgs e)
- {
- try
- {
- Button btn = (Button)sender;
- switch (btn.Name)
- {
- case "btnMenu1":
- if (this.selectMenuIndex == 1)
- {
- this.ImgChangeBtnMenu1o();
- }
- else
- {
- this.ImgChangeBtnMenu1n();
- }
- break;
- case "btnMenu2":
- if (this.selectMenuIndex == 2)
- {
- this.ImgChangeBtnMenu2o();
- }
- else
- {
- this.ImgChangeBtnMenu2n();
- }
- break;
- case "btnMenu3":
- if (this.selectMenuIndex == 3)
- {
- this.ImgChangeBtnMenu3o();
- }
- else
- {
- this.ImgChangeBtnMenu3n();
- }
- break;
- case "btnMenu4":
- if (this.selectMenuIndex == 4)
- {
- this.ImgChangeBtnMenu4o();
- }
- else
- {
- this.ImgChangeBtnMenu4n();
- }
- break;
- case "btnMenu5":
- if (this.selectMenuIndex == 5)
- {
- this.ImgChangeBtnMenu5o();
- }
- else
- {
- this.ImgChangeBtnMenu5n();
- }
- break;
- case "btnMenu6":
- if (this.selectMenuIndex == 6)
- {
- this.ImgChangeBtnMenu6o();
- }
- else
- {
- this.ImgChangeBtnMenu6n();
- }
- break;
- case "btnMenu7":
- if (this.selectMenuIndex == 7)
- {
- this.ImgChangeBtnMenu7o();
- }
- else
- {
- this.ImgChangeBtnMenu7n();
- }
- break;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //private void btnMenu_MouseDown(object sender, MouseEventArgs e) {
- // try {
- // if (e.Button == MouseButtons.Left) {
- // Button btn = (Button)sender;
- // switch (btn.Name) {
- // case "btnMenu1":
- // btn.ImageIndex = cstBtnMenu1_Down;
- // break;
- // case "btnMenu2":
- // btn.ImageIndex = cstBtnMenu2_Down;
- // break;
- // case "btnMenu3":
- // btn.ImageIndex = cstBtnMenu3_Down;
- // break;
- // case "btnMenu4":
- // btn.ImageIndex = cstBtnMenu4_Down;
- // break;
- // case "btnMenu5":
- // btn.ImageIndex = cstBtnMenu5_Down;
- // break;
- // case "btnMenu6":
- // btn.ImageIndex = cstBtnMenu6_Down;
- // break;
- // case "btnMenu7":
- // btn.ImageIndex = cstBtnMenu7_Down;
- // break;
- // }
- // }
- // }
- // catch (Exception ex) {
- // Util.UErrorMessage(ex, 0, 0);
- // }
- //}
- private void btnMenu_MouseDown(object sender, MouseEventArgs e)
- {
- try
- {
- if (e.Button == MouseButtons.Left)
- {
- Button btn = (Button)sender;
- switch (btn.Name)
- {
- case "btnMenu1": { this.ImgChangeBtnMenu1d(); break; }
- case "btnMenu2": { this.ImgChangeBtnMenu2d(); break; }
- case "btnMenu3": { this.ImgChangeBtnMenu3d(); break; }
- case "btnMenu4": { this.ImgChangeBtnMenu4d(); break; }
- case "btnMenu5": { this.ImgChangeBtnMenu5d(); break; }
- case "btnMenu6": { this.ImgChangeBtnMenu6d(); break; }
- case "btnMenu7": { this.ImgChangeBtnMenu7d(); break; }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnMenu_MouseUp(object sender, MouseEventArgs e)
- {
- try
- {
- if (e.Button == MouseButtons.Left)
- {
- Button btn = (Button)sender;
- switch (btn.Name)
- {
- case "btnMenu1": { this.ImgChangeBtnMenu1o(); break; }
- case "btnMenu2": { this.ImgChangeBtnMenu2o(); break; }
- case "btnMenu3": { this.ImgChangeBtnMenu3o(); break; }
- case "btnMenu4": { this.ImgChangeBtnMenu4o(); break; }
- case "btnMenu5": { this.ImgChangeBtnMenu5o(); break; }
- case "btnMenu6": { this.ImgChangeBtnMenu6o(); break; }
- case "btnMenu7": { this.ImgChangeBtnMenu7o(); break; }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 설비제어--테스트화면 */
- /********************************************************/
- // cyim 2015.8.18 주경종정지 기능 추가 : 델리게이트 선언 및 생성자 변경
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- // 0 : Default, 1 : 전체정지, 2 : 전체연동
- public void ShowControlWrite(bool MainSoundStop, int EquipmentAllOperationStatus)
- {
- try
- {
- if (this.InvokeRequired)
- {
- SetBoolIntCallback d = new SetBoolIntCallback(ShowControlWrite);
- this.Invoke(d, new object[] { MainSoundStop, EquipmentAllOperationStatus });
- }
- else
- {
- Form f = ShowChildForm(new frmControlWrite(MainSoundStop, EquipmentAllOperationStatus));
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 설비 연동 버튼 클릭 이벤트
- public void btnMenu1_Click(object sender, EventArgs e)
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- LFC.Log("타입: 수신기 조작 로그, 메세지: 설비연동 메뉴 클릭");
- ShowControlWrite(false, 0); // cyim 2015.8.18 주경종정지 기능 추가 : 기본값은 false
- }
- /********************************************************/
- /********************************************************/
- /* 시스템정보 버튼 클릭시 메뉴 표시 */
- /********************************************************/
- private void btnMenu3_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- int mnSizeW = MenuStripStatus.Size.Width;
- mnSizeW = 1280 - mnSizeW - 196;
- MenuStripStatus.Show(this.Location.X + mnSizeW, this.Location.Y + 308);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 시스템정보>중계반상태보기 Form 생성 */
- /********************************************************/
- private void RepeaterGroupToolStripMenuItem_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
- if (ReceiverModel == "IFC3300")
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-중계반 상태보기 메뉴 클릭");
- Form f = ShowChildForm(new frmBoardGroup_BigReceiver());
- }
- else
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-중계반 상태보기 메뉴 클릭");
- Form f = ShowChildForm(new frmBoardGroup());
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 시간표시 및 통신연결상태 표시 */
- /********************************************************/
- //int imgIndexbtnMenu1_normal = cstBtnMenu1;
- public int updatebutton1timer = 0;
- private void timerDateTime_Tick(object sender, EventArgs e)
- {
- try
- {
- // cyim 2015.7.3 감지기 레벨중 FireDay, FireNight 구분을 위한 현재 시간 정보 조회
- AnalogDetect.FireDayTime_Check_Timer_Tick(); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // cyim 2016.12.28 : 예외처리 추가: 수신반에 불필요한 이벤트는 발생하지 않는다
- if (_Data.FireDeskMode == false)
- {
- // cyim 2014.7.18 : 데몬이 늦게 출력되어 포커스를 잃어버리면 작업바가 나타난다
- if (timer_MdiParent_TopMost == false)
- {
- timer_MdiParent_TopMost_Cnt++;
- if (timer_MdiParent_TopMost_Cnt == 5)
- {
- this.TopMost = false;
- }
- // cyim 2014.7.23 마우스 이벤트 강제로 발생
- else if (timer_MdiParent_TopMost_Cnt == 60)
- {
- _MouseEvent.Click(10, 10);
- // 1회만 실행
- timer_MdiParent_TopMost = true;
- }
- }
- }
- // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
- this.MonitorDaemon_Chk_Cnt++;
- if (this.MonitorDaemon_Chk_Cnt >= 20) // cyim 2015.10.23 네트워크 수신기 통신 상태 폴링 주기 변경 : 30 -> 20
- {
- this.MonitorDaemon_Chk_Cnt = 0;
- // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트 : 시간정보를 보내는 루틴과 폴링하는 루틴이 별개로 존재하게 되어 공통 루틴으로 일단 함수로 처리함
- ReadRegister_And_SendToPacket_MonitorDaemon("ComStatus");
- //// 레지스트리 값을 다시 읽어온다
- //RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\I_FPER_COMM_DAEMON", false);
- //if (rk != null)
- //{
- // this.MonitorDaemon_Enable = (rk.GetValue("MAIN_MONITOR_ACTIVE").ToString() == "1") ? true : false;
- // this.MonitorDaemon_IP = rk.GetValue("MAIN_MONITOR_SERVER_IP").ToString();
- // // 모니터데몬을 사용하지 않으면 모두 true 로 전환
- // if (this.MonitorDaemon_Enable == false)
- // {
- // this.MonitorDaemon_ComStatus = true;
- // foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
- // NetworkReceiver_ID_ComStatus[ReceiverID] = true;
- // // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- // Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
- // // 스레드 중지
- // Thread.Abort("TcpComClient"); // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정 // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // }
- // else
- // {
- // if (this.MonitorDaemon_IP != null && this.MonitorDaemon_IP.Length != 0)
- // {
- // // cyim 2014.8.11 : Connect 루틴은 스레드로 돌림 (접속이 안되는 PC 라면 프로그램이 멈춤현상이 발생함) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // Thread.Abort("TcpComClient");
- // Thread.Create("TcpComClient", TcpComClient_byThread, "ComStatus");
- // }
- // }
- //}
- }
- try
- {
- // cyim 2015.9.23 시간정보 표시 오류 (갱신을 안함)
- MyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //시간표시
- String strTime = string.Format("{0:yyyy}년 {0:MM}월 {0:dd}일 {0:HH}:{0:mm}:{0:ss}", DateTime.Now);
- LblTime.Text = strTime;
- //LblTime.Image = null; //sdkim, 20120129, [MTS-47]
- //LblTime.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
- //if ((updatebutton1timer++ % 2 )== 0) {
- // this.Setmenu1Button();
- //}
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- //if (this.MdiChildren.Length < 1) this.SelectMenuIndex = 0;
- //축적시간표시
- if (this.ConfigVO != null)
- {
- if (this.ConfigVO.Fire_accumulation_mode && this.ConfigVO.Fire_accumulation_start)
- {
- this.ConfigVO.Fire_accumulation_second--;
- Display_AccumulSecond();
- }
- }
- //통신데몬연결상태 화면에 표시
- if (this.socketUI != null)
- this.socketUI.ReadDeamonInfo();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- }
- }
- /********************************************************/
- // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트 : 시간정보를 보내는 루틴과 폴링하는 루틴이 별개로 존재하게 되어 공통 루틴으로 일단 함수로 처리함
- private void ReadRegister_And_SendToPacket_MonitorDaemon(string Data) // 레지스트리값을 읽고 주기적으로 모니터데몬에게 메세지를 보내는 함수
- {
- // 수신반은 의미없다
- if (_Data.FireDeskMode == true)
- return;
- // 레지스트리 값을 다시 읽어온다
- RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\I_FPER_COMM_DAEMON", false);
- if (rk != null)
- {
- this.MonitorDaemon_Enable = (rk.GetValue("MAIN_MONITOR_ACTIVE").ToString() == "1") ? true : false;
- this.MonitorDaemon_IP = rk.GetValue("MAIN_MONITOR_SERVER_IP").ToString();
- // 모니터데몬을 사용하지 않으면 모두 true 로 전환
- if (this.MonitorDaemon_Enable == false)
- {
- this.MonitorDaemon_ComStatus = true;
- foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
- NetworkReceiver_ID_ComStatus[ReceiverID] = true;
- // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
- // 스레드 중지
- Thread.Abort("TcpComClient"); // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정 // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- else
- {
- if (this.MonitorDaemon_IP != null && this.MonitorDaemon_IP.Length != 0)
- {
- // cyim 2014.8.11 : Connect 루틴은 스레드로 돌림 (접속이 안되는 PC 라면 프로그램이 멈춤현상이 발생함) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- Thread.Abort("TcpComClient");
- Thread.Create("TcpComClient", TcpComClient_byThread, Data);
- }
- }
- }
- }
- // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트 (데이타를 파라미터로 변환)
- // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
- private void TcpComClient_byThread(object Data)
- {
- // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
- // 어느순간 갑자기 레지스트리값이 변경될수도 있으므로 안전하게 임시변수를 이용
- string temp_MonitorDaemon_IP = this.MonitorDaemon_IP;
- // 모니터데몬에 접속해본다
- if (TcpComClient.Ping_SyncCheck(temp_MonitorDaemon_IP) == true && TcpComClient.Socket_Connect(temp_MonitorDaemon_IP, "9004") == true) // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- {
- // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
- lock (CS_MonitorDaemon_ComStatus)
- {
- // 모니터데몬은 통신이 잘됨
- this.MonitorDaemon_ComStatus = true;
- // cyim 2015.10.23 통신이 정상인데도 불구하고 30초마다 통신오류가 표시됨 : 주석처리
- //foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
- // NetworkReceiver_ID_ComStatus[ReceiverID] = false;
- // 메세지 송출
- byte[] data = _Convert.EncodingData(_Convert.Coding.UTF8, Data.ToString());
- TcpComClient.Socket_Send(temp_MonitorDaemon_IP, "9004", data); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- }
- else
- {
- // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
- lock (CS_MonitorDaemon_ComStatus)
- {
- // 모니터데몬은 통신이 안됨
- this.MonitorDaemon_ComStatus = false;
- // 원래있던 수신기의 통신상태는 true 로 돌려놓는다
- foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
- NetworkReceiver_ID_ComStatus[ReceiverID] = false; // cyim 2015.10.23 통신이 정상인데도 불구하고 30초마다 통신오류가 표시됨 : true -> false 해야된다
- // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
- }
- }
- }
- /********************************************************/
- /* 시스템설정버튼 클릭시 메뉴 표시 */
- /********************************************************/
- private void btnMenu2_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- int mnSizeW = MenuStripSystem.Size.Width;
- mnSizeW = 1280 - mnSizeW - 196;
- MenuStripSystem.Show(this.Location.X + mnSizeW, this.Location.Y + 244);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 시스템설정>수신기설정 Form 생성 */
- /********************************************************/
- private void toolStripMenuItem1_Click(object sender, EventArgs e)
- {
- try
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템설정-수신기설정 메뉴 클릭");
- ShowLogin(new frmReceiverConfig());
- //ShowChildForm(new frmReceiverConfig());
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 이력점검버튼 클릭시 메뉴 표시 */
- /********************************************************/
- private void btnMenu4_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- int mnSizeW = MenuStripLog.Size.Width;
- mnSizeW = 1280 - mnSizeW - 196;
- MenuStripLog.Show(this.Location.X + mnSizeW, this.Location.Y + 372);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 시스템정보>중계기상태보기 Form 생성 */
- /********************************************************/
- private void RepeaterToolStripMenuItem_Click(object sender, EventArgs e)
- {
- try
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-중계기 상태보기 메뉴 클릭");
- Form f = ShowChildForm(new frmRepeaterGroup());
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 이력점검>현재내역보기 Form 생성 */
- /********************************************************/
- public void toolStripMenuItem4_Click(object sender, EventArgs e)
- {
- try
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 이력점검-현재내역 클릭");
- FormLogView frm = new FormLogView(true);
- frm = (FormLogView)ShowChildForm(frm);
- frm.InitFormLogView(true);
- //Form f = ShowChildForm(new FormLogView(true));
- frm.SetSearchCondition("ALL");
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 이력점검>과거내역보기 Form 생성 */
- /********************************************************/
- private void toolStripMenuItem5_Click(object sender, EventArgs e)
- {
- try
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 이력점검-과거내역 클릭");
- FormLogView frm = new FormLogView(false);
- frm = (FormLogView)ShowChildForm(frm);
- frm.InitFormLogView(false);
- //Form f = ShowChildForm(new FormLogView(false));
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /* MdiParent 화면이동 */
- /********************************************************/
- private void MdiParent_MouseDown(object sender, MouseEventArgs e)
- {
- try
- {
- if (MDIMove)
- {
- mouseOffset = new Point(-e.X, -e.Y);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void MdiParent_MouseMove(object sender, MouseEventArgs e)
- {
- try
- {
- if (MDIMove && (e.Button == MouseButtons.Left))
- {
- Point mousePos = Control.MousePosition;
- mousePos.Offset(mouseOffset.X, mouseOffset.Y);
- this.Location = mousePos;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- //카운트 라벨에 표시
- public void Count_Display(int cnt_DeviceFire, int cnt_DeviceWrite, int cnt_ConnetError, int cnt_RepeaterBlocking, int cnt_ReceiverCut)
- {
- try
- {//화재, 설비, 통신, 단선, 차단
- Display_FireCnt(cnt_DeviceFire); //화재입력값 count
- Display_WriteCnt(cnt_DeviceWrite); //설비입력값 count
- Display_ErrorCnt(cnt_ConnetError); //통신에러 count
- Display_BlockingCnt(cnt_RepeaterBlocking); //단선 count
- //Display_CutCnt(cnt_ReceiverCut); //차단 count
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
- public void Display_Check(bool Enable)
- {
- try
- {
- if (this.btnCheck.InvokeRequired)
- {
- SetBoolCallback d = new SetBoolCallback(Display_Check);
- this.btnCheck.Invoke(d, new object[] { Enable });
- }
- else
- {
- Color CheckBtnColor = Color.Transparent;
- if (Enable == true) // 점검내용이 있다
- CheckBtnColor = Color.Red;
- else
- CheckBtnColor = Color.Transparent;
- this.btnCheck.BackColor = CheckBtnColor;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblDeviceFireCnt 는 루틴에서 제외한다.
- //
- // 화재입력값 표시
- public int fireCount = 0;
- // 축적 화재입력값 표시
- public int fireCount_Accumulation = 0;
- // cyim 2015.7.9 PreFire 표시 문제
- public ArrayList PreFireList = new ArrayList();
- public void Display_FireCnt(int cnt)
- {
- try
- {
- if (this.btnFireCount.InvokeRequired)
- {
- SetTextCallback d = new SetTextCallback(Display_FireCnt);
- this.btnFireCount.Invoke(d, new object[] { cnt });
- }
- else
- {
- this.fireCount = cnt;
- // cyim 2013.11.19 : 카운트 사라지는 문제
- if (cnt > 9999)
- this.btnFireCount.Text = String.Format("화재 : {0:00000}", cnt);
- else
- this.btnFireCount.Text = String.Format("화재 : {0:0000}", cnt);
- //this.lblDeviceFireCnt.Text = String.Format("{0:0000}", cnt);
- //this.btnFireCount.Image = null;//sdkim, 20120129, [MTS-47]
- //this.btnFireCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
- // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
- Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "FireDetect", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblDeviceWriteCnt 는 루틴에서 제외한다.
- //
- //설비입력값 표시
- public int facilityCount = 0; // cyim 2015.7.30 수신반 메인에서 카운터 정보를 접근해야함
- public void Display_WriteCnt(int cnt)
- {
- try
- {
- if (this.btnDevCount.InvokeRequired)
- {
- SetTextCallback d = new SetTextCallback(Display_WriteCnt);
- this.btnDevCount.Invoke(d, new object[] { cnt });
- }
- else
- {
- this.facilityCount = cnt;
- // cyim 2013.11.19 : 카운트 사라지는 문제
- if (cnt > 9999)
- this.btnDevCount.Text = String.Format("설비 : {0:00000}", cnt);
- else
- this.btnDevCount.Text = String.Format("설비 : {0:0000}", cnt);
- //this.lblDeviceWriteCnt.Text = String.Format("{0:0000}", cnt);
- //this.btnDevCount.Image = null;//sdkim, 20120129, [MTS-47]
- //this.btnDevCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
- // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
- Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "DeviceInput", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblConnetErrorCnt 는 루틴에서 제외한다.
- //
- //통신에러 표시
- public int errorCount = 0; // cyim 2015.7.30 수신반 메인에서 카운터 정보를 접근해야함
- public void Display_ErrorCnt(int cnt)
- {
- try
- {
- if (this.btnErrorCount.InvokeRequired)
- {
- SetTextCallback d = new SetTextCallback(Display_ErrorCnt);
- this.btnErrorCount.Invoke(d, new object[] { cnt });
- }
- else
- {
- this.errorCount = cnt;
- // cyim 2013.11.19 : 카운트 사라지는 문제
- if (cnt > 9999)
- this.btnErrorCount.Text = String.Format("통신 : {0:00000}", cnt);
- else
- this.btnErrorCount.Text = String.Format("통신 : {0:0000}", cnt);
- //this.lblConnetErrorCnt.Text = String.Format("{0:0000}", cnt);
- //this.btnErrorCount.Image = null;//sdkim, 20120129, [MTS-47]
- //this.btnErrorCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
- // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
- Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "RepeaterError", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblRepeaterBlockingCnt 는 루틴에서 제외한다.
- //
- //단선 표시
- public int blockingCount = 0; // cyim 2015.7.30 수신반 메인에서 카운터 정보를 접근해야함
- public void Display_BlockingCnt(int cnt)
- {
- try
- {
- if (this.btnDevCutCount.InvokeRequired)
- {
- SetTextCallback d = new SetTextCallback(Display_BlockingCnt);
- this.btnDevCutCount.Invoke(d, new object[] { cnt });
- }
- else
- {
- this.blockingCount = cnt;
- // cyim 2013.11.19 : 카운트 사라지는 문제
- if (cnt > 9999)
- this.btnDevCutCount.Text = String.Format("단선 : {0:00000}", cnt);
- else
- this.btnDevCutCount.Text = String.Format("단선 : {0:0000}", cnt);
- //this.lblRepeaterBlockingCnt.Text = String.Format("{0:0000}", cnt);
- //this.btnDevCutCount.Image = null;//sdkim, 20120129, [MTS-47]
- //this.btnDevCutCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
- // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
- Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "DeviceCut", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.18 속도개선작업 : 사용하지 않은 lblReceiverCutCnt 는 루틴에서 제외한다.
- //
- //차단 표시
- public int CutCnt = 0; // cyim 2015.7.30 수신반 메인에서 카운터 정보를 접근해야함
- public void Display_CutCnt(int cnt)
- {
- try
- {
- if (this.btnDisableCount.InvokeRequired)
- {
- SetTextCallback d = new SetTextCallback(Display_CutCnt);
- this.btnDisableCount.Invoke(d, new object[] { cnt });
- }
- else
- {
- this.CutCnt = cnt;
- // cyim 2013.11.19 : 카운트 사라지는 문제
- if (cnt > 9999)
- this.btnDisableCount.Text = String.Format("차단 : {0:00000}", cnt);
- else
- this.btnDisableCount.Text = String.Format("차단 : {0:0000}", cnt);
- //this.lblReceiverCutCnt.Text = String.Format("{0:0000}", cnt);
- //this.btnDisableCount.Image = null;//sdkim, 20120129, [MTS-47]
- //this.btnDisableCount.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
- // cyim 2015.7.30 수신반 이벤트 추가 (카운터 정보)
- Event.FireDesk_Update_SendMessage_Write(myReceiverID, "Count", "DeviceNotuse", cnt); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 전압 표시 (메인)
- public void Display_Voltage(float vol24, float vol33, float vol50)
- {
- try
- {
- // cyim 2013.3.6
- // MDIParent 와 frmDriveTest 를 동시에 처리 하도록 유도하는 것으로 예상
- // Socket Thread Cross Error 수정
- // MDIParent
- Display_24Voltage(vol24);
- //this.lbl24Voltage.Text = String.Format("{0:00.00}V", vol24);
- // cyim 2016.03.21 : 전원값 화면에 표시못하는 문제 보완
- Power_Main_vol24 = String.Format("{0:00.00}V", vol24);
- // frmDriveTest
- foreach (Form childForm in MdiChildren)
- {
- if (childForm is frmDriveTest)
- {
- frmDriveTest frm = (frmDriveTest)childForm;
- frm.Display_24Voltage(vol24);
- //frm.Display_3Voltage(vol33);
- //frm.Display_5Voltage(vol50);
- break;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //전압 표시 (서브)
- public void Display_24Voltage(float vol)
- {
- try
- {
- if (this.lbl24Voltage.InvokeRequired)
- {
- SetVoltageCallback d = new SetVoltageCallback(Display_24Voltage);
- this.lbl24Voltage.Invoke(d, new object[] { vol }); // cyim
- }
- else
- {
- this.lbl24Voltage.Text = String.Format("{0:00.00}V", vol);
- //this.lbl24Voltage.Image = null;//sdkim, 20120129, [MTS-47]
- //this.lbl24Voltage.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //축적시간표시
- private void Display_AccumulSecond()
- {
- try
- {
- if (this.lblAccumulSecond.InvokeRequired)
- {
- SetVoidCallback d = new SetVoidCallback(Display_AccumulSecond);
- // cyim 2013.7.19 속도개선작업
- this.lblAccumulSecond.Invoke(d, new object[] { });
- }
- else
- {
- if (this.ConfigVO.Fire_accumulation_second < 0)
- {
- this.ConfigVO.Fire_accumulation_second = 0;
- this.ConfigVO.Fire_accumulation_start = false;
- this.ConfigVO.Fire_accumulation_reset();
- }
- if (this.ConfigVO.Fire_accumulation_start)
- this.lblAccumulSecond.ForeColor = System.Drawing.Color.Red;
- else
- this.lblAccumulSecond.ForeColor = System.Drawing.Color.Black;
- this.lblAccumulSecond.Text = String.Format("{0}", this.ConfigVO.Fire_accumulation_second);
- this.lblAccumulSecond.Image = null;
- this.lblAccumulSecond.BackColor = Color.Transparent;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //축적시작-초기값설정
- public void Accumulate_ReStart(int second)
- {
- try
- {
- this.ConfigVO.Fire_accumulation_second = second;
- this.ConfigVO.Fire_accumulation_start = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //축적시작
- public void Accumulate_Start()
- {
- try
- {
- //이미 축적일경우에는 RESET하지 않는다.
- if (!this.ConfigVO.Fire_accumulation_start)
- {
- this.ConfigVO.Fire_accumulation_reset();
- this.ConfigVO.Fire_accumulation_start = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //축적종료
- public void Accumulate_Stop()
- {
- try
- {
- this.ConfigVO.Fire_accumulation_start = false;
- this.ConfigVO.Fire_accumulation_reset();
- Display_AccumulSecond();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.18 속도개선작업 : this.invoke 제외
- //
- //화재홀딩모드 표시
- public void Display_FireMode(bool mode)
- {
- try
- {
- if (this.lblFireMode.InvokeRequired)
- {
- SetBoolCallback d = new SetBoolCallback(Display_FireMode);
- this.lblFireMode.Invoke(d, new object[] { mode });
- }
- else
- {
- if (mode)
- this.lblFireMode.Text = "지속";//2010.11.08, k.s.d , 홀딩 -> 지속
- else
- this.lblFireMode.Text = "자동";
- //this.lblFireMode.Image = null;//sdkim, 20120129, [MTS-47]
- //this.lblFireMode.BackColor = Color.Transparent;//sdkim, 20120129, [MTS-47]
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //화재복구 처리
- public void FireReset_Process()//2010.10.29, k.s.d , demon db reset cmd by T.E.I(UB)
- {
- try
- {
- //화재홀딩 모드
- //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)
- // {
- this.SetInputTestMode(false);
- //경고화면창 닫기
- if (this.warningForm != null)
- {
- this.warningForm.Close();
- this.warningForm = null;
- this.winMsg = null;
- }
- //경고화면창 닫기
- if (this.warningForm2 != null)
- {
- this.warningForm2.Close();
- this.warningForm2 = null;
- this.winMsg = null;
- }
- //타수신기 화재 복구창 닫기
- ((Form_Popup_OtherFireAlarm)Popup.HASH_EtcReceiverFireAlarmPopup[myReceiverID.ToString()]).LIST_FIRE_INFO.Clear();
- OtherFireAlarm_ME.button_FirePopupClose.PerformClick();
- this.arrayListLog.Clear(); //현재 이벤트 제거
- Count_Display(0, 0, 0, 0, 0); //카운트 표시 0으로
- this.fireCount_Accumulation = 0; // cyim 2014.7.10 : 축적화재 카운터 도중 복구버튼누르면 축적상태알람표시가 남아있음
- FireList.Clear();
- FireList_Accumulation.Clear(); // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
- FireEventProcess();
- // cyim 2015.7.9 PreFire 표시 문제
- PreFireList.Clear();
- PreFireEventProcess();
- EquipList.Clear();
- EquipEventProcess();
- this.Accumulate_Stop(); //축적모드 종료 // cyim 2014.7.10 : 축적화재 카운터 도중 복구버튼누르면 카운터표시가 남아있음
- //CloseChildForm_Except_InitForm(); //19.04.09 초기화 폼 일찍 오류 삭제 : 화재 복구 - "BS" 단계에서 초기화폼 닫기
- // Display_FireEventComboDel(null); //제1보,2보 제거
- //Display_WriteEventComboDel(null); //제경보 제거
- // csw 2013.2.15 (복구가 두번 호출되는 현상 제거)
- //this.socketUI.ReceiverDemonReset(); //데몬 RESET 명령 // sdkim, 20111206 , delete demon reload command ( with CSW bj, jws - ubi )
- // }
- // cyim 2015.9.15 수신반 하단 이벤트 표시 : 복구
- if (_Data.FireDeskMode == true)
- {
- Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "EventProcess", "Reset", 0);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //Debug.WriteLine(string.Format("[{0}]\r\n{1}",ex.Message,ex.Source));
- }
- }
- public void ClaerAllEventListAndCount()
- {
- try
- {
- if (this.InvokeRequired)
- {
- dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(ClaerAllEventListAndCount);
- this.Invoke(d, new object[] { });
- }
- else
- {
- this.SetEmergencyBroadCastSetatus(true);
- this.arrayListLog.Clear(); //현재 이벤트 제거
- this.Count_Display(0, 0, 0, 0, 0); //카운트 표시 0으로
- this.fireCount_Accumulation = 0; // cyim 2014.7.10 : 축적화재 카운터 도중 복구버튼누르면 축적상태알람표시가 남아있음
- FireList.Clear();
- FireList_Accumulation.Clear(); // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
- FireEventProcess();
- // cyim 2015.7.9 PreFire 표시 문제
- PreFireList.Clear();
- PreFireEventProcess();
- EquipList.Clear();
- EquipEventProcess();
- //this.Display_FireEventComboDel(null); //제1보,2보 제거
- //this.Display_WriteEventComboDel(null); //제경보 제거
- this.Accumulate_Stop(); //축적모드 종료
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.18 속도개선작업 : this.invoke 제외하고 화재 처리는 textbox 1보처리는 따로한다
- //
- public void FireEventProcess()
- {
- // 일반화재
- int iFireEventCount = FireList.Count;
- // 축적화재
- int iFireEventCount_Accumulation = FireList_Accumulation.Count;
- try
- {
- if (this.cboSecondFireWarnningMessage.InvokeRequired)
- {
- dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(FireEventProcess);
- this.cboSecondFireWarnningMessage.Invoke(d, new object[] { });
- }
- else
- {
- this.Focus(); // cyim 2014.5.15 : OutofRangeException
- this.cboSecondFireWarnningMessage.Items.Clear();
- this.cboSecondFireWarnningMessage.Text = "";
- if (iFireEventCount > 0)
- {
- // 2보 정리
- for (int iLoop = 1; iLoop < iFireEventCount; iLoop++)
- this.cboSecondFireWarnningMessage.Items.Add(FireList[iLoop].ToString());
- if (this.cboSecondFireWarnningMessage.Items.Count > 0)
- this.cboSecondFireWarnningMessage.Text = this.cboSecondFireWarnningMessage.Items[0].ToString();
- // 1보 정리
- FireEventProcess_Text(this.txtFirstFireWarnningMessage, FireList[0].ToString());
- // 화재 타입
- FireEventProcess_Text(this.labelFireAlert, "화재발생");
- }
- // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
- else if (iFireEventCount_Accumulation > 0)
- {
- // 2보 정리
- for (int iLoop = 1; iLoop < iFireEventCount_Accumulation; iLoop++)
- this.cboSecondFireWarnningMessage.Items.Add(FireList_Accumulation[iLoop].ToString());
- if (this.cboSecondFireWarnningMessage.Items.Count > 0)
- this.cboSecondFireWarnningMessage.Text = this.cboSecondFireWarnningMessage.Items[0].ToString();
- // 1보 정리
- FireEventProcess_Text(this.txtFirstFireWarnningMessage, FireList_Accumulation[0].ToString());
- // 화재 타입
- FireEventProcess_Text(this.labelFireAlert, "화재축적상태 발생");
- }
- // cyim 2015.9.15 수신반 하단 이벤트 표시 : 화재 및 축적화재
- if (_Data.FireDeskMode == true)
- {
- Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "EventProcess", "Fire", 0);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2015.7.9 PreFire 표시 문제
- //
- public delegate void dCommandFuctionCallEvent_PreFireEventProcess();
- public void PreFireEventProcess()
- {
- // PreFire
- int iPreFireListCount = PreFireList.Count;
- if (this.cboPreFireWarnningMessage.InvokeRequired)
- {
- dCommandFuctionCallEvent_PreFireEventProcess d = new dCommandFuctionCallEvent_PreFireEventProcess(PreFireEventProcess);
- this.cboPreFireWarnningMessage.Invoke(d, new object[] { });
- }
- else
- {
- this.Focus(); // OutofRangeException 문제 수정
- this.cboPreFireWarnningMessage.Items.Clear();
- this.cboPreFireWarnningMessage.Text = "";
- if (PreFireList.Count > 0)
- {
- for (int i = 0; i < iPreFireListCount; i++)
- this.cboPreFireWarnningMessage.Items.Add(PreFireList[i].ToString());
- this.cboPreFireWarnningMessage.Text = PreFireList[0].ToString();
- }
- // cyim 2015.9.15 수신반 하단 이벤트 표시 : 아날로그감지기의 PreFire 처리
- if (_Data.FireDeskMode == true)
- {
- Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "EventProcess", "PreFire", 0);
- }
- }
- }
- //
- // cyim 2013.7.18 속도개선작업 : 화재 처리는 textbox 는 여기서 처리하도록 한다
- //
- public delegate void dCommandFuctionCallEvent_Text(Control Target, string Data); // cyim 2014.7.10 : 화면 하단 라벨을 화재발생 및 축적화재발생으로 구분한다 : Textbox -> Control
- public void FireEventProcess_Text(Control Target, string Data)
- {
- try
- {
- if (Target.InvokeRequired)
- {
- dCommandFuctionCallEvent_Text d = new dCommandFuctionCallEvent_Text(FireEventProcess_Text);
- Target.Invoke(d, new object[] { Target, Data });
- }
- else
- {
- Target.Text = Data;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.18 속도개선작업 : this.invoke 제외
- //
- public void EquipEventProcess()
- {
- int iEquipEventCount = EquipList.Count;
- try
- {
- if (this.cboWriteWarningMessage.InvokeRequired)
- {
- dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(EquipEventProcess);
- this.cboWriteWarningMessage.Invoke(d, new object[] { });
- }
- else
- {
- this.Focus(); // cyim 2014.5.15 : OutofRangeException
- this.cboWriteWarningMessage.Items.Clear();
- this.cboWriteWarningMessage.Text = "";
- if (iEquipEventCount > 0)
- {
- for (int iLoop = 0; iLoop < iEquipEventCount; iLoop++)
- {
- this.cboWriteWarningMessage.Items.Add(EquipList[iLoop].ToString());
- }
- if (this.cboWriteWarningMessage.Items.Count > 0)
- {
- this.cboWriteWarningMessage.Text = this.cboWriteWarningMessage.Items[0].ToString();
- }
- }
- // cyim 2015.9.15 수신반 하단 이벤트 표시 : 설비
- if (_Data.FireDeskMode == true)
- {
- Event.FireDesk_Update_SendMessage_Write(this.myReceiverID, "EventProcess", "Equip", 0);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //핫키-F3:창사이즈 최소,F4:프로그램종료
- public void MDIParent_KeyDown(object sender, KeyEventArgs e)
- {
- try
- {
- if (e.KeyCode == Keys.F3)
- {
- //창사이즈최소
- btnWinMinimum_Click(btnWinMinimum, System.EventArgs.Empty);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /* 시스템설정>운전설정 Form 생성 */
- /********************************************************/
- private void toolStripMenuItem2_Click(object sender, EventArgs e)
- {
- try
- {
- //로그인후 화면SHOW
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템설정-운전설정 메뉴 클릭");
- ShowLogin(new frmModeConfig());
- //ShowChildForm(new frmModeConfig());
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 시스템설정>맵설정 Form 생성 */
- /********************************************************/
- private void toolStripMenuItem3_Click(object sender, EventArgs e)
- {
- try
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템설정-맵설정 메뉴 클릭");
- ShowLogin(new frmMapConfig());
- //Form f = ShowChildForm(new frmMapConfig());
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 예비전원 시험 Form 생성 */
- /********************************************************/
- private void btnMenu5_Click(object sender, EventArgs e)
- {
- //Form f = ShowChildForm(new frmDriveTest());
- try //k.s.d 20101023, form init error bug fix & management form class handle.
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- LFC.Log("타입: 수신기 조작 로그, 메세지: 예비전원시험 클릭");
- winDriveTestForm = new frmDriveTest();
- ShowChildForm(winDriveTestForm);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /********************************************************/
- /********************************************************/
- /* 제어 Form 생성 */
- /********************************************************/
- private void btnMenu6_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
- if (ReceiverModel == "IFC3300")
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 차단 메뉴 클릭");
- Form f = ShowChildForm(new frmControlMode_BigReceiver());
- }
- else
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 차단 메뉴 클릭");
- Form f = ShowChildForm(new frmControlMode());
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnWinMinimum_Click(object sender, EventArgs e)
- {
- try
- {
- this.WindowState = FormWindowState.Minimized;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //command log 생성
- public void CommandLog(MappingStatus EventStatus, string message)
- {
- try
- {
- string commandType = "";
- string commandLogType = "";
- switch (EventStatus)
- {
- case MappingStatus.ProgramStart:
- {
- commandType = "OU";
- commandLogType = "UI프로그램시작";
- EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", false, EventStatus, message);
- break;
- }
- case MappingStatus.ProgramEnd:
- {
- commandType = "XU";
- commandLogType = "UI프로그램종료";
- EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", false, EventStatus, message);
- break;
- }
- case MappingStatus.CommConnectError:
- {
- commandType = "OD";
- commandLogType = "데몬연결이상";
- EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", true, EventStatus, message);
- EventLogAdd(info);
- MessageProcess(info);
- break;
- }
- case MappingStatus.CommConnectNormal:
- {
- commandType = "XD";
- commandLogType = "데몬연결정상";
- EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", false, EventStatus, message);
- EventLogDel(info); // cyim 2015.7.7 통신 데몬 연결 정상시에는 기존 실패 이벤트 삭제처리
- //MessageProcess(info);
- break;
- }
- // cyim 2015.2.10 LOG
- case MappingStatus.Log:
- {
- commandType = "LG";
- commandLogType = "수신기 조작 로그";
- EventLogInfo info = CreateCommandMessage(commandType, this.myReceiverID, 1, 0, 0, 0, 0, "A", false, EventStatus, message);
- }
- break;
- }
- if (EventStatus == MappingStatus.Log)
- {
- if (message.Substring(0, 3) == "키패드")
- {
- LFC.Log("타입: 키패드 조작 로그, 메세지: " + message);
- }
- else
- {
- if (message != "비상방송 연결 정상")
- LFC.Log("타입: " + commandLogType + ", 메세지: " + message);
- }
- }
- else
- {
- LFC.Log("타입: " + commandLogType);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //이벤트 로그 메세지 생성
- private EventLogInfo CreateCommandMessage(String Command_type, int Receiver_id
- , int Comm_id, int Board_id, int Loop_no, int Repeater_id, int Device_id, String Inout_type
- , bool LiveMsgFlag, MappingStatus EventStatus, string message
- )
- {
- EventLogInfo eventLogInfo = null;
- //try
- {
- DateTime commandTime = DateTime.Now;
- // * 'L' 밀리 세컨드. 필요에 따라서 0을 선두에 추가해, 3 자리수로 표현합니다 (000 - 999).
- //* 'N' 나노초. 필요에 따라서 0을 선두에 추가해, 9 자리수로 표현합니다 (000000000 - 999999999).
- 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
- , Receiver_id, Comm_id, Board_id, Loop_no, Repeater_id, Device_id, Inout_type, commandTime.Millisecond);
- eventLogInfo = new EventLogInfo(commandId);
- //MskDeviceIDString device_str = new MskDeviceIDString(
- // Comm_id, Board_id, Loop_no, Repeater_id, Device_id, Inout_type);
- string eventTypeName = this.socketUI.EventTypeName(Command_type, "");
- //string message = String.Format("[{0}]{1} ", Command_type, eventTypeName);
- string command_time = String.Format("{0:yyyy}{0:MM}{0:dd}{0:HH}{0:mm}{0:ss}{1:00000}", commandTime, commandTime.Millisecond);
- //eventLogInfo.EventTime = command_time;
- eventLogInfo.EventTime = commandTime;
- eventLogInfo.EventType = Command_type; //-----------------------
- eventLogInfo.EventTypeName = eventTypeName; //-----------------------
- eventLogInfo.Message = message; //-----------------------
- eventLogInfo.EventStatus = EventStatus;
- eventLogInfo.LiveMsgFlag = LiveMsgFlag;
- eventLogInfo.ReceiverID = Receiver_id;
- eventLogInfo.CommId = Comm_id;
- eventLogInfo.BoardNo = Board_id;
- eventLogInfo.LoopNo = Loop_no;
- eventLogInfo.RepeaterNo = Repeater_id;
- eventLogInfo.DeviceId = Device_id;
- eventLogInfo.InoutType = Inout_type;
- eventLogInfo.DeviceMessage = Util.device_message(Inout_type, Receiver_id, Comm_id, Board_id, Loop_no, Repeater_id, Device_id);
- //eventLogInfo.Confirm_flag = "N";
- //eventLogInfo.Confirm_remark = message;
- //command 로그 생성
- DacUIProcess dacUIProcess = new DacUIProcess(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacUIProcess.Command_Log_UPDATE(QUERYMode.insert, commandId, command_time, Command_type, Receiver_id
- , Comm_id, Board_id, Loop_no, Repeater_id, Device_id, Inout_type, message);
- }
- //catch (Exception ex)
- //{
- // Util.UErrorMessage(ex, 0, 0);
- //}
- return eventLogInfo;
- }
- // 현장 도면 버튼 Click Event
- private void btnMenu7_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- LFC.Log("타입: 수신기 조작 로그, 메세지: 현장도면 클릭");
- Form f = ShowChildForm(new FormField(this.xField, this.DataType_Set));
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //화재발생내역
- private void label5_Click(object sender, EventArgs e)
- {
- try
- {
- FormLogView frm = new FormLogView(true);
- frm = (FormLogView)ShowChildForm(frm);
- frm.InitFormLogView(true);
- //frm.SetSearchCondition("OF");
- frm.SearchType(0);
- //frm.DataLoadProcess();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //설비가동내역
- private void label6_Click(object sender, EventArgs e)
- {
- try
- {
- FormLogView frm = new FormLogView(true);
- frm = (FormLogView)ShowChildForm(frm);
- frm.InitFormLogView(true);
- //frm.SetSearchCondition("OE");
- frm.SearchType(1);
- //frm.DataLoadProcess();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //통신에러내역
- private void label9_Click(object sender, EventArgs e)
- {
- //OM-통신모듈 통신정상-LOOP 통신정상,XM-통신모듈 통신이상-LOOP 통신이상
- //OR-중계기 통신정상,XR-중계기 통신이상
- //OI-I/O 모듈 통신정상,XI-I/O 모듈 통신이상
- //OK-키패드모듈 통신정상,XK-키패드모듈 통신이상
- try
- {
- FormLogView frm = new FormLogView(true);
- frm = (FormLogView)ShowChildForm(frm);
- frm.InitFormLogView(true);
- //frm.SetSearchCondition("XMXRXIXK");
- frm.SearchType(2);
- //frm.DataLoadProcess();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //단선발생내역
- private void label7_Click(object sender, EventArgs e)
- {
- try
- {
- FormLogView frm = new FormLogView(true);
- frm = (FormLogView)ShowChildForm(frm);
- frm.InitFormLogView(true);
- //frm.SetSearchCondition("OL");
- frm.SearchType(3);
- //frm.DataLoadProcess();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //차단내역
- private void label8_Click(object sender, EventArgs e)
- {
- try
- {
- //FormLogView frm = new FormLogView(true);
- //frm = (FormLogView)ShowChildForm(frm);
- //frm.InitFormLogView(true);
- //frm.SetSearchCondition("CE");
- //UIReceiverInfo cfg = new UIReceiverInfo(this.myReceiverID);
- ////int cut_cnt = cfg.Count_ReceiverCut(this.myReceiverTypeInfo);
- //ArrayList ary = new ArrayList();
- //ary = cfg.Array_ReceiverCut(this.ui.MyReceiverTypeInfo);
- //frm.EventLogInfos = ary;
- //frm.DataLoadProcess();
- // cyim 2013.9.26 중계기차단 보완 // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- if (Popup.Form_Popup_CutInfo_Enable == false)
- {
- Popup.Form_Popup_CutInfo_Main = new Form_Popup_CutInfo(this);
- Popup.Form_Popup_CutInfo_Main.Show();
- }
- else
- {
- Popup.Form_Popup_CutInfo_Main.Select();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 점검 카운터 클릭
- private void lblCheckCnt_Click(object sender, EventArgs e)
- {
- // cyim 2014.1.10 : 점검카운터 추가
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- LFC.Log("타입: 수신기 조작 로그, 메세지: 점검 카운터 클릭");
- // 창을 표시
- FormLogView frm = new FormLogView(true);
- frm = (FormLogView)ShowChildForm(frm);
- frm.InitFormLogView(true);
- // 점검 : 보드이상
- frm.SearchType(4);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 화재 카운터 클릭
- private void lblDeviceFireCnt_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- LFC.Log("타입: 수신기 조작 로그, 메세지: 화재 카운터 클릭");
- label5_Click(label5, System.EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 설비 카운터 클릭
- private void lblDeviceWriteCnt_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- LFC.Log("타입: 수신기 조작 로그, 메세지: 설비 카운터 클릭");
- label6_Click(label6, System.EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 통신 카운터 클릭
- private void lblConnetErrorCnt_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- LFC.Log("타입: 수신기 조작 로그, 메세지: 통신 카운터 클릭");
- label9_Click(label9, System.EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 단선 카운터 클릭
- private void lblRepeaterBlockingCnt_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- LFC.Log("타입: 수신기 조작 로그, 메세지: 단선 카운터 클릭");
- label7_Click(label7, System.EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 차단 카운터 클릭
- private void lblReceiverCutCnt_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2013.10.2 : 복구 및 통신데몬 시작 팝업창에서는 동작안함
- if (this.warningForm3 != null && this.warningForm3.Visible == true) return;
- // cyim 2016.12.13 : 추가 모든 데이타 저장 버튼 누르지 않으면 안된다
- if (this.MDIReceiverConfig_Change_Flag == true) { MessageBox.Show("설정 변경되었음. 반드시 모든 데이타 저장(수신기 쓰기) 버튼을 실행하십시요!"); return; }
- LFC.Log("타입: 수신기 조작 로그, 메세지: 차단 카운터 클릭");
- label8_Click(label8, System.EventArgs.Empty);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 1시간 단위로 실행.
- // Firebird 파일을 Backup.
- private void timerMaintance_Tick(object sender, EventArgs e)
- {
- try
- {
- //1시간마다..
- if (myDbBackUpDate == DateTime.Parse("1999-01-01"))
- {
- myDbBackUpDate = Util.getBackUpLastDateTime(); // cyim 2015.8.12 데이타베이스 용량 문제 : 분석 - 레지스트리값을 읽기
- }
- TimeSpan sp = DateTime.Now - myDbBackUpDate;
- if (sp.TotalDays >= 30)
- {
- myDbBackUpDate = DateTime.Now;
- // cyim 2015.7.29 수신반 루틴을 위해 외부 파라미터로 동작하도록 수정
- //string filePath = Util.FirebirdPath();
- string filePath = _Data.Registry_DATABASE_NAME_PATH;
- if (filePath.Length > 0)
- {
- FileInfo f = new FileInfo(filePath);
- if (f.Exists)
- {
- FireDbBackup(filePath);
- Util.setBackUpLastDateTime(myDbBackUpDate); // cyim 2015.8.12 데이타베이스 용량 문제 : 분석 - 레지스트리값을 쓰기
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //파이어버드 DB 백업 저장..
- private void FireDbBackup(string filePath)
- {
- try
- {
- if (filePath.Length > 0)
- {
- int pos = filePath.LastIndexOf(".");
- string fileName = filePath.Substring(0, pos);
- string ext = filePath.Substring(pos + 1, filePath.Length - pos - 1);
- ext = ext.ToUpper();
- if (File.Exists(filePath))
- {
- int no = 0;
- string filePath2 = string.Format("{0}_{1:yyyyMMdd_HHmmss}.{2}", fileName, DateTime.Now, ext);
- while (File.Exists(filePath2))
- {
- ++no;
- filePath2 = string.Format("{0}_{1:yyyyMMdd}_HHmmss_{2}.{3}", fileName, DateTime.Now, no, ext);
- }
- File.Copy(filePath, filePath2);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //2010.11.08, k.s.d , ll child window close.
- public void CloseChildForm()
- {
- try
- {
- // cyim 2015.7.10 크로스 스레드 예외처리
- if (this.InvokeRequired)
- {
- SetVoidCallback d = new SetVoidCallback(CloseChildForm);
- this.Invoke(d, new object[] { });
- }
- else
- {
- foreach (Form childForm in MdiChildren)
- {
- childForm.Close();
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //2010.11.08, k.s.d , ll child window close.
- public void CloseChildForm_Except_InitForm()
- {
- try
- {
- // cyim 2015.7.10 크로스 스레드 예외처리
- if (this.InvokeRequired)
- {
- SetVoidCallback d = new SetVoidCallback(CloseChildForm_Except_InitForm);
- this.Invoke(d, new object[] { });
- }
- else
- {
- foreach (Form childForm in MdiChildren)
- {
- if (childForm is frmWarningBox)
- {
- ;
- }
- else
- {
- childForm.Close();
- }
- }
- //System.Threading.Thread.Sleep(30000);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.19 속도개선작업
- //
- // 최초로 쿼리 되는 결과 테이블을 저장해두고 이를 이용해서 결과를 도출하면 제일 빠르지/만 현재 사용하는 루틴이 많으므로
- // 정렬조건을 삭제하여 속도를 향상한다. 여기에서는 정렬이 의미없으므로 새로운 쿼리를 적용해도 무방하다
- private bool CheckOutputDeviceTypeStop()
- {
- bool ret = false;
- DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacDeviceConfig.Device_type_Select_NotOrdering(code_InOutType.Output, null);
- // cyim 2016.12.28 : 예외처리 추가 : 사용빈도수가 엄청 높은 함수는 방어코드가 필요함 : 특히 수신반처럼 네트워크 DB 를 이용하는 상황에서는 필요함
- if (dt != null && dt.Rows.Count != 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- // cyim 2015.7.7 주경종 허용에 따른 쿼리변경
- // 즉, 설비연동에서도 주경종이 추가될수 있도록 컨셉이 바뀌었다.
- //if (dr["USE_FLAG"].ToString() == "N" && dr["DEVICE_TYPE"].ToString() != "OA")
- if (dr["USE_FLAG"].ToString() == "N")
- {
- ret = true;
- break;
- }
- }
- }
- return ret;
- }
- //public void SetLikageBtnStatus() {
- // if (this.InvokeRequired) {
- // dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(SetLikageBtnStatus);
- // this.Invoke(d, new object[] { });
- // }
- // else {
- // if (this.CheckOutputDeviceTypeStop()) {
- // imgIndexbtnMenu1_normal = 21;
- // if (btnMenu1.ImageIndex == cstBtnMenu1) {
- // btnMenu1.ImageIndex = imgIndexbtnMenu1_normal;
- // }
- // }
- // else {
- // imgIndexbtnMenu1_normal = cstBtnMenu1;
- // if (btnMenu1.ImageIndex == 21) {
- // btnMenu1.ImageIndex = imgIndexbtnMenu1_normal;
- // }
- // }
- // }
- //}
- //
- // cyim 2013.7.18 속도개선작업 : 여기 함수에서 접근가능한 변수는 Component 가 아니다. 불필요한 invoke 는 삭제한다
- //
- private bool likageBtnStatus = false;
- public void SetLikageBtnStatus()
- {
- //if (this.InvokeRequired)
- //{
- // dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(SetLikageBtnStatus);
- // this.Invoke(d, new object[] { });
- //}
- //else
- {
- // cyim 2015.7.7 속도개선작업
- // 속도에 악영향을 미치는 대표적인 함수이다. 남용이 많은 현재 프로그램에서 대표적인 사례이다.
- // 설비연동이 주용도가 될것같은데, 주경종을 제외하고 출력타입의 디바이스중 한개라도 사용하지 않는다면 true 를 반환한다
- // 결국 설비연동정지가 한개라도 눌려진 경우에는 likageBtnStatus 변수가 true 로 변경된다
- if (this.CheckOutputDeviceTypeStop())
- {
- this.likageBtnStatus = true;
- }
- else
- {
- this.likageBtnStatus = false;
- }
- //this.SelectMenuIndex = this.SelectMenuIndex;
- }
- }
- private void toolStripMenuItem7_Click(object sender, EventArgs e)
- {
- try
- {
- // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
- if (ReceiverModel == "IFC3300")
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-버전 정보 보기 메뉴 클릭");
- Form f = ShowChildForm(new frmVersion_BigReceiver());
- }
- else
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-버전 정보 보기 메뉴 클릭");
- Form f = ShowChildForm(new frmVersion());
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- int togglecont = 0;
- // 500 ms 단위
- private void timerEventCheck_Tick(object sender, EventArgs e)
- {
- if (this.togglecont++ > 10)
- {
- this.togglecont = 0;
- }
- // this.FireCheck();
- // this.FacilityCheck();
- FireFacilityEventCheck();
- // cyim 2016.06.15 : 화재 음원 출력
- if (SoundPlayer_AlarmPopupSound_Count > 6)
- {
- SoundPlayer_AlarmPopupSound_Count = 0; // 3초마다
- AlarmPopup_PlaySound_Check();
- }
- else
- {
- SoundPlayer_AlarmPopupSound_Count++;
- }
- //System.GC.Collect();
- //Application.DoEvents();
- // cyim 2014.1.14 : 점검카운터 내용이 존재하는 경우에만 빨강색상처리
- if (CheckBtn_Current_Status == true || MonitorDaemon_ComErrorCheck() == false) // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
- {
- if (togglecont % 2 == 0)
- Display_Check(true);
- else
- Display_Check(false);
- }
- else
- {
- Display_Check(false);
- }
- }
- // cyim 2014.8.8 통신점검 시나리오 신규 작업 (네트워크 수신기의 통신 상태)
- public bool MonitorDaemon_ComErrorCheck()
- {
- lock (CS_MonitorDaemon_ComStatus)
- {
- // 타수신기가 존재하고 모니터데몬에 접속중인 경우
- if (this.NetworkReceiver_ID_ComStatus.Count > 0 && this.MonitorDaemon_Enable == true)
- {
- // 모니터데몬에 접속을 못하는 경우
- if (this.MonitorDaemon_ComStatus == false)
- {
- return false;
- }
- // 타수신기의 통신상태가 이상인 경우
- else
- {
- // cyim 2014.8.12 네트워크 수신기 통신상태 문제 수정 (해쉬테이블은 DirectionEntry 를 이용하여 데이타를 추출하면 중간에 그 데이타가 변경되면 오류 발생됨)
- foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
- {
- if ((bool)NetworkReceiver_ID_ComStatus[ReceiverID] == false)
- return false;
- }
- }
- }
- }
- return true;
- }
- // 화재 처리와 설비 동작 처리를 한번에 수행한다.
- public delegate void dCommandFuctionCallEvent();
- public void FireFacilityEventCheck()
- {
- if (this.InvokeRequired)
- {
- dCommandFuctionCallEvent d = new dCommandFuctionCallEvent(FireFacilityEventCheck);
- this.Invoke(d, new object[] { });
- }
- else
- {
- //
- // 화재
- //
- if (this.fireCount > 0)
- {
- this.labelFireAlert.Visible = true;
- //this.labelFireAlert.Image = null;//sdkim, 20120129, [MTS-47]
- this.labelFireAlert_inform_1th.Visible = true;
- this.txtFirstFireWarnningMessage.Visible = true;
- if (this.fireCount > 1)
- {
- this.labelFireAlert_inform_2th.Visible = true;
- this.cboSecondFireWarnningMessage.Visible = true;
- }
- else
- {
- this.labelFireAlert_inform_2th.Visible = false;
- this.cboSecondFireWarnningMessage.Visible = false;
- }
- if (togglecont % 2 == 0)
- {
- this.labelFireAlert.BackColor = Color.Red;
- this.labelFireAlert.ForeColor = Color.Black;
- }
- else
- {
- this.labelFireAlert.BackColor = Color.Transparent;
- this.labelFireAlert.ForeColor = Color.Red;
- }
- }
- // cyim 2014.7.10 : 축적화재 표시 : KFI 요청사항
- else if (this.fireCount_Accumulation > 0)
- {
- // 상위 화재와 동일한 코드이다. 굳이 상위와 합치지 않은 이유는 우선순위는 무조건 일반 화재가 높기 때문이다. (위험도 고려)
- this.labelFireAlert.Visible = true;
- //this.labelFireAlert.Image = null;//sdkim, 20120129, [MTS-47]
- this.labelFireAlert_inform_1th.Visible = true;
- this.txtFirstFireWarnningMessage.Visible = true;
- if (this.fireCount_Accumulation > 1)
- {
- this.labelFireAlert_inform_2th.Visible = true;
- this.cboSecondFireWarnningMessage.Visible = true;
- }
- else
- {
- this.labelFireAlert_inform_2th.Visible = false;
- this.cboSecondFireWarnningMessage.Visible = false;
- }
- if (togglecont % 2 == 0)
- {
- this.labelFireAlert.BackColor = Color.Red;
- this.labelFireAlert.ForeColor = Color.Black;
- }
- else
- {
- this.labelFireAlert.BackColor = Color.Transparent;
- this.labelFireAlert.ForeColor = Color.Red;
- }
- }
- else
- {
- this.labelFireAlert.Visible = false;
- this.txtFirstFireWarnningMessage.Visible = false;
- this.labelFireAlert_inform_1th.Visible = false;
- this.cboSecondFireWarnningMessage.Visible = false;
- this.cboSecondFireWarnningMessage.Items.Clear();
- this.labelFireAlert_inform_2th.Visible = false;
- }
- //
- // cyim 2015.7.9 PreFire 표시 문제 : 아날로그 감지기는 PreFire 단계가 있다
- //
- if (this.PreFireList.Count > 0)
- {
- this.labelPreFireAlert.Visible = true;
- this.cboPreFireWarnningMessage.Visible = true;
- if (togglecont % 2 == 0)
- {
- this.labelPreFireAlert.BackColor = Color.Red;
- this.labelPreFireAlert.ForeColor = Color.Black;
- }
- else
- {
- this.labelPreFireAlert.BackColor = Color.Transparent;
- this.labelPreFireAlert.ForeColor = Color.Red;
- }
- }
- else
- {
- this.labelPreFireAlert.Visible = false;
- this.cboPreFireWarnningMessage.Visible = false;
- this.cboPreFireWarnningMessage.Items.Clear();
- }
- //
- // 설비
- //
- if (this.facilityCount > 0)
- {
- this.labelFacilityAlert.Visible = true;
- //this.labelFacilityAlert.Image = null;//sdkim, 20120129, [MTS-47]
- this.cboWriteWarningMessage.Visible = true;
- this.labelFacilityAlert_inform_1th.Visible = true;
- if (togglecont % 2 == 0)
- {
- this.labelFacilityAlert.BackColor = Color.Blue;
- this.labelFacilityAlert.ForeColor = Color.White;
- }
- else
- {
- this.labelFacilityAlert.BackColor = Color.Transparent;
- this.labelFacilityAlert.ForeColor = Color.LightSkyBlue;
- }
- }
- else
- {
- this.labelFacilityAlert.Visible = false;
- this.cboWriteWarningMessage.Visible = false;
- this.cboWriteWarningMessage.Items.Clear();
- this.labelFacilityAlert_inform_1th.Visible = false;
- }
- //
- // cyim 2017.01.18 : 신규 스위치 정보 표시
- //
- //LEDCount = LEDList.Count;
- //if (this.LEDCount > 0)
- //{
- // this.lblLEDText.Text = LEDList[LEDCount - 1].ToString();
- // this.lblLEDText.Visible = true;
- // if (togglecont % 2 == 0)
- // {
- // this.lblLEDText.BackColor = Color.LightPink;
- // this.lblLEDText.ForeColor = Color.White;
- // }
- // else
- // {
- // this.lblLEDText.BackColor = Color.Transparent;
- // this.lblLEDText.ForeColor = Color.LightPink;
- // }
- //}
- //else
- //{
- // this.lblLEDText.Visible = false;
- //}
- // cyim 2017.01.24 : 자동아님 상태면 펌프 점멸 표시하도록 한다
- PumpSwitchStatusLabel(this.label_P1, Pump_1, 1);
- PumpSwitchStatusLabel(this.label_P2, Pump_2, 2);
- PumpSwitchStatusLabel(this.label_P3, Pump_3, 3);
- PumpSwitchStatusLabel(this.label_P4, Pump_4, 4);
- PumpSwitchStatusLabel(this.label_P5, Pump_5, 5);
- PumpSwitchStatusLabel(this.label_P6, Pump_6, 6);
- PumpSwitchStatusLabel(this.label_P7, Pump_7, 7);
- PumpSwitchStatusLabel(this.label_P8, Pump_8, 8);
- }
- }
- // 펌프 스위치 상태 (0 : 정지, 1 : 자동 2 : 수동)
- public void PumpSwitchStatusLabel(Label label, int status, int no)
- {
- switch (status)
- {
- case 0:
- if (togglecont % 2 == 0)
- {
- label.BackColor = Color.WhiteSmoke;
- label.Text = string.Format("P{0} ", no);
- }
- else
- {
- label.BackColor = Color.DarkGray;
- label.Text = string.Format("P{0} ", no);
- }
- break;
- case 1:
- {
- label.BackColor = Color.YellowGreen;
- label.Text = string.Format(" P{0} 자동", no);
- }
- break;
- case 2:
- if (togglecont % 2 == 0)
- {
- label.BackColor = Color.LightBlue;
- label.Text = string.Format(" P{0} 수동", no);
- }
- else
- {
- label.BackColor = Color.DarkGray;
- label.Text = string.Format(" P{0} 수동", no);
- }
- break;
- }
- }
- private List<XMLField> xField = null;
- private Dev_Type_Set DataType_Set = null;
- public int InitXFieldData(string sPrjPath)
- {//xml data 초기화
- XMLReader xmlR = null;
- xmlR = new XMLReader();
- DacFieldConfig db = new DacFieldConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- xmlR.SetXML_BasePath(sPrjPath, this.dtDeviceDBList2);
- this.DataType_Set = xmlR.GetXMLDevTypeData("DevType.xml");
- this.xField = xmlR.GetXMLFieldData("FieldSetting.xml");
- return xField.Count;
- }
- // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
- //public bool bJumpField = true;
- public delegate void dCommandFuctionCall(EventLogInfo eventLog);
- public void FireDetect(EventLogInfo eventLog)
- {
- // 화재 감시 이벤트 처리
- try
- {
- if (this.InvokeRequired)
- {
- dCommandFuctionCall d = new dCommandFuctionCall(FireDetect);
- this.Invoke(d, new object[] { eventLog });
- }
- else
- {
- // cyim 2013.7.29 화재시화면전환 정보 데이타베이스 저장 및 읽기
- //if (bJumpField)
- if (this.ConfigVO.Jump_field_flag == "Y")
- {
- // 도면 전환 설정시
- DataTable Dt = null;
- DacDeviceConfig db = new DacDeviceConfig(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- try
- {
- Dt = db.SelectDevice(eventLog.ReceiverID, eventLog.BoardNo, eventLog.LoopNo, eventLog.RepeaterNo, eventLog.DeviceId, eventLog.InoutType);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- if (Dt != null && Dt.Rows.Count > 0)
- {
- DataRow dr = Dt.Rows[0];
- string sTemp = dr["JUMP_FIELD_ID"].ToString();
- if (sTemp.Length != 0)
- {
- int id = Int32.Parse(dr["JUMP_FIELD_ID"].ToString());
- //Util.UDebugMessage(string.Format("FireDetect JUMP_FIELD_ID = {0}", id), 0, 0);
- FormField formField = (FormField)ShowChildForm(new FormField(this.xField, this.DataType_Set));
- formField.JumpField(id);
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 카운트 업데이트 타이머
- private void timerCountRead_Tick(object sender, EventArgs e)
- {
- if (this.ui.Connected)
- {
- this.IdleCountCheck();
- }
- }
- // private bool ISIdle { get { return (this.ui.TermEventReciveTime > 0 && this.ui.TermEventReciveTime > 1000 * 30); } }
- private bool countValueCheckFalse = false; //화재, 설비, 통신, 단선, 차단
- public void CountValueCheck(int cnt_DeviceFire, int cnt_DeviceWrite, int cnt_ConnetError, int cnt_RepeaterBlocking, int cnt_ReceiverCut)
- {
- try
- {
- if ((this.fireCount != cnt_DeviceFire) || (this.facilityCount != cnt_DeviceWrite) || (this.errorCount != cnt_ConnetError) || (this.blockingCount != cnt_RepeaterBlocking))
- {
- //if (this.ui.TermEventReciveTime > 1000 * 60) {// count error, reload event list if get event term over 60 sec
- if (this.countValueCheckFalse == true)
- {
- //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);
- this.ClaerAllEventListAndCount();
- this.ui.Event_Read(null);
- }
- else
- {
- this.countValueCheckFalse = true;
- //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);
- }
- }
- else
- {// check ok
- this.countValueCheckFalse = false;
- //Util.UDebugMessage("CountValueCheck OK", 0, 0);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- void IdleCountCheck()
- {// 카운터 체크 호출 함수
- this.ui.CountRead();
- }
- private void timerLoading_Tick(object sender, EventArgs e)
- {// 사용안함
- //if (this.ui.Connected) {
- // if (this.ui.TermEventReciveTime > 0 && this.ui.TermEventReciveTime < 5000) {
- // if (!this.pictureBoxLoading.Visible) {
- // this.ImageLoadingPBoxLaoding();
- // }
- // this.pictureBoxLoading.Visible = true;
- // }
- // else {
- // this.pictureBoxLoading.Visible = false;
- // }
- //}
- //else {
- // this.pictureBoxLoading.Visible = false;
- //}
- }
- private void lblDemonStatus_Click(object sender, EventArgs e)
- {// 데몬 통신이상시 강제 재연결
- this.ui.ServiceStart();
- }
- class DataEventLog
- {// 로그 이벤트 임시저장 데이터 클래스
- public string eventID = "";
- public string eventTime = "";
- public string eventType = "";
- public int receverID = 0;
- public int commID = 0;
- public int boardID = 0;
- public int loopNo = 0;
- public int repeaterID = 0;
- public int deviceID = 0;
- public string inoutType = "";
- public int dataValue = 0;
- public string eventRemark = "";
- public string sendFlag = "";
- public DataEventLog(DataRow dr)
- {
- this.eventID = dr["EVENT_ID"].ToString();
- this.eventTime = dr["EVENT_TIME"].ToString();
- this.eventType = dr["EVENT_TYPE"].ToString();
- this.receverID = Int32.Parse(dr["RECEIVER_ID"].ToString());
- this.commID = Int32.Parse(dr["COMM_ID"].ToString());
- this.boardID = Int32.Parse(dr["BOARD_ID"].ToString());
- this.loopNo = Int32.Parse(dr["LOOP_NO"].ToString());
- this.repeaterID = Int32.Parse(dr["REPEATER_ID"].ToString());
- this.deviceID = Int32.Parse(dr["DEVICE_ID"].ToString());
- this.inoutType = dr["INOUT_TYPE"].ToString();
- this.dataValue = Int32.Parse(dr["DATA_VALUE"].ToString());
- this.eventRemark = dr["EVENT_REMARK"].ToString();
- this.sendFlag = dr["SEND_FLAG"].ToString();
- }
- }
- // cyim 2015.8.12 데이타베이스 용량 문제 : 30000 건이 넘었는지는 항상 새벽 3시에 검사하고, 넘었다고 가정하는 기준은 1.1 배이다
- void EventLogDeleteProc(int deleteLogCount)
- {
- // 특정 이상 넘는 DB 이력 삭제 함수
- DacUIProcess db = new DacUIProcess(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- int logCount = db.GetEventLogCount(this.myReceiverID);
- //for (int i = 0; i < this.arrayListLog.Count; i++) {
- // EventLogInfo elog = (EventLogInfo)this.arrayListLog[i];
- // if (elog.EventId != "000000000000000000000000000000000" && elog.LiveMsgFlag) {
- // logCount++;
- // }
- //}
- if (logCount > deleteLogCount * 1.1)
- {// 삭제 건수의 1.1배 이상이면 동작
- string logTime = db.GetEventLogTime(this.myReceiverID, deleteLogCount - 1);
- ////Util.UDebugMessage(string.Format("EventLogDeleteProc logCount = {0}, logTime = {1}", logCount, logTime), 0, 0);
- if (logTime.Length == 19)
- {// 이력 ID 길이 체크
- string event_time_s = String.Format("{0}-{1}-{2} {3}:{4}:{5}.{6}", logTime.Substring(0, 4), logTime.Substring(4, 2),
- logTime.Substring(6, 2), logTime.Substring(8, 2), logTime.Substring(10, 2), logTime.Substring(12, 2), logTime.Substring(14));
- DateTime eventTime = DateTime.Parse(event_time_s);
- // cyim 2015.8.12 데이타베이스 용량 문제 : 하위 루틴 제거
- // 아래의 루틴은 이해할수가 없다. 왜 하루에 1번 그것도 새벽 3시에 미업데이트된 이벤트를 체크하고 현재이벤트 리스트에 넣어야되는가?
- // 우선은 여기 함수는 그동안 사용되지 않았던 함수이므로 보수적으로 접근한다. 주석 처리함
- //////Util.UDebugMessage(string.Format("EventLogDeleteProc logTime = {0}", logTime), 0, 0);
- //List<DataEventLog> eventLog = new List<DataEventLog>();
- //// cyim 2015.7.6 속도개선작업
- //// 해쉬 리스트 구현 방법은 아래와 같다
- //// 키 : ReceiverID-CommId-BoardNo-LoopNo-RepeaterNo-DeviceId-InoutType-EventType
- //// 데이타 : EventLogInfo 클래스
- //foreach (DictionaryEntry d in arrayListLog)
- //{
- // EventLogInfo elog = (EventLogInfo)d.Value;
- ////for (int i = 0; i < this.arrayListLog.Count; i++)
- ////{
- //// EventLogInfo elog = (EventLogInfo)this.arrayListLog[i];
- // if (elog.EventId != "000000000000000000000000000000000" && elog.LiveMsgFlag)
- // {// 미 업데이트 이벤트 체크
- // if (eventTime > elog.EventTime)
- // {
- // ////Util.UDebugMessage(string.Format("EventLogDeleteProc add elog.EventId = {0}", elog.EventId), 0, 0);
- // DataTable dt = db.SelectLogEvnetID(elog.EventId);
- // if (dt.Rows.Count > 0)
- // {
- // eventLog.Add(new DataEventLog(dt.Rows[0]));
- // }
- // }
- // }
- //}
- db.DeleteEventLogDataTime(logTime);
- db.DeleteCommandLogData(logTime);// cyim 2015.8.20 조작로그도 이벤트로그와 동일하게 삭제됨
- // cyim 2015.8.12 데이타베이스 용량 문제 : 하위 루틴 제거
- //foreach (DataEventLog log in eventLog)
- //{
- // db.AddEventLogData(log.eventID, log.eventTime, log.eventType, log.receverID, log.commID, log.boardID, log.loopNo,
- // log.repeaterID, log.deviceID, log.inoutType, log.dataValue, log.eventRemark, log.sendFlag);
- //}
- }
- }
- }
- //
- // 이벤트 삭제 타이머
- //
- private void timerLogDelete_Tick(object sender, EventArgs e)
- {
- try
- {
- // cyim 분석 : 1시간마다 실행되는 타이머이므로 1일에 1번 실행된다.
- // 0부터 23 사이의 값으로 표시되는 시간 구성 요소입니다.
- if (DateTime.Now.Hour == 3)
- {
- // cyim 2015.8.20 이벤트로그는 50000건 : 새벽 3시에 1회 실행됨
- this.EventLogDeleteProc(50000);
- // cyim 2015.8.20 외부파일 로그 삭제
- string FireBirdLogPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles, Environment.SpecialFolderOption.None);
- FireBirdLogPath += "\\Firebird\\Firebird_2_5\\firebird.log";
- if (File.Exists(FireBirdLogPath) == true)
- File.Delete(FireBirdLogPath);
- //
- // cyim 2015.8.20 조작로그도 이벤트로그와 동일하게 삭제됨 : 하위루틴 제거
- //
- //if (this.pictureBoxLoading.Visible == false) // 의미없다
- //{
- //idle status
- //this.EventLogDeleteProc(30000);
- //}
- //// cyim 2015.2.13 로그는 2년 유지
- //DacUIProcess db = new DacUIProcess(myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- //DateTime commandTime = DateTime.Now;
- //commandTime = commandTime.AddYears(-2); // 2년 전
- //string command_time = String.Format("{0:yyyy}{0:MM}{0:dd}{0:HH}{0:mm}{0:ss}{1:00000}", commandTime, commandTime.Millisecond);
- //db.DeleteCommandLogData(command_time);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void timerVoltage_Tick(object sender, EventArgs e)
- {// 전압 읽는 타이머
- this.ui.Voltage_Read(null);
- }
- // cyim 2015.7.31 비상방송 및 통신데몬도 점검으로 표시함
- public bool lblEmergencyBoardStatus_Visible = false;
- public void SetEmergencyBroadCastSetatus(bool status)
- {
- // 비상방송 에러 표시 함수
- try
- {
- if (this.InvokeRequired)
- {
- SetBoolCallback d = new SetBoolCallback(SetEmergencyBroadCastSetatus);
- this.Invoke(d, new object[] { status });
- }
- else
- {
- // 비상방송 통신이상 일경우 라벨이 표시됨
- if (status == false)
- {
- this.lblEmergencyBoardStatus_Visible = this.lblEmergencyBoardStatus.Visible = true;
- }
- else
- this.lblEmergencyBoardStatus_Visible = this.lblEmergencyBoardStatus.Visible = false;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public bool inputTestMode = false;
- public void SetInputTestMode(bool testmode)
- {// 입력 강제 테스트 모드 진입 함수
- if (testmode == true)
- {
- this.labelinputTestMode.Visible = true;
- this.inputTestMode = true;
- this.timerTestMode.Start();
- }
- else
- {
- this.labelinputTestMode.BackColor = Color.Transparent;
- this.labelinputTestMode.Visible = false;
- this.inputTestMode = false;
- this.timerTestMode.Stop();
- }
- }
- private void timerTestMode_Tick(object sender, EventArgs e)
- {// 입력 강제 테스트 모드 화면 표시 함수
- if (this.labelinputTestMode.BackColor == Color.Transparent)
- {
- this.labelinputTestMode.BackColor = Color.Red;
- this.labelinputTestMode.Visible = true;
- }
- else
- {
- this.labelinputTestMode.BackColor = Color.Transparent;
- }
- }
- private void picCI_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- ui.ReadIO15Input();
- }
- // cyim 2013.7.19 버퍼 초과 경고창
- private void _Event_SocketBufferError_Inform_Event(string ErrorText)
- {
- this.ShowMessageForm3(MappingStatus.CommConnectError, "통신오류", ErrorText);
- }
- // cyim 2014.4.7 : 마우스 포커스가 점검 버튼 위에 있을때 동작 추가
- private void btnCheck_MouseEnter(object sender, EventArgs e)
- {
- if (CheckBtn_Current_Status == true || MonitorDaemon_ComErrorCheck() == false) // cyim 2014.8.8 통신점검 시나리오 신규 작업
- this.btnCheck.FlatAppearance.MouseOverBackColor = Color.Red;
- else
- this.btnCheck.FlatAppearance.MouseOverBackColor = Color.Transparent;
- this.btnCheck.Update();
- }
- // cyim 2014.8.8 통신점검 시나리오 신규 작업
- private void _Event_ClientSocketReceive_SendMessage_Event(string data)
- {
- try
- {
- // 메세지를 수신하는 내용에 따라 데몬의 상태가 결정된다
- // 예시 : "1,0:2,1" 는 수신기 아이디 1은 통신 안됨, 2는 통신 잘됨
- string[] datas = data.Trim().Split(':');
- foreach (string id_status in datas)
- {
- string[] temp = id_status.Split(',');
- if (NetworkReceiver_ID_ComStatus[temp[0]] != null)
- {
- if (temp[1] == "1")
- NetworkReceiver_ID_ComStatus[temp[0]] = true;
- else
- NetworkReceiver_ID_ComStatus[temp[0]] = false;
- }
- }
- // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- private void _TcpComClient_SocketConnect_Inform_Event(object data, bool Connect)
- {
- try // cyim 2015.10.23 보완 코드 추가
- {
- // 갑자기 소켓이 종료됨
- if (Connect == false)
- {
- // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
- lock (CS_MonitorDaemon_ComStatus)
- {
- // 모니터데몬은 통신이 안됨
- this.MonitorDaemon_ComStatus = false;
- // 원래있던 수신기의 통신상태는 true 로 돌려놓는다
- foreach (string ReceiverID in NetworkReceiver_ID_List) // cyim 2014.8.11 : 해쉬테이블에서 곧바로 처리하지않게 바꿈
- NetworkReceiver_ID_ComStatus[ReceiverID] = true;
- // cyim 2014.8.12 통신점검 시나리오 보완 작업 (네트워크 수신기의 통신 상태)
- Check_EtcMonitorDaemon_for_Update_FormLogView(this.MonitorDaemon_ComStatus, NetworkReceiver_ID_ComStatus);
- }
- }
- }
- catch
- { }
- }
- // 현재이력을 무작정 갱신하면 부하확률이 높다. 네트워크 수신기 상태가 변경되었을 경우에만 갱신하도록 하자
- private void Check_EtcMonitorDaemon_for_Update_FormLogView(bool pMonitorDaemon_ComStatus, Hashtable pNetworkReceiver_ID_ComStatus)
- {
- // cyim 2014.8.12 네트워크 수신기 통신상태 문제 수정 (동시에 이벤트 발생시 UI 에서 처리하려면 큐가 아니라서 결국 CriticalSection 으로 처리해야함)
- lock (CS_MonitorDaemon_ComStatus)
- {
- try // cyim 2015.10.23 보완 코드 추가
- {
- bool update = false;
- if (pMonitorDaemon_ComStatus != Before_MonitorDaemon_ComStatus)
- {
- update = true;
- }
- foreach (string ReceiverID in NetworkReceiver_ID_List)
- {
- if (pNetworkReceiver_ID_ComStatus[ReceiverID].ToString() != Before_NetworkReceiver_ID_ComStatus[ReceiverID].ToString())
- update = true;
- }
- if (update == true)
- Event.FormLogView_Update_SendMessage_Write(); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- // 모니터데몬의 이전값
- Before_MonitorDaemon_ComStatus = pMonitorDaemon_ComStatus;
- // cyim 2014.8.14 모니터데몬이 죽는 경우 프로그램이 죽는 문제 수정
- foreach (string ReceiverID in NetworkReceiver_ID_List)
- Before_NetworkReceiver_ID_ComStatus[ReceiverID] = NetworkReceiver_ID_ComStatus[ReceiverID];
- }
- catch
- { }
- }
- }
- // cyim 2015.10.1 시간 동기화를 위해 시간정보를 셋팅한것을 메인에게 알리는 이벤트
- private void Event_TimeSync_Setup_SendMessage_Event(string data)
- {
- // 마스터 수신기에서 시간정보를 셋팅한다
- if (this.ConfigVO.Master_flag == "Y")
- ReadRegister_And_SendToPacket_MonitorDaemon("TS " + data);
- }
- // cyim 2016.06.15 : 화재 음원 출력
- public void AlarmPopup_PlaySound_Check()
- {
- if (SoundPlayer_AlarmPopupSound != null) // cyim 2016.11.11 : 비상 음원 출력 음원 파일 없을때 대응 코드 추가
- {
- if (this.labelFireAlert.Visible == true || this.labelFacilityAlert.Visible == true) // cyim 2016.06.16 : 설비동작 발생시 음원 출력 포함
- SoundPlayer_AlarmPopupSound.Play();
- else
- SoundPlayer_AlarmPopupSound.Stop();
- }
- }
- //
- // 버튼 이미지 정리
- //
- private string strImgPathBtnMenu1n = "btnMenu1.png";
- private string strImgPathBtnMenu1o = "btnMenu1_ov.png";
- private string strImgPathBtnMenu1d = "btnMenu1_dn.png";
- private string strImgPathBtnMenu1s = "btnMenu1_red.png";
- private string strImgPathBtnMenu2n = "btnMenu2.png";
- private string strImgPathBtnMenu2o = "btnMenu2_ov.png";
- private string strImgPathBtnMenu2d = "btnMenu2_dn.png";
- private string strImgPathBtnMenu3n = "btnMenu3.png";
- private string strImgPathBtnMenu3o = "btnMenu3_ov.png";
- private string strImgPathBtnMenu3d = "btnMenu3_dn.png";
- private string strImgPathBtnMenu4n = "btnMenu4.png";
- private string strImgPathBtnMenu4o = "btnMenu4_ov.png";
- private string strImgPathBtnMenu4d = "btnMenu4_dn.png";
- private string strImgPathBtnMenu5n = "btnMenu5.png";
- private string strImgPathBtnMenu5o = "btnMenu5_ov.png";
- private string strImgPathBtnMenu5d = "btnMenu5_dn.png";
- private string strImgPathBtnMenu6n = "btnMenu6.png";
- private string strImgPathBtnMenu6o = "btnMenu6_ov.png";
- private string strImgPathBtnMenu6d = "btnMenu6_dn.png";
- private string strImgPathBtnMenu7n = "btnMenu7.png";
- private string strImgPathBtnMenu7o = "btnMenu7_ov.png";
- private string strImgPathBtnMenu7d = "btnMenu7_dn.png";
- private string strImgBasePath = "image";
- private string ImgBasePath { get { return Path.Combine(Directory.GetCurrentDirectory(), this.strImgBasePath); } }
- private string ImgPathBtnMenu1n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu1n); } }
- private string ImgPathBtnMenu1o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu1o); } }
- private string ImgPathBtnMenu1d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu1d); } }
- private string ImgPathBtnMenu1s { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu1s); } }
- private string ImgPathBtnMenu2n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu2n); } }
- private string ImgPathBtnMenu2o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu2o); } }
- private string ImgPathBtnMenu2d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu2d); } }
- private string ImgPathBtnMenu3n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu3n); } }
- private string ImgPathBtnMenu3o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu3o); } }
- private string ImgPathBtnMenu3d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu3d); } }
- private string ImgPathBtnMenu4n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu4n); } }
- private string ImgPathBtnMenu4o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu4o); } }
- private string ImgPathBtnMenu4d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu4d); } }
- private string ImgPathBtnMenu5n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu5n); } }
- private string ImgPathBtnMenu5o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu5o); } }
- private string ImgPathBtnMenu5d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu5d); } }
- private string ImgPathBtnMenu6n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu6n); } }
- private string ImgPathBtnMenu6o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu6o); } }
- private string ImgPathBtnMenu6d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu6d); } }
- private string ImgPathBtnMenu7n { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu7n); } }
- private string ImgPathBtnMenu7o { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu7o); } }
- private string ImgPathBtnMenu7d { get { return Path.Combine(this.ImgBasePath, this.strImgPathBtnMenu7d); } }
- private Image ImgLoad(string path)
- {
- Image ret = null;
- try
- {
- ret = Image.FromFile(path);
- }
- catch (Exception e)
- {
- Util.UErrorMessage(e, 0, 0);
- }
- return ret;
- }
- private void ImgChangeBtnMenu1n()
- {
- if (this.likageBtnStatus)
- {
- this.ImgChangeBtnMenu1s();
- }
- else
- {
- this.ImgChangeBtnMenu1n2();
- }
- }
- private void ImgChangeBtnMenu1n2()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu1n);
- if (img != null)
- {
- this.btnMenu1.Image = img;
- }
- }
- private void ImgChangeBtnMenu1o()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu1o);
- if (img != null)
- {
- this.btnMenu1.Image = img;
- }
- }
- private void ImgChangeBtnMenu1d()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu1d);
- if (img != null)
- {
- this.btnMenu1.Image = img;
- }
- }
- private void ImgChangeBtnMenu1s()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu1s);
- if (img != null)
- {
- this.btnMenu1.Image = img;
- }
- }
- private void ImgChangeBtnMenu2n()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu2n);
- if (img != null)
- {
- this.btnMenu2.Image = img;
- }
- }
- private void ImgChangeBtnMenu2o()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu2o);
- if (img != null)
- {
- this.btnMenu2.Image = img;
- }
- }
- private void ImgChangeBtnMenu2d()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu2d);
- if (img != null)
- {
- this.btnMenu2.Image = img;
- }
- }
- private void ImgChangeBtnMenu3n()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu3n);
- if (img != null)
- {
- this.btnMenu3.Image = img;
- }
- }
- private void ImgChangeBtnMenu3o()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu3o);
- if (img != null)
- {
- this.btnMenu3.Image = img;
- }
- }
- private void ImgChangeBtnMenu3d()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu3d);
- if (img != null)
- {
- this.btnMenu3.Image = img;
- }
- }
- private void ImgChangeBtnMenu4n()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu4n);
- if (img != null)
- {
- this.btnMenu4.Image = img;
- }
- }
- private void ImgChangeBtnMenu4o()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu4o);
- if (img != null)
- {
- this.btnMenu4.Image = img;
- }
- }
- private void ImgChangeBtnMenu4d()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu4d);
- if (img != null)
- {
- this.btnMenu4.Image = img;
- }
- }
- private void ImgChangeBtnMenu5n()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu5n);
- if (img != null)
- {
- this.btnMenu5.Image = img;
- }
- }
- private void ImgChangeBtnMenu5o()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu5o);
- if (img != null)
- {
- this.btnMenu5.Image = img;
- }
- }
- private void ImgChangeBtnMenu5d()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu5d);
- if (img != null)
- {
- this.btnMenu5.Image = img;
- }
- }
- private void ImgChangeBtnMenu6n()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu6n);
- if (img != null)
- {
- this.btnMenu6.Image = img;
- }
- }
- private void ImgChangeBtnMenu6o()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu6o);
- if (img != null)
- {
- this.btnMenu6.Image = img;
- }
- }
- private void ImgChangeBtnMenu6d()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu6d);
- if (img != null)
- {
- this.btnMenu6.Image = img;
- }
- }
- private void ImgChangeBtnMenu7n()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu7n);
- if (img != null)
- {
- this.btnMenu7.Image = img;
- }
- }
- private void ImgChangeBtnMenu7o()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu7o);
- if (img != null)
- {
- this.btnMenu7.Image = img;
- }
- }
- private void ImgChangeBtnMenu7d()
- {
- Image img = ImgLoad(this.ImgPathBtnMenu7d);
- if (img != null)
- {
- this.btnMenu7.Image = img;
- }
- }
- // cyim 2015.8.20 이벤트로그는 50000건 : 하위 불필요한 루틴 제거
- //private string strImagePathPBoxLoading = "loading.gif";
- //private string ImagePathPBoxLoading { get { return Path.Combine(this.ImgBasePath, this.strImagePathPBoxLoading); } }
- //private void ImageLoadingPBoxLoading()
- //{
- // Image img = ImgLoad(this.ImagePathPBoxLoading);
- // if (img != null)
- // {
- // this.pictureBoxLoading.Image = img;
- // }
- //}
- // cyim 2015.7.30 오른쪽 상단에 숨김버튼 추가
- private void button_Hide_Click(object sender, EventArgs e)
- {
- this.Visible = false;
- }
- //
- // cyim 2016.12.26 : UI 이탈방지 코드 추가 (후킹)
- //
- // Tray ===============================================================================================================
- private NotifyIcon trayIcon;
- private ContextMenu trayMenu;
- private void GimmeTray()
- {
- // Create a simple tray menu with only one item.
- trayMenu = new ContextMenu();
- trayMenu.MenuItems.Add("Exit", OnExit);
- // Create a tray icon.
- trayIcon = new NotifyIcon();
- trayIcon.Text = "Windows System Key Blocker";
- trayIcon.Icon = new Icon(SystemIcons.Shield, 40, 40);
- // Add menu to tray icon and show it.
- trayIcon.ContextMenu = trayMenu;
- trayIcon.Visible = true;
- }
- private void OnExit(object sender, EventArgs e)
- {
- Console.WriteLine(" ! OSK exited.");
- trayIcon.Dispose();
- m_KeyboardHookManager.Dispose();
- Application.Exit();
- ShowToolbars();
- }
- // Toolbars ===============================================================================================================
- private const int SW_HIDE = 0;
- private const int SW_SHOW = 1;
- [DllImport("user32.dll")]
- private static extern int FindWindow(string className, string windowText);
- [DllImport("user32.dll")]
- private static extern int ShowWindow(int hwnd, int command);
- private void HideToolbars()
- {
- int hWnd = FindWindow("Shell_TrayWnd", "");
- ShowWindow(hWnd, SW_HIDE);
- }
- private void ShowToolbars()
- {
- int hWnd = FindWindow("Shell_TrayWnd", "");
- ShowWindow(hWnd, SW_SHOW);
- }
- private void ManualOpenMenuItem_Click(object sender, EventArgs e)//(매뉴얼 파일 열기) 클릭 함수
- {
- LFC.Log("타입: 수신기 조작 로그, 메세지: 시스템정보-매뉴얼 파일 열기 클릭");
- String openPDFFile = Environment.CurrentDirectory + "\\manual\\FireManual.docx";
- System.IO.FileInfo fi = new System.IO.FileInfo(openPDFFile);
- if (fi.Exists)
- {
- System.Diagnostics.Process.Start("explorer.exe", openPDFFile);
- }
- else
- {
- MessageBox.Show("매뉴얼 파일이 없습니다.", "매뉴얼", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- }
- // 디버깅 클릭
- private void Button_Debug_Click(object sender, EventArgs e)
- {
- if (_Data.Enable_Form_Debug == false)
- {
- _Data.Enable_Form_Debug = true;
- Form_Debug _Form_Debug = new Form_Debug();
- _Form_Debug.Show();
- }
- }
- public FbConnection connection = null;
- public static int iOpenCount = 0;
- public static int iAccessCount = 0;
- private void button1_Click_1(object sender, EventArgs e)
- {
- DBlabel.Text = "시작";
- try
- {
- int tempcnt = Convert.ToInt32(DBbox.Text);
- if (tempcnt > 9999)
- tempcnt = 9999;
- for (var i = 0; i < tempcnt; i++)
- {
- DBlabel.Text = i.ToString();
- string temp;
- if (i < 10)
- {
- temp = "000" + i.ToString();
- }
- else if (i < 100)
- {
- temp = "00" + i.ToString();
- }
- else if (i < 1000)
- {
- temp = "0" + i.ToString();
- }
- else
- {
- temp = i.ToString();
- }
- String SQL = "INSERT INTO TB_EVENT_LOG (EVENT_ID,EVENT_TIME,EVENT_TYPE,RECEIVER_ID,COMM_ID,"
- + "BOARD_ID,LOOP_NO,REPEATER_ID,DEVICE_ID,INOUT_TYPE,DATA_VALUE, EVENT_REMARK,SEND_FLAG)"
- + " VALUES ('" + DateTime.Now.ToString("yyyyMMddHHmmss0") + i + "OF01110000101I','" + DateTime.Now.ToString("yyyyMMddHHmmss0") + i + "','OF',1,1,10,0,1,1,'I',1,'FIRE ON!','N')";
- ExecuteNonQuery(SQL); //2019 04 26 08 29 45 001 66
- }
- DBlabel.Text = "완료";
- }
- //연,월,일, 시, 분,1,2,3
- catch (Exception ex)
- {
- DBlabel.Text = "실패";
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public bool Connect()
- {
- bool ret = false;
- try
- {
- // 사용자와 암호는 고정시킨다
- String strConnection = string.Format("Server={0};User={1};Password={2};Database={3};Charset={4};ServerType={5}",
- "127.0.0.1", // IP ex)192.168.63.22
- "SYSDBA", // 사용자
- "masterkey", // 암호
- @"C:\FireTest\Receiver1\DB\FPER.FDB", // 절대위치.. ex) C:\TEST\TEST.FDB
- "KSC_5601", // KSC_5601 같은 문자셋을 지정
- "0"); // 0이면 Classic/Super Server, 1이면 Embedded Server를 지정하신다음...
- connection = new FbConnection(strConnection);
- connection.Open();
- iOpenCount++;
- iAccessCount++;
- if (iAccessCount > 100000)
- {
- iAccessCount = 0;
- }
- ret = (this.connection.State == ConnectionState.Open);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return ret;
- }
- // 쿼리명령
- public void ExecuteNonQuery(String sqlSyntax)
- {
- if (connection == null || connection.State != ConnectionState.Open)
- {
- Connect();
- }
- FbTransaction transaction = connection.BeginTransaction();
- try
- {
- FbCommand command = new FbCommand(sqlSyntax, connection, transaction);
- command.CommandType = CommandType.Text;
- command.CommandTimeout = 2147483647;
- command.ExecuteNonQuery();
- transaction.Commit();
- command.Dispose();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- transaction.Rollback();
- throw ex;
- }
- }
- // 접속종료
- public void DisConnect()
- {
- try
- {
- if (connection != null)
- connection.Close();
- iOpenCount--;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- // cyim 2015.10.1 통보받은 화재 발생 시간을 기준으로 표시
- string event_time = String.Format("{0:yyyy}-{0:MM}-{0:dd} {0:HH}:{0:mm}:{0:ss}", DateTime.Now);
- // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
- Popup.EtcReceiverFirePopupProcess(myReceiverID.ToString(), "2", true, String.Format("{0}", socketUI.EventTypeName("OF", "FIRE ON!")), event_time);
- // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
- Popup.EtcReceiverFirePopupShow(myReceiverID.ToString(), "2", this);
- // 팝업창이 보이지 않는 경우에는 데이타를 변경하는 루틴이 적용되지 않아서 해당 루틴 삭제하고 여기에 적용함 : 팝업창이 숨겨져 있다가 다시 출력할때 화면 표시 잘못되는 문제 수정
- Event.EtcFirePopup_Update_Inform_Write("2");
- // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
- Popup.EtcReceiverFirePopupProcess(myReceiverID.ToString(), "3", true, String.Format("{0}", socketUI.EventTypeName("OF", "FIRE ON!")), event_time);
- // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
- Popup.EtcReceiverFirePopupShow(myReceiverID.ToString(), "3", this);
- // 팝업창이 보이지 않는 경우에는 데이타를 변경하는 루틴이 적용되지 않아서 해당 루틴 삭제하고 여기에 적용함 : 팝업창이 숨겨져 있다가 다시 출력할때 화면 표시 잘못되는 문제 수정
- Event.EtcFirePopup_Update_Inform_Write("3");
- // cyim 2015.10.1 통보받은 화재 발생 시간을 기준으로 표시
- // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
- Popup.EtcReceiverFirePopupProcess(myReceiverID.ToString(), "4", true, String.Format("{0}", socketUI.EventTypeName("OF", "FIRE ON!")), event_time);
- // cyim 2013.8.9 타수신기 화재 정보 팝업창 출력 기능 추가
- Popup.EtcReceiverFirePopupShow(myReceiverID.ToString(), "4", this);
- // 팝업창이 보이지 않는 경우에는 데이타를 변경하는 루틴이 적용되지 않아서 해당 루틴 삭제하고 여기에 적용함 : 팝업창이 숨겨져 있다가 다시 출력할때 화면 표시 잘못되는 문제 수정
- Event.EtcFirePopup_Update_Inform_Write("4");
- }
- private void DBlabel_Click(object sender, EventArgs e)
- {
- DBlabel.Text = "0";
- }
- }
- }
|