private void UpdateSummary(SummaryResult summary) { _currentSummaryResult = summary; _avalonFloatWindow.CurMHS = SafeGHS(summary.Summary.GetCurGHS()); SafeControlUpdater.Invalidate(this.pictureBoxGraph); _avalonFloatWindow.Invalidate(); }
private void DrawSummary(Graphics g, SummaryResult summary) { if (g == null || summary == null) { return; } StringFormat align = new StringFormat(); align.Alignment = StringAlignment.Center; // draw MHS total Font font = new Font(_fontName, _MHSDrawInfos[0].FontSize, FontStyle.Bold); Brush brush = new SolidBrush(_MHSDrawInfos[0].FontColor); g.DrawString(SafeGHS(summary.Summary.GetCurGHS()).ToString(), font, brush, _MHSDrawInfos[0].Rect, align); // draw MHS av font = new Font(_fontName, _MHSDrawInfos[1].FontSize, FontStyle.Bold); brush = new SolidBrush(_MHSDrawInfos[1].FontColor); g.DrawString(SafeGHS(summary.Summary.GetGHSAv()).ToString(), font, brush, _MHSDrawInfos[1].Rect, align); // draw MHS 300s font = new Font(_fontName, _MHSDrawInfos[2].FontSize, FontStyle.Bold); brush = new SolidBrush(_MHSDrawInfos[2].FontColor); g.DrawString(SafeGHS(summary.Summary.GetGHSByInterval(_appConfig.MHSSeconds)).ToString(), font, brush, _MHSDrawInfos[2].Rect, align); }
private void RestartBfgMinerProc(object state) { SafeCloseBfgMiner(); _summaryQueue.Clear(); _currentSummaryResult = null; _currentPoolResult = null; SafeControlUpdater.Invalidate(pictureBox1); SafeControlUpdater.Invalidate(pictureBoxGraph); _avalonFloatWindow.CurMHS = 0; Thread.Sleep(100); RunMinerAndMonitorData(); }
private bool ParseData(string apiName, string content) { string[] items = content.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (items == null || items.Length < 2) { return false; } if (string.Compare(apiName, "summary", true) == 0) { SummaryResult summary = new SummaryResult(); summary.Header.Deserialize(items[0]); summary.Summary.Deserialize(items[1]); if (_summaryQueue.Count > SummaryQueueSize) { _summaryQueue.Dequeue(); } _summaryQueue.Enqueue(summary); UpdateSummary(summary); return true; } else if (string.Compare(apiName, "pools", true) == 0) { PoolResult poolResult = new PoolResult(); poolResult.Header.Deserialize(items[0]); int poolSize = items.Length - 1; int v = 0; if (Int32.TryParse(poolResult.Header.Msg, out v)) { if (v < poolSize) { poolSize = v; } } if (poolSize > 0) { Pool[] pools = new Pool[poolSize]; for (int i = 0; i < poolSize; i++) { Pool pi = new Pool(); pi.Deserialize(items[i + 1]); pools[i] = pi; } poolResult.Pools = pools; } _currentPoolResult = poolResult; UpdatePoolInfo(poolResult); return true; } return false; }