Exemplo n.º 1
0
        private void UpStatusbarInfo(string S, LibUsbDotNet.DeviceNotify.Info.UsbDeviceNotifyInfo deviceinfo)
        {
            switch (S)
            {
            case "Connected":
                tbUSBSt.Foreground = Brushes.Green;
                tbPID.Text         = deviceinfo.IdProduct.ToString();
                tbVID.Text         = deviceinfo.IdVendor.ToString();
                tbSN.Text          = deviceinfo.SerialNumber;
                btnG.IsEnabled     = true;
                break;

            case "Disconnected":
                tbUSBSt.Foreground = Brushes.Red;
                tbPID.Text         = "";
                tbVID.Text         = "";
                tbSN.Text          = "";
                btnG.IsEnabled     = false;

                break;

            default:
                break;
            }
            tbUSBSt.Text = S;
        }
Exemplo n.º 2
0
        private void UpStatusbarInfo(string S, LibUsbDotNet.DeviceNotify.Info.UsbDeviceNotifyInfo deviceinfo)
        {
            Uri        uri;
            ImageBrush ib;

            switch (S)
            {
            case "Connected":
                //tbUSBSt.Foreground = Brushes.Green;
                //tbPID.Text = deviceinfo.IdProduct.ToString();
                //tbVID.Text = deviceinfo.IdVendor.ToString();
                //tbSN.Text = deviceinfo.SerialNumber;
                uri               = new Uri(@"connect.png", UriKind.Relative);
                ib                = new ImageBrush();
                ib.ImageSource    = new BitmapImage(uri);
                ib.Stretch        = Stretch.Uniform;
                lbicon.Background = ib;
                // lbicon.Background.SetValue(, Stretch.Uniform);
                btnG.IsEnabled = true;
                break;

            case "Disconnected":
                //tbUSBSt.Foreground = Brushes.Red;
                //tbPID.Text = "";
                //tbVID.Text = "";
                //tbSN.Text  = "";
                uri               = new Uri(@"disconnect.jpg", UriKind.Relative);
                ib                = new ImageBrush();
                ib.ImageSource    = new BitmapImage(uri);
                ib.Stretch        = Stretch.Uniform;
                lbicon.Background = ib;
                btnG.IsEnabled    = false;

                break;

            default:
                break;
            }
            // tbUSBSt.Text = S;
        }