public ConsoleView() { ViewModel = new ConsoleViewModel(); App.RustRcon.ConsoleLogUpdated += (s, args) => { if (ViewModel.ConsoleSettings.IsAutoScrollEnabled) { ConsoleScrollViewer.ScrollToBottom(); } }; InitializeComponent(); }
private void ConsoleScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) { if (e.ExtentHeightChange == 0) { if (ConsoleScrollViewer.VerticalOffset == ConsoleScrollViewer.ScrollableHeight) { autoScroll = true; } else { autoScroll = false; } } if (autoScroll == true && e.ExtentHeightChange != 0) { ConsoleScrollViewer.ScrollToVerticalOffset(ConsoleScrollViewer.ExtentHeight); } }
/// <summary> /// Initializes a new instance of the <see cref="Main"/> class. /// </summary> public Main() { InitializeComponent(); CheckPassword(); // USTALAMY LICZBE WATKOW I TASKOW (PROGRAMOWANIE ASYNCHRONICZNE I WIELOWATKOWE) threadsArray = new Thread[2]; // LICZNBA TASKOW JEST ROWNA LICZBIE RDZENI LOGICZNYCH PROCESORA tasksArray = new Task[proc]; // USTAWALY PUNKTY WYJSCIA DO EVENTU ZE SKRAPERA scraper.TextBoxValueChanged += OtherWindowOnTextBoxValueChanged; WriteToConsole("Application Started"); WriteToConsole($"Number Of Logical Processors: {Environment.ProcessorCount}"); ConsoleScrollViewer.ScrollToBottom(); Search_Async(); }
public void AddMessage(ConsoleMessage message) { Dispatcher.Invoke(() => { if (!_consoleEnabled) { Root.Visibility = Visibility.Visible; _consoleEnabled = true; } Console.Items.Add(message); if (message.Level == ConsoleMessage.MessageLevel.Error) { ErrorCount++; if (!ConsoleVisible) { UnseenErrorCount++; } } ConsoleScrollViewer.ScrollToEnd(); }); }
public void AddConsoleText(string text, bool newLine = true) { ConsoleWindow.Text += text + (newLine ? Environment.NewLine : string.Empty); ConsoleScrollViewer.ScrollToBottom(); }