Ejemplo n.º 1
0
 public void Form1_Load(object sender, EventArgs e)
 {
     PhysicalSwitch.Initialise();
     FillEngines();
     m_Loaded                 = true;
     ctrSwitch0.Type          = PhysicalSwitch.Types.Keyboard;
     ctrSwitch0.Parameter     = (int)Keys.Space;
     ctrSwitch1.Type          = PhysicalSwitch.Types.Keyboard;
     ctrSwitch1.Parameter     = (int)Keys.Enter;
     cmbMethods.SelectedIndex = 1;
 }
Ejemplo n.º 2
0
        public cfgSwitching()
        {
            PhysicalSwitch.Initialise();             // will be ignored if already done.  Required for detect mechanism to work

            InitializeComponent();
            Strings.Translate(this);
            TimingLabels   = new[] { lblAcceptance, lblPostActivation, lblLongPress, lblScanTime, lblFirstRepeat, lblSubsequentRepeat, lblDwellSelect, lblCriticalReverse };
            TimingControls = new[] { ctrTimingAcceptance, ctrTimingPostActivation, ctrTimingLongPress, ctrTimingScanTime, ctrTimingFirstRepeat, ctrTimingSubsequentRepeat, ctrTimingDwellTime, ctrTimingCriticalReverse };
            foreach (Label lbl in TimingLabels)
            {
                Engine.Timings timing = (Engine.Timings)Convert.ToInt32(lbl.Tag);
                lbl.Text = Strings.Item("Switch_Timing_" + timing);
            }
            foreach (ctrEditTiming ctr in TimingControls)
            {
                ctr.UserChangedValue += ctrTiming_UserChangedValue;
            }
        }
Ejemplo n.º 3
0
        /// <summary>Creates the necessary switching objects from the config settings, and returns the engine object</summary>
        public static Engine PrepareSwitchingFromConfig()
        {
            int numberSwitches = Globals.Root.CurrentConfig.ReadInteger(Config.Number_Switches, 1); // only needed indirectly;  the engine often is enough info, but a 2 switch engine can use 1 with long presses

            PhysicalSwitch.Initialise();                                                            // will be ignored if already done
            var engine = Create((Methods)Globals.Root.CurrentConfig.ReadInteger(Config.Switch_Engine, (int)DefaultMethodForSwitches(numberSwitches)));

            PhysicalSwitch.ClearSwitches();
            if (engine.NumberSwitchInputs >= 1)
            {
                PhysicalSwitch.AssignSwitchFromConfig(0);
            }
            if (engine.NumberSwitchInputs >= 2)
            {
                PhysicalSwitch.AssignSwitchFromConfig(1);
            }

            if (numberSwitches > 0)             // for 0, mouse switch will do what is needed on initialise
            {
                if (numberSwitches == 2)
                {
                    Logical.CreateSwitches(Logical.Number.Two, engine);
                }
                else if (engine.NumberSwitchInputs == 2)
                {
                    Logical.CreateSwitches(Logical.Number.ShortLong, engine);
                }
                else
                {
                    Logical.CreateSwitches(Logical.Number.One, engine);
                }
            }

            engine.Initialise();
            return(engine);
        }