12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480 |
- 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;
- // 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;
- 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) / 2);
- 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) / 2);
- 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());
- if (_Data.FireDeskMode == false) // 수신반이 아닐때는 레지스트리 값 이용
- {
- this.socketUI = new SocketUI(this, this.myReceiverID, lblDemonStatus, _Data.Registry_DATABASE_NAME_IP);
- }
- else
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[this.myReceiverID.ToString()];
- this.socketUI = new SocketUI(this, this.myReceiverID, lblDemonStatus, FireDesk_Receiver.DATABASE_NAME_IP);
- }
- // 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();
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- // 자기 아이디는 제외
- if (this.myReceiverID.ToString() != dr["RECEIVER_ID"].ToString())
- {
- // 폼 클래스 생성
- 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
- {
- _FireDesk_Receiver FireDesk_Receiver = (_FireDesk_Receiver)_Data.Hash_Receiver[this.myReceiverID.ToString()];
- // 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;
- }
- 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 DBlabel_Click(object sender, EventArgs e)
- {
- DBlabel.Text = "0";
- }
- }
- }
|