Exemple #1
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;
		}