protected void OnMessageDateTime(DateTimeMessage ea) { if (MessageDateTime != null) { MessageDateTime(this, new ProtocolMessageEventArgs <DateTimeMessage> { Message = ea }); } }
public void SendDateTime(DateTime dt) { var msg = new DateTimeMessage() { DateTime = dt }; this.Presentation.SendData(msg); }
public async Task Handle(DateTimeMessage message) { lock (msgLock) { Console.WriteLine("Got DateTime: {0} {1}", message.DateTime, message.DateTime.Millisecond); Console.WriteLine("Local DateTime: {0} {1}", DateTime.Now, DateTime.Now.Millisecond); Console.WriteLine("Time diff (ms): {0}", (DateTime.Now - message.DateTime).TotalMilliseconds); DoSleepAndUpdateConsole(1000).Wait(); } }
public DateTimeMessage GetTime() { DateTimeMessage msg = new DateTimeMessage(); Thread.Sleep(3000); //namjerno usporavam da se vidi čekanje... msg.TekstPoruke = "Web Api request"; msg.DateTimeValue = DateTime.Now.ToString(); return(msg); }
public void ShouldSerializeDateTime() { var dateTime = DateTime.Now; var message = new DateTimeMessage { CreateDate = dateTime }; var memoryStream = new MemoryStream(); new AdvancedXmlSerializer().Serialize(new IMessage[] { message }, memoryStream); memoryStream.Seek(0, SeekOrigin.Begin); var deserialized = new AdvancedXmlSerializer().Deserialize(memoryStream); ((DateTimeMessage)deserialized[0]).CreateDate.ToString().Should(Be.EqualTo(dateTime.ToString())); }
public async Task Handle(DateTimeMessage message) { Console.WriteLine("Got DateTime: {0}", message.DateTime); }
public void ShouldSerializeDateTime() { var dateTime = DateTime.Now; var message = new DateTimeMessage {CreateDate = dateTime}; var memoryStream = new MemoryStream(); new AdvancedXmlSerializer().Serialize(new IMessage[] {message}, memoryStream); memoryStream.Seek(0, SeekOrigin.Begin); var deserialized = new AdvancedXmlSerializer().Deserialize(memoryStream); ((DateTimeMessage) deserialized[0]).CreateDate.ToString().Should(Be.EqualTo(dateTime.ToString()), "((DateTimeMessage) deserialized[0]).CreateDate.ToString().Should(Be.EqualTo(dateTime.ToString()))"); }
public async Task Handle(DateTimeMessage message) { _logger.LogInformation("Got DateTime: {0}", message.DateTime); }