Esempio n. 1
0
 public SocketClient(Config config, ObserverVariable <string> status, CancellationToken?token = null)
 {
     this.config = config;
     this.status = status;
     this.token  = token ?? CancellationToken.None;
     uri         = new Uri(config.watch);
 }
Esempio n. 2
0
        private Program(Config config)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var status = new ObserverVariable <string>("Ожидание");

            GuiController controller = new GuiController(config);
            var           watcher    = new SocketClient(config, status);

            watcher.OnMessage += controller.OnMessage;
            watcher.StartAsync();

            MakeTrayIcon(out var menuItem, out var menuDebug);
            status.Changed += value => menuItem.Text = value;

            if (config.debug_mode)
            {
                menuDebug.Visible = true;
                menuDebug.Click  += (o, ev) => controller.runDebug();
            }

            //Test(controller);

            Application.Run();
        }