コード例 #1
0
        public void SendNextRandomLoadunloadCmd()
        {
            if (InvokeRequired)
            {
                DelSendNextRandomLoadunloadCmd mydel = new DelSendNextRandomLoadunloadCmd(SendNextRandomLoadunloadCmd);
                Invoke(mydel);
            }
            else
            {
                TempAddr = GetNextRandomAdr();
                LoadunloadCmd cmd = GetLoadunloadCmd(CurAddr, TempAddr);

                var pairs = SetupCommandInfoPairs(cmd);

                middleAgent.SendCommand(31, pairs);

                var showMsg = $"+++++++++ {cmd.CmdText} ++++++++++";

                AppendDebugLogMsg(showMsg);

                //LoopNext();
            }
        }
コード例 #2
0
        private void LoadXmls()
        {
            AXmlHandler = new XmlHandler();
            LoadunloadCmd aCmd = new LoadunloadCmd();

            aCmd = AXmlHandler.ReadXml <LoadunloadCmd>("AtoA.xml");
            CmdsFromA.Add(aCmd.EndAddress, aCmd);
            aCmd = AXmlHandler.ReadXml <LoadunloadCmd>("AtoB.xml");
            CmdsFromA.Add(aCmd.EndAddress, aCmd);
            aCmd = AXmlHandler.ReadXml <LoadunloadCmd>("AtoG.xml");
            CmdsFromA.Add(aCmd.EndAddress, aCmd);
            aCmd = AXmlHandler.ReadXml <LoadunloadCmd>("BtoB.xml");
            CmdsFromB.Add(aCmd.EndAddress, aCmd);
            aCmd = AXmlHandler.ReadXml <LoadunloadCmd>("BtoA.xml");
            CmdsFromB.Add(aCmd.EndAddress, aCmd);
            aCmd = AXmlHandler.ReadXml <LoadunloadCmd>("BtoG.xml");
            CmdsFromB.Add(aCmd.EndAddress, aCmd);
            aCmd = AXmlHandler.ReadXml <LoadunloadCmd>("GtoG.xml");
            CmdsFromG.Add(aCmd.EndAddress, aCmd);
            aCmd = AXmlHandler.ReadXml <LoadunloadCmd>("GtoA.xml");
            CmdsFromG.Add(aCmd.EndAddress, aCmd);
            aCmd = AXmlHandler.ReadXml <LoadunloadCmd>("GtoB.xml");
            CmdsFromG.Add(aCmd.EndAddress, aCmd);
        }
コード例 #3
0
        public Dictionary <string, string> SetupCommandInfoPairs(LoadunloadCmd loadunloadCmd)
        {
            Dictionary <string, string> pairs = new Dictionary <string, string>();

            try
            {
                pairs.Add("CmdID", loadunloadCmd.CmdId);
                pairs.Add("CSTID", loadunloadCmd.CstId);
                //pairs.Add("ActType", loadunloadCmd.ActType.ToString());
                pairs.Add("GuideSectionsStartToLoad", SetupCommandInfoPairFromBuffer(loadunloadCmd.GuideSectionsStartToLoad));
                pairs.Add("GuideAddressesStartToLoad", SetupCommandInfoPairFromBuffer(loadunloadCmd.GuideAddressesStartToLoad));
                pairs.Add("LoadAdr", loadunloadCmd.LoadAdr);
                pairs.Add("GuideSectionsToDestination", SetupCommandInfoPairFromBuffer(loadunloadCmd.GuideSectionsToDestination));
                pairs.Add("GuideAddressesToDestination", SetupCommandInfoPairFromBuffer(loadunloadCmd.GuideAddressesToDestination));
                pairs.Add("DestinationAdr", loadunloadCmd.DestinationAdr);
                pairs.Add("SecDistance", loadunloadCmd.SecDistance.ToString());
            }
            catch (Exception ex)
            {
                var msg = ex.StackTrace;
            }

            return(pairs);
        }