Exemple #1
0
        public int Setup(int serial)
        {
            int setupResult = 0;

            serialNum = serial;
            bool found = tub.Initialize(tub.GetSettingsFromDB(serial));

            if (found)
            {
                setupResult++;
            }
            var runSettings = found && tub.name.Length > 0 ? DBHelper.SearchTable(Settings.Default.SettingsTable, "Moxtek#", tub.name) : null;

            found = runSettings != null;
            if (found)
            {
                GiveSettings(runSettings.Rows[0].ItemArray);
                picTube.Image = tub.productImage;
                setupResult++;
            }
            else
            {
                runTime       = new TimeSpan(0, 0, 0);
                picTube.Image = picTube.ErrorImage;
                tub.status    = Tube.Status.Error;
            }
            ledStatus.Value = true;
            return(setupResult);
        }
Exemple #2
0
 private void txtSerial_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         int id = 0;
         if (int.TryParse(txtSerial.Text.Split('-')[0], out id))
         {
             var search = tub.GetSettingsFromDB(id);
             if (search != null)
             {
                 var ask = MessageBox.Show($"Is the power supply a { search[1] }?", $"Load { search[10] }?", MessageBoxButtons.YesNo);
                 if (ask == DialogResult.Yes && tub.Initialize(search))
                 {
                     if (lnkLog.Enabled)
                     {
                         lnkLog.Text = $@"K:\Software\Tubes\Saved Data\{ tub.serialNum }\{ Log.timeStamp }.txt";
                     }
                     picTube.Image = tub.productImage;
                     picTube.Show();
                     if (tub.controlType == Tube.ControlType.I2C && !tabControl1.TabPages.Contains(tabI2C))
                     {
                         tabControl1.TabPages.Add(tabI2C);
                     }
                     else if (tabControl1.TabPages.Contains(tabI2C))
                     {
                         tabControl1.TabPages.Remove(tabI2C);
                     }
                 }
                 else
                 {
                     txtSerial.Clear();
                 }
             }
             else
             {
                 txtSerial.Clear();
             }
         }
         else
         {
             txtSerial.Clear();
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// Manual connect each device.
        /// </summary>
        /// <param name="powerSupply">COM port.</param>
        /// <param name="amplifier">COM port.</param>
        /// <param name="spiI2c">Controller name.</param>
        /// <param name="daqTasks">DAQ Task names.</param>
        /// <returns></returns>
        public void Connect(string powerSupply, string amplifier, string spiI2c, string daqTasks)
        {
            tub = new Tube(powerSupply, amplifier, spiI2c, daqTasks);
            tub.updateControls += UpdateControls;

            if (tub.connected)
            {
                tub.Initialize();
                tmrUpdate.Start();
            }
        }
Exemple #4
0
        /// <summary>
        /// Connect to Universal Tube Controller (UTC).
        /// </summary>
        /// <param name="utcIP">IP address of UTC.</param>
        public void Connect(string utcIP)
        {
            tub = new Tube(utcIP);
            tub.updateControls += UpdateControls;

            if (tub.connected)
            {
                tub.Initialize();
                tmrUpdate.Start();
            }
        }
    private void CreateTube()
    {
        if (Time.time - createTime < interval)
        {
            return;
        }

        if (GameManager.Manager.IsStart && !GameManager.Manager.IsOver)
        {
            startPosition = new Vector2(startPositionX, Random.Range(-3f, -1f));
            Tube t = GameObject.Instantiate(tube, startPosition, Quaternion.identity).GetComponent <Tube>();
            t.Initialize(tubeSpeed);
            createTime = Time.time;
        }
    }