private static bool IsNodeNonMemberItem(HierarchyNode node, object criteria)
        {
            bool isNonMemberItem = false;
            if (node != null)
            {
                object propObj = node.GetProperty((int)__VSHPROPID.VSHPROPID_IsNonMemberItem);
                if (propObj != null)
                    bool.TryParse(propObj.ToString(), out isNonMemberItem);
            }

            return isNonMemberItem;
        }
Beispiel #2
0
        public bool Supports(string capabilities)
        {
            if (!string.IsNullOrEmpty(capabilities))
            {
                string projectCapabilities = HierarchyNode
                                             .GetProperty <string>((int)__VSHPROPID5.VSHPROPID_ProjectCapabilities);

                if (!string.IsNullOrEmpty(projectCapabilities))
                {
                    return(ExpressionEvaluator.Value.EvaluateExpression(capabilities, projectCapabilities));
                }
            }

            return(false);
        }
Beispiel #3
0
        // Add a service reference to the given project.
        public static IVsAddWebReferenceResult AddWebReferenceDialog(
            IServiceProvider serviceProvider,
            string title,
            HierarchyNode proxyProject)
        {
            Guard.ArgumentNotNull(serviceProvider, "serviceProvider");
            Guard.ArgumentNotNull(proxyProject, "proxyProject");

            if (!proxyProject.GetProperty <Boolean>((int)__VSHPROPID3.VSHPROPID_ServiceReferenceSupported))
            {
                throw new NotSupportedException(Properties.Resources.ServiceReferenceSupported);
            }

            IVsAddWebReferenceDlg3 awrdlg           = serviceProvider.GetService(typeof(SVsAddWebReferenceDlg3)) as IVsAddWebReferenceDlg3;
            IVsDiscoveryService    discoveryService = serviceProvider.GetService(typeof(SVsDiscoveryService)) as IVsDiscoveryService;
            IDiscoverySession      discoverySession = null;

            if (discoveryService != null)
            {
                discoveryService.CreateDiscoverySession(out discoverySession);
            }

            IVsAddWebReferenceResult addWebReferenceResult = null;

            int cancelled = 1;

            if (awrdlg != null)
            {
                awrdlg.ShowAddWebReferenceDialog(
                    proxyProject.Hierarchy,
                    discoverySession,
                    ServiceReferenceType.SRT_WCFReference | ServiceReferenceType.SRT_ASMXReference,
                    title,
                    null,
                    null,
                    out addWebReferenceResult,
                    out cancelled);
            }

            if (addWebReferenceResult != null && cancelled == 0)
            {
                return(addWebReferenceResult);
            }
            else
            {
                return(null);
            }
        }
        private static bool IsNodeNonMemberItem(HierarchyNode node, object criteria)
        {
            bool isNonMemberItem = false;

            ThreadHelper.ThrowIfNotOnUIThread();

            if (node != null)
            {
                object propObj = node.GetProperty((int)__VSHPROPID.VSHPROPID_IsNonMemberItem);
                if (propObj != null)
                {
                    Boolean.TryParse(propObj.ToString(), out isNonMemberItem);
                }
            }

            return(isNonMemberItem);
        }
        private static bool IsNodeNonMemberItem(HierarchyNode node, object criteria)
        {
            bool isNonMemberItem = false;
            if (node != null)
            {
                object propObj = node.GetProperty((int)__VSHPROPID.VSHPROPID_IsNonMemberItem);
                if (propObj != null)
                    bool.TryParse(propObj.ToString(), out isNonMemberItem);
            }

            return isNonMemberItem;
        }
Beispiel #6
0
        /// <summary>
        /// This is the filter for non member items.
        /// </summary>
        /// <param name="node">Node to be filtered.</param>
        /// <returns>Returns if the node is a non member item node or not.</returns>
        protected virtual bool IsNodeNonmemberItem(HierarchyNode node)
        {
            bool isNonmemberItem = false;
            if (node != null)
            {
                object propObj = node.GetProperty((int)__VSHPROPID.VSHPROPID_IsNonMemberItem);
                if (propObj != null)
                {
                    if (!bool.TryParse(propObj.ToString(), out isNonmemberItem))
                        isNonmemberItem = false;
                }
            }

            return isNonmemberItem;
        }
        // Add a service reference to the given project. 
        public static IVsAddWebReferenceResult AddWebReferenceDialog(
            IServiceProvider serviceProvider,
            string title,
            HierarchyNode proxyProject)
        {
            Guard.ArgumentNotNull(serviceProvider, "serviceProvider");
            Guard.ArgumentNotNull(proxyProject, "proxyProject");

            if (!proxyProject.GetProperty<Boolean>((int)__VSHPROPID3.VSHPROPID_ServiceReferenceSupported))
            {
                throw new NotSupportedException(Properties.Resources.ServiceReferenceSupported);
            }

            IVsAddWebReferenceDlg3 awrdlg = serviceProvider.GetService(typeof(SVsAddWebReferenceDlg3)) as IVsAddWebReferenceDlg3;
            IVsDiscoveryService discoveryService = serviceProvider.GetService(typeof(SVsDiscoveryService)) as IVsDiscoveryService;
            IDiscoverySession discoverySession = null;
            if (discoveryService != null) discoveryService.CreateDiscoverySession(out discoverySession);

            IVsAddWebReferenceResult addWebReferenceResult = null;
 
            int cancelled = 1;

            if (awrdlg != null)
            {
                awrdlg.ShowAddWebReferenceDialog(
                    proxyProject.Hierarchy,
                    discoverySession,
                    ServiceReferenceType.SRT_WCFReference | ServiceReferenceType.SRT_ASMXReference,
                    title,
                    null,
                    null,
                    out addWebReferenceResult,
                    out cancelled);
            }

            if (addWebReferenceResult != null && cancelled == 0)
            {
                return addWebReferenceResult;
            }
            else
            {
                return null;
            }
        }