예제 #1
0
        private void XamlCodeRenderer_KeyDown(Monaco.CodeEditor sender, Monaco.Helpers.WebKeyEventArgs args)
        {
            // Handle Shortcuts.
            // Ctrl+Enter or F5 Update // TODO: Do we need this in the app handler too? (Thinking no)
            if ((args.KeyCode == 13 && args.CtrlKey) ||
                args.KeyCode == 116)
            {
                var t = UpdateXamlRenderAsync(XamlCodeRenderer.Text);

                // Eat key stroke
                args.Handled = true;
            }

            // Ignore as a change to the document if we handle it as a shortcut above or it's a special char.
            if (!args.Handled && Array.IndexOf(NonCharacterCodes, args.KeyCode) == -1)
            {
                // TODO: Mark Dirty here if we want to prevent overwrites.

                // Setup Time for Auto-Compile
                this._autocompileTimer?.Cancel(); // Stop Old Timer

                // Create Compile Timer
                this._autocompileTimer = ThreadPoolTimer.CreateTimer(
                    async(e) =>
                {
                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Low, () =>
                    {
                        var t = UpdateXamlRenderAsync(XamlCodeRenderer.Text);
                    });
                }, TimeSpan.FromSeconds(0.5));
            }
        }
        private void XamlCodeRenderer_KeyDown(Monaco.CodeEditor sender, Monaco.Helpers.WebKeyEventArgs args)
        {
            // Handle Shortcuts.
            // Ctrl+Enter or F5 Update // TODO: Do we need this in the app handler too? (Thinking no)
            if ((args.KeyCode == 13 && args.CtrlKey) ||
                args.KeyCode == 116)
            {
                UpdateRequested?.Invoke(this, EventArgs.Empty);

                // Eat key stroke
                args.Handled = true;
            }

            // Ignore as a change to the document if we handle it as a shortcut above or it's a special char.
            if (!args.Handled && Array.IndexOf(NonCharacterCodes, args.KeyCode) == -1)
            {
                // TODO: Mark Dirty here if we want to prevent overwrites.

                // Setup Time for Auto-Compile
                this._autoCompileTimer?.Cancel(); // Stop Old Timer

                // Create Compile Timer
                this._autoCompileTimer = ThreadPoolTimer.CreateTimer(
                    e =>
                {
                    UpdateRequested?.Invoke(this, EventArgs.Empty);

                    if (TimeSampleEditedFirst == DateTime.MinValue)
                    {
                        TimeSampleEditedFirst = DateTime.Now;
                    }

                    TimeSampleEditedLast = DateTime.Now;
                }, TimeSpan.FromSeconds(0.5));
            }
        }
예제 #3
0
        private void Editor_InternalException(Monaco.CodeEditor sender, Exception args)

        {
            // This shouldn't happen, if it does, then it's a bug.
        }