예제 #1
0
 //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);
         }
     }
 }
예제 #2
0
 public void AddMongoMessage(MongoMessage mongoMessage)
 {
     IMongoCollection<BsonDocument> messagesCollection = GetMongoCollection("messages");
     messagesCollection.InsertOneAsync(mongoMessage.ToBsonDocument());
 }