From 19d2f51e3c88cdb2c6fac405b03c7ff0f1aab17e Mon Sep 17 00:00:00 2001 From: padartamas Date: Mon, 28 Aug 2023 23:25:44 +0200 Subject: [PATCH] New example & test Bump version to 2.1 --- .../MndpService.Core/MndpService.Core.csproj | 6 ++-- MndpTray/MndpTray.Core/MndpTray.Core.csproj | 6 ++-- .../MndpTray.Protocol.Test.csproj | 8 ++--- .../MndpTray.Protocol.csproj | 6 ++-- README.md | 32 +++++++++++-------- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/MndpTray/MndpService.Core/MndpService.Core.csproj b/MndpTray/MndpService.Core/MndpService.Core.csproj index 643931f..93b5713 100644 --- a/MndpTray/MndpService.Core/MndpService.Core.csproj +++ b/MndpTray/MndpService.Core/MndpService.Core.csproj @@ -6,9 +6,9 @@ true true Data\key.snk - 2.0.0.0 - 2.0.0.0 - 2.0.0 + 2.1.0.0 + 2.1.0.0 + 2.1.0 https://github.com/xmegz/MndpTray true diff --git a/MndpTray/MndpTray.Core/MndpTray.Core.csproj b/MndpTray/MndpTray.Core/MndpTray.Core.csproj index 795334c..769e1ce 100644 --- a/MndpTray/MndpTray.Core/MndpTray.Core.csproj +++ b/MndpTray/MndpTray.Core/MndpTray.Core.csproj @@ -8,9 +8,9 @@ true true Data\key.snk - 2.0.0.0 - 2.0.0.0 - 2.0.0 + 2.1.0.0 + 2.1.0.0 + 2.1.0 https://github.com/xmegz/MndpTray true diff --git a/MndpTray/MndpTray.Protocol.Test/MndpTray.Protocol.Test.csproj b/MndpTray/MndpTray.Protocol.Test/MndpTray.Protocol.Test.csproj index 8f2f4b0..b9aeb22 100644 --- a/MndpTray/MndpTray.Protocol.Test/MndpTray.Protocol.Test.csproj +++ b/MndpTray/MndpTray.Protocol.Test/MndpTray.Protocol.Test.csproj @@ -1,11 +1,11 @@  - net462 + net60 Exe true - 2.0.0.0 - 2.0.0.0 - 2.0.0 + 2.1.0.0 + 2.1.0.0 + 2.1.0 diff --git a/MndpTray/MndpTray.Protocol/MndpTray.Protocol.csproj b/MndpTray/MndpTray.Protocol/MndpTray.Protocol.csproj index 16e6f5c..8791c5d 100644 --- a/MndpTray/MndpTray.Protocol/MndpTray.Protocol.csproj +++ b/MndpTray/MndpTray.Protocol/MndpTray.Protocol.csproj @@ -2,9 +2,9 @@ netstandard2.0;net462 - 2.0.0.0 - 2.0.0.0 - 2.0.0 + 2.1.0.0 + 2.1.0.0 + 2.1.0 true True True diff --git a/README.md b/README.md index 8060f60..d9ee766 100644 --- a/README.md +++ b/README.md @@ -75,34 +75,40 @@ Standalone package for intergation and testing * Try it on .Net Fiddle: [https://dotnetfiddle.net/vMF42n/](https://dotnetfiddle.net/vMF42n/) ```C# -using System; -using System.Threading; - namespace MndpTray.Protocol.Test { - public class Program - { - private static readonly Timer Timer = new Timer(Timer_Callback, null, Timeout.Infinite, Timeout.Infinite); + using System; + using System.Threading; - public static void Main(string[] args) + /// + /// Startup Class. + /// + public static class Program + { + /// + /// Startup Method. + /// + public static void Main() { MndpListener.Instance.Start(); + MndpListener.Instance.OnDeviceDiscovered += Instance_OnDeviceDiscovered; MndpSender.Instance.Start(MndpHostInfo.Instance); - Timer.Change(0, 5000); Console.WriteLine("--- Start ---"); - while (!Console.KeyAvailable) { Thread.Sleep(100); } + Console.WriteLine("Press any key to stop"); + + while (!Console.KeyAvailable) + Thread.Sleep(100); + Console.WriteLine("--- Stop ---"); - Timer.Change(Timeout.Infinite, Timeout.Infinite); MndpListener.Instance.Stop(); MndpSender.Instance.Stop(); } - private static void Timer_Callback(object state) + private static void Instance_OnDeviceDiscovered(object sender, MndpListener.DeviceDiscoveredEventArgs e) { - foreach (var i in MndpListener.Instance.GetMessages()) Console.WriteLine(i.Value.ToString()); - Console.WriteLine("--- Message List End ---"); + Console.WriteLine(e.Message.ToString()); } } }