コード例 #1
0
ファイル: Form1.cs プロジェクト: Pwnur/17805MES
        public 工厂模式()
        {
            InitializeComponent();
            //关联closing事件
            this.FormClosing += new FormClosingEventHandler(this.Form1_FormClosing);

            string filePath;
            string ErrMessage = "";

            filePath = System.AppDomain.CurrentDomain.BaseDirectory + "MESS.ini";

            StringBuilder temp = new StringBuilder(1024);

            GetPrivateProfileString("MESS", "User", null, temp, 1024, filePath);
            User = temp.ToString();

            GetPrivateProfileString("MESS", "PassWork", null, temp, 1024, filePath);
            PassWork = temp.ToString();

            GetPrivateProfileString("MESS", "ResCode", null, temp, 1024, filePath);
            ResCode = temp.ToString();

            //GetPrivateProfileString("T8300", "WorkOrder", null, temp, 1024, filePath);
            //WorkOrder = temp.ToString();

            GetPrivateProfileString("MESS", "ISCHECK", null, temp, 1024, filePath);
            ISCHECK = temp.ToString();

            GetPrivateProfileString("MESS", "IP", null, temp, 1024, filePath);
            IP = temp.ToString();
            textBox_IP.Text = IP;

            GetPrivateProfileString("MESS", "Port", null, temp, 1024, filePath);
            myPort            = temp.ToString();
            imyPort           = int.Parse(myPort);
            textBox_Port.Text = myPort;


            BenQGuru.eMES.DLLService.MESHelper login = new BenQGuru.eMES.DLLService.MESHelper();
            if (!login.CheckUserAndResourcePassed(User, ResCode, PassWork, "", out ErrMessage))
            {
                labelTips.Text      = User + "登录" + ResCode + "失败\n" + ErrMessage;
                loginstatus         = false;
                labelTips.ForeColor = Color.Red;
            }
            else
            {
                labelTips.Text      = User + "登录" + ResCode + "成功\n";
                loginstatus         = true;
                labelTips.ForeColor = Color.Green;
            }

            serverstart();
        }
コード例 #2
0
        public Form1()
        {
            InitializeComponent();

            //关联closing事件
            this.FormClosing += new FormClosingEventHandler(this.Form1_FormClosing);

            string filePath;
            string ErrMessage = "";

            filePath = System.AppDomain.CurrentDomain.BaseDirectory + "T8300.ini";

            StringBuilder temp = new StringBuilder(1024);

            GetPrivateProfileString("T8300", "User", null, temp, 1024, filePath);
            User = temp.ToString();

            GetPrivateProfileString("T8300", "PassWork", null, temp, 1024, filePath);
            PassWork = temp.ToString();

            GetPrivateProfileString("T8300", "ResCode", null, temp, 1024, filePath);
            ResCode = temp.ToString();

            //GetPrivateProfileString("T8300", "WorkOrder", null, temp, 1024, filePath);
            //WorkOrder = temp.ToString();

            GetPrivateProfileString("T8300", "ISCHECK", null, temp, 1024, filePath);
            ISCHECK = temp.ToString();


            BenQGuru.eMES.DLLService.MESHelper login = new BenQGuru.eMES.DLLService.MESHelper();
            if (!login.CheckUserAndResourcePassed(User, ResCode, PassWork, "", out ErrMessage))
            {
                labelTips.Text      = "登录失败\n" + ErrMessage;
                labelTips.ForeColor = Color.Red;
            }
            else
            {
                labelTips.Text      = "登录成功";
                labelTips.ForeColor = Color.Red;
            }
        }