Ejemplo n.º 1
0
        private void ReflectSwitches()
        {
            bool oldFilling = m_Filling;

            SuspendLayout();
            int switches = m_Applied.ReadInteger(Config.Number_Switches, 1);

            lblSwitch1.Visible = switches >= 1;
            ctrSwitch1.Visible = switches >= 1;
            ctrSwitch2.Visible = switches >= 2;

            cmbScanType.Items.Clear();
            m_PossibleEngines = Engine.PossibleEngines(switches).ToList();
            foreach (Engine possible in m_PossibleEngines)
            {
                cmbScanType.Items.Add(possible.DisplayName);
            }
            ReflectEngine();
            ResumeLayout();
            m_Filling = oldFilling;
            Engine.Methods configured = (Engine.Methods)m_Applied.ReadInteger(Config.Switch_Engine, -1);
            if (configured < 0 || !m_PossibleEngines.Any(e => e.Method == configured))
            {
                configured = Engine.DefaultMethodForSwitches(switches);
            }
            cmbScanType.SelectedIndex = m_PossibleEngines.IndexOf(m_PossibleEngines.FirstOrDefault(e => e.Method == configured));
            // will fire the event to save the value, which is important if it was change, and just has no effect otherwise
        }
Ejemplo n.º 2
0
 public void cmbMethods_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbMethods.SelectedIndex < 0 || !m_Loaded)
     {
         return;
     }
     Engine.Methods eMethod = (Engine.Methods)cmbMethods.SelectedValue;
     if (m_Engine != null && m_Engine.Method == eMethod)
     {
         return;
     }
     StartScan();
     FillTimings();
 }
Ejemplo n.º 3
0
        public static PhysicalSwitch Create(int param)
        {
            if (View == null)
            {
                throw new InvalidOperationException("PointerSwitch.View not assigned");
            }
            Engine.Methods method = (Engine.Methods)param;
            switch (method)
            {
            case Engine.Methods.DirectPointer:
                return(new PointerClickSwitch());

            case Engine.Methods.DwellPointer:
                return(new PointerDwellSwitch());

            case Engine.Methods.DwellAveragePointer:
                return(new PointerDwellAverageSwitch());

            default: throw new ArgumentException(nameof(param));
            }
        }