Ejemplo n.º 1
0
        public SettingsControlDemo(PluginMain p)
        {
            parent = p;
            InitializeComponent();

            checkboxGearPrefix.IsChecked   = parent.settingHandler.GetDefaultPrefix();
            checkboxEnableInGame.IsChecked = parent.settingHandler.GetDefaultEnableInGame();

            CheckboxGearPrefix_Checked(null, null);
            CheckboxEnableInGame_Checked(null, null);

            datagr.ItemsSource = parent.serialHandler.customPar;
        }
Ejemplo n.º 2
0
        public SerialHandler(PluginMain p)
        {
            parent = p;

            //serial.PortName = SerialHandler.GetPort("STM32 Virtual ComPort");
            serial.BaudRate = 921600;
            serial.DataBits = 8;
            serial.Parity   = Parity.None;
            serial.StopBits = StopBits.One;
            // Set the read/write timeouts
            serial.ReadTimeout  = 500;
            serial.WriteTimeout = 500;

            parList = new List <PluginData.IPluginData>
            {
                speed,
                rpm,
                handbrake,
                gear,
                button,
                enable
            };

            customPar = new List <CustomParameter>()
            {
                new CustomParameter("Normal Light", "l0", parent.settingHandler),
                new CustomParameter("Long Beam", "l1", parent.settingHandler),
                new CustomParameter("Blinker Left", "l2", parent.settingHandler),
                new CustomParameter("Blinker Right", "l3", parent.settingHandler),
                new CustomParameter("Fog Front", "l4", parent.settingHandler),
                new CustomParameter("Fog Rear", "l5", parent.settingHandler),
                new CustomParameter("Handbrake", handbrake, parent.settingHandler),
                new CustomParameter("ESP off", "w2", parent.settingHandler),
                new CustomParameter("ESP active", "w1", parent.settingHandler),
                new CustomParameter("Check engine", "w6", parent.settingHandler),
                new CustomParameter("Cruise control", "w9", parent.settingHandler)
            };

            foreach (var x in customPar)
            {
                parList.Add(x.GetPlugData());
            }

            timer.AutoReset = true;
            timer.Elapsed  += Timer_Elapsed;
            timer.Interval  = 1.0;
            timer.Start();
        }