mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 03:01:24 +00:00
Added test structure
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||
using MewtocolNet;
|
||||
using MewtocolNet.Logging;
|
||||
using MewtocolNet.Registers;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace Examples;
|
||||
|
||||
@@ -10,6 +11,14 @@ class Program {
|
||||
|
||||
static void Main(string[] args) {
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += (s,e) => {
|
||||
Console.WriteLine(e.ExceptionObject.ToString());
|
||||
};
|
||||
|
||||
TaskScheduler.UnobservedTaskException += (s,e) => {
|
||||
Console.WriteLine(e.Exception.ToString());
|
||||
};
|
||||
|
||||
Console.WriteLine("Enter your scenario number:\n" +
|
||||
"1 = Permanent connection\n" +
|
||||
"2 = Dispose connection");
|
||||
@@ -59,21 +68,21 @@ class Program {
|
||||
}
|
||||
});
|
||||
|
||||
//await interf.ConnectAsync((plcinf) => AfterConnect(interf, registers));
|
||||
await interf.ConnectAsync();
|
||||
|
||||
bool flip = false;
|
||||
while(true) {
|
||||
//bool flip = false;
|
||||
//while(true) {
|
||||
|
||||
if(!flip) {
|
||||
await interf.ConnectAsync();
|
||||
} else {
|
||||
interf.Disconnect();
|
||||
}
|
||||
// if(!flip) {
|
||||
// await interf.ConnectAsync();
|
||||
// } else {
|
||||
// interf.Disconnect();
|
||||
// }
|
||||
|
||||
flip = !flip;
|
||||
await Task.Delay(5000);
|
||||
// flip = !flip;
|
||||
// await Task.Delay(5000);
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user