private void button9_Click_1(object sender, EventArgs e)
 {
     try
     {
         conncamera();
         button6_Click_1();
         needsave = false;
         this.Camera.ContinueShot();
         Iboxcontroller iboxcontroller = new Iboxcontroller(this.testDevice, this.Camera);
         iboxcontroller.ShowDialog();
         if (iboxcontroller.DialogResult == DialogResult.OK)
         {
             string      name      = iboxcontroller.Xyname;
             string      xmove     = iboxcontroller.Xmove;
             string      ymove     = iboxcontroller.Ymove;
             string      firstpont = iboxcontroller.Firstpoint.X.ToString() + "," + iboxcontroller.Firstpoint.Y.ToString();
             string      endponit  = iboxcontroller.Endpoint.X.ToString() + "," + iboxcontroller.Endpoint.Y.ToString();
             XmlDocument doc       = new XmlDocument();
             doc.Load(@"xyrule.xml");
             //XmlNodeList no = doc.SelectSingleNode("//Rules").ChildNodes;
             XmlNode    xmlElementpark  = doc.SelectSingleNode("//Rules");
             XmlElement xmlElementall   = doc.CreateElement("rule");
             XmlElement xmlElement_name = doc.CreateElement("name");
             xmlElement_name.InnerText = name;
             xmlElementall.AppendChild(xmlElement_name);
             XmlElement xmlElement_cardnum = doc.CreateElement("leftup");
             xmlElement_cardnum.InnerText = firstpont;
             xmlElementall.AppendChild(xmlElement_cardnum);
             XmlElement xmlElement_kname = doc.CreateElement("rightdown");
             xmlElement_kname.InnerText = endponit;
             xmlElementall.AppendChild(xmlElement_kname);
             XmlElement xmlElement_khangbie = doc.CreateElement("xmove");
             xmlElement_khangbie.InnerText = xmove;
             xmlElementall.AppendChild(xmlElement_khangbie);
             XmlElement xmlElement_kainame = doc.CreateElement("ymove");
             xmlElement_kainame.InnerText = ymove;
             xmlElementall.AppendChild(xmlElement_kainame);
             xmlElementpark.AppendChild(xmlElementall);
             doc.Save(@"xyrule.xml");
         }
         comboxgetrules();
         Camera.CameraStop();
         testDevice.StylusReset();
         this.testDevice.Close();
     }
     catch (Exception ex)
     {
         Loghelper.WriteLog("创建运行规则失败", ex);
     }
 }