Пример #1
0
        public void AddExample(Example example)
        {
            example.Context = this;
            Examples.Add(example);

            example.Pending |= example.Context.IsPending();
        }
        void importExamples(PSObject example)
        {
            List <PSObject> examples = new List <PSObject>();

            if (!(example.Members["example"].Value is PSObject))
            {
                examples = new List <PSObject>((PSObject[])example.Members["example"].Value);
            }
            else
            {
                examples.Add((PSObject)example.Members["example"].Value);
            }
            foreach (PSObject ex in examples)
            {
                String title       = ((String)((PSObject)ex.Members["title"].Value).BaseObject).Replace("-", String.Empty).Trim();
                String code        = (String)((PSObject)ex.Members["code"].Value).BaseObject;
                String description = ((PSObject[])ex.Members["remarks"].Value)
                                     .Aggregate(String.Empty, (current, paragraph) => current + (paragraph.Members["Text"].Value + Environment.NewLine));
                Examples.Add(new Example {
                    Name        = title,
                    Cmd         = code,
                    Description = description
                });
            }
        }
Пример #3
0
        protected override async Task OnInitializedAsync()
        {
            lexer       = new PascalLexer(this);
            ast         = new PascalAst(this);
            analyzer    = new PascalSemanticAnalyzer(this);
            csharp      = new PascalToCSharp();
            con         = new ConsoleModel();
            interpreter = new PascalInterpreter(console: con);
            Examples.Add("Hello World", @"program hello;
begin
    writeln('hello world!');
end.");

            Examples.Add("Simple Program", @"program test;
begin
end.");
            Examples.Add("Math", @"program math;
var a,b,c : integer;
begin
    a := 10;
    b := 20;
    c := 30;
    writeln(a + c - b);
end.");
            //Compile();
            base.OnInitialized();
        }
Пример #4
0
        public void AddExample(ExampleBase example)
        {
            example.AddTo(this);

            Examples.Add(example);

            runnables.Add(new RunnableExample(this, example));
        }
Пример #5
0
 public DefaultSearchBlockViewModel(DefaultSearchCriteria defaultSearchCriteria, ISearchHistory history, Action <SearchSuggestionViewModel> applySuggestionAction)
     : base(defaultSearchCriteria, applySuggestionAction)
 {
     _history = history;
     foreach (var(keyword, exampleTerm) in defaultSearchCriteria.ExamplesFromEachSubCriteria())
     {
         Examples.Add(new SearchBlockExampleViewModel($" {keyword}: ", exampleTerm));
     }
 }
Пример #6
0
 /// <summary>
 ///     Adds an example
 /// </summary>
 /// <param name="example">The example.</param>
 public void AddExample(Example example)
 {
     example.ThrowIfArgumentNull(nameof(example));
     if (Examples.Contains(example))
     {
         return;
     }
     Examples.Add(example);
 }
Пример #7
0
        public void AddExample(Example example)
        {
            example.Context = this;

            example.Tags.AddRange(Tags);

            Examples.Add(example);

            example.Pending |= IsPending();
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PackageCommand"/> class.
        /// </summary>
        public PackageCommand() : base()
        {
            Name        = Id;
            IsInternal  = true;
            Target      = typeof(PackageCommand);
            Description = "";
            Examples.Add(new Example("", ""));
            RelatedLinks.Add("");

            Add(new Argument(nameof(ExecutableFile), typeof(string))
            {
                Position    = 0,
                Description = "",
                IsRequired  = true
            }, new Argument(nameof(PackageKind), typeof(ShellKind))
            {
                Position    = 1,
                Description = "",
                Default     = (ShellKind.Powershell)
            });
        }
Пример #9
0
 /// <summary>Adds an example that will be displayed on the help page.</summary>
 /// <param name="description">The name or description for this example.</param>
 /// <param name="commandLine">The command line to display for this example.</param>
 public void AddExample(string description, string commandLine)
 {
     Examples.Add(description, commandLine);
 }
Пример #10
0
 public void AddExample(Example example)
 {
     example.Context = this;
     Examples.Add(example);
 }