private Chart CreateChartWork() { Chart chart = null; try { PortfolioDoc portfolioDoc = new PortfolioDoc(execute); portfolioDocs.Add(portfolioDoc); chart = portfolioDoc.ChartControl; } catch (Exception ex) { log.Error(ex.Message, ex); } return(chart); }
public void Stop() { if (portfolioDoc != null) { portfolioDoc.Invoke(new MethodInvoker(portfolioDoc.Hide)); portfolioDoc = null; } if (thread != null) { stop = true; thread.Join(); thread = null; } }
public void Run() { try { log.Debug("Chart Thread Started"); portfolioDoc = new PortfolioDoc(); Thread.CurrentThread.IsBackground = true; while (!stop) { Application.DoEvents(); Thread.Sleep(10); } } catch (Exception ex) { log.Error("ERROR: Thread had an exception:", ex); } }
private void ShowChartWork() { try { for (int i = portfolioDocs.Count - 1; i >= 0; i--) { PortfolioDoc portfolioDoc = portfolioDocs[i]; if (portfolioDoc.ChartControl.IsDisposed) { portfolioDocs.RemoveAt(i); } else { if (portfolioDoc.ChartControl.IsValid && this.Visible) { portfolioDoc.Show(); } } } } catch (Exception ex) { log.Error(ex.Message, ex); } }