private void trackBarCH_Scroll(object sender, EventArgs e) { if (listBox1.SelectedIndex == -1) { return; } SFNWOscGraph sfnwog = ((SFNWOscGraph)listBox1.SelectedItem); sfnwog.MacroCoherencyK = new PointF( GetTrackValue(trackBar4, 0.05, 20), GetTrackValue(trackBar3, 0.05, 20) ); sfnwog.MacroCoherencyKTB = new PointF(trackBar1.Value, trackBar2.Value); label7.Text = sfnwog.MacroCoherencyK.X.ToString(); label8.Text = sfnwog.MacroCoherencyK.Y.ToString(); OnNetworkChanged?.Invoke(this, sfnwog); }
private void nwopenToolStripMenuItem_Click(object sender, EventArgs e) { if (ofd.ShowDialog() == DialogResult.OK && File.Exists(ofd.FileName)) { try { foreach (string fn in ofd.FileNames) { SFNetworkOscillator nw = SFNetworkOscillator.Debinarize(fn); SFNWOscGraph nwg = new SFNWOscGraph(nw, fn, Color.Red, Color.Blue); networks.Add(nwg); listBox1.Items.Clear(); foreach (SFNWOscGraph i in networks) { listBox1.Items.Add(i); } OnNetworkOpened?.Invoke(this, nwg); } } catch (Exception ex) { MessageBox.Show("Error occured while loading file: " + ex.Message, "Loading error"); } } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { groupBox1.Enabled = false; groupBox2.Enabled = false; checkBox1.Enabled = false; if (listBox1.SelectedIndex > -1) { SFNWOscGraph sfnwog = ((SFNWOscGraph)listBox1.SelectedItem); groupBox1.Enabled = true; groupBox2.Enabled = true; checkBox1.Enabled = true; checkBox1.Checked = sfnwog.Visible; trackBar1.Value = (int)sfnwog.MacroSignalKTB.X; trackBar2.Value = (int)sfnwog.MacroSignalKTB.Y; label5.Text = sfnwog.MacroSignalK.X.ToString(); label6.Text = sfnwog.MacroSignalK.Y.ToString(); trackBar4.Value = (int)sfnwog.MacroCoherencyKTB.X; trackBar3.Value = (int)sfnwog.MacroCoherencyKTB.Y; label7.Text = sfnwog.MacroCoherencyK.X.ToString(); label8.Text = sfnwog.MacroCoherencyK.Y.ToString(); pictureBox1.BackColor = sfnwog.ColorSignal; pictureBox2.BackColor = sfnwog.ColorCoherency; } }