internal void AddNewWebresource(FolderNode parentNode, WebresourceType type) { var map = WebresourceMapper.Instance.Items.First(i => i.Type == type); var nwrDialog = new NewWebResourceDialog(map.Extension, OrganizationMajorVersion); if (nwrDialog.ShowDialog(mainControl) == DialogResult.OK) { var name = $"{parentNode.ResourceFullPath}/{nwrDialog.WebresourceName}"; var resource = new Webresource(name, null, type, mainControl); mainControl.WebresourcesCache.Add(resource); AddSingleNode(resource, name.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries), parentNode); parentNode.Expand(); } }
internal void DuplicateWebresource(WebresourceNode node) { var selectedResource = node.Resource; var map = WebresourceMapper.Instance.Items.First(i => (int)i.Type == selectedResource.Type); var nwrDialog = new NewWebResourceDialog(map.Extension, OrganizationMajorVersion); if (nwrDialog.ShowDialog(mainControl) == DialogResult.OK) { var name = $"{((FolderNode)node.Parent).ResourceFullPath}/{nwrDialog.WebresourceName}"; var resource = selectedResource.Clone(name); if (mainControl.WebresourcesCache.All(w => w.Name != resource.Name)) { mainControl.WebresourcesCache.Add(resource); } AddSingleNode(resource, name.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries), (FolderNode)node.Parent); node.Parent.Expand(); } }