public EntryBlockHolder(EntryBase entryElem, EditorFactory eFactory, Swoosh swooshMgr) { entryElement = entryElem; editorFactory = eFactory; swooshManager = swooshMgr; Height = 100; lblName = GlobalLayout.GenMetroLabel(GetNameFromEntry(entryElem)); lblName.Location = new Point(0, 0); lblName.Height = GlobalLayout.LineHeight; btnEdit = GlobalLayout.GenMetroButton("Edit", Edit_Click); btnEdit.Size = new Size(GlobalLayout.LabelWidth, GlobalLayout.LineHeight); btnEdit.Top = 0; Controls.Add(lblName); Controls.Add(btnEdit); Type editorType = editorFactory.GetEditorTypeByEntry(entryElem); isEditorInline = EditorFactory.IsInline(editorType); if (isEditorInline) { displayControl = (Control)editorFactory.CreateEditorForEntry(entryElem); displayControl.Location = new Point(0, GlobalLayout.LineHeight); displayControl.Enabled = false; } else { lblLabel = GlobalLayout.GenMetroLabel(entryElem.Label); displayControl = lblLabel; } Controls.Add(displayControl); }
protected void Edit_Click(object sender, EventArgs e) { if (isEditorInline) { displayControl.Enabled = true; } else { var eType = editorFactory.GetEditorTypeByEntry(entryElement); string panelName = EditorFactory.GetEditorName(eType); swooshManager.PushPanel((Swoosh.ISwoosh)editorFactory.CreateEditorForEntry(entryElement), panelName); } }