// Save Settings Button
        private async void button3_Click(object sender, EventArgs e)
        {
            string fileName = "./BreadboardSettings.set";

            BreadboardSettings["SnippetFolder"] = textBox1.Text;
            BreadboardSettings["RunLogFolder"]  = textBox2.Text;
            BreadboardSettings["LabName"]       = comboBox1.Text;
            BreadboardSettings["APIToken"]      = textBox3.Text;
            BreadboardSettings["APIURL"]        = textBox4.Text;
            DictIO.WriteDictionary(BreadboardSettings, fileName);
            addEventLogText("Settings saved.");
            MessageBox.Show("Settings saved as 'BreadboardSettings.set'.");
            if (BreadboardSettings.ContainsKey("APIToken"))
            {
                client.DefaultRequestHeaders.Authorization =
                    new AuthenticationHeaderValue("Token", BreadboardSettings["APIToken"]);
            }
            else
            {
                addEventLogText("API client not set up. Please enter an API token and URL and save the settings.");
            }
            try
            {
                string path = "labs/" + LabURLs[BreadboardSettings["LabName"]].ToString() + "/";

                Lab lab = await GetLabAsync(path);

                addEventLogText("Hi " + lab.name + "!");
            }
            catch (Exception x)
            {
                addEventLogText("API Error: " + x.Message);
            }
        }
        public BreadboardMainForm()
        {
            InitializeComponent();
            string settingsFileName = "./BreadboardSettings.set";

            //addEventLogText("Settings loaded");
            if (File.Exists(settingsFileName))
            {
                BreadboardSettings = DictIO.ReadDictionary(settingsFileName);
                if (BreadboardSettings.ContainsKey("SnippetFolder"))
                {
                    textBox1.Text = BreadboardSettings["SnippetFolder"];
                }
                if (BreadboardSettings.ContainsKey("RunLogFolder"))
                {
                    textBox2.Text = BreadboardSettings["RunLogFolder"];
                }
                if (BreadboardSettings.ContainsKey("LabName"))
                {
                    comboBox1.Text = BreadboardSettings["LabName"];
                }
                if (BreadboardSettings.ContainsKey("APIToken"))
                {
                    textBox3.Text = BreadboardSettings["APIToken"];
                }
                if (BreadboardSettings.ContainsKey("APIURL"))
                {
                    textBox4.Text = BreadboardSettings["APIURL"];
                }
                //MessageBox.Show("Settings were loaded from the file 'BreadboardSettings.set' in the directory with the Breadboard executable.");
            }
            else
            {
                MessageBox.Show("Settings were not automatically loaded. Save new settings to enable automatic loading of settings.");
            }

            // Set up the HTTP Client
            if (BreadboardSettings.ContainsKey("APIURL"))
            {
                client.BaseAddress = new Uri(BreadboardSettings["APIURL"]);
            }
            else
            {
                client.BaseAddress = new Uri("http://breadboard-215702.appspot.com");
            }
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));
            if (BreadboardSettings.ContainsKey("APIToken"))
            {
                client.DefaultRequestHeaders.Authorization =
                    new AuthenticationHeaderValue("Token", BreadboardSettings["APIToken"]);
            }
            else
            {
                //addEventLogText("API client not set up. Please enter an API token and save the settings.");
            }
        }