Exemplo n.º 1
0
 public OptionsForm(Handbell[] handbells, MotionControllerManager.MotionControllerManager mcm)
 {
     InitializeComponent();
     _mcm = mcm;
     _hb = handbells;
     InitializeFields();
 }
Exemplo n.º 2
0
        public void UpdateGraph(Handbell [] handbell, int handbellCount)
        {
            if (_frozen)
                return;

            int hbCt = handbellCount;
            if (hbCt > 4)
                hbCt = 4;

            for (int i = 0; i < hbCt; i++)
            {
                if (((ToolStripMenuItem)(calibrationLinesToolStripMenuItem.DropDownItems[i])).Checked)
                {
                    c2dGraph1.Push(handbell[i].HandstrokeStrikePoint, i + 8);
                    c2dGraph1.Push(handbell[i].BackstrokeStrikePoint, i + 12);
                }
                if (((ToolStripMenuItem)(strikeSignalsToolStripMenuItem.DropDownItems[i])).Checked)
                {
                    if (handbell[i].BackstrokeStrike || handbell[i].HandstrokeStrike)
                    {
                        c2dGraph1.Push(handbell[i].CurrentZ, i + 4);
                    }
                    else
                    {
                        c2dGraph1.Push(c2dGraph1.MinPeekMagnitude, i + 4);
                    }
                }
                if (((ToolStripMenuItem)(handbellLinesToolStripMenuItem.DropDownItems[i])).Checked)
                {
                    c2dGraph1.Push(handbell[i].CurrentZ, i);
                }
            }
            c2dGraph1.UpdateGraph();
        }
Exemplo n.º 3
0
 public ControllerForm(MotionControllerManager.MotionControllerManager mcm, Handbell [] hb)
 {
     InitializeComponent();
     _mcm = mcm;
     _hb = hb;
     listControllers();
     lstController.SelectedIndex = 0;
 }
Exemplo n.º 4
0
//		private bool IsSimulatorFocused()
//		{
//			foreach (Process p in Process.GetProcessesByName(_sim.ProcessName))
//			{
//				if (GetForegroundWindow() == p.MainWindowHandle)
//				{
//					return true;
//				}
//			}
//
//			return false;
//		}

        private void InitDevices()
        {
            tmrTurn.Stop();

            try
            {
                _mcm = new MotionControllerManager.MotionControllerManager();
                _mcm.initialize(true);
                _mcm.initDetectors();
                _mcm.update(0);
                //Set initial controller sequence
                for (int i = 0; i < _mcm.Count; i++)
                {
                    ControllerSequence[i] = i;
                }
                //Assign to handbells
                for (int i = 0; i < 4; i++)
                {
                    _hb[i] = new Handbell(_mcm, i);
                    if (i >= _mcm.Count)
                    {
                        _hb[i].Enabled = false;
                    }
                    else
                    {
                        _hb[i].Enabled = true;
                        _hb[i].UpdateSettings();
                        _hb[i].Update(0);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message != "No Motion Controller Found" && _suppressNoControllerMessage)
                {
                    MessageBox.Show(ex.Message, "Configuration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            _lastTick = Environment.TickCount;
            btnReset_Click(null, EventArgs.Empty);
            if (_mcm.Count > 0)
            {
                btnReset.Focus();
            }
            else
            {
                btnFindControllers.Focus();
            }

            if (_monitorForm != null)
            {
                _monitorForm.ReInitLines();
            }
            tmrTurn.Start();
        }
Exemplo n.º 5
0
        private void btnCalibrate_Click(object sender, EventArgs e)
        {
            sendKeystrokesEnabled = false;
            Button btn = (Button)sender;
            int    i   = Convert.ToInt32(btn.Name.Substring(btn.Name.Length - 1, 1));

            CalibrationForm cf    = new CalibrationForm();
            Handbell        newHB = cf.StartCalibration(_mcm, i);

            if (newHB != null)
            {
                _hb[i] = newHB;
            }
            sendKeystrokesEnabled = true;
        }
Exemplo n.º 6
0
        private void btnCalibrate_Click(object sender, EventArgs e)
        {
            ConfigForm.sendKeystrokesEnabled = false;
            Button btn = (Button)sender;
            int    i   = Convert.ToInt32(btn.Name.Substring(btn.Name.Length - 1, 1));

            CalibrationForm cf    = new CalibrationForm();
            Handbell        newHB = cf.StartCalibration(_mcm, i);

            //Apply Calibration
            if (newHB != null)
            {
                _hb[i] = newHB;
                tabHandbellCalibration.Controls["txtBSP" + i].Text = Settings.BSP[i].ToString();
                tabHandbellCalibration.Controls["txtHSP" + i].Text = Settings.HSP[i].ToString();
            }
            ConfigForm.sendKeystrokesEnabled = true;
        }
Exemplo n.º 7
0
        public Handbell StartCalibration(MotionControllerManager.MotionControllerManager manager, int index)
        {
            _handbell = new Handbell(manager, index);
            _question = 0;
            _index = index;
            AskQuestion();
            if (ShowDialog() == DialogResult.OK)
            {
                _handbell.UpdateSettings();

                Close();
                return _handbell;
            }
            else
            {
                Close();
                return null;
            }
        }
Exemplo n.º 8
0
        public Handbell StartCalibration(MotionControllerManager.MotionControllerManager manager, int index)
        {
            _handbell = new Handbell(manager, index);
            _question = 0;
            _index    = index;
            AskQuestion();
            if (ShowDialog() == DialogResult.OK)
            {
                _handbell.UpdateSettings();

                Close();
                return(_handbell);
            }
            else
            {
                Close();
                return(null);
            }
        }