Example #1
0
        public static void PLC_Setting_Save()
        {
            Pgm_Setting.Group_Select("PLC");


            vari.Pgm_Setting.Value_Set("RSLINX_ID", plc.RSLINX_ID);
            vari.Pgm_Setting.Value_Set("TOPIC_NAME", plc.Topic_Name);
            vari.Pgm_Setting.Value_Set("ADD_TRIGGER", plc.Add_Trigger);
            vari.Pgm_Setting.Value_Set("ADD_CONFIRM", plc.Add_Confirm);
            vari.Pgm_Setting.Value_Set("ADD_ACK", plc.Add_Ack);
            vari.Pgm_Setting.Value_Set("ADD_INFO", plc.Add_Info);
            vari.Pgm_Setting.Value_Set("ADD_DATA", plc.Add_Data);


            //프로그램 설정
            Pgm_Setting.Group_Select("PGM");

            vari.Pgm_Setting.Value_Set("StationID", StationID);
            vari.Pgm_Setting.Value_Set("TestSeq", iTestSeq.ToString());
            vari.Pgm_Setting.Value_Set("OPMODE", ((int)OpMode).ToString());
            vari.Pgm_Setting.Value_Set("TorqueImagePath", vari.TorqueImagePath);
            vari.Pgm_Setting.Value_Set("IF_Check", vari.bIF_Chk.ToString());


            Pgm_Setting.Setting_Save();
        }
Example #2
0
        /// <summary>
        /// 변수 초기화
        /// </summary>
        public static void Init()
        {
            Pgm_Path             = System.Windows.Forms.Application.StartupPath;
            Pgm_Setting_FileName = $"{Pgm_Path}\\{Pgm_Setting_FileName}";
            bool rb = false;

            Pgm_Setting = new Setting(Pgm_Setting_FileName);

            Pgm_Setting.Group_Select("PGM");

            //기기 id
            StationID       = Pgm_Setting.Value_Get("StationID", "DEV_01");
            iTestSeq        = Fnc.obj2int(Pgm_Setting.Value_Get("TestSeq", "0"));
            TorqueImagePath = Pgm_Setting.Value_Get("TorqueImagePath", "");
            bIF_Chk         = Fnc.obj2Bool(Pgm_Setting.Value_Get("IF_Check", "False"));


            //db 정보 로드
            Pgm_Setting.Group_Select("MsSql");

            conn.strIP       = Pgm_Setting.Value_Get("IP", string.Empty);
            conn.strDataBase = Pgm_Setting.Value_Get("DataBase", string.Empty);
            conn.strID       = Pgm_Setting.Value_Get("ID", string.Empty);
            conn.strPass     = Pgm_Setting.Value_Get("PassWords", string.Empty);

            //plc 기초 값 로드  N7:0,L2
            plc_default.RSLINX_ID   = "opcda://localhost/RSLinx OPC Server";
            plc_default.Topic_Name  = "Torque";
            plc_default.Add_Trigger = "[Torque]R7001:0,L2";
            plc_default.Add_Ack     = "[Torque]R7002:0,L2";
            plc_default.Add_Confirm = "[Torque]R7003:0,L2";
            plc_default.Add_Info    = "[Torque]R7004:0,L16";
            plc_default.Add_Data    = "[Torque]R7000:0,L200";

            Pgm_Setting.Group_Select("PLC");

            plc.RSLINX_ID = vari.Pgm_Setting.Value_Get("RSLINX_ID");

            if (plc.RSLINX_ID?.Equals(string.Empty) == false)
            {
                plc.Topic_Name  = vari.Pgm_Setting.Value_Get("TOPIC_NAME");
                plc.Add_Trigger = vari.Pgm_Setting.Value_Get("ADD_TRIGGER");
                plc.Add_Ack     = vari.Pgm_Setting.Value_Get("ADD_ACK");
                plc.Add_Confirm = vari.Pgm_Setting.Value_Get("ADD_CONFIRM");
                plc.Add_Info    = vari.Pgm_Setting.Value_Get("ADD_INFO");
                plc.Add_Data    = vari.Pgm_Setting.Value_Get("ADD_DATA");
            }
            else
            {
                plc = plc_default;
            }


            //프로그램 설정
            Pgm_Setting.Group_Select("PGM");
            OpMode = (enOpMode)Fnc.obj2int(vari.Pgm_Setting.Value_Get("OPMODE", "0"));
        }
Example #3
0
        private async void btnConnect_Click(object sender, EventArgs e)
        {
            try
            {
                string phone = textBox1.Text.Trim();

                config.Group_Select("PgmSetting", true);

                config.Value_Set("PhoneNumber", phone, null, null, null);
                config.Setting_Save();


                _client = new Client(phone, fnc.apiId, fnc.apiHash, this);

                await _client.Connect();

                if (_client.isAuth())
                {
                    SetMessage(false, "연결이 되었습니다.", false);
                }
                else
                {
                    SetMessage(false, "연결이 되었습니다. 인증이 필요 합니다.", false);
                }
            }
            catch (Exception ex)
            {
                ProcException(ex, "btnConnect_Click", false);
            }
        }