Ejemplo n.º 1
0
 private void comboBoxGraph0a_SelectedIndexChanged(object sender, EventArgs e)
 {
     // gmacLeft is accessed by another, non-gui, thread:
     gmacLeft = ((this.comboBoxGraph0a.SelectedIndex == 0) ? GMAC.gmac0 : GMAC.gmac1);
     spPerfChart0.Clear();
     // Remember previous selection:
     int registerSelection = Math.Min(this.comboBoxGraph0b.SelectedIndex, gmacLeft.RegisterNames.Length - 1);
     // reload combo of register names
     this.comboBoxGraph0b.Items.Clear();
     foreach (string s in gmacLeft.RegisterNames)
     {
         this.comboBoxGraph0b.Items.Add(s);
     }
     // change selection, if beyond end of list
     this.comboBoxGraph0b.SelectedIndex = Math.Max(0, registerSelection);
 }
Ejemplo n.º 2
0
        private void comboBoxGraph1a_SelectedIndexChanged(object sender, EventArgs e)
        {
            // gmacRight is accessed by another, non-gui, thread:
            gmacRight = ((this.comboBoxGraph1a.SelectedIndex == 0) ? GMAC.gmac0 : GMAC.gmac1);
            spPerfChart1.Clear();
            // Previous selection:
            int registerSelection = Math.Min(this.comboBoxGraph1b.SelectedIndex, gmacRight.RegisterNames.Length - 1);

            // reload combo of register names
            this.comboBoxGraph1b.Items.Clear();
            foreach (string s in gmacRight.RegisterNames)
            {
                this.comboBoxGraph1b.Items.Add(s);
            }
            // Try to restore previous selection (but not -1)
            this.comboBoxGraph1b.SelectedIndex = Math.Max(0, registerSelection); 
        }