public void DoNotify(NotifyEventObject obj) { //don't try catch here // System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bFormat = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); foreach (NotifyEventObject regobj in Register) { lock (stream) { if (obj.type == EventEnumType.TEST) { bFormat.Serialize(stream, obj); stream.Flush(); } if (obj.type == regobj.type) if (regobj.deviceName == "*" || regobj.deviceName == obj.deviceName) { // if (regobj.port == -1 || regobj.port == obj.port) bFormat.Serialize(stream, obj); stream.Flush(); } } } }
static void Program_OnEvent(object sender, NotifyEventObject objEvent) { // throw new Exception("The method or operation is not implemented."); Console.WriteLine(objEvent.EventObj.ToString()); }
public void RegistEvent(NotifyEventObject eventObj) { if(!connected) throw new Exception("�q�T�_�u�γs�u���A�еy��A��!"); bf.Serialize(tcp.GetStream(),eventObj); }
static void nclient_OnEvent(object sender,NotifyEventObject objEvent) { // throw new Exception("The method or operation is not implemented."); if (objEvent.type == EventEnumType.VD_Real_Data_Event) { System.Data.DataSet ds = (System.Data.DataSet)objEvent.EventObj; System.Data.DataRow r = ds.Tables[0].Rows[0]; for (int i = 0; i < ds.Tables[0].Columns.Count; i++) { Console.Write(ds.Tables[0].Columns[i].ColumnName + ":" + r[i].ToString()); } Console.WriteLine(); } }