Exemplo n.º 1
0
        private void FormServer_Load(object sender, EventArgs e)
        {
            int locX1, locY1, sizeX, sizeY;

            tbServPort.Text = inif.GetString("Server", "Port", "9001");

            locX1         = int.Parse(inif.GetString("Form", "LocationX", "0"));
            locY1         = int.Parse(inif.GetString("Form", "LocationY", "0"));
            this.Location = new Point(locX1, locY1);

            sizeX     = int.Parse(inif.GetString("Form", "SizeX", "500"));
            sizeY     = int.Parse(inif.GetString("Form", "SizeY", "500"));
            this.Size = new Size(sizeX, sizeY);
        }
Exemplo n.º 2
0
        private void Server_Load(object sender, EventArgs e)
        {
            int x1, y1, x2, y2;

            iniFile ini = new iniFile(@"ComServer.ini");

            x1 = int.Parse(ini.GetString("Form", "LocX", "0"));
            y1 = int.Parse(ini.GetString("Form", "LocY", "0"));
            x2 = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2 = int.Parse(ini.GetString("Form", "SizeY", "500"));

            Location = new Point(x1, y1);
            Size     = new Size(x2, y2);
        }
Exemplo n.º 3
0
        private void Form_Chatting_Load(object sender, EventArgs e)
        {
            tbIP.Text   = ini.GetString("Server", "IP", "211.43.12.96");
            tbPort.Text = ini.GetString("Server", "Port", "9500");

            try
            {
                if (sock == null)
                {
                    sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                }
                else
                {
                    if (threadClient != null)
                    {
                        threadClient.Abort();
                        threadClient = null;
                    }
                    sock.Close();
                    sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                }


                sock.Connect(tbIP.Text, int.Parse(tbPort.Text));

                /*
                 * if (threadConnect == null)
                 * {
                 *  threadConnect = new Thread(SocketConnect);
                 *  threadConnect.Start();
                 * }
                 */

                sb_IP.Text    = ((IPEndPoint)(sock.RemoteEndPoint)).Address.ToString();
                sb_Port1.Text = ((IPEndPoint)(sock.RemoteEndPoint)).Port.ToString();
                tbRecieve.AppendText("서버에 연결되었습니다.\r\n메세지를 입력하세요.\r\n");


                if (threadClient == null)
                {
                    threadClient = new Thread(ClientProcess);
                    threadClient.Start();
                }
            }
            catch (Exception e1)
            {
                tbRecieve.AppendText(e1.Message + "\r\n");
            }
        }
Exemplo n.º 4
0
        private void Form_Server_Load(object sender, EventArgs e)
        {
            // Form 로드시 초기값
            int x1, x2, y1, y2;

            tbServerPort.Text = ini.GetString("Server", "Port", "9001");

            x1            = int.Parse(ini.GetString("Form", "LocationX", "0"));
            y1            = int.Parse(ini.GetString("Form", "LocationY", "0"));
            this.Location = new Point(x1, y1); // LOCATION 변경

            x2        = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2        = int.Parse(ini.GetString("Form", "SizeY", "500"));
            this.Size = new Size(x2, y2);  // Size 변경
        }
Exemplo n.º 5
0
        private void EquipManager_Load(object sender, EventArgs e)
        {
            tbPort.Text = ini.GetString("Connection", "Port", "8080");

            int x1, x2, y1, y2;

            x1            = int.Parse(ini.GetString("Form", "LocationX", "0"));
            y1            = int.Parse(ini.GetString("Form", "LocationY", "0"));
            this.Location = new Point(x1, y1);
            x2            = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2            = int.Parse(ini.GetString("Form", "SizeY", "500"));
            this.Size     = new Size(x2, y2);
            connectionStr = ini.GetString("Database", "ConnectionString", @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\박주형\Desktop\KOSTA\Emulator\EquipDB.mdf;Integrated Security=True;Connect Timeout=30");

            tabControl1.SelectedIndex = int.Parse(ini.GetString("Form", "TabIndex", "1"));
            sqlconn.ConnectionString  = connectionStr;
            sqlconn.Open();
            sqlcomd.Connection = sqlconn;
            SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM EqStatus", sqlconn);
            DataTable      ds      = new DataTable();

            adapter.Fill(ds);
            GridView(ds, 0);
            int cnum = ds.Rows.Count;

            Control[] BTN = new Control[cnum];
            for (int i = 0; i < cnum; i++)
            {
                BTN[i]        = new Button();
                BTN[i].Text   = $"Code : {i + 1}";
                BTN[i].Click += Select_Code;
                flpanel.Controls.Add(BTN[i]);
            }
        }
Exemplo n.º 6
0
        private void FormServer_Load(object sender, EventArgs e)
        {
            int x1, y1, x2, y2;

            ini = new iniFile("");

            ini.ChangeFileName(".\\ComServer.ini");

            x1       = int.Parse(ini.GetString("Form", "LocX", "0"));
            y1       = int.Parse(ini.GetString("Form", "LocY", "0"));
            Location = new Point(x1, y1);

            x2   = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2   = int.Parse(ini.GetString("Form", "SizeY", "500"));
            Size = new Size(x2, y2);

            splitContainer1.SplitterDistance = int.Parse(ini.GetString("Form", "Splitter", "300"));
        }
Exemplo n.º 7
0
 private void Chat_Client_Load(object sender, EventArgs e)
 {
     IP            = ini.GetString("Server", "IP", "192.168.35.94");
     Port          = ini.GetString("Server", "PORT", "8080");
     x1            = int.Parse(ini.GetString("Form", "LocationX", "0"));
     y1            = int.Parse(ini.GetString("Form", "LocationY", "0"));
     this.Location = new Point(x1, y1);
     x2            = int.Parse(ini.GetString("Form", "SizeX", "0"));
     y2            = int.Parse(ini.GetString("Form", "SizeY", "0"));
     this.Size     = new Size(x2, y2);
 }
Exemplo n.º 8
0
        private void frmSocket_Load(object sender, EventArgs e)
        {
            int x1, x2, y1, y2;

            sPort    = ini.GetString("Server", "Port", "9001");
            sAddress = ini.GetString("Server", "IP", "0.0.0.0");

            cPort    = ini.GetString("Client", "Port", "9001");
            cAddress = ini.GetString("Client", "IP", "127.0.0.1");

            sbLabel1.Text = sAddress; sbLabel2.Text = sPort;
            sbLabel3.Text = cAddress; sbLabel4.Text = cPort;

            x1            = int.Parse(ini.GetString("Form", "LocationX", "0"));
            y1            = int.Parse(ini.GetString("Form", "LocationY", "0"));
            this.Location = new Point(x1, y1);

            x2        = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2        = int.Parse(ini.GetString("Form", "SizeY", "500"));
            this.Size = new Size(x2, y2);
        }
Exemplo n.º 9
0
        private void FormClient_Load(object sender, EventArgs e)
        {
            int x1, y1, x2, y2;

            ini = new iniFile(".\\ComClient.ini");

            Init_IP   = ini.GetString("Comm", "IP", "127.0.0.1");
            Init_Port = int.Parse(ini.GetString("Comm", "Port", "9001"));
            x1        = int.Parse(ini.GetString("Form", "LocX", $"0"));
            y1        = int.Parse(ini.GetString("Form", "LocY", $"0"));
            x2        = int.Parse(ini.GetString("Form", "SizeX", $"500"));
            y2        = int.Parse(ini.GetString("Form", "SizeY", $"500"));
            splitContainer1.SplitterDistance = int.Parse(ini.GetString("Form", "Splitter", $"300"));

            Location    = new Point(x1, y1);
            Size        = new Size(x2, y2);
            tbIP.Text   = Init_IP;
            tbPort.Text = $"{Init_Port}";
        }
Exemplo n.º 10
0
        private void frmEquipManager_Load(object sender, EventArgs e)
        {
            int x1, x2, y1, y2;

            tbServerPort.Text = ini.GetString("Server", "Port", "9001");

            x1            = int.Parse(ini.GetString("Form", "LocationX", "0"));
            y1            = int.Parse(ini.GetString("Form", "LocationY", "0"));
            this.Location = new Point(x1, y1);

            x2        = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2        = int.Parse(ini.GetString("Form", "SizeY", "500"));
            this.Size = new Size(x2, y2);

            tabControl1.SelectedIndex = int.Parse(ini.GetString("Form", "TabIndex", "1"));

            conString = ini.GetString("Database", "ConnectionString", @"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\HulkL\source\repos\EquipManager\EquipDatabase.mdf; Integrated Security = True; Connect Timeout = 30");
            db1       = new SQLDB(conString);
            db2       = new SQLDB(conString);

            timer1.Interval = int.Parse(tbInterval.Text);
            timer1.Start();
        }
Exemplo n.º 11
0
        private void Manager_Load(object sender, EventArgs e)
        {
            int x1, x2, y1, y2;

            x1            = int.Parse(ini.GetString("Form", "LocationX", "600"));
            y1            = int.Parse(ini.GetString("Form", "LocationY", "300"));
            this.Location = new Point(x1, y1);

            x2        = int.Parse(ini.GetString("Form", "SizeX", "800"));
            y2        = int.Parse(ini.GetString("Form", "SizeY", "500"));
            this.Size = new Size(x2, y2);

            tabControl.SelectedIndex = int.Parse(ini.GetString("Form", "TabIndex", "1"));
            tbServerPort.Text        = ini.GetString("Server", "Port", "9001");

            connString            = ini.GetString("Database", "ConnectionString", @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\anvo9\KOSTA\Emulator\EquipManager\EquipDatabase.mdf;Integrated Security = True; Connect Timeout = 30");
            conn.ConnectionString = connString;
            conn.Open();
            cmd.Connection = conn;

            dataGrid.DataSource = RunSQL("select * from fStatus");
            timer.Interval      = int.Parse(tbInterval.Text);
            timer.Start();
        }
Exemplo n.º 12
0
        private void Main_Load(object sender, EventArgs e)
        {
            tbEqCode.Text  = ini.GetString("Equipment", "EqCode", "00001");
            tbEqModel.Text = ini.GetString("Equipment", "EqModel", "000001");
            tbEqLine.Text  = ini.GetString("Equipment", "EqLine", "00001");
            tbEqBat.Text   = ini.GetString("Equipment", "EqBat", "00001");
            tbEqState.Text = ini.GetString("Equipment", "EqState", "0");
            tbEqCount.Text = ini.GetString("Equipment", "EqCount", "0");

            tbEnvTemp.Text  = ini.GetString("Enviroment", "EnvTemp", "0000");
            tbEnvHum.Text   = ini.GetString("Enviroment", "EnvHum", "0000");
            tbEnvWind.Text  = ini.GetString("Enviroment", "EnvWind", "0000");
            tbEnvOz.Text    = ini.GetString("Enviroment", "EnvOz", "0000");
            tbEnvAir.Text   = ini.GetString("Enviroment", "EnvAir", "0");
            tbEnvTotal.Text = ini.GetString("Enviroment", "EnvTotal", "0000");

            dtStartDate.Value = new DateTime(long.Parse(ini.GetString("Operation", "StartDate", "0")));
            dtStopDate.Value  = new DateTime(long.Parse(ini.GetString("Operation", "StopDate", "0")));
            dtStartTime.Value = new DateTime(long.Parse(ini.GetString("Operation", "StartTime", "0")));
            dtStopTime.Value  = new DateTime(long.Parse(ini.GetString("Operation", "StopTime", "0")));
            tbInterval.Text   = ini.GetString("Operation", "Interval", "2");

            int x1, x2, y1, y2;

            sblabel1.Text = ini.GetString("Server", "IP", "127.0.0.1");
            sblabel2.Text = ini.GetString("Server", "Port", "9001");

            x1            = int.Parse(ini.GetString("Form", "LocationX", "600"));
            y1            = int.Parse(ini.GetString("Form", "LocationY", "300"));
            this.Location = new Point(x1, y1);

            x2        = int.Parse(ini.GetString("Form", "SizeX", "700"));
            y2        = int.Parse(ini.GetString("Form", "SizeY", "500"));
            this.Size = new Size(x2, y2);
        }
Exemplo n.º 13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ini            = new iniFile(".\\Emulator.ini");
            tbEqcode.Text  = ini.GetString("Equipment", "Code", "00001");           //장비 코드 5
            tbEqModel.Text = ini.GetString("Equipment", "Model", "      ");         //장비 모델 6
            tbEqLine.Text  = ini.GetString("Equipment", "Line", "00001");           //라인 번호 5
            tbEqBatt.Text  = ini.GetString("Equipment", "Battery", "00001");        //배터리 잔량 5
            tbEqState.Text = ini.GetString("Equipment", "State", "0");              //현재 상태 1
            tbEqCount.Text = ini.GetString("Equipment", "Count", "00000");          //사용 횟수 5

            tbEqCelsius.Text = ini.GetString("Environment", "Temperature", "0000"); //온도 4
            tbEqHumi.Text    = ini.GetString("Environment", "Humidity", "0000");    //습도 4
            tbEqWind.Text    = ini.GetString("Environment", "Wind_Speed", "0000");  //풍속 4
            tbEqAtmos.Text   = ini.GetString("Environment", "Atmosphere", "0000");  //대기 1
            tbEqOz.Text      = ini.GetString("Environment", "Ozone", "0000");       //오존 4
            tbEqTotal.Text   = ini.GetString("Environment", "Total", "0000");       //종합 4 : total 48bytes

            dtStart_Days.Value = new DateTime(long.Parse(ini.GetString("Operation", "Start_Time_Days", "0")));
            dtStart_HMS.Value  = new DateTime(long.Parse(ini.GetString("Operation", "Start_Time_HMS", "0")));
            dtEnd_Days.Value   = new DateTime(long.Parse(ini.GetString("Operation", "End_Time_Days", "0")));
            dtEnd_HMS.Value    = new DateTime(long.Parse(ini.GetString("Operation", "End_Time_HMS", "0")));

            tbInterval.Text = ini.GetString("Operation", "Interval", "5");

            sb_IP.Text   = ini.GetString("Connection", "IP", "127.0.0.1");
            sb_Port.Text = ini.GetString("Connection", "Port", "8080");

            int x1, x2, y1, y2;

            x1            = int.Parse(ini.GetString("Form", "LocationX", "0"));
            y1            = int.Parse(ini.GetString("Form", "LocationY", "0"));
            this.Location = new Point(x1, y1);
            x2            = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2            = int.Parse(ini.GetString("Form", "SizeY", "500"));
            this.Size     = new Size(x2, y2);
        }
Exemplo n.º 14
0
        private void Form1_Load(object sender, EventArgs e)
        {
            tbEqCode.Text      = inif.GetString("Equipment", "EqCode", "00001");
            tbEqModel.Text     = inif.GetString("Equipment", "EqModel", "000000");
            tbEqLineNum.Text   = inif.GetString("Equipment", "EqLineNum", "00001");
            tbEqBattery.Text   = inif.GetString("Equipment", "EqBattery", "00001");
            tbEqOperState.Text = inif.GetString("Equipment", "EqOperState", "00001");
            tbEqOperCount.Text = inif.GetString("Equipment", "EqOperCount", "00001");

            tbEqTemp.Text  = inif.GetString("Environment", "EqTemp", "00001");
            tbEqHumid.Text = inif.GetString("Environment", "EqHumid", "00001");
            tbEqWind.Text  = inif.GetString("Environment", "EqWind", "00001");
            tbEqOzon.Text  = inif.GetString("Environment", "EqOzon", "00001");
            tbEqAtmos.Text = inif.GetString("Environment", "EqAtmos", "00001");
            tbEqTotal.Text = inif.GetString("Environment", "EqTotal", "00001");

            dtBegin.Value     = new DateTime(long.Parse(inif.GetString("Operation", "StartTime", "0")));
            dtEnd.Value       = new DateTime(long.Parse(inif.GetString("Operation", "StopTime", "0")));
            tbEqInterval.Text = inif.GetString("Operation", "Interval", "5");

            int x1, x2, y1, y2;

            sbLabel1.Text = inif.GetString("Server", "IP", "127.0.0.1");
            sbLabel2.Text = inif.GetString("Server", "Port", "9001");

            x1            = int.Parse(inif.GetString("Form", "LocationX", "0"));
            y1            = int.Parse(inif.GetString("Form", "LocationY", "0"));
            this.Location = new Point(x1, y1);


            x2        = int.Parse(inif.GetString("Form", "SizeX", "500"));
            y2        = int.Parse(inif.GetString("Form", "SizeY", "500"));
            this.Size = new Size(x2, y2);
        }
Exemplo n.º 15
0
        private void frmSocket_FormClosing(object sender, FormClosingEventArgs e)
        {
            ini.GetString("Server", "Port", sAddress);
            ini.GetString("Client", "Port", sPort);
            ini.GetString("Server", "IP", cAddress);
            ini.GetString("Client", "IP", cPort);

            ini.SetString("Server", "Port", sPort);
            ini.SetString("Form", "LocationX", $"{Location.X}");
            ini.SetString("Form", "LocationY", $"{Location.Y}");
            ini.SetString("Form", "SizeX", $"{Size.Width}");
            ini.SetString("Form", "SizeY", $"{Size.Height}");

            if (threadServer != null)
            {
                threadServer.Abort();
            }
            if (threadRead != null)
            {
                threadRead.Abort();
            }
        }
Exemplo n.º 16
0
        private void Form1_Load(object sender, EventArgs e)
        {
            tbEqCode.Text  = ini.GetString("Equipment", "EqCode", "00001");     // 5
            tbEqModel.Text = ini.GetString("Equipment", "EqModel", "000000");   // 6
            tbEqLine.Text  = ini.GetString("Equipment", "EqLine", "00001");     // 5
            tbEqBatt.Text  = ini.GetString("Equipment", "EqBatt", "00001");     // 5
            tbEqState.Text = ini.GetString("Equipment", "EqState", "00001");    // 1
            tbEqCount.Text = ini.GetString("Equipment", "EqCount", "00001");    // 5

            tbEqTemp.Text  = ini.GetString("Environment", "EqTemp", "00001");   // 4
            tbEqHum.Text   = ini.GetString("Environment", "EqHum", "00001");    // 4
            tbEqWind.Text  = ini.GetString("Environment", "EqWind", "00001");   // 4
            tbEqOzon.Text  = ini.GetString("Environment", "EqOzon", "00001");   // 4
            tbEqAir.Text   = ini.GetString("Environment", "EqAir", "00001");    // 1
            tbEqTotal.Text = ini.GetString("Environment", "EqTotal", "00001");  // 4  : total 48 byte

            dtStart.Value     = new DateTime(long.Parse(ini.GetString("Operation", "StartDate", "0")));
            dtStop.Value      = new DateTime(long.Parse(ini.GetString("Operation", "StopDate", "0")));
            dtStartTime.Value = new DateTime(long.Parse(ini.GetString("Operation", "StartTime", "0")));
            dtStopTime.Value  = new DateTime(long.Parse(ini.GetString("Operation", "StopTime", "0")));
            tbInterval.Text   = ini.GetString("Operation", "Interval", "5");

            int x1, x2, y1, y2;

            sbLabel1.Text = ini.GetString("Server", "IP", "127.0.0.1");
            sbLabel2.Text = ini.GetString("Server", "Port", "9001");

            x1            = int.Parse(ini.GetString("Form", "LocationX", "0"));
            y1            = int.Parse(ini.GetString("Form", "LocationY", "0"));
            this.Location = new Point(x1, y1);

            x2        = int.Parse(ini.GetString("Form", "SizeX", "500"));
            y2        = int.Parse(ini.GetString("Form", "SizeY", "500"));
            this.Size = new Size(x2, y2);
        }