private void button2_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() != DialogResult.OK) { return; } ShowWindow(); if (maskedTextBox1.Text == " :") { maskedTextBox1.Text = "00:00"; } if (maskedTextBox2.Text == " :") { maskedTextBox2.Text = "23:59"; } DateTime from = DateTime.Parse(comboBox1.SelectedItem.ToString() + " " + maskedTextBox1.Text); DateTime to = DateTime.Parse(comboBox2.SelectedItem.ToString() + " " + maskedTextBox2.Text); if (from > to) { DateTime temp = from; from = to; to = temp; } GraphRenderer renderer = new GraphRenderer(HistoryManager.INSTANCE.GetData(hostname, from, to), 1920, 1080); renderer.GenerateImage().Save(saveFileDialog1.FileName); HideWindow(); }
public void PushInformation() { if (maskedTextBox1.Text == " :") { return; } if (maskedTextBox2.Text == " :") { return; } string cb1 = (string)Invoke(new Func <string>(() => comboBox1.SelectedItem.ToString())); string cb2 = (string)Invoke(new Func <string>(() => comboBox2.SelectedItem.ToString())); DateTime from, to; try { from = DateTime.Parse(cb1 + " " + maskedTextBox1.Text); to = DateTime.Parse(cb2 + " " + maskedTextBox2.Text); } catch (FormatException) { return; } if (from > to) { DateTime temp = from; from = to; to = temp; } GraphRenderer renderer = new GraphRenderer(HistoryManager.INSTANCE.GetData(hostname, from, to), pictureBox1.Width, pictureBox1.Height); Image img = renderer.GenerateImage(); lock (pictureBox1) { pictureBox1.Image = img; } }
public void PushInformation() { TimeData[] data = HistoryManager.INSTANCE.GetData(label1.Text, DateTime.Now.AddHours(-3), DateTime.Now); if (data.Length == 0) { return; } if (button1.IsDisposed) { return; } GraphRenderer renderer = new GraphRenderer(data, pictureBox1.Width, pictureBox1.Height); //pictureBox1.Image = renderer.GenerateImage(); pictureBox1.GetType().GetProperty("Image").SetValue(pictureBox1, renderer.GenerateImage()); Invoke(new Action(() => button1.Location = new Point(Width - button1.Width - 3, 0))); Invoke(new Action(() => button2.Location = new Point(Width - button2.Width - 3 - button1.Width - 3, 0))); Invoke(new Action(() => label1.Location = new Point(Width - button2.Width - 3 - button1.Width - 3 - label1.Width - 3, 0))); }
private void button1_Click(object sender, EventArgs e) { ShowWindow(); if (maskedTextBox1.Text == " :") { maskedTextBox1.Text = "00:00"; } if (maskedTextBox2.Text == " :") { maskedTextBox2.Text = "23:59"; } if (comboBox1.Items.Count == 0 || comboBox2.Items.Count == 0) { return; } DateTime from = DateTime.Parse(comboBox1.SelectedItem.ToString() + " " + maskedTextBox1.Text); DateTime to = DateTime.Parse(comboBox2.SelectedItem.ToString() + " " + maskedTextBox2.Text); if (from > to) { DateTime temp = from; from = to; to = temp; } GraphRenderer renderer = new GraphRenderer(HistoryManager.INSTANCE.GetData(this.hostname, from, to), pictureBox1.Width, pictureBox1.Height); lock (pictureBox1) { pictureBox1.Image = renderer.GenerateImage(); } HideWindow(); }