Beispiel #1
0
 public void ConsoleWrite(string str)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         OutputLabel.Text += str;
         OutputScroll.ScrollToAsync(OutputLabel, ScrollToPosition.End, true);
     });
 }
Beispiel #2
0
        public void Log(string logLine)
        {
            TextBlock uiElement = new TextBlock();

            uiElement.FontSize = 14;
            uiElement.Text     = logLine;
            OutputStackPanel.Children.Add(uiElement);
            OutputScroll.ChangeView(null, OutputScroll.ScrollableHeight + 200, null);
        }
 private void OutputScroll_PreviewMouseMove(object sender, MouseEventArgs e)
 {
     if (OutputScroll.IsMouseCaptured)
     {
         var position = e.GetPosition(OutputScroll);
         OutputScroll.ScrollToVerticalOffset(outputScrollVerticalOffset + (outputScrollMousePoint.Y - position.Y));
         OutputScroll.ScrollToHorizontalOffset(outputScrollHorizontalOffset + (outputScrollMousePoint.X - position.X));
     }
 }
 private void OutputScroll_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
     {
         if (IsScrollOutputEnabled())
         {
             OutputScroll.VerticalScrollBarVisibility   = ScrollBarVisibility.Disabled;
             OutputScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
         }
         else
         {
             OutputScroll.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
             OutputScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
         }
     }
     else
     {
         outputScrollMousePoint       = e.GetPosition(OutputScroll);
         outputScrollVerticalOffset   = OutputScroll.VerticalOffset;
         outputScrollHorizontalOffset = OutputScroll.HorizontalOffset;
         OutputScroll.CaptureMouse();
     }
 }
 private void OutputControl_OnSizeChanged(object sender, SizeChangedEventArgs e)
 {
     OutputScroll.ScrollToBottom();
 }
Beispiel #6
0
        // private as you can't make one
        private OutputScrollWindow()
            : base(400, 300)
        {
            this.BackgroundColor = backgroundColor;
            this.Padding         = new BorderDouble(5);

            FlowLayoutWidget topLeftToRightLayout = new FlowLayoutWidget();

            topLeftToRightLayout.AnchorAll();

            {
                FlowLayoutWidget manualEntryTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
                manualEntryTopToBottomLayout.VAnchor |= Agg.UI.VAnchor.ParentTop;
                manualEntryTopToBottomLayout.Padding  = new BorderDouble(5);

                {
                    FlowLayoutWidget OutputWindowsLayout = new FlowLayoutWidget(FlowDirection.LeftToRight);
                    OutputWindowsLayout.HAnchor |= HAnchor.ParentLeft;

                    string filterOutputChkTxt = new LocalizedString("Filter Output").Translated;

                    filterOutput                      = new CheckBox(filterOutputChkTxt);
                    filterOutput.Margin               = new BorderDouble(5, 5, 5, 2);
                    filterOutput.Checked              = false;
                    filterOutput.TextColor            = this.textColor;
                    filterOutput.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(SetCorrectFilterOutputBehavior);
                    OutputWindowsLayout.AddChild(filterOutput);

                    string autoUpperCaseChkTxt = new LocalizedString("Auto Uppercase").Translated;

                    autoUppercase           = new CheckBox(autoUpperCaseChkTxt);
                    autoUppercase.Margin    = new BorderDouble(5, 5, 5, 2);
                    autoUppercase.Checked   = true;
                    autoUppercase.TextColor = this.textColor;
                    OutputWindowsLayout.AddChild(autoUppercase);

                    monitorPrinterTemperature                      = new CheckBox("Monitor Temperature");
                    monitorPrinterTemperature.Margin               = new BorderDouble(5, 5, 5, 2);
                    monitorPrinterTemperature.Checked              = PrinterCommunication.Instance.MonitorPrinterTemperature;
                    monitorPrinterTemperature.TextColor            = this.textColor;
                    monitorPrinterTemperature.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(monitorPrinterTemperature_CheckedStateChanged);

                    manualEntryTopToBottomLayout.AddChild(OutputWindowsLayout);
                }

                {
                    FlowLayoutWidget OutputWindowsLayout = new FlowLayoutWidget(FlowDirection.LeftToRight);
                    OutputWindowsLayout.VAnchor = VAnchor.ParentBottomTop;

                    outputScrollWidget                 = new OutputScroll();
                    outputScrollWidget.Height          = 100;
                    outputScrollWidget.BackgroundColor = RGBA_Bytes.White;
                    outputScrollWidget.HAnchor         = HAnchor.ParentLeftRight;
                    outputScrollWidget.VAnchor         = VAnchor.ParentBottomTop;
                    outputScrollWidget.Margin          = new BorderDouble(0, 5);

                    OutputWindowsLayout.AddChild(outputScrollWidget);

                    manualEntryTopToBottomLayout.AddChild(outputScrollWidget);
                }

                FlowLayoutWidget manualEntryLayout = new FlowLayoutWidget(FlowDirection.LeftToRight);
                manualEntryLayout.BackgroundColor = this.backgroundColor;
                manualEntryLayout.HAnchor         = HAnchor.ParentLeftRight;
                {
                    manualCommandTextEdit = new MHTextEditWidget("");
                    manualCommandTextEdit.BackgroundColor = RGBA_Bytes.White;
                    manualCommandTextEdit.HAnchor         = HAnchor.ParentLeftRight;
                    manualCommandTextEdit.VAnchor         = VAnchor.ParentCenter;
                    manualCommandTextEdit.ActualTextEditWidget.EnterPressed += new KeyEventHandler(manualCommandTextEdit_EnterPressed);
                    manualCommandTextEdit.ActualTextEditWidget.KeyDown      += new KeyEventHandler(manualCommandTextEdit_KeyDown);
                    manualEntryLayout.AddChild(manualCommandTextEdit);

                    sendCommand        = controlButtonFactory.Generate(new LocalizedString("Send").Translated);
                    sendCommand.Margin = new BorderDouble(5, 0);
                    sendCommand.Click += new ButtonBase.ButtonEventHandler(sendManualCommandToPrinter_Click);
                    manualEntryLayout.AddChild(sendCommand);
                }

                manualEntryTopToBottomLayout.AddChild(manualEntryLayout);
                manualEntryTopToBottomLayout.AnchorAll();

                topLeftToRightLayout.AddChild(manualEntryTopToBottomLayout);
            }

            AddHandlers();

            AddChild(topLeftToRightLayout);
            SetCorrectFilterOutputBehavior(this, null);
            this.AnchorAll();

            Title = new LocalizedString("MatterControl - Terminal").Translated;
            this.ShowAsSystemWindow();
            MinimumSize = new Vector2(Width, Height);
        }
 private void OutputScroll_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     OutputScroll.ReleaseMouseCapture();
 }