static void Timer1_Tick(object sender, EventArgs e) { var timer1 = _MainForm.timer1; timer1.Enabled = false; try { if (_enableZmqTask != Zmq.IsRunning) { if (_enableZmqTask) { WriteLine("ZMQ Start"); Zmq.StartZmq(); } else { WriteLine("ZMQ Stop"); Zmq.StopZmq(); } } if (Blocks.IsStopping) { _MainForm.tasksControl.cbBlockHeaders.Checked = false; Blocks.IsStopping = false; } if (_enableBlockHeadersTask != Blocks.IsRunning) { if (_enableBlockHeadersTask) { WriteLine("Block Headers Start"); Blocks.StartGetOldBlocks(); } else { WriteLine("Block Headers Stop"); Blocks.StopGetOldBlocks(); } } if (_enableVerifyRawBlocksTask != RawBlocks.IsRunning) { if (_enableVerifyRawBlocksTask) { WriteLine("Verify RawBlocks Start"); RawBlocks.StartVerifyRawBlocks(); } else { WriteLine("Verify RawBlocks Stop"); RawBlocks.StopVerifyRawBlocks(); } } } catch (Exception ex) { WriteLine($"timer1_Tick: {ex.LastInnerMessage()}"); } finally { timer1.Enabled = true; } }
public static void StartZmq() { _zmqRunning = true; Task.Run(async() => await Zmq.MainZmq(null)); }