public USBDevice(string name, ComState comState, Button button, DriveType driveType) { Name = name; ComState = comState; Button = button; DriveType = driveType; }
/// <summary> /// 在主界面上添加控件 /// </summary> /// <param name="num"></param> /// <param name="comState"></param> /// <param name="button"></param> private void AddControl(string num, out ComState comState, out Button button) { button = new Button() { Margin = new Thickness(10), Height = 30, Content = string.Format("{0}已连接(点击移除)", num) }; button.Click += DoUSBout;; leftPanel.Children.Add(button); comState = new ComState() { Margin = new Thickness(3) }; comState.StateWating(); comState.SetNum(num); rightPanel.Children.Add(comState); }