ComboDelThisValue() public static method

public static ComboDelThisValue ( ComboBox myCombo, string toRemove ) : void
myCombo ComboBox
toRemove string
return void
Ejemplo n.º 1
0
 public Gtk.ComboBox DeleteValue(string nameTranslated)
 {
     UtilGtk.ComboDelThisValue(combo, nameTranslated);
     combo.Active = 0;
     return(combo);
 }
Ejemplo n.º 2
0
    //private void createComboWindows(string myPort, Gtk.ComboBox myCombo) {
    private void createComboWindows()
    {
        //combo port stuff
        comboWindowsOptions = new string[32];
        //for (int i=1; i <= 32; i ++)
        //comboWindowsOptions[i-1] = "COM" + i;
        comboWindowsOptions = SerialPort.GetPortNames();

        string [] def        = Util.StringToStringArray(Constants.ChronopicDefaultPortWindows);
        string [] allWithDef = Util.AddArrayString(def, comboWindowsOptions);

        UtilGtk.ComboUpdate(combo_windows1, allWithDef, Constants.ChronopicDefaultPortWindows);
        UtilGtk.ComboUpdate(combo_windows2, allWithDef, Constants.ChronopicDefaultPortWindows);
        UtilGtk.ComboUpdate(combo_windows3, allWithDef, Constants.ChronopicDefaultPortWindows);
        UtilGtk.ComboUpdate(combo_windows4, allWithDef, Constants.ChronopicDefaultPortWindows);

        foreach (ChronopicPortData a in cpd)
        {
            if (a.Num == 1)
            {
                combo_windows1.Active   = UtilGtk.ComboMakeActive(comboWindowsOptions, a.Port);
                combo_windows1.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_windows2, a.Port);
                    UtilGtk.ComboDelThisValue(combo_windows3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_windows4, a.Port);
                }
            }
            else if (a.Num == 2)
            {
                combo_windows2.Active   = UtilGtk.ComboMakeActive(comboWindowsOptions, a.Port);
                combo_windows2.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_windows3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_windows4, a.Port);
                }
            }
            else if (a.Num == 3)
            {
                combo_windows3.Active   = UtilGtk.ComboMakeActive(comboWindowsOptions, a.Port);
                combo_windows3.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_windows4, a.Port);
                }
            }
            else                 //4
            {
                combo_windows4.Active   = UtilGtk.ComboMakeActive(comboWindowsOptions, a.Port);
                combo_windows4.Changed += new EventHandler(on_combo_changed);
            }
        }

        //encoder
        //this reduces the callbacks of combo change
        combo_windows_encoder.Sensitive = false;

        UtilGtk.ComboUpdate(combo_windows_encoder, allWithDef, encoderPort);

        combo_windows_encoder.Changed += new EventHandler(on_combo_changed);

        combo_windows_encoder.Active = UtilGtk.ComboMakeActive(allWithDef, encoderPort);

        combo_windows_encoder.Sensitive = true;
    }
Ejemplo n.º 3
0
    private void createComboLinux()
    {
        //string [] serial = Directory.GetFiles("/dev/", "ttyS*");
        string [] usbSerial    = Directory.GetFiles("/dev/", "ttyUSB*");
        string [] usbSerialMac = Directory.GetFiles("/dev/", "tty.usbserial*");
        string [] all          = Util.AddArrayString(usbSerial, usbSerialMac);

        string [] def = Util.StringToStringArray(Constants.ChronopicDefaultPortLinux);

        string [] allWithDef = Util.AddArrayString(def, all);

        UtilGtk.ComboUpdate(combo_linux1, allWithDef, Constants.ChronopicDefaultPortLinux);
        UtilGtk.ComboUpdate(combo_linux2, allWithDef, Constants.ChronopicDefaultPortLinux);
        UtilGtk.ComboUpdate(combo_linux3, allWithDef, Constants.ChronopicDefaultPortLinux);
        UtilGtk.ComboUpdate(combo_linux4, allWithDef, Constants.ChronopicDefaultPortLinux);

        foreach (ChronopicPortData a in cpd)
        {
            if (a.Num == 1)
            {
                combo_linux1.Active   = UtilGtk.ComboMakeActive(combo_linux1, a.Port);
                combo_linux1.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_linux2, a.Port);
                    UtilGtk.ComboDelThisValue(combo_linux3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_linux4, a.Port);
                }
            }
            else if (a.Num == 2)
            {
                combo_linux2.Active   = UtilGtk.ComboMakeActive(combo_linux2, a.Port);
                combo_linux2.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_linux3, a.Port);
                    UtilGtk.ComboDelThisValue(combo_linux4, a.Port);
                }
            }
            else if (a.Num == 3)
            {
                combo_linux3.Active   = UtilGtk.ComboMakeActive(combo_linux3, a.Port);
                combo_linux3.Changed += new EventHandler(on_combo_changed);
                if (a.Connected)
                {
                    UtilGtk.ComboDelThisValue(combo_linux4, a.Port);
                }
            }
            else                 //4
            {
                combo_linux4.Active   = UtilGtk.ComboMakeActive(combo_linux4, a.Port);
                combo_linux4.Changed += new EventHandler(on_combo_changed);
            }
        }

        //encoder
        //this reduces the callbacks of combo change
        combo_linux_encoder.Sensitive = false;

        UtilGtk.ComboUpdate(combo_linux_encoder, allWithDef, encoderPort);

        combo_linux_encoder.Changed += new EventHandler(on_combo_changed);

        combo_linux_encoder.Active = UtilGtk.ComboMakeActive(allWithDef, encoderPort);

        combo_linux_encoder.Sensitive = true;
    }
Ejemplo n.º 4
0
    private void connectionSucceded(int port, bool playSound)
    {
        string myPort = ((ChronopicPortData)cpd[port - 1]).Port;

        ((ChronopicPortData)cpd[port - 1]).Connected = true;

        if (port == 1)
        {
            button_connect_cp1.Sensitive = false;
            image_cp1_no.Hide();
            image_cp1_yes.Show();

            if (isWindows)
            {
                combo_windows1.Sensitive = false;
                combo_windows2.Sensitive = true;
                UtilGtk.ComboDelThisValue(combo_windows2, myPort);
                combo_windows2.Active = 0;                 //first option
                UtilGtk.ComboDelThisValue(combo_windows3, myPort);
                combo_windows3.Active = 0;
                UtilGtk.ComboDelThisValue(combo_windows4, myPort);
                combo_windows4.Active = 0;
            }
            else
            {
                combo_linux1.Sensitive = false;
                combo_linux2.Sensitive = true;
                UtilGtk.ComboDelThisValue(combo_linux2, myPort);
                combo_linux2.Active = 0;                 //first option
                UtilGtk.ComboDelThisValue(combo_linux3, myPort);
                combo_linux3.Active = 0;
                UtilGtk.ComboDelThisValue(combo_linux4, myPort);
                combo_linux4.Active = 0;
            }
        }
        else if (port == 2)
        {
            button_connect_cp2.Sensitive = false;
            image_cp2_no.Hide();
            image_cp2_yes.Show();

            if (isWindows)
            {
                combo_windows2.Sensitive = false;
                combo_windows3.Sensitive = true;
                UtilGtk.ComboDelThisValue(combo_windows3, myPort);
                combo_windows3.Active = 0;
                UtilGtk.ComboDelThisValue(combo_windows4, myPort);
                combo_windows4.Active = 0;
            }
            else
            {
                combo_linux2.Sensitive = false;
                combo_linux3.Sensitive = true;
                UtilGtk.ComboDelThisValue(combo_linux3, myPort);
                combo_linux3.Active = 0;
                UtilGtk.ComboDelThisValue(combo_linux4, myPort);
                combo_linux4.Active = 0;
            }
        }
        else if (port == 3)
        {
            button_connect_cp3.Sensitive = false;
            image_cp3_no.Hide();
            image_cp3_yes.Show();

            if (isWindows)
            {
                combo_windows3.Sensitive = false;
                combo_windows4.Sensitive = true;
                UtilGtk.ComboDelThisValue(combo_windows4, myPort);
                combo_windows4.Active = 0;
            }
            else
            {
                combo_linux3.Sensitive = false;
                combo_linux4.Sensitive = true;
                UtilGtk.ComboDelThisValue(combo_linux4, myPort);
                combo_linux4.Active = 0;
            }
        }
        else if (port == 4)
        {
            button_connect_cp4.Sensitive = false;
            image_cp4_no.Hide();
            image_cp4_yes.Show();

            if (isWindows)
            {
                combo_windows4.Sensitive = false;
            }
            else
            {
                combo_linux4.Sensitive = false;
            }
        }


        connectingInfoHide();
        frame_connection.Visible = true;
        updateChronopicWin(true, Catalog.GetString("connected"));
        if (playSound)
        {
            Util.PlaySound(Constants.SoundTypes.GOOD, volumeOn);
        }
        updateChronopicWinValuesState = true;        //connected
    }