123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Forms;
- using System.IO;
- using System.Text;
- using System.Diagnostics;
- using System.Collections;
- using System.Data.SqlClient;
- using System.Timers;
- using System.Threading;
- using System.Runtime.InteropServices;
- namespace BEMSDataGateway
- {
- static class Program
- {
-
-
-
-
- [STAThread]
- static void Main()
- {
- string mtxName = "DGW";
- Mutex mtx = new Mutex(true, mtxName);
-
- TimeSpan tsWait = new TimeSpan(0, 0, 1);
- bool success = mtx.WaitOne(tsWait);
- if (!success)
- {
- MessageBox.Show("프로그램이 이미 실행중입니다.");
- return;
- }
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
- }
- }
-
-
-
- class My_TimerThread
- {
- static string TimeCheck = "";
- Parsing PS = new Parsing();
- Control_Point_Group CPG = new Control_Point_Group();
- public System.Timers.Timer timer2;
- private Object DBCommObj = new Object();
- public static bool check = false;
- public void timer2start()
- {
- timer2 = new System.Timers.Timer();
- timer2.Interval = 10 * 1000;
- timer2.Elapsed += new ElapsedEventHandler(timer2_Elapsed);
- timer2.Start();
- }
- public void timer2Stop()
- {
- timer2.Stop();
- timer2.Enabled = false;
- timer2.Dispose();
- }
- public void timer2_Elapsed(object sender, ElapsedEventArgs e)
- {
- string tmpMin = DateTime.Now.Minute.ToString();
- lock (DBCommObj)
- {
- if (TimeCheck != tmpMin)
- {
- CPG.Control_Group();
- CPG.Control_Point();
- TimeCheck = PS.SettingFileParsing();
- }
- }
- }
- }
- }
|