44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
|
using System;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace franz.tests
|
|||
|
{
|
|||
|
class Program
|
|||
|
{
|
|||
|
static async Task Main(string[] args)
|
|||
|
{
|
|||
|
Console.WriteLine("Hello World!");
|
|||
|
var f1 = new Telefranz("libfranztest1", "focalor:9092");
|
|||
|
var f1Reported = false;
|
|||
|
f1.addHandler<silver_messages.global.report>((r) => {
|
|||
|
Console.WriteLine($"someone reporting. {r}");
|
|||
|
if(r.name =="libfranztest1")
|
|||
|
{
|
|||
|
f1Reported = true;
|
|||
|
Console.WriteLine("f1 reported");
|
|||
|
}
|
|||
|
});
|
|||
|
await Task.Delay(1000);
|
|||
|
f1.ProduceMessage(new silver_messages.global.sound_off());
|
|||
|
Task.WaitAny(
|
|||
|
Task.Run(async () => {
|
|||
|
while(f1Reported == false)
|
|||
|
{
|
|||
|
Console.WriteLine("not ready, giving another 100ms");
|
|||
|
await Task.Delay(100);
|
|||
|
}
|
|||
|
Console.WriteLine("done, ready, green");
|
|||
|
Environment.Exit(0);
|
|||
|
}),
|
|||
|
Task.Run(async () => {
|
|||
|
await Task.Delay(30000);
|
|||
|
Console.WriteLine("time up");
|
|||
|
await Task.Delay(500);
|
|||
|
Environment.Exit(-1);
|
|||
|
})
|
|||
|
);
|
|||
|
Console.WriteLine("done I guess?");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|