Пример #1
0
 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;
 }
Пример #3
0
 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 });
 }
Пример #4
0
 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;
 }