public void Open(IDocumentBase uc) { MetroTabPage pg = new MetroFramework.Controls.MetroTabPage(); pg.StyleManager = ERPFramework.GlobalInfo.StyleManager; pg.UseStyleColors = true; pg.AutoScroll = false; pg.SizeChanged += Pg_SizeChanged; pg.Text = uc.Title; uc.Exit += Uc_Exit; MetroUserControl muc = uc as MetroUserControl; muc.UseStyleColors = true; ERPFramework.GlobalInfo.StyleManager.Clone(muc); pg.Controls.Add(muc); TabPages.Add(pg); int p = TabPages.Count - 1; SelectedTab = pg; muc.Size = new Size(pg.Width, pg.Height - 5); pg.StyleManager.Update(); muc.Focus(); }
private void ShowUserControl(MetroUserControl control) { SupplierManager.Hide(); ProductManager.Hide(); PackageManager.Hide(); control.Show(); }
private async void btnMisCuestionarios_Click(object sender, EventArgs e) { DataTable oDT = await new BusinessLogic.Cuestionario().MisCuestionarios(); this.ucMisC = new ucMiscuestionarios(oDT); this.ucMisC.Dock = DockStyle.Fill; this.panelmain.Controls.Add(ucMisC); this.ucMisC.BringToFront(); }
public frmMainView() { InitializeComponent(); PackageManager = new frmPackageManager(); ProductManager = new frmProductManager(); SupplierManager = new frmSupplierManager(); this.BackColor = Color.Gray; }
private int InitializePropertyFragment(string component, MetaProperty property, Type editorType, int y) { if (property == null || editorType == null) { return(y); } string propertyPath = "components/" + component + "/" + property.Name; if (m_goData == null || !m_goData.ContainsKey(propertyPath)) { return(y); } try { object obj = PropertyEditorsManager.Instance.CreatePropertyEditor(editorType, m_goData, propertyPath, property.ValueType); MetroUserControl editor = obj as MetroUserControl; IEditorJsonValue jvEditor = obj as IEditorJsonValue; if (editor != null && jvEditor != null) { jvEditor.Text = property.Name; jvEditor.JsonDefaultValue = property.DefaultValue; jvEditor.UpdateEditorValue(); editor.Top = y; editor.Width = Width; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); jvEditor.EditorJsonValueChangedCallback = this; m_editors.Add(jvEditor); y = editor.Bottom + DEFAULT_SEPARATOR; } } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } ErrorPropertyEditor editor = new ErrorPropertyEditor(property.Name, ex.Message); editor.Tag = string.Format("{0}\n{1}\n\nStack trace:\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); editor.Top = y; editor.Width = Width; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); y = editor.Bottom + DEFAULT_SEPARATOR; } return(y); }
public static void Show(View viewType) { var view = new MetroUserControl(); if (!FrmMain.Instance.Container.Controls.ContainsKey(viewType.ToString())) { switch (viewType) { case View.UcRegisterOperations: view = new UcRegisterOperations { Dock = DockStyle.Fill }; break; case View.UcMenu: view = new UcMenu() { Dock = DockStyle.Fill }; break; case View.UcStations: view = new UcStations() { Dock = DockStyle.Fill }; break; case View.UcStationTypes: view = new UcStationTypes() { Dock = DockStyle.Fill }; break; } FrmMain.Instance.Container.Controls.Add(view); } FrmMain.Instance.Container.Controls[viewType.ToString()].BringToFront(); }
public Main() { InitializeComponent(); /**********************************/ this.ucCC = new ucAgregarCuestionario(); this.ucCC.Dock = DockStyle.Fill; this.ucFA = new ucFacturación(); this.ucFA.Dock = DockStyle.Fill; this.ucIni = new ucInicio(); this.ucIni.Dock = DockStyle.Fill; this.ucPerf = new ucPerfil(); this.ucPerf.Dock = DockStyle.Fill; this.panelmain.Controls.Add(ucCC); this.panelmain.Controls.Add(ucFA); this.panelmain.Controls.Add(ucIni); this.panelmain.Controls.Add(ucPerf); this.ucCC.BringToFront(); }
private void InitializeComponent(ItemEditorInfo[] metaEditors, ItemEditorInfo[] propertyEditors, string id, string meta, string tags) { IsProxyEditor = true; m_subProperties["id"] = Newtonsoft.Json.JsonConvert.SerializeObject(id); m_subProperties["tags"] = string.IsNullOrEmpty(tags) ? "null" : Newtonsoft.Json.JsonConvert.SerializeObject(tags.Split('|')); MetroButton applyButton = new MetroButton(); MetroSkinManager.ApplyMetroStyle(applyButton); applyButton.Text = "Apply"; applyButton.Width = Width - 20; applyButton.Top = Height; applyButton.Left = 10; applyButton.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; applyButton.Click += new EventHandler(applyButton_Click); Controls.Add(applyButton); Height += applyButton.Height + DEFAULT_SEPARATOR; MetroButton removeButton = new MetroButton(); MetroSkinManager.ApplyMetroStyle(removeButton); removeButton.Text = "Remove"; removeButton.Width = Width - 20; removeButton.Top = Height; removeButton.Left = 10; removeButton.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; removeButton.Click += new EventHandler(removeButton_Click); Controls.Add(removeButton); Height += removeButton.Height + DEFAULT_SEPARATOR; m_idEditor = new String_PropertyEditor(m_subProperties, "id"); m_idEditor.Width = Width - 20; m_idEditor.Top = Height; m_idEditor.Left = 10; m_idEditor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(m_idEditor); m_idEditor.EditorJsonValueChangedCallback = this; Height += m_idEditor.Height + DEFAULT_SEPARATOR; if (metaEditors != null && metaEditors.Length > 0) { string[] metaParts = string.IsNullOrEmpty(meta) ? null : meta.Split('|'); int metaPartsIndex = 0; foreach (ItemEditorInfo info in metaEditors) { if (metaParts != null && metaPartsIndex < metaParts.Length) { m_subProperties[info.property] = Newtonsoft.Json.JsonConvert.SerializeObject(metaParts[metaPartsIndex]); } metaPartsIndex++; try { object obj = Activator.CreateInstance(info.editorType, m_subProperties, info.property); MetroUserControl editor = obj as MetroUserControl; IEditorJsonValue jvEditor = obj as IEditorJsonValue; if (editor != null && jvEditor != null) { jvEditor.Text = info.property; jvEditor.UpdateEditorValue(); editor.Top = Height; editor.Width = Width - 20; editor.Left = 10; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); jvEditor.EditorJsonValueChangedCallback = this; m_metaEditors.Add(new KeyValuePair <string, IEditorJsonValue>(info.property, jvEditor)); Height += editor.Height + DEFAULT_SEPARATOR; } } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } ErrorPropertyEditor editor = new ErrorPropertyEditor(info.property, ex.Message); editor.Tag = string.Format("{0}\n{1}\n\nStack trace:\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); editor.Top = Height; editor.Width = Width - 20; editor.Left = 10; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); Height += editor.Height + DEFAULT_SEPARATOR; } } } if (propertyEditors != null && propertyEditors.Length > 0) { foreach (ItemEditorInfo info in propertyEditors) { m_subProperties[info.property] = "null"; try { object obj = Activator.CreateInstance(info.editorType, m_subProperties, info.property); MetroUserControl editor = obj as MetroUserControl; IEditorJsonValue jvEditor = obj as IEditorJsonValue; if (editor != null && jvEditor != null) { jvEditor.Text = info.property; jvEditor.UpdateEditorValue(); editor.Top = Height; editor.Width = Width - 20; editor.Left = 10; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); jvEditor.EditorJsonValueChangedCallback = this; m_propertyEditors.Add(new KeyValuePair <string, IEditorJsonValue>(info.property, jvEditor)); Height += editor.Height + DEFAULT_SEPARATOR; } } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } ErrorPropertyEditor editor = new ErrorPropertyEditor(info.property, ex.Message); editor.Tag = string.Format("{0}\n{1}\n\nStack trace:\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); editor.Top = Height; editor.Width = Width - 20; editor.Left = 10; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); Height += editor.Height + DEFAULT_SEPARATOR; } } } m_tagsEditor = new Tags_PropertyEditor(m_subProperties, "tags"); m_tagsEditor.Width = Width - 20; m_tagsEditor.Top = Height; m_tagsEditor.Left = 10; m_tagsEditor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(m_tagsEditor); m_tagsEditor.EditorJsonValueChangedCallback = this; Height += m_tagsEditor.Height; UpdateJsonValue(); UpdateProperties(); }
public FieldContainer( EditorDialog dialog, CollectionPropertyEditorUtils.CollectionType collectionType, Func <Dictionary <string, string>, string, PropertyEditor <T> > creator, string jsonValue, string memberName = null ) { m_collectionType = collectionType; m_creator = creator; if (m_creator == null) { throw new Exception("Creator cannot be null!"); } MetroSkinManager.ApplyMetroStyle(this); Height = 0; MetroTile remove = new MetroTile(); MetroSkinManager.ApplyMetroStyle(remove); remove.Text = "-"; remove.TextAlign = ContentAlignment.MiddleCenter; remove.TileTextFontWeight = MetroTileTextWeight.Bold; remove.Width = DEFAULT_BUTTON_SIZE + DEFAULT_BUTTON_SIZE; remove.Height = DEFAULT_BUTTON_SIZE; remove.Left = Width - remove.Width; remove.Anchor = AnchorStyles.Top | AnchorStyles.Right; remove.Click += new EventHandler(remove_Click); Controls.Add(remove); MetroTile add = new MetroTile(); MetroSkinManager.ApplyMetroStyle(add); add.Text = "+"; add.TextAlign = ContentAlignment.MiddleCenter; add.TileTextFontWeight = MetroTileTextWeight.Bold; add.Width = DEFAULT_BUTTON_SIZE + DEFAULT_BUTTON_SIZE; add.Height = DEFAULT_BUTTON_SIZE; add.Left = Width - add.Width - DEFAULT_SEPARATOR - remove.Width; add.Anchor = AnchorStyles.Top | AnchorStyles.Right; add.Click += new EventHandler(add_Click); Controls.Add(add); Height += Math.Max(add.Height, remove.Height); if (m_collectionType == CollectionPropertyEditorUtils.CollectionType.JsonObject) { m_memberTextBox = new MetroTextBox(); MetroSkinManager.ApplyMetroStyle(m_memberTextBox); m_memberTextBox.Text = memberName; m_memberTextBox.Width = Width; m_memberTextBox.Top = Height; m_memberTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; m_memberTextBox.TextChanged += new EventHandler(m_memberTextBox_TextChanged); Controls.Add(m_memberTextBox); Height += m_memberTextBox.Height; } try { m_propertyEditor = m_creator(m_imHereForNothing, "-.-"); if (m_propertyEditor == null) { throw new Exception("Property editor couldn't be created properly!"); } MetroUserControl editor = m_propertyEditor as MetroUserControl; IEditorJsonValue jvEditor = m_propertyEditor as IEditorJsonValue; if (editor != null && jvEditor != null) { jvEditor.Text = "Item"; jvEditor.JsonValue = jsonValue; jvEditor.UpdateEditorValue(); editor.Width = Width; editor.Top = Height; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); Height += editor.Height; } } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } ErrorPropertyEditor editor = new ErrorPropertyEditor("Item", ex.Message); editor.Tag = string.Format("{0}\n{1}\n\nStack trace:\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); editor.Width = Width; editor.Top = Height; editor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; Controls.Add(editor); Height += editor.Height; } }
public GlobalInfoFormArgs(MetroUserControl usercontrol, bool modal) { userControl = usercontrol; this.modal = modal; }
private void InitializeUserControl(MetroUserControl metroUserControl) { metroUserControl.Dock = DockStyle.Fill; metroPanel2.Controls.Add(metroUserControl); }