private void Save_but_Click(object sender, EventArgs e) { if (MainForm.KeyExists("Programs")) { key.SetValue("Programs", ""); } for (int i = 0; i < ItemBox.Items.Count; i++) { string check; if (ItemBox.GetItemChecked(i)) { check = "TRUE"; } else { check = "FALSE"; } key.SetValue("Programs", key.GetValue("Programs").ToString() + ItemBox.Items[i] + "," + tmpprocesslist[i] + "," + check + ";"); //File.AppendAllText(@"C:\Windows\System32\drivers\etc\Programs.begeba", ItemBox.Items[i] + "," + tmpprocesslist[i] + "," + check + ";"); } Program.CreateProgramArray(); MainForm.CreateProgramArray(Program.checkedState, Program.processList); key.SetValue("ProgramsChanged", "TRUE"); MessageBox.Show("Ændringerne er gemt", "ADVARSEL", MessageBoxButtons.OK, MessageBoxIcon.Information); }
/* * Method : GrabTotalBtn_Click * Returns : none * Parameters : none * Description : grabs the total of the selected items the user wishes to purchase * : it also grabs the region, and passes all of that information to the * : PurchaseTotaller to send to the service. */ private void GrabTotalBtn_Click(object sender, EventArgs e) { double totalItemPrice = 0; string regionCode = ""; List <double> itemCosts = new List <double>() { 8.25, 2.99, 3.99, 5.00 }; itemTotal.Text = ""; hstTotal.Text = ""; pstTotal.Text = ""; gstTotal.Text = ""; totalPrice.Text = ""; if (regionCheck.CheckedItems.Count != minimum) { regionCode = regionCheck.CheckedItems[firstIndex].ToString(); } for (int i = 0; i < ItemBox.Items.Count; i++) { //check to see if the current index is checked if (ItemBox.GetItemChecked(i) == true) { //add the price of the checked item to the item total totalItemPrice += itemCosts[i]; } } Call_PurchaseTotaller(Convert.ToDouble(Pricetxt.Text), regionCode); }