Пример #1
0
        private void OnPreferenceEvent()
        {
            var pf = new Preferences.PreferenceForm();

            OnAddPreferenceButton(pf);
            OpenDocument.Show(pf);
        }
Пример #2
0
 public DocumentOpened(OpenDocument command, RelativeFilePath relativeFilePath, string regionName, string content)
     : base(command)
 {
     _relativeFilePath = relativeFilePath ?? throw new ArgumentNullException(nameof(relativeFilePath));
     RegionName        = regionName;
     Content           = content ?? throw new ArgumentNullException(nameof(content));
 }
Пример #3
0
 public DocumentOpened(OpenDocument command, string path, string regionName, string content)
     : base(command)
 {
     Path       = path ?? throw new ArgumentNullException(nameof(path));
     RegionName = regionName;
     Content    = content ?? throw new ArgumentNullException(nameof(content));
 }
Пример #4
0
 protected override void OnClick(EventArgs e)
 {
     base.OnClick(e);
     Cursor = Cursors.WaitCursor;
     Application.DoEvents();
     OpenDocument.Show(Item.Namespace);
     Cursor = Cursors.Default;
     Application.DoEvents();
 }
        private void OnItemDoubleClicked(object o)
        {
            SelectedItem = o as IProjectItemViewModel;

            if (SelectedItem.Type == ProjectItemType.Layout)
            {
                OpenDocument?.Invoke(SelectedItem.Type, SelectedItem.Title, Path.Combine(_projectService.ProjectPath, SelectedItem.ParentSubPath, SelectedItem.FileName));
            }
        }
Пример #6
0
        private void ItemMenu_Click(object sender, System.EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            var menuItem = sender as MenuButton;

            OpenDocument.Show(menuItem.Item.Namespace);
            Cursor = Cursors.Default;
            Application.DoEvents();
        }
Пример #7
0
        protected PrinterForm OnPreviewEvent(PrintType printType, string title = "")
        {
            var pf = new PrinterForm("Preview", PrinterForm.PrintMode.Preview, printType)
            {
                Title = title
            };

            OpenDocument.Show(pf);
            return(pf);
        }
Пример #8
0
        protected PrinterForm OnPreviewEvent(PrintType printType, string title = "")
        {
            var pf = new PrinterForm(Name, PrinterForm.PrintMode.Preview, printType)
            {
                Title = string.Concat(Properties.Resources.Preview, " ", title)
            };

            OpenDocument.Show(pf);
            return(pf);
        }
Пример #9
0
        public async Task HandleAsync(OpenDocument command, KernelInvocationContext context)
        {
            ThrowIfProjectIsNotOpened();

            var file = _workspace.Files.SingleOrDefault(f => f.Name == command.RelativeFilePath);

            if (file is null)
            {
                // check for a region-less buffer instead
                var buffer = _workspace.Buffers.SingleOrDefault(b => b.Id.FileName == command.RelativeFilePath && b.Id.RegionName is null);
                if (buffer is { })
Пример #10
0
        public override void OpenScreen()
        {
            OpenedDocument DocumentFactory()
            {
                var scope = this.callScopeFactory.CreateScope();
                var host  = (IDocumentHost <IDocument>) this.windowFactory.Create <IDocumentHost <TDocument> >();

                return(new OpenedDocument(host, scope));
            }

            var message = new OpenDocument(typeof(TDocument), DocumentFactory);

            this.eventAggregator.PublishOnUIThread(message);
        }
Пример #11
0
 private void Sf_Open(object sender, ApplicationMenuItem e)
 {
     OpenDocument.Show(e.Namespace);
     (sender as Form).Close();
 }
Пример #12
0
        public static IEnumerable <object[]> Events()
        {
            foreach (var @event in events().Select(e =>
            {
                e.Command.Properties["id"] = "command-id";
                return(e);
            }))
            {
                yield return(new object[] { @event });
            }

            IEnumerable <KernelEvent> events()
            {
                var compileProject = new CompileProject("123");

                yield return(new AssemblyProduced(compileProject, new Base64EncodedAssembly("01020304")));

                var submitCode = new SubmitCode("123");

                yield return(new CodeSubmissionReceived(
                                 submitCode));

                yield return(new CommandFailed(
                                 "Oooops!",
                                 submitCode));

                yield return(new CommandFailed(
                                 new InvalidOperationException("Oooops!"),
                                 submitCode,
                                 "oops"));

                yield return(new CommandSucceeded(submitCode));

                yield return(new CompleteCodeSubmissionReceived(submitCode));

                var requestCompletion = new RequestCompletions("Console.Wri", new LinePosition(0, 11));

                yield return(new CompletionsProduced(
                                 new[]
                {
                    new CompletionItem(
                        "WriteLine",
                        "Method",
                        "WriteLine",
                        "WriteLine",
                        "WriteLine",
                        "Writes the line")
                },
                                 requestCompletion));

                yield return(new DiagnosticLogEntryProduced("oops!", submitCode));

                yield return(new DiagnosticsProduced(
                                 new[]
                {
                    new Diagnostic(
                        new LinePositionSpan(
                            new LinePosition(1, 2),
                            new LinePosition(3, 4)),
                        DiagnosticSeverity.Error,
                        "code",
                        "message")
                },
                                 submitCode));

                yield return(new DisplayedValueProduced(
                                 new HtmlString("<b>hi!</b>"),
                                 new SubmitCode("b(\"hi!\")", "csharp", SubmissionType.Run),
                                 new[]
                {
                    new FormattedValue("text/html", "<b>hi!</b>"),
                }));

                yield return(new DisplayedValueUpdated(
                                 new HtmlString("<b>hi!</b>"),
                                 "the-value-id",
                                 new SubmitCode("b(\"hi!\")", "csharp", SubmissionType.Run),
                                 new[]
                {
                    new FormattedValue("text/html", "<b>hi!</b>"),
                }));

                var openDocument = new OpenDocument("path");

                yield return(new DocumentOpened(openDocument, "path", null, "file contents"));

                yield return(new ErrorProduced("oops!", submitCode));

                yield return(new IncompleteCodeSubmissionReceived(submitCode));

                var requestHoverTextCommand = new RequestHoverText("document-contents", new LinePosition(1, 2));

                yield return(new HoverTextProduced(
                                 requestHoverTextCommand,
                                 new[] { new FormattedValue("text/markdown", "markdown") },
                                 new LinePositionSpan(new LinePosition(1, 2), new LinePosition(3, 4))));

                yield return(new KernelInfoProduced(
                                 new KernelInfo("javascript", "javascript")
                {
                    Aliases = new[] { "js" },
                    DestinationUri = new Uri("kernel://vscode/javascript"),
                    SupportedDirectives = new[]
                    {
                        new DirectiveInfo("#r")
                    },
                    SupportedKernelCommands = new[]
                    {
                        new KernelCommandInfo(nameof(SubmitCode))
                    }
                },
                                 new RequestKernelInfo()));

                yield return(new KernelReady());

                yield return(new PackageAdded(
                                 new ResolvedPackageReference(
                                     packageName: "ThePackage",
                                     packageVersion: "1.2.3",
                                     assemblyPaths: new[] { "/path/to/a.dll" },
                                     packageRoot: "/the/package/root",
                                     probingPaths: new[] { "/probing/path/1", "/probing/path/2" }),
                                 new SubmitCode("#r \"nuget:ThePackage,1.2.3\"")));

                yield return(new ReturnValueProduced(
                                 new HtmlString("<b>hi!</b>"),
                                 new SubmitCode("b(\"hi!\")", "csharp", SubmissionType.Run),
                                 new[]
                {
                    new FormattedValue("text/html", "<b>hi!</b>"),
                }));

                yield return(new SignatureHelpProduced(
                                 new RequestSignatureHelp("sig-help-contents", new LinePosition(1, 2)),
                                 new[]
                {
                    new SignatureInformation("label",
                                             new FormattedValue("text/html", "sig-help-result"),
                                             new[]
                    {
                        new ParameterInformation("param1", new FormattedValue("text/html", "param1")),
                        new ParameterInformation("param2", new FormattedValue("text/html", "param2"))
                    })
                },
                                 0,
                                 1));

                yield return(new StandardErrorValueProduced(
                                 submitCode,
                                 new[]
                {
                    new FormattedValue("text/plain", "oops!"),
                }));

                yield return(new StandardOutputValueProduced(
                                 new SubmitCode("Console.Write(123);", "csharp", SubmissionType.Run),
                                 new[]
                {
                    new FormattedValue("text/plain", "123"),
                }));

                yield return(new WorkingDirectoryChanged(
                                 "some/different/directory",
                                 new ChangeWorkingDirectory("some/different/directory")));

                yield return(new KernelExtensionLoaded(new SubmitCode(@"#r ""nuget:package"" ")));

                yield return(new ValueInfosProduced(new[] { new KernelValueInfo("a", typeof(string)), new KernelValueInfo("b", typeof(string)), new KernelValueInfo("c", typeof(string)) }, new RequestValueInfos("csharp")));

                yield return(new ValueProduced("raw value", "a", new FormattedValue(HtmlFormatter.MimeType, "<span>formatted value</span>"), new RequestValue("a", "csharp", HtmlFormatter.MimeType)));

                yield return(new CommandCancelled(new Cancel(), new SubmitCode("var value = 1;", "csharp")));

                yield return(new InputProduced("user input", new GetInput(targetKernelName: "vscode")));
            }
        }
Пример #13
0
 public Listener(OpenDocument owner)
     : base(owner.WindowFrame)
 {
     _owner = owner;
 }
Пример #14
0
        private void RemoveDocument(OpenDocument openDocument)
        {
            bool removed = _openDocuments.Remove(openDocument.Document);

            Debug.Assert(removed);
        }
Пример #15
0
 public DocumentOpened(OpenDocument command, string relativeFilePath, string regionName, string content)
     : this(command, new RelativeFilePath(relativeFilePath), regionName, content)
 {
 }