예제 #1
0
        private void FillInController(string xmlFileName)
        {
            try
            {
                this._doc = XDocument.Load(xmlFileName);
            }
            catch
            {
                MessageBox.Show(string.Concat("Failed to load XML file: ", xmlFileName));
            }
            if (this._doc == null)
            {
                throw new Exception(string.Concat("Failed to open XML file: ", xmlFileName));
            }
            IEnumerable <XElement> controllerNode =
                from xml in this._doc.Descendants("TXLaserModule").Elements <XElement>("TXLaserController")
                select xml;

            if (controllerNode != null)
            {
                foreach (XElement element in controllerNode)
                {
                    string            name       = element.Attribute("name").Value;
                    string            com_port   = element.Attribute("comport").Value;
                    int               baudrate   = int.Parse(element.Attribute("baudrate").Value);
                    TXLaserController controller = new TXLaserController(com_port, baudrate);
                    this.controllerList.Add(controller);
                }
            }
        }
예제 #2
0
 public TXLaserViewFeeder(TXLaserController controller)
 {
     this._txLaserController = controller;
     this._txLaserView       = new TXLaserView();
     this.init();
     this.subscribeToView();
     this.SetButtonState(false);
 }
예제 #3
0
 public TXLaserStartForm()
 {
     this.InitializeComponent();
     this._txLaserModuleAPI  = TXLaserModuleAPI.instance();
     this._txLaserController = this._txLaserModuleAPI.GetControllerList[0];
     this._txLaserController.Connect();
     this.panel1.Controls.Add(this._txLaserController.View);
 }