コード例 #1
0
ファイル: Form2.cs プロジェクト: adelinechan/WindowsFormsApp1
 //當程式開始連接機臺網域,並按下Connect鍵時,會將連接訊息變成ONLINE
 private void btnConn_Click(object sender, EventArgs e)
 {
     if (ChannelServices.RegisteredChannels.Length == 0)
     {
         ChannelServices.RegisterChannel(new TcpChannel(), false);
     }
     _Pwd.ConnectionKey = "pmc"; //二次開發密碼
     _Pwd.WritePwd      = "pmc";
     iRemoting          = (IMsg)Activator.GetObject(typeof(IMsg), "tcp://" + txtIP.Text.Trim() + ":9501" +
                                                    "/RemoteObjectURI9501");
     lblStatus.BackColor = Color.LawnGreen;
     lblStatus.Text      = "ONLINE";
     ReflashListView(true);
     ReflashMemView();
 }
コード例 #2
0
        //按下Connect鍵之後所要做的事和判斷的訊息
        private void btnConn_Click(object sender, EventArgs e)
        {
            if (ChannelServices.RegisteredChannels.Length == 0)
            {
                ChannelServices.RegisterChannel(new TcpChannel(), false);
            }
            string IP   = txtIP.Text.Trim();
            string Port = "9501";

            iRemoting          = (IMsg)Activator.GetObject(typeof(IMsg), "tcp://" + IP + ":" + Port + "/RemoteObjectURI" + Port);
            _Pwd.ConnectionKey = "pmc";
            _Pwd.WritePwd      = "pmc";
            short ret = iRemoting.SKY_conn_status(_Pwd, ref _SkyConn_status);

            if (ret == 0)
            {
                MessageBox.Show("Successful!");
                lblConnStatus.Image = Image.FromFile(Application.StartupPath + "\\images\\online.ico");
                timer1.Enabled      = true;
                timer2.Enabled      = true;
            }
        }
コード例 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (ChannelServices.RegisteredChannels.Length == 0)
            {
                ChannelServices.RegisterChannel(new TcpChannel());

                iRemoting = (IMsg)Activator.GetObject(typeof(IMsg), "tcp://localhost:9501/RemoteObjectURI9501");
            }

            _Pwd.ConnectionKey = "123";
            MS100.Enabled      = true;
            S1.Enabled         = true;

            //廠牌及機台名稱
            ret = iRemoting.SKY_conn_ip_port(_Pwd, ref _SkyConn_ip_port);
            if (ret == 0)
            {
                txtMan_F.Text  = _SkyConn_ip_port.Manufacturer[0];
                txtName_F.Text = _SkyConn_ip_port.MachineName[0];
            }

            //基本資訊
            ret = iRemoting.GET_information(_Pwd, ref _information);
            if (ret == 0)
            {
                txtAxes_F.Text   = _information.Axes.ToString();
                txtType_F.Text   = _information.CncType;
                txtSeries_F.Text = _information.Series;
                txtNc_F.Text     = _information.Nc_Ver;
            }

            //Key序號
            ret = iRemoting.SKY_version(_Pwd, ref _SkyVersion);
            if (ret == 0)
            {
                txtLic.Text = _SkyVersion.SerialNumber.ToString();
            }
        }