public OptionsForm(Handbell[] handbells, MotionControllerManager.MotionControllerManager mcm)
 {
     InitializeComponent();
     _mcm = mcm;
     _hb  = handbells;
     InitializeFields();
 }
Exemple #2
0
 public OptionsForm(Handbell[] handbells, MotionControllerManager.MotionControllerManager mcm)
 {
     InitializeComponent();
     _mcm = mcm;
     _hb = handbells;
     InitializeFields();
 }
 public ControllerForm(MotionControllerManager.MotionControllerManager mcm, Handbell [] hb)
 {
     InitializeComponent();
     _mcm = mcm;
     _hb = hb;
     listControllers();
     lstController.SelectedIndex = 0;
 }
Exemple #4
0
 public ControllerForm(MotionControllerManager.MotionControllerManager mcm, Handbell [] hb)
 {
     InitializeComponent();
     _mcm = mcm;
     _hb  = hb;
     listControllers();
     lstController.SelectedIndex = 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();
        }
        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);
            }
        }