// Invoke the ReceivedPacket event protected virtual void OnReceivedPacket(ManagerEventArgs e) { if (ReceivedPacket != null) { ReceivedPacket(this, e); } }
// Invoke the NewDevice event protected virtual void OnNewDevice(ManagerEventArgs e) { if (NewDevice != null) { NewDevice(this, e); } }
// Invoke the HypothesisChanged event protected virtual void OnHypothesisChanged(ManagerEventArgs e) { if (HypothesisChanged != null) { HypothesisChanged(this, e); } }
public void UpdateHypothesis(string name, bool value, string label = null) { //Console.WriteLine("HYPOTHESIS: " + name + "=" + value + " (" + label + ")."); if (label == null) { label = name; } if (!value && activeHypothesis.ContainsKey(name)) { activeHypothesis.Remove(name); } else if (value) { activeHypothesis[name] = label; } string currentLabel = null; foreach (KeyValuePair<string, string> kvp in activeHypothesis) { currentLabel = kvp.Value; } //Console.WriteLine("HYPOTHESIS: " + currentLabel); CurrentHypothesis = currentLabel; ManagerEventArgs mea = new ManagerEventArgs(name, value, label); OnHypothesisChanged(mea); if (outStompConnection == null && !outStompAttempted) { try { outStompConnection = new StompConnection(outStompHost, outStompPort); } catch (Exception) { ; } outStompAttempted = true; } if (outStompConnection != null) { // Create JSON-encoded data Hashtable sourceData = new Hashtable(); sourceData.Add("name", name); sourceData.Add("value", value); string jsonData = Json.JsonEncode(sourceData); outStompConnection.Send(outStompTopic, jsonData); Console.WriteLine("Sent " + jsonData + " to " + outStompTopic); } else { //Console.WriteLine("FAILED to send to " + outStompTopic); } }
void waxManager_ReceivedPacket(object sender, ManagerEventArgs e) { if (autoInvalidate) { this.Invalidate(); } }
void waxManager_NewDevice(object sender, ManagerEventArgs e) { this.Invalidate(); }