private void Ctvf_PortalItemSelected(object sender, PortalItemSelectedEventArgs e) { if (e.Item != null) { var content = dpMain.Contents.OfType <CodeEditorForm>().FirstOrDefault(c => c.Item == e.Item); if (content == null) { content = new CodeEditorForm(e.Item, mySettings, Service); content.UpdateRequested += Content_UpdateRequested; content.TabPageContextMenuStrip = cmsTab; content.Show(dpMain, DockState.Document); } else { content.Show(dpMain, content.DockState); } } }
private void ctv_PortalItemSelected(object sender, PortalItemSelectedEventArgs e) { tcCodeContents.Padding = new Point(20, tcCodeContents.Padding.Y); if (e.Item != null) { var key = $"{e.Item.Parent.Id}{e.Item.Type}"; TabPage tab; if (tcCodeContents.TabPages.ContainsKey(key)) { tab = tcCodeContents.TabPages[key]; tcCodeContents.SelectedTab = tab; } else { tab = new TabPage { Text = e.Item.Parent.Name, Name = key, Tag = e.Item, Width = TextRenderer.MeasureText(e.Item.Parent.Name, tcCodeContents.Font).Width + 40 }; var ce = new CodeEditorScintilla(e.Item, mySettings) { Dock = DockStyle.Fill }; tab.Controls.Add(ce); tcCodeContents.TabPages.Add(tab); tcCodeContents.SelectedTab = tab; } ManageCodeContentToolbarDisplay(e.Item); lblItemSelected.Text = $"{e.Item.Parent.Name} {(e.Item.Parent is WebPage ? (e.Item.Type == CodeItemType.JavaScript ? "(JavaScript)" : "(Style)") : "")}"; } }