private void OnExceedLimit(ExceedLimitItem item) { this.Dispatcher.BeginInvoke( (Action)(() => { LogListBox.Items.Add(item); LogListBox.ScrollIntoView(item); }) ); }
private void Log(string obj) { var tb = new TextBlock(); tb.Text = obj; LogListBox.Items.Add(tb); LogListBox.ScrollIntoView(tb); if (LogListBox.Items.Count > 500) { LogListBox.Items.RemoveAt(0); } }
public void LogSay(object sender, DebugLogEventArgs args) { LogEntry newEntry = new LogEntry() { Text = args.Text }; newEntry.Foreground = "Red"; newEntry.Justification = "Right"; App.Current.Dispatcher.Invoke((Action) delegate { _items.Add(newEntry); LogListBox.ScrollIntoView(LogListBox.Items[LogListBox.Items.Count - 1]); }); }
public void LogSpeech(object sender, DebugLogEventArgs args) { LogEntry newEntry = new LogEntry() { Text = args.Text }; if (args.Accepted) { newEntry.Foreground = "LightBlue"; } else { newEntry.Foreground = "Khaki"; } newEntry.Justification = "Left"; App.Current.Dispatcher.Invoke((Action) delegate { _items.Add(newEntry); LogListBox.ScrollIntoView(LogListBox.Items[LogListBox.Items.Count - 1]); }); }
private void LogListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { LogListBox.ScrollIntoView(LogListBox.SelectedItem); }
public MainWindow(Control.MainController mainController) { _mainController = mainController ?? throw new ArgumentNullException(nameof(mainController)); _logController = _mainController.LogController; InitializeComponent(); DataContext = _mainController.SettingsController; PhoneModelComboBox.ItemsSource = Phone.Models; LogListBox.ItemsSource = _logController.LogEntries; ImageHost.DataContext = _mainController.ImageReformatController; RingtonePathTextBlock.DataContext = _mainController.RingtoneReformatController; //_ringtoneOpenFileDialog.Filter = _mainController.FileFilter.AudioFilter; //_imageOpenFileDialog.Filter = _mainController.FileFilter.ImageFilter; _logController.LogEntries.CollectionChanged += (s, e) => Dispatcher.Invoke(() => LogListBox.ScrollIntoView(_mainController.LogController.LogEntries.Last())); _mainController.RingtoneReformatController.PropertyChanged += (s, e) => { if (e.PropertyName.Equals(nameof(Control.RingtoneReformatController.Ringtone), StringComparison.Ordinal)) { _waveOutEvent.Stop(); } }; _mainController.ImageServerController.Run(); _logController.Log(new Entry(LogSeverity.Info, Strings.StatusReady)); CheckForUpdates(); }