private void UpdatePollMonitors(DateTime dt) { foreach (object o in ActivePollMonitors) { Form frmMon = (Form)o; foreach (UserControl control in frmMon.Controls) { if (control.GetType().IsSubclassOf(Type.GetType("csi.see.client1.BaseAnal"))) { BaseAnal analyzer = (BaseAnal)control; analyzer.AddData(dt); } //else if (control.GetType().IsSubclassOf(Type.GetType("ConsoleRecords.PageableConsole"))) //{} } } }
private void UpdateAnalyzer(DateTime dt, BaseAnal analyzer) { analyzer.AddData(dt); }
ArrayList ActivePollMonitors = new ArrayList();//Keep a list of open analyzers private void btnNewAnalyzer_Click(object sender, EventArgs e) { DialogNewAnalyzer dlgNew = new DialogNewAnalyzer(); if (dlgNew.ShowDialog() == DialogResult.OK) { bool realTime = false; DateTime[] times; #region Get the 10 most recent times or the selected historical times if (dlgNew.IsHistorical) { times = SqlManager.GetPollTimes(dlgNew.StartTime, dlgNew.EndTime); } else //Display recent activity { times = SqlManager.GetLast10PollTimes(SessionStart); realTime = true; } #endregion if (times.Length < 1 && dlgNew.IsHistorical) { MessageBox.Show("There is no data in the selected time range.", "SeeTCP/IP Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ArrayList selAnalyzers = dlgNew.GetSelectedAnalyzers(); if (selAnalyzers.Count < 1) { MessageBox.Show("You did not select an analyzer.", "SeeTCP/IP Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { foreach (PrebuiltAnalyzers analType in selAnalyzers) {//Create form to house the analyzer and open it Form frmAnal = new Form(); #region Setup frmAnal frmAnal.Text = Name + " - "; frmAnal.Icon = ParentForm.Icon; frmAnal.Size = new Size(600, 600); frmAnal.FormBorderStyle = FormBorderStyle.Sizable; #endregion BaseAnal analyzer = null; switch (analType) { #region Set frmAnal.Text and create proper analyzer control case PrebuiltAnalyzers.VSE: frmAnal.Text += "VSE Activity"; analyzer = new AnalVSE(Name, SqlManager.ConnectionString, realTime); break; case PrebuiltAnalyzers.CPU: frmAnal.Text += "CPU Utilization"; analyzer = new AnalCPU(Name, SqlManager.ConnectionString, realTime); break; case PrebuiltAnalyzers.TD: frmAnal.Text += "Turbo Dispatcher"; analyzer = new AnalTD(Name, SqlManager.ConnectionString, realTime); break; case PrebuiltAnalyzers.SIOs: frmAnal.Text += "SIO Counts"; analyzer = new AnalSIO(Name, SqlManager.ConnectionString, realTime); break; case PrebuiltAnalyzers.TCPIP: frmAnal.Text += "TCP/IP Stack"; analyzer = new AnalTCPIP(Name, SqlManager.ConnectionString, realTime); break; case PrebuiltAnalyzers.InOut: frmAnal.Text += "TCP/IP Traffic"; analyzer = new AnalInOut(Name, SqlManager.ConnectionString, realTime); break; case PrebuiltAnalyzers.ForgnIps: frmAnal.Text += "TCP/IP Foreign IPs"; analyzer = new AnalForgnIps(Name, SqlManager.DatabaseName, realTime); break; case PrebuiltAnalyzers.Conns: frmAnal.Text += "TCP/IP Connections"; analyzer = new AnalConns(Name, SqlManager.DatabaseName, realTime); break; //case PrebuiltAnalyzers.BSDC: //frmAnal.Text += "BSDC Connections"; //break; //case PrebuiltAnalyzers.FTPs: //break; #endregion } if (analyzer != null) { #region Array.Sort(times);//Sort times in ascending order if (analType == PrebuiltAnalyzers.ForgnIps) { if (times.Length > 0) { AnalForgnIps fIPanalyzer = (AnalForgnIps)analyzer; fIPanalyzer.SetTimeRange(times[0], times[times.Length - 1]); } } else if (analType == PrebuiltAnalyzers.Conns) { if (times.Length > 0) { AnalConns cAnalyzer = (AnalConns)analyzer; cAnalyzer.SetTimeRange(times[0], times[times.Length - 1], times); /* * if (dlgNew.IsHistorical) * { cAnalyzer.SetTimeRange(times[0], times[times.Length - 1], times); } * else { cAnalyzer.SetTimeRange(times[times.Length - 1], times[times.Length - 1], times); } */ } } else { for (int i = 0; i < times.Length; i++) { UpdateAnalyzer(times[i], analyzer); } analyzer.InvokeCrossTabUpdate(); /*Need for PJS - call every time - just in case */ } analyzer.Dock = DockStyle.Fill; frmAnal.Controls.Add(analyzer); if (!dlgNew.IsHistorical) { ActivePollMonitors.Add(frmAnal);//Add only objects that derive from BaseAnal frmAnal.FormClosing += new FormClosingEventHandler(analyzer_FormClosing); } frmAnal.Show(); #endregion } else { frmAnal.Dispose(); } } } } } }