public static Hanndler GetInstance() { if (!chk) { handler = new Hanndler(); } return(handler); }
public Reciever3() { Hanndler.GetInstance().Event1 += (b, i) => { if (!Hanndler.GetInstance().Checked) { Hanndler.GetInstance().counter++; Console.WriteLine($"{Hanndler.GetInstance().counter}from:{this} {i}"); } }; }
public static void Send() { var rand = new Random(); for (int i = 0; i < 100; i++) { Thread.Sleep(100); var num = rand.Next(0, 100); Hanndler.GetInstance().Checked = false; Hanndler.GetInstance().Event1(Hanndler.GetInstance().Checked, num); } }