示例#1
0
 public override void ShowPage(int npage)
 {
     if (designer != null && group != null)
     {
         // At every page switch update the generated code, to make sure code completion works
         // for the generated fields. The call to GenerateSteticCodeStructure will generate
         // the code for the window (only the fields in fact) and update the parser database, it
         // will not save the code to disk.
         if (project.Project.UsePartialTypes)
         {
             GuiBuilderService.GenerateSteticCodeStructure((DotNetProject)project.Project, designer.RootComponent, null, false, false);
         }
     }
     base.ShowPage(npage);
 }
        void OnComponentNameChanged(object s, Stetic.ComponentNameEventArgs args)
        {
            try {
                // Make sure the fields in the partial class are up to date.
                // Provide the args parameter to GenerateSteticCodeStructure, in this
                // way the component that has been renamed will be generated with the
                // old name, and UpdateField will be able to find it (to rename the
                // references to the field, it needs to have the old name).
                if (gproject.Project.UsePartialTypes)
                {
                    GuiBuilderService.GenerateSteticCodeStructure((DotNetProject)gproject.Project, designer.RootComponent, args, false, false);
                }

                codeBinder.UpdateField(args.Component, args.OldName);
            }
            catch (Exception ex) {
                MessageService.ShowException(ex);
            }
        }
示例#3
0
        public StringCollection GenerateFiles(string guiFolder)
        {
            StringCollection files = new StringCollection();

            if (hasError)
            {
                return(files);
            }

            IDotNetLanguageBinding binding = LanguageBindingService.GetBindingPerLanguageName(project.LanguageName) as IDotNetLanguageBinding;
            string path = Path.Combine(guiFolder, binding.GetFileName("generated"));

            if (!System.IO.File.Exists(path))
            {
                // Generate an empty build class
                CodeDomProvider provider = binding.GetCodeDomProvider();
                if (provider == null)
                {
                    throw new UserException("Code generation not supported for language: " + project.LanguageName);
                }
                GuiBuilderService.SteticApp.GenerateProjectCode(path, "Stetic", provider, null);
            }
            files.Add(path);

            if (Windows != null)
            {
                foreach (GuiBuilderWindow win in Windows)
                {
                    files.Add(GuiBuilderService.GenerateSteticCodeStructure(project, win.RootWidget, true, false));
                }
            }

            foreach (Stetic.ActionGroupInfo ag in SteticProject.ActionGroups)
            {
                files.Add(GuiBuilderService.GenerateSteticCodeStructure(project, ag, true, false));
            }

            return(files);
        }