Beispiel #1
0
        protected void UpdateArguments()
        {
            this.Wizard.OnValidationStateChanged(this);

            IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;

            if (CreateNewFeature())
            {
                dictionaryService.SetValue("ParentFeatureName", SafeAppName + "_" + this.textBox_FeatureName.Text);
                dictionaryService.SetValue("ParentFeatureId", this.FeatureID);
                dictionaryService.SetValue("ParentFeatureScope", this.comboBox_Scopes.Text);
                dictionaryService.SetValue("CreateNewFeature", true);

                dictionaryService.SetValue("FeatureName", this.textBox_FeatureName.Text);
                dictionaryService.SetValue("FeatureTitle", this.textBox_FeatureTitle.Text);
                dictionaryService.SetValue("FeatureDescription", this.textBox_FeatureDescription.Text);
                dictionaryService.SetValue("FeatureScope", this.comboBox_Scopes.Text);
                dictionaryService.SetValue("FeatureHidden", this.checkBox_Hidden.Checked);
                dictionaryService.SetValue("FeatureCreateReceiver", this.checkBox_CreateReceiver.Checked);
            }
            else
            {
                //use the selected feature
                if (comboBox1.SelectedItem != null)
                {
                    FeatureItem selectedFeature = comboBox1.SelectedItem as FeatureItem;

                    dictionaryService.SetValue("ParentFeatureName", selectedFeature.FeatureName);
                    dictionaryService.SetValue("ParentFeatureId", selectedFeature.FeatureId);
                    dictionaryService.SetValue("ParentFeatureScope", selectedFeature.FeatureScope);

                    dictionaryService.SetValue("CreateNewFeature", false);
                    dictionaryService.SetValue("FeatureCreateReceiver", false);
                }
            }
        }
			private void LoadFeatures()
			{
				if (HasBeenActivated)
				{
					return;
				}

				IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;
				CurrentProject = dictionaryService.GetValue("CurrentProject") as Project;
				AllowedScopes = dictionaryService.GetValue("AllowedScopes").ToString();
				
                List<string> allowedScopesList = new List<string>();
                if (AllowedScopes == "")
				{
					allowedScopesList.Add("Web");
					allowedScopesList.Add("Site");
					allowedScopesList.Add("WebApplication");
					allowedScopesList.Add("Farm");
				}
				else
				{
					char[] sep = new char[] { ';' };
					string[] scopes = AllowedScopes.Split(sep);
					foreach (string scope in scopes)
					{
						allowedScopesList.Add(scope);
					}
				}

                this.comboBox_Scopes.Items.Clear();
                foreach(string allowedScope in allowedScopesList)
                {
                    comboBox_Scopes.Items.Add(allowedScope);
				}
				comboBox_Scopes.SelectedIndex = 0;

				this.comboBox1.Items.Clear();
				comboBox1.Items.Add("<New...>");
				int selectedIndex = 0;
				if (CurrentProject != null)
				{
					List<NameValueItem> list = new List<NameValueItem>();
					Helpers.GetAllFeatures(list, CurrentProject);
					foreach (NameValueItem item in list)
					{
						FeatureItem newItem = new FeatureItem();
						newItem.FeatureName = item.Name;
						newItem.FeatureId = item.Value;
						newItem.FeatureScope = item.Description;
						int index = comboBox1.Items.Add(newItem);
                        if (ParentFeatureName != "")
                        {
                            if (item.Name.Equals(ParentFeatureName, StringComparison.InvariantCultureIgnoreCase))
                            {
                                selectedIndex = index;
                            }
                        }
                        else
                        {
                            //if feature has allowed scope then we select it first
                            if (allowedScopesList.Contains(newItem.FeatureScope))
                            {
                                selectedIndex = index;
                            }
                        }
					}
				}
				comboBox1.SelectedIndex = selectedIndex;

                UpdateArguments();
			}
Beispiel #3
0
        private void LoadFeatures()
        {
            if (HasBeenActivated)
            {
                return;
            }

            IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;

            CurrentProject = dictionaryService.GetValue("CurrentProject") as Project;
            AllowedScopes  = dictionaryService.GetValue("AllowedScopes").ToString();

            List <string> allowedScopesList = new List <string>();

            if (AllowedScopes == "")
            {
                allowedScopesList.Add("Web");
                allowedScopesList.Add("Site");
                allowedScopesList.Add("WebApplication");
                allowedScopesList.Add("Farm");
            }
            else
            {
                char[]   sep    = new char[] { ';' };
                string[] scopes = AllowedScopes.Split(sep);
                foreach (string scope in scopes)
                {
                    allowedScopesList.Add(scope);
                }
            }

            this.comboBox_Scopes.Items.Clear();
            foreach (string allowedScope in allowedScopesList)
            {
                comboBox_Scopes.Items.Add(allowedScope);
            }
            comboBox_Scopes.SelectedIndex = 0;

            this.comboBox1.Items.Clear();
            comboBox1.Items.Add("<New...>");
            int selectedIndex = 0;

            if (CurrentProject != null)
            {
                List <NameValueItem> list = new List <NameValueItem>();
                Helpers.GetAllFeatures(list, CurrentProject);
                foreach (NameValueItem item in list)
                {
                    FeatureItem newItem = new FeatureItem();
                    newItem.FeatureName  = item.Name;
                    newItem.FeatureId    = item.Value;
                    newItem.FeatureScope = item.Description;
                    int index = comboBox1.Items.Add(newItem);
                    if (ParentFeatureName != "")
                    {
                        if (item.Name.Equals(ParentFeatureName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            selectedIndex = index;
                        }
                    }
                    else
                    {
                        //if feature has allowed scope then we select it first
                        if (allowedScopesList.Contains(newItem.FeatureScope))
                        {
                            selectedIndex = index;
                        }
                    }
                }
            }
            comboBox1.SelectedIndex = selectedIndex;

            UpdateArguments();
        }