//recieving
 public void RecieveMessage(object sender, EventArgs eventArgs)
 {
     MessengingEventArgs<MeasuringMessage> messengingEventArgs =
         eventArgs as MessengingEventArgs<MeasuringMessage>;
     if (messengingEventArgs != null)
     {
         MeasuringMessage recievedMessage = messengingEventArgs.Object;
         if (recievedMessage.MessageType == MessageTypeEnum.CriticalInfo)
         {
             MongoMessage mongoMessage = new MongoMessage(recievedMessage);
             MongoDbAccessor.AddMongoMessage(mongoMessage);
         }
     }
 }
Exemple #2
0
 public void AddMongoMessage(MongoMessage mongoMessage)
 {
     IMongoCollection<BsonDocument> messagesCollection = GetMongoCollection("messages");
     messagesCollection.InsertOneAsync(mongoMessage.ToBsonDocument());
 }