/// <summary> /// Add log list view item /// </summary> private void ListViewLogItemsAdd(ListViewItem listViewItem) { // ensure visibility if (LogListViewer.InvokeRequired) { try { LogListViewer.Invoke(new Action <ListViewItem>(ListViewLogItemsAdd), new object[] { listViewItem }); } catch (Exception) { Log(LogSeverityType.Warning, $"Failed to log '{listViewItem.Text}', because GUI thread already terminated"); } } else { LogListViewer.Items.Add(listViewItem); LogListViewer.EnsureVisible(LogListViewer.Items.Count - 1); } }
//////////////////////////////////////////////////////////////////////////////////////////////// // API functions //////////////////////////////////////////////////////////////////////////////////////////////// #region API functions /// <summary> /// Scroll down log list view to latest log entry /// </summary> public void EnsureVisible() { LogListViewer.EnsureVisible(LogListViewer.Items.Count - 1); }