コード例 #1
0
ファイル: YamlPreview.cs プロジェクト: Davincier/openpetra
        private static void ProcessFile(string filename, string ASelectedLocalisation)
        {
            TProcessYAMLForms processor = new TProcessYAMLForms(filename, ASelectedLocalisation);

            // report is at the moment the only real different type of screen,
            // because it uses different controls
            // otherwise, the Template attribute is also quite important, because it determines which code is written
            processor.AddWriter("navigation", typeof(TWinFormsWriter));
            processor.AddWriter("edit", typeof(TWinFormsWriter));
            processor.AddWriter("dialog", typeof(TWinFormsWriter));
            processor.AddWriter("report", typeof(TWinFormsWriter));
            processor.AddWriter("browse", typeof(TWinFormsWriter));

            processor.ProcessDocument();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Davincier/openpetra
        private static void ProcessFile(string filename, string ASelectedLocalisation)
        {
            if (ASelectedLocalisation == null)
            {
                // check for all existing localisations
                foreach (string file in System.IO.Directory.GetFiles(
                             Path.GetDirectoryName(filename),
                             "*.yaml"))
                {
                    if (!file.EndsWith(Path.GetFileName(filename))
                        && Path.GetFileName(file).StartsWith(Path.GetFileNameWithoutExtension(filename)))
                    {
                        ASelectedLocalisation = Path.GetExtension(Path.GetFileNameWithoutExtension(file)).Substring(1);

                        TProcessYAMLForms processorLocalized = new TProcessYAMLForms(file, null);

                        processorLocalized.AddWriter("SubmitForm", typeof(TExtJsFormsWriter));

                        processorLocalized.ProcessDocument();
                    }
                }

                if (ASelectedLocalisation != null)
                {
                    // do not generate the root yaml file
                    return;
                }
            }

            // by default, just generate the form for one (or default) localisation
            TProcessYAMLForms processor = new TProcessYAMLForms(filename, ASelectedLocalisation);

            processor.AddWriter("SubmitForm", typeof(TExtJsFormsWriter));

            processor.ProcessDocument();
        }