예제 #1
0
 /// <summary>
 /// 创建一个请求通讯包
 /// </summary>
 /// <param name="communicateName">请求的名称</param>
 /// <param name="communicateType">请求执行的网络类型</param>
 /// <param name="reqtParamPkg">携带的参数属性包</param>
 /// <param name="targetDevice">目的设备</param>
 /// <param name="waitResponse">是否等待应答</param>
 /// <param name="callback">在异步情形下,收到应答后的通知事件</param>
 /// <returns></returns>
 public RequestCommunicatePackage CreateRequestCommunicatePackage(string communicationName,
                                                                  CommunicatType communicateType,
                                                                  ParamPackage reqtParamPkg,
                                                                  ClientDevice targetDevice,
                                                                  bool waitResponse,
                                                                  AsynReponseHandler callback)
 {
     return(base.CoCreateRequestCommunicatePackage(communicationName,
                                                   communicateType,
                                                   reqtParamPkg,
                                                   targetDevice,
                                                   waitResponse,
                                                   callback));
 }
        protected RequestCommunicatePackage CoCreateRequestCommunicatePackage(string communicationName,
                                                                              CommunicatType communicateType,
                                                                              ParamPackage reqtParamPkg,
                                                                              ClientDevice targetDevice,
                                                                              bool waitResponse,
                                                                              AsynReponseHandler callback)
        {
            RequestCommunicatePackage reqtPkg = new RequestCommunicatePackage();

            reqtPkg.CommunicationName       = communicationName;
            reqtPkg.CommunicateType         = communicateType;
            reqtPkg.ParamPackage            = reqtParamPkg;
            reqtPkg.TargetDevice            = targetDevice;
            reqtPkg.WaitResponse            = waitResponse;
            reqtPkg.AsynchronousReponseCame = callback;
            return(reqtPkg);
        }
예제 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            opRulesList.Add(FsmListChange);
            opRulesList.Add(FsmStateChange);
            opRulesList.Add(EventButtonChange);
            opRulesList.Add(FsmList);
            opRulesList.Add(FsmState);
            opRulesList.Add(EventButtonList);
            opRulesList.Add(Log);

            opredRulesList.Add(RequestFsmList);
            opredRulesList.Add(RequestFsmState);
            opredRulesList.Add(RequestEventButton);
            opredRulesList.Add(FsmLoad);
            opredRulesList.Add(FsmUnload);
            opredRulesList.Add(FsmStart);
            opredRulesList.Add(FsmPause);
            opredRulesList.Add(FsmReset);
            opredRulesList.Add(FsmEvent);

            System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
            var communicationType = new System.Collections.ArrayList(Enum.GetValues(typeof(CommunicatType))).ToArray();

            this.comboBox1.Items.Clear();
            this.comboBox1.Items.AddRange(communicationType);
            this.comboBox1.SelectedIndex = 1;
            this.comboBox2.Items.Clear();
            this.comboBox2.Items.AddRange(communicationType);
            this.comboBox2.SelectedIndex = 1;
            this.comboBox5.Items.Clear();
            this.comboBox5.Items.AddRange(communicationType);
            this.comboBox5.SelectedIndex = 1;
            this.comboBox6.Items.Clear();
            this.comboBox6.Items.AddRange(communicationType);
            this.comboBox6.SelectedIndex = 1;
            this.comboBox10.Items.Clear();
            this.comboBox10.Items.AddRange(communicationType);
            this.comboBox10.SelectedIndex = 1;
            this.comboBox11.Items.Clear();
            this.comboBox11.Items.AddRange(communicationType);
            this.comboBox11.SelectedIndex = 1;

            var groupMemberRole = new System.Collections.ArrayList(Enum.GetValues(typeof(GroupMemberRole))).ToArray();

            this.comboBox4.Items.Clear();
            this.comboBox4.Items.AddRange(groupMemberRole);
            this.comboBox4.SelectedIndex = 2;

            var opRules    = new System.Collections.ArrayList(opRulesList).ToArray();
            var opredRules = new System.Collections.ArrayList(opredRulesList).ToArray();

            this.comboBox8.Items.Clear();
            this.comboBox8.Items.AddRange(opRules);
            this.comboBox8.Items.AddRange(opredRules);
            this.comboBox8.SelectedIndex = 0;
            this.comboBox9.Items.Clear();
            this.comboBox9.Items.AddRange(opRules);
            this.comboBox9.Items.AddRange(opredRules);
            this.comboBox9.SelectedIndex = 0;

            var reply_info = new System.Collections.ArrayList(Enum.GetValues(typeof(ReplyPackage.Middleware_ReplyInfo))).ToArray();

            this.comboBox13.Items.Clear();
            this.comboBox13.Items.AddRange(reply_info);
            this.comboBox13.SelectedIndex = 0;

            localDevice.RemotReqtRecived  += new RemotReqtRecivedHandler(RequestPackage_Received);
            localDevice.RemotRadioRecived += new RemotRadioRecivedHandler(RadioPackage_Received);
            //localDevice.AsynReponseRecived += new AsynReponseHandler(CallBack_MessageReceived);
            asynReponseHandler += new AsynReponseHandler(CallBack_Received);
        }