private void switchView(FormViews view) { CurrentFormView = view; switch (view) { case FormViews.Main: title_label.Text = "CS:GO Fonts"; addFont_button.Visible = true; remove_button.Visible = true; trackBar1.Visible = true; apply_button.Text = "Apply Selected Font"; donate_button.Text = "Support me 🎉"; donate_button.BackColor = Color.FromArgb(184, 253, 10); search_textBox.Visible = false; refreshFontList(); break; case FormViews.AddSystemFont: title_label.Text = "System Fonts"; addFont_button.Visible = false; remove_button.Visible = false; trackBar1.Visible = false; apply_button.Text = "Add Selected Font"; donate_button.Text = "Cancel"; donate_button.BackColor = Color.FromArgb(196, 104, 92); search_textBox.Visible = true; search_textBox.Text = ""; search_textBox.Focus(); loadSystemFontList(); break; } }
private void btnSelectViews_Click(object sender, EventArgs e) { rb2DViewCustom.Checked = true; var form = new FormViews(_UIDocument.Document, _ViewIds); if (form.ShowDialog(this) == DialogResult.OK) { _ViewIds = form.SelectedViewIds; btnSelectViews.Text = string.Format(Strings.SelectedViews, _ViewIds.Count); } Refresh2DDerivedDataStatus(); }
protected virtual void OnFormViewChanged(FormViews view) { //contentPanel is just a System.Windows.Forms.Panel docked to fill the form switch (view) { case FormViews.A: if (viewA != null) { viewA = new MyViewA(); } //extension method, you could use a static function. this.contentPanel.DockControl(viewA); break; case FormViews.B: if (viewB != null) { viewB = new MyViewB(); } this.contentPanel.DockControl(viewB); break; } }
protected void Page_Load(object sender, EventArgs e) { LiHyperLink.SetNameToCompare(Context, "settings"); _category = int.Parse(Request.QueryString["category"] ?? "-1"); if (Request.QueryString["id"] != null) { if (Request.QueryString["new"] != null) { if (!IsPostBack) { Message.Text = "Your field was successfully added."; Message.Type = StatusType.Success; } } if (!IsPostBack) { Cancel_Edit.NavigateUrl = "?category=" + _category.ToString(); Master.FindControl("SideBarRegion").Visible = false; CustomFormSettings csf = CustomFormSettings.Get(_category, false); CustomField cf = null; Guid g = new Guid(Request.QueryString["id"]); foreach (CustomField cfx in csf.Fields) { if (cfx.Id == g) { cf = cfx; break; } } if (cf != null) { FormViews.SetActiveView(EditFieldView); ExistingName.Text = cf.Name; ExistingDescription.Text = cf.Description; if (cf.FieldType == FieldType.CheckBox) { CheckboxRegion.Visible = true; ExistingCheckBox.Checked = cf.Checked; } else if (cf.FieldType == FieldType.List) { ListRegion.Visible = true; if (cf.ListOptions != null && cf.ListOptions.Count > 0) { foreach (ListItemFormElement li in cf.ListOptions) { ExistingListOptions.Text += (li.Text + "\n"); } } } } } } else { if (!IsPostBack) { Master.FindControl("SideBarRegion").Visible = true; if (_category != -1) { Category c = new Category(_category); lblCategory.Text = c.Name; } else { lblCategory.Text = "Global"; } LoadCategories(); LoadCustomFields(); } } }
public MainForm() { InitializeComponent(); FormView = FormViews.A; //simply change views like this }