/// <summary> /// Nodes the menu items requested. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ExplorerNodeMenuItemsRequestedEventArgs" /> instance containing the event data.</param> protected virtual void NodeMenuItemsRequested(object sender, ExplorerNodeMenuItemsRequestedEventArgs e) { IExplorerNode fileNode = e.Node; FileNodeInfo file = fileNode.Annotations.GetValue <FileNodeInfo>(); IMenuItem openFileMenuItem = e.MenuItems.Add(CKSProperties.FileNodeTypeProvider_OpenFile); openFileMenuItem.Click += OpenFileMenuItemClick; IMenuItem checkOutFileMenuItem = e.MenuItems.Add(CKSProperties.FileNodeTypeProvider_CheckOutFile); checkOutFileMenuItem.Click += CheckOutFileMenuItemClick; checkOutFileMenuItem.IsEnabled = file.IsCheckedOut == false; IMenuItem checkInFileMenuItem = e.MenuItems.Add(CKSProperties.FileNodeTypeProvider_CheckInFile); checkInFileMenuItem.Click += CheckInFileMenuItemClick; checkInFileMenuItem.IsEnabled = file.IsCheckedOut == true; IMenuItem discardCheckOutFileMenuItem = e.MenuItems.Add(CKSProperties.FileNodeTypeProvider_DiscardCheckOut); discardCheckOutFileMenuItem.Click += DiscardCheckOutFileMenuItemClick; discardCheckOutFileMenuItem.IsEnabled = file.IsCheckedOut == true; IMenuItem saveFileMenuItem = e.MenuItems.Add(CKSProperties.FileNodeTypeProvider_SaveFile); saveFileMenuItem.Click += SaveFileMenuItemClick; }
/// <summary> /// Handles the Click event of the importContentTypesMenuItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Microsoft.VisualStudio.SharePoint.MenuItemEventArgs"/> instance containing the event data.</param> void importContentTypesMenuItem_Click(object sender, MenuItemEventArgs e) { IExplorerNode contentTypeGroupNode = e.Owner as IExplorerNode; if (contentTypeGroupNode != null && contentTypeGroupNode.ChildNodes != null && contentTypeGroupNode.ChildNodes.Count() > 0) { //This will be valid if a user has already expanded the group node foreach (IExplorerNode childNode in contentTypeGroupNode.ChildNodes) { ContentTypeNodeExtension.ImportContentType(childNode); } } else if (contentTypeGroupNode != null && contentTypeGroupNode.ChildNodes != null) { //This is valid if the user has not expanded the group node but we still need the ct's ContentTypeNodeInfo[] contentTypes = contentTypeGroupNode.Context.SharePointConnection.ExecuteCommand <string, ContentTypeNodeInfo[]>(ContentTypeSharePointCommandIds.GetContentTypesFromGroup, contentTypeGroupNode.Text); if (contentTypes != null) { foreach (ContentTypeNodeInfo contentTypeNodeInfo in contentTypes) { ContentTypeInfo contentTypeInfo = contentTypeGroupNode.Context.SharePointConnection.ExecuteCommand <string, ContentTypeInfo>(ContentTypeSharePointCommandIds.GetContentTypeImportProperties, contentTypeNodeInfo.Name); ContentTypeNodeExtension.ImportContentType(contentTypeInfo); } } } }
/// <summary> /// Creates the node. /// </summary> /// <param name="parentNode">The parent node.</param> /// <param name="dependency">The dependency.</param> /// <returns></returns> internal static IExplorerNode CreateNode(IExplorerNode parentNode, FeatureDependencyInfo dependency) { Dictionary <object, object> annotations = new Dictionary <object, object>(); annotations.Add(typeof(FeatureDependencyInfo), dependency); return(parentNode.ChildNodes.Add(ExplorerNodeIds.FeatureDependencyNode, String.Format("{0} ({1})", dependency.Title, dependency.MinimumVersion), annotations)); }
/// <summary> /// Saves the file menu item click. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="MenuItemEventArgs" /> instance containing the event data.</param> protected virtual void SaveFileMenuItemClick(object sender, MenuItemEventArgs e) { IExplorerNode parentNode = e.Owner as IExplorerNode; var fileNodeInfo = parentNode.Annotations.GetValue <FileNodeInfo>(); DTEManager.SetStatus(CKSProperties.FileUtilities_SavingFile); Document file = DTEManager.DTE.ActiveDocument; TextSelection selection = file.Selection as TextSelection; selection.SelectAll(); fileNodeInfo.Contents = selection.Text; selection.StartOfDocument(); bool result = parentNode.Context.SharePointConnection.ExecuteCommand <FileNodeInfo, bool>(FileSharePointCommandIds.SaveFileCommand, fileNodeInfo); if (result) { DTEManager.SetStatus(CKSProperties.FileUtilities_FileSuccessfullySaved); } else { MessageBox.Show(CKSProperties.FileUtilities_FileSaveError, CKSProperties.FileUtilities_FileSaveErrorMessageTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Creates the node. /// </summary> /// <param name="parentNode">The parent node.</param> /// <param name="publishingPage">The publishing page.</param> /// <returns></returns> public static IExplorerNode CreateNode(IExplorerNode parentNode, PublishingPageInfo publishingPage) { return(parentNode.ChildNodes.Add(ExplorerNodeIds.PublishingPageNodeTypeId, String.IsNullOrEmpty(publishingPage.Name) ? publishingPage.Title : publishingPage.Name, new Dictionary <object, object> { { typeof(PublishingPageInfo), publishingPage } })); }
IObservableList IObservableHierarchyList.this[long index] { get { IExplorerNode explorerNode = base[(int)index] as IExplorerNode; IObservableList list = explorerNode != null ? explorerNode.Children : null; return(list != null && list.Count != 0 ? list : null); } }
/// <summary> /// Retrieves properties that are displayed in the Properties window when /// a theme node is selected. /// </summary> /// <param name="sender">The sender object</param> /// <param name="e">The ExplorerNodePropertiesRequestedEventArgs object</param> protected override void NodePropertiesRequested(object sender, ExplorerNodePropertiesRequestedEventArgs e) { IExplorerNode themeNode = e.Node; FileNodeInfo theme = themeNode.Annotations.GetValue <FileNodeInfo>(); Dictionary <string, string> masterPageProperties = themeNode.Context.SharePointConnection.ExecuteCommand <FileNodeInfo, Dictionary <string, string> >(ThemeSharePointCommandIds.GetThemeProperties, theme); object propertySource = themeNode.Context.CreatePropertySourceObject(masterPageProperties); e.PropertySources.Add(propertySource); }
/// <summary> /// Retrieves properties that are displayed in the Properties window when /// a solution node is selected. /// </summary> /// <param name="sender">The sender object</param> /// <param name="e">The ExplorerNodePropertiesRequestedEventArgs object</param> private void NodePropertiesRequested(object sender, ExplorerNodePropertiesRequestedEventArgs e) { IExplorerNode solutionNode = e.Node; FileNodeInfo solution = solutionNode.Annotations.GetValue <FileNodeInfo>(); Dictionary <string, string> solutionProperties = solutionNode.Context.SharePointConnection.ExecuteCommand <FileNodeInfo, Dictionary <string, string> >(SolutionSharePointCommandIds.GetSolutionProperties, solution); object propertySource = solutionNode.Context.CreatePropertySourceObject(solutionProperties); e.PropertySources.Add(propertySource); }
/// <summary> /// Creates the node. /// </summary> /// <param name="parentNode">The parent node.</param> /// <param name="element">The element.</param> /// <returns></returns> internal static IExplorerNode CreateNode(IExplorerNode parentNode, FeatureElementInfo element) { Dictionary <object, object> annotations = new Dictionary <object, object>(); annotations.Add(typeof(FeatureElementInfo), element); return(parentNode.ChildNodes.Add(ExplorerNodeIds.FeatureElementNode, String.Format("{0} ({1})", element.Name, element.ElementType), annotations)); }
/// <summary> /// Handles the Click event of the importFieldMenuItem control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MenuItemEventArgs" /> instance containing the event data.</param> void importFieldMenuItem_Click(object sender, MenuItemEventArgs e) { IExplorerNode node = e.Owner as IExplorerNode; if (node != null) { ImportField(node); } }
/// <summary> /// Handles the NodeChildrenRequested event of the nodeType control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ExplorerNodeEventArgs" /> instance containing the event data.</param> void nodeType_NodeChildrenRequested(object sender, ExplorerNodeEventArgs e) { IExplorerNode siteNode = e.Node; if (siteNode.Context.SharePointConnection.ExecuteCommand <bool>(SiteCommandIds.IsPublishingSiteCommandId)) { IExplorerNode pages = siteNode.ChildNodes.AddFolder("Pages", CKSProperties.PagesNode.ToBitmap(), new Action <IExplorerNode>(PublishingPageNodeTypeProvider.CreatePublishingPageNodes)); } }
/// <summary> /// Retrieves properties that are displayed in the Properties window when /// a solution node is selected. /// </summary> /// <param name="sender">The sender object</param> /// <param name="e">The ExplorerNodePropertiesRequestedEventArgs object</param> private void NodePropertiesRequested(object sender, ExplorerNodePropertiesRequestedEventArgs e) { IExplorerNode webTemplateNode = e.Node; WebTemplateInfo webTemplate = webTemplateNode.Annotations.GetValue <WebTemplateInfo>(); Dictionary <string, string> webTemplateProperties = webTemplateNode.Context.SharePointConnection.ExecuteCommand <WebTemplateInfo, Dictionary <string, string> >(WebTemplateSharePointCommandIds.GetWebTemplateProperties, webTemplate); object propertySource = webTemplateNode.Context.CreatePropertySourceObject(webTemplateProperties); e.PropertySources.Add(propertySource); }
/// <summary> /// Nodes the properties requested. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ExplorerNodePropertiesRequestedEventArgs" /> instance containing the event data.</param> protected virtual void NodePropertiesRequested(object sender, ExplorerNodePropertiesRequestedEventArgs e) { IExplorerNode fileNode = e.Node; FileNodeInfo file = fileNode.Annotations.GetValue <FileNodeInfo>(); Dictionary <string, string> fileProperties = fileNode.Context.SharePointConnection.ExecuteCommand <FileNodeInfo, Dictionary <string, string> >(FileSharePointCommandIds.GetFilePropertiesCommand, file); object propertySource = fileNode.Context.CreatePropertySourceObject(fileProperties); e.PropertySources.Add(propertySource); }
/// <summary> /// Import the selected content type into the currently selected project. /// </summary> /// <param name="e">The MenuItemEventArgs object.</param> void ImportContentType(MenuItemEventArgs e) { IExplorerNode owner = (IExplorerNode)e.Owner; if (owner != null) { ImportContentType(owner); } }
/// <summary> /// Gets the content type groups. /// </summary> /// <param name="contentTypesFolder">The content types folder.</param> /// <returns></returns> private string[] GetContentTypeGroups(IExplorerNode contentTypesFolder) { if (contentTypesFolder == null) { throw new ArgumentNullException("contentTypesFolder"); } return(contentTypesFolder.Context.SharePointConnection.ExecuteCommand <string[]>(ContentTypeSharePointCommandIds.GetContentTypeGroups)); }
/// <summary> /// Gets the site columns groups. /// </summary> /// <param name="siteColumnsNode">The site columns node.</param> /// <returns></returns> private string[] GetSiteColumnsGroups(IExplorerNode siteColumnsNode) { if (siteColumnsNode == null) { throw new ArgumentNullException("siteColumnsNode"); } return(siteColumnsNode.Context.SharePointConnection.ExecuteCommand <string[]>(SiteColumnsSharePointCommandIds.GetSiteColumnsGroups)); }
/// <summary> /// Nodes the properties requested. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ExplorerNodePropertiesRequestedEventArgs" /> instance containing the event data.</param> protected override void NodePropertiesRequested(object sender, ExplorerNodePropertiesRequestedEventArgs e) { IExplorerNode pageLayoutNode = e.Node; FileNodeInfo pageLayout = pageLayoutNode.Annotations.GetValue <FileNodeInfo>(); Dictionary <string, string> properties = pageLayoutNode.Context.SharePointConnection.ExecuteCommand <FileNodeInfo, Dictionary <string, string> >(MasterPageGallerySharePointCommandIds.GetMasterPagesOrPageLayoutPropertiesCommand, pageLayout); object propertySource = pageLayoutNode.Context.CreatePropertySourceObject(properties); e.PropertySources.Add(propertySource); }
/// <summary> /// Creates the publishing page nodes. /// </summary> /// <param name="pagesFolder">The pages folder.</param> internal static void CreatePublishingPageNodes(IExplorerNode pagesFolder) { List <PublishingPageInfo> publishingPages = pagesFolder.Context.SharePointConnection.ExecuteCommand <List <PublishingPageInfo> >(SiteCommandIds.GetPublishingPagesCommandId); foreach (PublishingPageInfo publishingPage in publishingPages) { CreateNode(pagesFolder, publishingPage); } }
/// <summary> /// The copy id item click event copies the selected feature node id to the clipboard. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The MenuItemEventArgs.</param> void CopyIdItem_Click(object sender, MenuItemEventArgs e) { IExplorerNode owner = (IExplorerNode)e.Owner; IFeatureNodeInfo annotation = owner.Annotations.GetValue <IFeatureNodeInfo>(); if (annotation.Id != null) { Clipboard.SetData(DataFormats.Text, annotation.Id.ToString("D")); } }
/// <summary> /// Get the catergories for the web templates. /// </summary> /// <param name="parentNode">The parent node.</param> private void CreateWebTemplateCategories(IExplorerNode parentNode) { //Get the categories which string[] categories = parentNode.Context.SharePointConnection.ExecuteCommand <string[]>(WebTemplateCollectionSharePointCommandIds.GetWebTemplateCategories); foreach (var item in categories) { parentNode.ChildNodes.AddFolder(item, CKSProperties.WebTemplateCategoryNode.ToBitmap(), CreateWebTemplateNodes); } }
/// <summary> /// Handles the NodePropertiesRequested event of the typeDefinition control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ExplorerNodePropertiesRequestedEventArgs" /> instance containing the event data.</param> void typeDefinition_NodePropertiesRequested(object sender, ExplorerNodePropertiesRequestedEventArgs e) { IExplorerNode pageNode = e.Node; if (pageNode != null) { IDictionary <string, string> publishingPageProperties = pageNode.Context.SharePointConnection.ExecuteCommand <PublishingPageInfo, Dictionary <string, string> >(PublishingPageCommandIds.GetProperties, pageNode.Annotations.GetValue <PublishingPageInfo>()); object propertySource = e.Node.Context.CreatePropertySourceObject(publishingPageProperties); e.PropertySources.Add(propertySource); } }
/// <summary> /// The copy id item click event copies the selected content type node id to the clipboard. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The MenuItemEventArgs.</param> void CopyIdItem_Click(object sender, MenuItemEventArgs e) { IExplorerNode owner = (IExplorerNode)e.Owner; IContentTypeNodeInfo annotation = owner.Annotations.GetValue <IContentTypeNodeInfo>(); string id = owner.Context.SharePointConnection.ExecuteCommand <string, string>(ContentTypeSharePointCommandIds.GetContentTypeID, annotation.Name); if (!String.IsNullOrEmpty(id)) { Clipboard.SetData(DataFormats.Text, id); } }
/// <summary> /// Adds the site columns groups. /// </summary> /// <param name="siteColumnsNode">The site columns node.</param> void AddSiteColumnsGroups(IExplorerNode siteColumnsNode) { string[] siteColumnsGroups = GetSiteColumnsGroups(siteColumnsNode); if (siteColumnsGroups != null) { foreach (string groupName in siteColumnsGroups) { IExplorerNode contentTypeGroup = siteColumnsNode.ChildNodes.Add(ExplorerNodeIds.SiteColumnsGroupNode, groupName, null, -1); } } }
void writeMessageMenuItem_Click(object sender, MenuItemEventArgs e) { IExplorerNode node = (IExplorerNode)e.Owner; if (projectService == null) { projectService = (ISharePointProjectService)node.ServiceProvider.GetService(typeof(ISharePointProjectService)); } projectService.Logger.WriteLine("Clicked the menu item for " + node.Text, LogCategory.Message); }
/// <summary> /// Imports the field. /// </summary> /// <param name="fieldNode">The field node.</param> /// <exception cref="System.ArgumentNullException"></exception> public static void ImportField(IExplorerNode fieldNode) { if (fieldNode == null) { throw new ArgumentNullException("fieldNode"); } Microsoft.VisualStudio.SharePoint.Explorer.Extensions.IFieldNodeInfo nodeInfo = fieldNode.Annotations.GetValue <Microsoft.VisualStudio.SharePoint.Explorer.Extensions.IFieldNodeInfo>(); if (nodeInfo != null) { FieldNodeInfo fieldNodeInfo = new FieldNodeInfo { ContentTypeName = nodeInfo.ContentTypeName, Id = nodeInfo.Id, IsHidden = nodeInfo.IsHidden, ListId = nodeInfo.ListId, Title = nodeInfo.Title }; Dictionary <string, string> fieldProperties = null; if (String.IsNullOrEmpty(fieldNodeInfo.ContentTypeName) && fieldNodeInfo.ListId == Guid.Empty) { fieldProperties = fieldNode.Context.SharePointConnection.ExecuteCommand <FieldNodeInfo, Dictionary <string, string> >(SiteColumnsSharePointCommandIds.GetProperties, fieldNodeInfo); } else { fieldProperties = fieldNode.Context.SharePointConnection.ExecuteCommand <FieldNodeInfo, Dictionary <string, string> >(FieldSharePointCommandIds.GetProperties, fieldNodeInfo); } if (fieldProperties != null) { XNamespace xn = XNamespace.Get("http://schemas.microsoft.com/sharepoint/"); XElement xElements = new XElement(xn + "Elements", XElement.Parse(fieldProperties["SchemaXml"])); EnvDTE.Project activeProject = DTEManager.ActiveProject; if (activeProject != null) { ISharePointProjectService projectService = fieldNode.ServiceProvider.GetService(typeof(ISharePointProjectService)) as ISharePointProjectService; ISharePointProject activeSharePointProject = projectService.Projects[activeProject.FullName]; if (activeSharePointProject != null) { ISharePointProjectItem fieldProjectItem = activeSharePointProject.ProjectItems.Add(fieldProperties["InternalName"], "Microsoft.VisualStudio.SharePoint.Field"); System.IO.File.WriteAllText(Path.Combine(fieldProjectItem.FullPath, "Elements.xml"), xElements.ToString().Replace("xmlns=\"\"", String.Empty)); ISharePointProjectItemFile elementsXml = fieldProjectItem.Files.AddFromFile("Elements.xml"); elementsXml.DeploymentType = DeploymentType.ElementManifest; elementsXml.DeploymentPath = String.Format(@"{0}\", fieldProperties["InternalName"]); fieldProjectItem.DefaultFile = elementsXml; } } } } }
/// <summary> /// Handles the NodePropertiesRequested event of the typeDefinition control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Microsoft.VisualStudio.SharePoint.Explorer.ExplorerNodePropertiesRequestedEventArgs"/> instance containing the event data.</param> void typeDefinition_NodePropertiesRequested(object sender, ExplorerNodePropertiesRequestedEventArgs e) { IExplorerNode listEventReceiverNode = e.Node; EventReceiverInfo eventReceiverInfo = listEventReceiverNode.Annotations.GetValue <EventReceiverInfo>(); if (eventReceiverInfo != null) { Dictionary <string, string> listEventReceiverProperties = listEventReceiverNode.Context.SharePointConnection.ExecuteCommand <EventReceiverInfo, Dictionary <string, string> >(ListEventReceiversCommandIds.GetListEventReceiverProperties, eventReceiverInfo); object propertySource = listEventReceiverNode.Context.CreatePropertySourceObject(listEventReceiverProperties); e.PropertySources.Add(propertySource); } }
/// <summary> /// Handles the Click event of the CreatePageLayoutContentTypeNodeExtension control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Microsoft.VisualStudio.SharePoint.MenuItemEventArgs" /> instance containing the event data.</param> void CreatePageLayoutContentTypeNodeExtension_Click(object sender, Microsoft.VisualStudio.SharePoint.MenuItemEventArgs e) { IExplorerNode ctNode = e.Owner as IExplorerNode; if (ctNode != null) { IContentTypeNodeInfo ctInfo = ctNode.Annotations.GetValue <IContentTypeNodeInfo>(); string pageLayoutContents = ctNode.Context.SharePointConnection.ExecuteCommand <string, string>(ContentTypeSharePointCommandIds.CreatePageLayoutCommand, ctInfo.Name); DTEManager.CreateNewTextFile(SafeContentTypeName(ctInfo.Name) + ".aspx", pageLayoutContents); } }
void ImportListInstanceExplorerExtension_Click(object sender, MenuItemEventArgs e) { IExplorerNode listNode = e.Owner as IExplorerNode; if (listNode != null) { try { IListNodeInfo listInfo = listNode.Annotations.GetValue <IListNodeInfo>(); string listInstanceContents = listNode.Context.SharePointConnection.ExecuteCommand <Guid, string>(CommandIds.GetListInstanceXmlCommandId, listInfo.Id); XNamespace xn = "http://schemas.microsoft.com/sharepoint/"; string moduleContents = new XElement(xn + "Elements", XElement.Parse(listInstanceContents)).ToString().Replace(" xmlns=\"\"", String.Empty); EnvDTE.Project activeProject = Utils.GetActiveProject(); if (activeProject != null) { ISharePointProjectService projectService = listNode.ServiceProvider.GetService(typeof(ISharePointProjectService)) as ISharePointProjectService; ISharePointProject activeSharePointProject = projectService.Projects[activeProject.FullName]; if (activeSharePointProject != null) { string spiName = listInfo.Title; ISharePointProjectItem listInstanceProjectItem = null; bool itemCreated = false; int counter = 0; do { try { listInstanceProjectItem = activeSharePointProject.ProjectItems.Add(spiName, "Microsoft.VisualStudio.SharePoint.ListInstance"); itemCreated = true; } catch (ArgumentException) { spiName = String.Format("{0}{1}", listInfo.Title, ++counter); } }while (!itemCreated); string elementsXmlFullPath = Path.Combine(listInstanceProjectItem.FullPath, "Elements.xml"); System.IO.File.WriteAllText(elementsXmlFullPath, moduleContents); ISharePointProjectItemFile elementsXml = listInstanceProjectItem.Files.AddFromFile("Elements.xml"); elementsXml.DeploymentType = DeploymentType.ElementManifest; elementsXml.DeploymentPath = String.Format(@"{0}\", spiName); listInstanceProjectItem.DefaultFile = elementsXml; Utils.OpenFile(Path.Combine(elementsXmlFullPath)); } } } catch (Exception ex) { listNode.Context.ShowMessageBox(String.Format("The following exception occured while exporting List Instance: {0}", ex.Message), MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
ContextMenu TreeView_ContextMenu(IHierarchyLevel level, long index) { if (level == null) { return(NodeUtil.RootsContextMenu(this.Data.AddRoot, Data.LoadConfiguration)); } IExplorerNode node = level.List[index] as IExplorerNode; return(node != null?node.ContextMenu(level, index) : null); }
/// <summary> /// Import all the custom content types. /// </summary> /// <param name="sender">The sender object.</param> /// <param name="e">The MenuItemEventArgs object.</param> void ContentTypesGenericFolderNodeExtension_Click(object sender, MenuItemEventArgs e) { IExplorerNode owner = (IExplorerNode)e.Owner; if (MessageBox.Show(CKSProperties.ContentTypeFolderExtension_ImportAllConfirmationQuestion, CKSProperties.ContentTypeFolderExtension_ImportAllConfirmationDialogTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { ImportContentTypes(owner); } }