public void StartNewClient() { try { RedisPerformanceCounter.PCHelper.InstanceName = Properties.Settings.Default.IPPort; client = new MonitorClient.InfoClient(Properties.Settings.Default.IPPort, logcallback, Properties.Settings.Default.BufferSize, Properties.Settings.Default.Interval); client.DataChanged += client_DataChanged; } catch (Exception ex) { } }
/// <summary> /// 连接到服务器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { client = new MonitorClient.InfoClient(textBox1.Text, (s) => Console.WriteLine(s), 4096, 0); client.DataChanged += client_DataChanged; chart1.Series.Clear(); Series series = new Series("xxxxx"); series.ChartType = SeriesChartType.Line; series.BorderWidth = 1; series.ShadowOffset = 1; series.IsValueShownAsLabel = true; series.CustomProperties = "LabelStyle=Top"; series.Label = "#VAL"; chart1.Series.Add(series); button1.Enabled = false; timer1.Interval = (int)numericUpDown2.Value * 1000; timer1.Enabled = true; }