Beispiel #1
0
        /// <summary>
        /// Handle clicking the "Select Interface" button
        /// </summary>
        /// <returns></returns>
        public async Task <bool> HandleSelectButtonClick()
        {
            if (this.vehicle != null)
            {
                this.vehicle.Dispose();
                this.vehicle = null;
            }

            DevicePicker picker = new DevicePicker(this);
            DialogResult result = picker.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (picker.DeviceCategory == Configuration.Constants.DeviceCategorySerial)
                {
                    if (string.IsNullOrEmpty(picker.SerialPort))
                    {
                        return(false);
                    }

                    if (string.IsNullOrEmpty(picker.SerialPortDeviceType))
                    {
                        return(false);
                    }
                }

                if (picker.DeviceCategory == Configuration.Constants.DeviceCategoryJ2534)
                {
                    if (string.IsNullOrEmpty(picker.J2534DeviceType))
                    {
                        return(false);
                    }
                }

                Configuration.DeviceCategory       = picker.DeviceCategory;
                Configuration.J2534DeviceType      = picker.J2534DeviceType;
                Configuration.SerialPort           = picker.SerialPort;
                Configuration.SerialPortDeviceType = picker.SerialPortDeviceType;
                return(await this.ResetDevice());
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Handle clicking the "Select Interface" button
        /// </summary>
        /// <returns></returns>
        public async Task <bool> HandleSelectButtonClick()
        {
            if (this.vehicle != null)
            {
                this.vehicle.Dispose();
                this.vehicle = null;
            }

            DevicePicker picker = new DevicePicker(this);
            DialogResult result = picker.ShowDialog();

            if (result == DialogResult.OK)
            {
                Configuration.DeviceCategory       = picker.DeviceCategory;
                Configuration.J2534DeviceType      = picker.J2534DeviceType;
                Configuration.SerialPort           = picker.SerialPort;
                Configuration.SerialPortDeviceType = picker.SerialPortDeviceType;
            }

            return(await this.ResetDevice());
        }
Beispiel #3
0
        /// <summary>
        /// Select which interface device to use. This opens the Device-Picker dialog box.
        /// </summary>
        private async void selectButton_Click(object sender, EventArgs e)
        {
            if (this.vehicle != null)
            {
                this.vehicle.Dispose();
                this.vehicle = null;
            }

            DevicePicker picker = new DevicePicker(this);
            DialogResult result = picker.ShowDialog();

            if (result == DialogResult.OK)
            {
                Configuration.DeviceCategory       = picker.DeviceCategory;
                Configuration.J2534DeviceType      = picker.J2534DeviceType;
                Configuration.SerialPort           = picker.SerialPort;
                Configuration.SerialPortDeviceType = picker.SerialPortDeviceType;
            }

            await this.ResetDevice();
        }