private void btnloaddefault_Click(object sender, EventArgs e) { temp_details.Clear(); foreach (var type in WidgetManager.GetAllWidgetTypes()) { temp_details.Add(type.Key.ToString(), new WidgetDetails { IsVisible = false, Location = new Point(-1, -1) }); } SetupUI(); }
public void SetupUI() { flbody.Controls.Clear(); if (temp_details == null) { temp_details = new Dictionary <string, WinForms.WidgetDetails>(); } foreach (var widgetType in WidgetManager.GetAllWidgetTypes()) { var details = WidgetManager.LoadDetails(widgetType.Value); if (temp_details.ContainsKey(widgetType.Key.ToString())) { details = temp_details[widgetType.Key.ToString()]; } else { temp_details.Add(widgetType.Key.ToString(), details); } var cbox = new CheckBox(); cbox.Checked = details.IsVisible; cbox.Size = new Size(32, 32); cbox.CheckedChanged += (o, a) => { details.IsVisible = cbox.Checked; }; flbody.Controls.Add(cbox); cbox.Show(); var title = new Label(); title.Text = widgetType.Key.Name; title.AutoSize = true; title.Tag = "header3"; ControlManager.SetupControl(title); flbody.Controls.Add(title); title.Show(); var desc = new Label(); desc.Text = widgetType.Key.Description; flbody.Controls.Add(desc); flbody.SetFlowBreak(desc, true); flbody.SetFlowBreak(title, true); desc.Show(); } }