private void lDeviceCom_DoubleClick(object sender, EventArgs e) { ListView.SelectedListViewItemCollection items = lDeviceCom.SelectedItems; foreach (ListViewItem item in items) { DeviceCommand commandDev = currentDevice; CloseCommandView(); commandDev.Logger.Clear(); DeviceCommand.Command command = commandDev.GetCommand(item.Text); currentCommandView = new CommandView(); bool hasCommands = command is DeviceCommand.ParamCommand; if (hasCommands) { hasCommands = currentCommandView.DisplayCommand((DeviceCommand.ParamCommand)command, commandDev); } if (!hasCommands) { IoStatus status = command.Execute(commandDev); if ((status.error == USBError.SUCCESS) && (status.size == 0)) { continue; } currentCommandView = new CommandView(); currentCommandView.DisplayCommand(status, commandDev.Logger.ToArray()); } currentCommandView.Location = new Point(this.Location.X + this.RestoreBounds.Width + 10, this.Location.Y - (currentCommandView.Height - this.Height) / 2); currentCommandView.Show(); } DeviceCommandChanged(currentDevice, null); }
private void CloseCommandView() { if (currentCommandView != null) { try { currentCommandView.Close(); } catch {} } currentCommandView = null; }
public VirtView() { InitializeComponent(); currentDevice = null; currentCommandView = null; }