Esempio n. 1
0
        public AddViewDialog(AspMvcProject project)
        {
            this.project = project;
            this.Build();

            dataClassCombo = new MonoDevelop.SourceEditor.DropDownBox();

            int w, h;

            Gtk.Icon.SizeLookup(Gtk.IconSize.Menu, out w, out h);
            dataClassCombo.DefaultIconHeight = Math.Max(h, 16);
            dataClassCombo.DefaultIconWidth  = Math.Max(w, 16);
            dataClassAlignment.Add(dataClassCombo);
            dataClassAlignment.QueueResize();
            dataClassCombo.ShowAll();

            provider = project.LanguageBinding.GetCodeDomProvider();

            ContentPlaceHolders = new List <string> ();
            string siteMaster = project.VirtualToLocalPath("~/Views/Shared/Site.master", null);

            if (project.Files.GetFile(siteMaster) != null)
            {
                masterEntry.Text = "~/Views/Shared/Site.master";
            }

            loadedTemplateList = project.GetCodeTemplates("AddView");
            bool foundEmptyTemplate = false;
            int  templateIndex      = 0;

            foreach (string file in loadedTemplateList)
            {
                string name = PP.GetFileNameWithoutExtension(file);
                templateCombo.AppendText(name);
                if (!foundEmptyTemplate)
                {
                    if (name == "Empty")
                    {
                        templateCombo.Active = templateIndex;
                        foundEmptyTemplate   = true;
                    }
                    else
                    {
                        templateIndex++;
                    }
                }
            }

            if (!foundEmptyTemplate)
            {
                throw new Exception("The Empty.tt template is missing.");
            }

            primaryPlaceholderCombo.Model = primaryPlaceholderStore;

            UpdateTypePanelSensitivity(null, null);
            UpdateMasterPanelSensitivity(null, null);
            Validate();
        }
		public AddViewDialog (AspMvcProject project)
		{
			this.project = project;
			this.Build ();
			
			dataClassCombo = new MonoDevelop.SourceEditor.DropDownBox ();
			
			int w, h;
			Gtk.Icon.SizeLookup (Gtk.IconSize.Menu, out w, out h);
			dataClassCombo.DefaultIconHeight = Math.Max (h, 16);
			dataClassCombo.DefaultIconWidth = Math.Max (w, 16);
			dataClassAlignment.Add (dataClassCombo);
			dataClassAlignment.QueueResize ();
			dataClassCombo.ShowAll ();
			
			provider = project.LanguageBinding.GetCodeDomProvider ();
			
			ContentPlaceHolders = new List<string> ();
			string siteMaster = project.VirtualToLocalPath ("~/Views/Shared/Site.master", null);
			if (project.Files.GetFile (siteMaster) != null)
				masterEntry.Text = "~/Views/Shared/Site.master";
			
			loadedTemplateList = project.GetCodeTemplates ("AddView");
			bool foundEmptyTemplate = false;
			int templateIndex = 0;
			foreach (string file in loadedTemplateList) {
				string name = PP.GetFileNameWithoutExtension (file);
				templateCombo.AppendText (name);
				if (!foundEmptyTemplate){
					if (name == "Empty") {
						templateCombo.Active = templateIndex;
						foundEmptyTemplate = true;
					} else
						templateIndex++;
				}
			}
			
			if (!foundEmptyTemplate)
				throw new Exception ("The Empty.tt template is missing.");
			
			primaryPlaceholderCombo.Model = primaryPlaceholderStore;
			
			UpdateTypePanelSensitivity (null, null);
			UpdateMasterPanelSensitivity (null, null);
			Validate ();
		}