示例#1
0
        static void Main(string[] args)
        {
            var filename = "k3.gmk";
            var reader   = new ProjectReader(filename);

            Console.WriteLine("Reading project...");
            var project = reader.ReadProject();

            Console.WriteLine("Removing DND...");
            foreach (var obj in project.Objects)
            {
                foreach (var ev in obj.Events)
                {
                    foreach (var ev2 in ev)
                    {
                        DNDRemover.RemoveDNDForEvent(project, ev2);
                        //foreach (var action in ev2.Actions)
                        //{
                        //    //foreach (var a in action.Arguments)
                        //    //{
                        //    //    Console.WriteLine(a.Value);
                        //    //}
                        //    //Console.WriteLine(action.LibraryId);
                        //}
                    }
                }
            }

            Console.WriteLine("Writing project...");
            var writer = new ProjectWriter("RemovedDND.gmk", project);

            writer.WriteProject();
        }
示例#2
0
        private static void ExportExampleToSolution(ref string lastGroup, Example current)
        {
            string projectName = ProjectWriter.WriteProject(
                current, ExportPath + @"\", TryAutomaticallyFindAssemblies(), false);

            if (!File.Exists(ScriptPath))
            {
                using (var fs = File.CreateText(ScriptPath))
                {
                    // Write the header
                    fs.WriteLine("REM Compile and run all exported SciChart examples for testing");
                    fs.WriteLine("@echo OFF");
                    fs.WriteLine("");
                    fs.Close();
                }
            }

            if (lastGroup != null && current.Group != lastGroup)
            {
                using (var fs = File.AppendText(ScriptPath))
                {
                    fs.WriteLine("@echo Finished Example Group " + lastGroup + ". Press any key to continue...");
                    fs.WriteLine("pause(0)");
                    fs.WriteLine("");
                }
            }
            lastGroup = current.Group;

            using (var fs = File.AppendText(ScriptPath))
            {
                fs.WriteLine("@echo Building " + projectName);
                fs.WriteLine(@"call ""C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe"" /ToolsVersion:12.0 /p:Configuration=""Debug"" ""{0}/{0}.csproj"" /p:WarningLevel=0", projectName);
                fs.WriteLine("if ERRORLEVEL 1 (");
                fs.WriteLine("   @echo - Example {0} Failed to compile >> errorlog.txt", projectName);
                fs.WriteLine(") else (");
                fs.WriteLine(@"   start """" ""{0}/bin/Debug/{0}.exe""", projectName);
                fs.WriteLine(")");
                fs.WriteLine("");
            }
        }
        public ExportExampleViewModel(IModule module, ExampleViewModel parent)
        {
            _parent = parent;
            WithTrait <DiscoverCoreAssembliesBehavior>();

            _selectExportPathCommand = new ActionCommand(() =>
            {
                var dialog = new System.Windows.Forms.FolderBrowserDialog();
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ExportPath = dialog.SelectedPath;
                }
            });

            _selectLibraryCommand = new ActionCommand(() =>
            {
                var dialog = new System.Windows.Forms.FolderBrowserDialog();
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    LibrariesPath = dialog.SelectedPath;
                }
            });

            _okCommand = new ActionCommand(
                () =>
            {
                ProjectWriter.WriteProject(module.CurrentExample, ExportPath + @"\", LibrariesPath);
                _parent.Usage.Exported = true;
                CloseTrigger           = true;
            },
                () => !string.IsNullOrEmpty(ExportPath) && ValidateExportPath() == null);

            _cancelCommand = new ActionCommand(() => IsExportVisible = false);

            ExportPath = "";
        }