Exemplo n.º 1
0
        /// <summary>
        /// The constructor access the data available from the channels manager
        /// and populates the GUI
        /// </summary>
        public simple_Switcher()
        {
            //show a splash screen on  window load
            Thread splash = new Thread(new ThreadStart(showSplash));

            splash.Start();
            Thread.Sleep(1250);
            splash.Abort();
            Thread.Sleep(100);

            InitializeComponent();

            //initialize channel data
            ch_mngr = new Channels_Manager();

            //
            cn_mngr = new Connections_Manager();

            //add channel names to listbox
            for (int i = 0; i < ch_mngr.number_of_Src_Channels; i++)
            {
                src_listBox.Items.Add((string)ch_mngr.get_Channel_Information("Sources", i, 0));
            }

            for (int i = 0; i < ch_mngr.number_of_Dest_Channels; i++)
            {
                dest_listBox.Items.Add((string)ch_mngr.get_Channel_Information("Destinations", i, 0));
            }

            //set the first channels as visible
            if (src_listBox.Items.Count > 0 && dest_listBox.Items.Count > 0)
            {
                src_listBox.SelectedIndex  = 0;
                dest_listBox.SelectedIndex = 0;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The constructor access the data available from the channels manager
        /// and populates the GUI
        /// </summary>
        public simple_Switcher()
        {
            InitializeComponent();

            //get current date time
            DOY = DateTime.Now.DayOfYear;

            //initialize channel data
            ch_mngr = new Channels_Manager();

            //initialize connections
            cn_mngr = new Connections_Manager();

            //initialize combo box arrays
            in_combobox_array = new ComboBox[]
            {
                in_comboBox1, in_comboBox2, in_comboBox3, in_comboBox4,
                in_comboBox5, in_comboBox6, in_comboBox7, in_comboBox8,
                in_comboBox9, in_comboBox10, in_comboBox11, in_comboBox12,
                in_comboBox13, in_comboBox14, in_comboBox15, in_comboBox16,
                in_comboBox17, in_comboBox18, in_comboBox19, in_comboBox20,
                in_comboBox21, in_comboBox22, in_comboBox23, in_comboBox24
            };

            out_combobox_array = new ComboBox[]
            {
                out_comboBox1, out_comboBox2, out_comboBox3, out_comboBox4,
                out_comboBox5, out_comboBox6, out_comboBox7, out_comboBox8,
                out_comboBox9, out_comboBox10, out_comboBox11, out_comboBox12
            };

            //initialize array to rember last selector positon when moving
            selector_lastpos = new string[12, 6];

            //add channel names to listbox
            for (int i = 0; i < ch_mngr.Number_of_Channels("Sources"); i++)
            {
                src_listBox.Items.Add((string)ch_mngr.get_Channel_Information("Sources", i, 0));

                //add names to in combo boxes
                for (int j = 0; j < in_combobox_array.Length; j++)
                {
                    in_combobox_array[j].Items.Add((string)ch_mngr.get_Channel_Information("Sources", i, 0));
                }
            }

            for (int i = 0; i < ch_mngr.Number_of_Channels("Destinations"); i++)
            {
                dest_listBox.Items.Add((string)ch_mngr.get_Channel_Information("Destinations", i, 0));

                //add names to out combo boxes
                for (int j = 0; j < out_combobox_array.Length; j++)
                {
                    out_combobox_array[j].Items.Add((string)ch_mngr.get_Channel_Information("Destinations", i, 0));
                }
            }

            //initialize crosspoints points
            x_crosspoints = new int[24];
            y_crosspoints = new int[12];

            //set comboboxes to first selection
            int p = 0;

            for (int j = 0; j < in_combobox_array.Length / 2; j++)
            {
                //incremental setting on intialize
                if (p < in_combobox_array[0].Items.Count)
                {
                    in_combobox_array[j].SelectedIndex = p++;
                    in_combobox_array[j + (in_combobox_array.Length / 2)].SelectedIndex = p++;
                }
                else
                {
                    p = 0;
                    in_combobox_array[j].SelectedIndex = p++;
                    in_combobox_array[j + (in_combobox_array.Length / 2)].SelectedIndex = p++;
                }
            }

            p = 0;
            for (int j = 0; j < out_combobox_array.Length; j++)
            {
                //incremental setting on intialize
                if (p < out_combobox_array[0].Items.Count)
                {
                    out_combobox_array[j].SelectedIndex = p++;
                }
                else
                {
                    p = 0;
                    out_combobox_array[j].SelectedIndex = p++;
                }
            }
        }