Exemple #1
0
        private void SetPanelToMethod(MethodInfo info)
        {
            SaveCurrentFunctionInfo();

            Utility.SuspendPainting(panelContent);

            ClearPanel();

            // Try find Api Extension in the current project
            if (Project.Instance.TryGetApiExtensionFor(info, out currentExtentionMethod) == false)
            {
                currentExtentionMethod             = new ApiExtensionMethod(info);
                currentExtentionMethod.DefaultCode = Project.Instance.GetDefaultFunctionBodyFor(info);
            }

            functionScreen.CurrentFunction         = currentExtentionMethod.FunctionInfo;
            functionScreen.AllowOverride           = true;
            functionScreen.OverrideFunctionChecked = currentExtentionMethod.HasOverride;

            functionScreen.Populate();

            panelContent.Visible = true;

            Utility.ResumePainting(panelContent);

            formUserOptionDetails.Visible = false;
        }
        void currentFunctionScreen_ResetDefaultCode(object sender, EventArgs e)
        {
            if (currentUserOption == null)
            {
                return;
            }

            switch (currentFunctionType)
            {
            case FunctionTypes.DefaultValue:
                currentFunctionScreen.CurrentFunction.Body     =
                    currentUserOption.DefaultValueFunctionBody = UserOption.Default_DefaultValueFunctionBody;
                SetDefaultValueToDirty(currentUserOption, true);
                break;

            case FunctionTypes.Validation:
                currentFunctionScreen.CurrentFunction.Body  =
                    currentUserOption.ValidatorFunctionBody = UserOption.Default_ValidatorFunctionBody;
                SetValidatorToDirty(currentUserOption, true);
                break;

            case FunctionTypes.DisplayToUser:
                currentFunctionScreen.CurrentFunction.Body      =
                    currentUserOption.DisplayToUserFunctionBody = UserOption.Default_DisplayToUserFunctionBody;
                SetDisplayToUserToDirty(currentUserOption, true);
                break;
            }

            currentFunctionScreen.Populate();
            Project.Instance.IsDirty = true;
        }
Exemple #3
0
		private TabItem CreateNewFunctionTabPage(UserOption userOption, FunctionTypes functionType, bool allowEdit)
		{
			var newPage = new TabItem();
			var panel = new TabControlPanel { TabItem = newPage, Dock = DockStyle.Fill };
			newPage.AttachedControl = panel;

			switch (functionType)
			{
				case FunctionTypes.DefaultValue:
					newPage.Text = userOption.VariableName + " [Default Value]";
					break;
				case FunctionTypes.DisplayToUser:
					newPage.Text = userOption.VariableName + " [Display To User]";
					break;
				case FunctionTypes.Validation:
					newPage.Text = userOption.VariableName + " [Valitation]";
					break;
			}
			newPage.ImageIndex = 0;
			newPage.Tag = userOption;
			newPage.CloseButtonVisible = true;
			var funcPanel = new ucFunction
								{
									Dock = DockStyle.Fill,
									AllowEdit = allowEdit

								};
			newPage.AttachedControl.Controls.Add(funcPanel);
			funcPanel.FunctionName = userOption.VariableName;
			funcPanel.CurrentUserOption = userOption;
			funcPanel.CurrentUserOptionFunctionType = functionType;
			funcPanel.Populate();
			newPage.ImageIndex = 0;
			return newPage;
		}
Exemple #4
0
		private TabItem CreateNewFunctionTabPage(FunctionInfo function, bool allowEdit)
		{
			TabItem newPage = new TabItem();
			TabControlPanel panel = new TabControlPanel();
			panel.TabItem = newPage;
			panel.Dock = DockStyle.Fill;
			newPage.AttachedControl = panel;
			newPage.Text = function.Name;
			newPage.ImageIndex = 0;
			newPage.Tag = function;
			newPage.CloseButtonVisible = true;
			ucFunction funcPanel = new ucFunction();
			funcPanel.Dock = DockStyle.Fill;
			funcPanel.AllowEdit = allowEdit;
			newPage.AttachedControl.Controls.Add(funcPanel);
			funcPanel.FunctionName = function.Name;
			funcPanel.CurrentFunction = function;
			//funcPanel.DefaultValueFunction = defaultValueFunction;
			funcPanel.Populate();

			switch (SyntaxEditorHelper.GetScriptingLanguage(function.ScriptLanguage))
			{
				case TemplateContentLanguage.CSharp:
					newPage.ImageIndex = 3;
					break;
				case TemplateContentLanguage.VbDotNet:
					newPage.ImageIndex = 5;
					break;
				case TemplateContentLanguage.Sql:
					newPage.ImageIndex = 0;
					break;
				case TemplateContentLanguage.Html:
					newPage.ImageIndex = 4;
					break;
				case TemplateContentLanguage.Css:
					newPage.ImageIndex = 2;
					break;
				case TemplateContentLanguage.IniFile:
					newPage.ImageIndex = 0;
					break;
				case TemplateContentLanguage.JScript:
					newPage.ImageIndex = 0;
					break;
				case TemplateContentLanguage.Python:
					newPage.ImageIndex = 0;
					break;
				case TemplateContentLanguage.VbScript:
					newPage.ImageIndex = 5;
					break;
				case TemplateContentLanguage.Xml:
					newPage.ImageIndex = 6;
					break;
				case TemplateContentLanguage.PlainText:
					newPage.ImageIndex = 0;
					break;
				default:
					throw new Exception("This function return type not handled yet in ShowFunction: " +
										funcPanel.ReturnType);
			}

			return newPage;
		}
Exemple #5
0
        private TabItem CreateNewFunctionTabPage(UserOption userOption, FunctionTypes functionType, bool allowEdit)
        {
            var newPage = new TabItem();
            var panel = new TabControlPanel { TabItem = newPage, Dock = DockStyle.Fill };
            newPage.AttachedControl = panel;

            switch (functionType)
            {
                case FunctionTypes.DefaultValue:
                    newPage.Text = userOption.VariableName + " [Default Value]";
                    break;
                case FunctionTypes.DisplayToUser:
                    newPage.Text = userOption.VariableName + " [Display To User]";
                    break;
                case FunctionTypes.Validation:
                    newPage.Text = userOption.VariableName + " [Valitation]";
                    break;
            }
            newPage.ImageIndex = 0;
            newPage.Tag = userOption;
            newPage.CloseButtonVisible = true;
            var funcPanel = new ucFunction
                                {
                                    Dock = DockStyle.Fill,
                                    AllowEdit = allowEdit

                                };
            newPage.AttachedControl.Controls.Add(funcPanel);
            funcPanel.FunctionName = userOption.VariableName;
            funcPanel.CurrentUserOption = userOption;
            funcPanel.CurrentUserOptionFunctionType = functionType;
            funcPanel.Populate();
            newPage.ImageIndex = 0;
            return newPage;
        }
Exemple #6
0
        private TabItem CreateNewFunctionTabPage(FunctionInfo function, bool allowEdit)
        {
            TabItem newPage = new TabItem();
            TabControlPanel panel = new TabControlPanel();
            panel.TabItem = newPage;
            panel.Dock = DockStyle.Fill;
            newPage.AttachedControl = panel;
            newPage.Text = function.Name;
            newPage.ImageIndex = 0;
            newPage.Tag = function;
            newPage.CloseButtonVisible = true;
            ucFunction funcPanel = new ucFunction();
            funcPanel.Dock = DockStyle.Fill;
            funcPanel.AllowEdit = allowEdit;
            newPage.AttachedControl.Controls.Add(funcPanel);
            funcPanel.FunctionName = function.Name;
            funcPanel.CurrentFunction = function;
            //funcPanel.DefaultValueFunction = defaultValueFunction;
            funcPanel.Populate();

            switch (SyntaxEditorHelper.GetScriptingLanguage(function.ScriptLanguage))
            {
                case TemplateContentLanguage.CSharp:
                    newPage.ImageIndex = 3;
                    break;
                case TemplateContentLanguage.VbDotNet:
                    newPage.ImageIndex = 5;
                    break;
                case TemplateContentLanguage.Sql:
                    newPage.ImageIndex = 0;
                    break;
                case TemplateContentLanguage.Html:
                    newPage.ImageIndex = 4;
                    break;
                case TemplateContentLanguage.Css:
                    newPage.ImageIndex = 2;
                    break;
                case TemplateContentLanguage.IniFile:
                    newPage.ImageIndex = 0;
                    break;
                case TemplateContentLanguage.JScript:
                    newPage.ImageIndex = 0;
                    break;
                case TemplateContentLanguage.Python:
                    newPage.ImageIndex = 0;
                    break;
                case TemplateContentLanguage.VbScript:
                    newPage.ImageIndex = 5;
                    break;
                case TemplateContentLanguage.Xml:
                    newPage.ImageIndex = 6;
                    break;
                case TemplateContentLanguage.PlainText:
                    newPage.ImageIndex = 0;
                    break;
                default:
                    throw new Exception("This function return type not handled yet in ShowFunction: " +
                                        funcPanel.ReturnType);
            }

            return newPage;
        }