Beispiel #1
0
        protected void RefreshLogItems(CommandLogger log)
        {
            SendOrPostCallback method = o =>
            {
                if (TabControl.SelectedTab == tabPageCommandLog)
                {
                    bool selectLastIndex = LogItems.Items.Count == 0 || LogItems.SelectedIndex == LogItems.Items.Count - 1;
                    LogItems.DataSource = log.Commands();
                    if (selectLastIndex && LogItems.Items.Count > 0)
                    {
                        LogItems.SelectedIndex = LogItems.Items.Count - 1;
                    }
                }
            };

            syncContext.Post(method, this);
        }