Exemplo n.º 1
0
        /// <summary>
        /// Close the old interface device and open a new one.
        /// </summary>
        protected async Task <bool> ResetDevice()
        {
            if (this.vehicle != null)
            {
                this.vehicle.Dispose();
                this.vehicle = null;
            }

            Device device = DeviceFactory.CreateDeviceFromConfigurationSettings(this);

            if (device == null)
            {
                this.NoDeviceSelected();
                this.DisableUserInput();
                this.EnableInterfaceSelection();
                return(false);
            }

            Protocol protocol = new Protocol();

            this.vehicle = new Vehicle(
                device,
                protocol,
                this,
                new ToolPresentNotifier(device, protocol, this));
            if (!await this.InitializeCurrentDevice())
            {
                this.vehicle = null;
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Close the old interface device and open a new one.
        /// </summary>
        private async Task ResetDevice()
        {
            if (this.vehicle != null)
            {
                this.vehicle.Dispose();
                this.vehicle = null;
            }

            Device device = DeviceFactory.CreateDeviceFromConfigurationSettings(this);

            if (device == null)
            {
                this.deviceDescription.Text = "None selected.";
                this.DisableUserInput();
                this.interfaceBox.Enabled = true;
                return;
            }

            this.deviceDescription.Text = device.ToString();

            Protocol protocol = new Protocol();

            this.vehicle = new Vehicle(
                device,
                protocol,
                this,
                new ToolPresentNotifier(device, protocol, this));
            await this.InitializeCurrentDevice();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Close the old interface device and open a new one.
        /// </summary>
        private async Task ResetDevice()
        {
            if (this.vehicle != null)
            {
                this.vehicle.Dispose();
                this.vehicle = null;
            }

            Device device = DeviceFactory.CreateDeviceFromConfigurationSettings(this);

            if (device == null)
            {
                this.deviceDescription.Text = "None selected.";
                return;
            }

            this.deviceDescription.Text = device.ToString();

            this.vehicle = new Vehicle(device, new MessageFactory(), new MessageParser(), this);
            await this.InitializeCurrentDevice();
        }