public void populateAssessment(string result) { Dictionary <string, List <string> > dictionary = FormatFunctions.createValuePairs(FormatFunctions.SplitToPairs(result)); List <UIElement> list = new List <UIElement>(); int Stage = int.Parse(dictionary["Stage"][0]); if (Stage < 2) { SecurityButton l = new SecurityButton(2, new string[] { "Employee" }) { Content = "Booking" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 3) { SecurityButton l = new SecurityButton(3, new string[] { "Employee" }) { Content = "Quote" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 4) { SecurityButton l = new SecurityButton(4, new string[] { "Employee" }) { Content = "Sale" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); List <string> options = new List <string>() { "1", "2", "3", "4", "5" }; QuotePicker.ItemsSource = options; } if (Stage < 5) { SecurityButton l = new SecurityButton(5, new string[] { "Employee" }) { Content = "Install" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 6) { SecurityButton l = new SecurityButton(6, new string[] { "Employee" }) { Content = "Installing" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 7) { SecurityButton l = new SecurityButton(7, new string[] { "Employee" }) { Content = "Quality Assurance" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 8) { SecurityButton l = new SecurityButton(8, new string[] { "Employee" }) { Content = "Clients" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 9) { SecurityButton l = new SecurityButton(9, new string[] { "Employee" }) { Content = "Archive" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 10) { SecurityButton l = new SecurityButton(10, new string[] { "Employee" }) { Content = "Service Lead" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 11) { SecurityButton l = new SecurityButton(11, new string[] { "Employee" }) { Content = "Service Appointment" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 12) { SecurityButton l = new SecurityButton(12, new string[] { "Employee" }) { Content = "Serviced" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 13) { SecurityButton l = new SecurityButton(13, new string[] { "Employee" }) { Content = "Maintenance Appointment" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } if (Stage < 14) { SecurityButton l = new SecurityButton(14, new string[] { "Employee" }) { Content = "Maintenance" }; l.Click += onClicked; Buttons.Add(l); list.Add(l); } bool[] b = new bool[list.Count]; GridFiller.rapidVertFillPremadeObjects(list, grid, b); }