Beispiel #1
0
        private void dataGridViewUsbList_SelectionChanged(object sender, EventArgs e)
        {
            selectedRow = null;

            if (dataGridViewUsbList.SelectedRows.Count > 0)
            {
                selectedRow = (HostUsbRow)dataGridViewUsbList.SelectedRows[0];
            }

            if (selectedRow == null)
            {
                // When none item selected, disable the button and show
                // "Enable Passthrough" on the button for better experience.
                buttonPassthrough.Text    = Messages.USBLIST_ENABLE_PASSTHROUGH_HOTKEY;
                buttonPassthrough.Enabled = false;
            }
            else if (selectedRow.Pusb.passthrough_enabled)
            {
                // Selected item has been passthrough enabled, set the availability of the button
                // as per whether the device has been attached or not.
                PUSB      pusb     = selectedRow.Pusb;
                USB_group usbGroup = pusb.Connection.Resolve(pusb.USB_group);
                bool      attached = (usbGroup != null) && (usbGroup.VUSBs != null) && (usbGroup.VUSBs.Count > 0);

                buttonPassthrough.Text    = Messages.USBLIST_DISABLE_PASSTHROUGH_HOTKEY;
                buttonPassthrough.Enabled = !attached;
            }
            else
            {
                // Selected item has not been passthrough enabled.
                buttonPassthrough.Text    = Messages.USBLIST_ENABLE_PASSTHROUGH_HOTKEY;
                buttonPassthrough.Enabled = true;
            }
        }
Beispiel #2
0
            public void UpdateDetails()
            {
                USB_group usbgroup = _vusb.Connection.Resolve(_vusb.USB_group);
                PUSB      pusb     = _vusb.Connection.Resolve(usbgroup.PUSBs[0]);

                locationCell.Value    = pusb.path;
                descriptionCell.Value = pusb.Description();
                attachedCell.Value    = _vusb.currently_attached.ToYesNoStringI18n();
            }
Beispiel #3
0
            public HostUsbRow(PUSB pusb)
            {
                _pusb = pusb;
                SetVm();

                _pusb.PropertyChanged += Pusb_PropertyChanged;

                Cells.AddRange(locationCell,
                               descriptionCell,
                               passthroughCell,
                               vmCell);
                UpdateDetails();
            }
Beispiel #4
0
 protected override void Run()
 {
     PUSB.set_passthrough_enabled(Session, _pusb.opaque_ref, _passthroughEnabled);
     Description = _passthroughEnabled ? Messages.ACTION_USB_PASSTHROUGH_ENABLED : Messages.ACTION_USB_PASSTHROUGH_DISABLED;
 }
Beispiel #5
0
 public SetUsbPassthroughAction(PUSB pusb, bool passthroughEnabled) :
     base(pusb.Connection, String.Format(passthroughEnabled ? Messages.ACTION_USB_PASSTHROUGH_ENABLING : Messages.ACTION_USB_PASSTHROUGH_DISABLING, pusb.Name()))
 {
     _pusb = pusb;
     _passthroughEnabled = passthroughEnabled;
 }
Beispiel #6
0
 public UsbUsageDialog(PUSB pusb)
 {
     _pusb = pusb;
     InitializeComponent();
     RefreshControls();
 }
Beispiel #7
0
 public UsbItem(PUSB pusb) : base(true)
 {
     Pusb = pusb;
     Text = String.Format(Messages.STRING_SPACE_STRING, Pusb.path, Pusb.Description());
 }
Beispiel #8
0
 public CreateVUSBAction(PUSB pusb, VM vm) :
     base(pusb.Connection, String.Format(Messages.ACTION_VUSB_CREATING, pusb.Name(), vm.Name()))
 {
     _pusb = pusb;
     VM    = vm;
 }