private static void Test(GuiController controller) { new Thread(() => { Thread.Sleep(500); controller.OnMessage(new Api.Message(MessageType.Started).Json); Thread.Sleep(1000); for (int i = 0; i < 5; i++) { var fakeApi = new Api.Message(MessageType.ProgressUpdated) { States = new Dictionary <string, UploadJobState> { { "Job", new UploadJobState { status = $"{i}", total = 5, current = i } } } }; controller.OnMessage(fakeApi.Json); Thread.Sleep(100); } controller.OnMessage(new Api.Message(MessageType.Completed).Json); Thread.Sleep(5000); controller.OnMessage(new Api.Message(MessageType.Started).Json); Thread.Sleep(2000); controller.OnMessage(new Api.Message(MessageType.Completed).Json); }).Start(); }
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(); }