private void _HandleMessage(AdapterMessage msg, bool updateWindow) { Program.Log.Write("{Adapter} Handling message (" + msg.ToString() + ") from adapter."); foreach (ListViewItem i in this.listViewInterface.Items) { GCInterface d = i.Tag as GCInterface; if (d != null && d.InterfaceID == msg.InterfaceID) { d.Status = msg.Status; if (i.SubItems.Count > 0) { i.SubItems[0].Text = msg.Status.ToString(); } Program.Log.Write("{Adapter} Handle message (" + msg.ToString() + ") from adapter succeeded."); if (updateWindow && i.Selected) { NotifySelectionChange(this.listViewInterface, EventArgs.Empty); Program.Log.Write("{Adapter} Update window by (" + msg.ToString() + ") succeeded."); } return; } } }
public void HandleMessage(AdapterMessage msg, bool updateWindow) { if (msg == null) { return; } Program.Log.Write("{Adapter} Received message (" + msg.ToString() + ") from adapter."); AdapterMessageHandler dlg = new AdapterMessageHandler(_HandleMessage); this.Invoke(dlg, new object[] { msg, updateWindow }); }
//private int MsgID = 0xFFFF; #region IMessageFilter Members public bool PreFilterMessage(ref Message m) { //if (m.Msg != MsgID) return false; //this.Text = m.LParam.ToString(); //MessageBox.Show(m.HWnd.ToString() + "\r\n" + // m.Msg.ToString() + "\r\n" + // m.WParam.ToString() + "\r\n" + // m.LParam.ToString() + "\r\n"); AdapterMessage am = AdapterMessage.FromMessage(m); if (am == null) { return(false); } MessageBox.Show(am.ToString()); return(true); }