예제 #1
0
        private void populateServers()
        {
            List <List <string> > data = DBM.SQLGetTableData("servers");

            foreach (List <string> row in data)
            {
                ListBoxItem itm = new ListBoxItem();
                itm.Content = row[1];
                this.lbStartupServers.Items.Add(itm);
            }
        }
예제 #2
0
        private void populateServers()
        {
            this.lbSettingsServers.Items.Clear();
            List <List <string> > data = DBM.SQLGetTableData("servers");

            foreach (List <string> row in data)
            {
                //foreach (string item in row)
                //{
                //System.Diagnostics.Debug.WriteLine(item);
                //}
                ListBoxItem itm = new ListBoxItem();
                itm.Content = row[1];
                this.lbSettingsServers.Items.Add(itm);
            }
        }
예제 #3
0
        private void bSettingsNewServ_Click(object sender, RoutedEventArgs e)
        {
            string newName = this.tbSettingsName.Text;
            string newIP   = this.tbSettingsIP.Text;
            string newPort = this.tbSettingsPort.Text;
            bool   check   = true;

            if (newName == "" || newIP == "" || newPort == "")
            {
                MessageBox.Show("Error - Please enter details before creating new server");
            }
            else
            {
                List <List <string> > data = DBM.SQLGetTableData("servers");
                foreach (List <string> row in data)
                {
                    if (row[1] == newName)
                    {
                        check = false;
                    }
                }
                if (check == true)
                {
                    try
                    {
                        List <string> newServer = new List <string> {
                            newName, newIP, newPort
                        };

                        DBM.SQLWriteToTable(newServer, "servers");

                        populateServers();
                    }
                    catch
                    {
                        MessageBox.Show("Error - Inputted information was in an invalid format");
                    }
                }
                else
                {
                    MessageBox.Show("Error - Cannot use duplicate server name");
                }
            }
        }