public void OpenTab(EditorBrowseInfo browseInfo, bool openCopy, bool makeDirty) { if (browseInfo == null) { throw new ArgumentNullException(nameof(browseInfo), Resources.NullParameterErrorMessage); } TabPage page = null; // If we are not opening a copy, always create a new page and do not use an already open page. if (!openCopy) { page = FindTab(browseInfo.SystemType, browseInfo.Id); } if (page != null) { tabContent.SelectedTab = page; } else { var builder = EditorFactory.Builders[EnumerationExtensions.GetEnum <SystemTypes>((int)browseInfo.SystemType)]; if (!builder.HasEditor()) { return; } // Create a new edit control based on the selected node var editControl = EditorFactory.Create(EnumerationExtensions.GetEnum <SystemTypes>((int)browseInfo.SystemType), browseInfo.ClassId); // Initialize the new control with the content that was dclicked editControl.InitContent(browseInfo.Id); var tabName = editControl.ControlName; if (openCopy) { editControl.MakeCopy(); tabName = "*" + editControl.ControlName + "*"; } else if (makeDirty) { editControl.MakeDirty(); tabName = "*" + editControl.ControlName + "*"; } tabName = $"[{editControl.Id}] {tabName}"; CreateContentTab(tabName, editControl); } }
private void CreateProductToolStripMenuItemClick(object sender, EventArgs e) { var browseInfo = treeBrowse.SelectedNode?.Tag as EditorBrowseInfo; if (browseInfo == null || browseInfo.Id <= 0) { return; } var editControl = EditorFactory.Create(browseInfo.SystemType, browseInfo.ClassId); editControl.InitContent(browseInfo.Id); browseInfo = editControl.MakeProduct(); if (browseInfo != null) { OpenTab(browseInfo, false, true); } }
private void MnuBrowseNewNodeClick(object sender, EventArgs e) { // Create a new edit control based on the selected node var browseInfo = treeBrowse.SelectedNode?.Tag as EditorBrowseInfo; if (browseInfo == null) { return; } var builder = EditorFactory.Builders[browseInfo.SystemType]; if (builder == null || !builder.HasCreate()) { return; } var editControl = EditorFactory.Create(browseInfo.SystemType, browseInfo.ClassId); editControl.InitNew(); // Throw the new edit control into its own tab CreateContentTab("[??] " + editControl.ControlName, editControl); }