public void addPad(PadInfo padInfo) { lock (mAddQueue) { mAddQueue.Enqueue(padInfo); Monitor.Pulse(mAddQueue); } }
public void connectPad(PadInfo info) { if (mWorking) return; mPadInfo = info; Thread workThread = new Thread(new ThreadStart(startConnectPad)); workThread.Start(); mWorking = true; }
public void onDeviceAdded(PadInfo info) { ToolStripMenuItem deviceMenuItem = new ToolStripMenuItem(); deviceMenuItem.DisplayStyle = ToolStripItemDisplayStyle.Text; deviceMenuItem.Size = new Size(50, 22); deviceMenuItem.Text = info.DeviceName; Console.WriteLine("add " + info.DeviceName); deviceMenuItem.Click += new EventHandler(onDeviceToolStripMenuItemClick); while (!mContextMenuStrip.IsHandleCreated) ; mContextMenuStrip.BeginInvoke(new AddDeviceItemDelegate(addDeviceItem), new object[] { info.DeviceId, deviceMenuItem }); }
public void onDeviceRemoved(PadInfo info) { Log.v("invoke remove delegate:" + info.DeviceId); try { while (!mContextMenuStrip.IsHandleCreated) ; mContextMenuStrip.BeginInvoke(new RemoveDeviceItemDelegate(removeDeviceItem), new object[]{info.DeviceId}); } catch (Exception e) { Log.v(e.Message); } }
private PadInfo makePadInfo(BroadcastMsg msg, IPAddress address) { PadInfo info = new PadInfo(msg.DeviceId, msg.DeviceName, address, msg.Port); return info; }