Пример #1
0
        /// <summary>
        /// Initialise from the the wizard data
        /// </summary>
        /// <param name="replacementsDictionary">The replacements dictionary</param>
        public override void InitializeFromWizardData(Dictionary <string, string> replacementsDictionary)
        {
            base.InitializeFromWizardData(replacementsDictionary);

            if (replacementsDictionary.ContainsKey("$rootname$"))
            {
                replacementsDictionary.Add("$subnamespace$", WizardHelpers.MakeNameCompliant(replacementsDictionary["$rootname$"]));
            }
        }
Пример #2
0
        /// <summary>
        /// Connect the item wizard to SharePoint
        /// </summary>
        public static void ConnectItemWizardToSharePoint()
        {
            Uri defaultProjectUrl = WizardHelpers.GetDefaultProjectUrl();

            WizardHelpers.CheckMissingSiteUrl(defaultProjectUrl);
            //try
            //{
            //    SharePointWeb.ValidateSiteWhileShowingProgress(defaultProjectUrl);
            //}
            //catch (Exception exception)
            //{
            //    string sharePointConnectionErrorMessage = SharePointWeb.GetSharePointConnectionErrorMessage(exception, defaultProjectUrl.AbsoluteUri);
            //    //RtlAwareMessageBox.ShowError(null, sharePointConnectionErrorMessage, WizardResources.SharePointConnectionErrorCaption);
            //    //WizardHelpers.Logger.LogException(exception);
            //    throw new WizardCancelledException();
            //}
        }
        /// <summary>
        /// Intialise the form wizard data
        /// </summary>
        /// <param name="replacementsDictionary">The replacements dictionary</param>
        public override void InitializeFromWizardData(Dictionary <string, string> replacementsDictionary)
        {
            base.InitializeFromWizardData(replacementsDictionary);

            if (replacementsDictionary.ContainsKey("$rootname$"))
            {
                replacementsDictionary.Add("$subnamespace$", WizardHelpers.MakeNameCompliant(replacementsDictionary["$rootname$"]));

                //Do this with a guid rather than $guid3$ as we have $ in the token that break it
                Guid ashxGuid = Guid.NewGuid();

                replacementsDictionary.Add("$ashxGuid$", ashxGuid.ToString("D"));

                replacementsDictionary.Add("$ashxGuidClass$", "$SharePoint.Type." + ashxGuid.ToString("D") + ".FullName$");
            }

            ProjectUtilities.AddTokenReplacementFileExtension(DTEManager.ActiveProject, "ashx");
        }
        /// <summary>
        /// Gets the urls from registry.
        /// </summary>
        /// <returns></returns>
        private List <string> GetUrlsFromRegistry()
        {
            string        empty       = string.Empty;
            List <string> strs        = new List <string>();
            RegistryKey   registryKey = VSRegistry.RegistryRoot(__VsLocalRegistryType.RegType_UserSettings, false);

            using (registryKey)
            {
                if (registryKey != null)
                {
                    RegistryKey registryKey1 = registryKey.OpenSubKey("SharePointTools", false);
                    using (registryKey1)
                    {
                        if (registryKey1 != null)
                        {
                            for (int i = 1; i <= 10; i++)
                            {
                                object[] objArray = new object[1];
                                objArray[0] = i;
                                string str   = string.Format(CultureInfo.InvariantCulture, "SpUrl{0}", objArray);
                                string value = registryKey1.GetValue(str, empty) as string;
                                if (value != null && !(value == empty) && WizardHelpers.IsValidUriString(value, UriKind.Absolute))
                                {
                                    strs.Add(value);
                                }
                            }
                        }
                    }
                }
            }
            if (strs.Count == 0)
            {
                strs.Add(MRUHelper.GetLocalHostUrl());
            }
            return(strs);
        }