private void MarkLine(GlobalFlags.GridLineTypes lineType, int lineIndex, bool needMassUpdate)
        {
            if (needMassUpdate)
            {
                BaseGrid.UpdateLayout();
                BaseGrid.ScrollIntoView(BaseGrid.Items[lineIndex]);
            }
            var lvitem = BaseGrid.ItemContainerGenerator.ContainerFromIndex(lineIndex) as ListViewItem;

            if (lvitem != null)
            {
                switch (lineType)
                {
                case GlobalFlags.GridLineTypes.Error:
                    Dispatcher.Invoke(new Action(() => lvitem.Foreground = Brushes.Red));
                    break;

                case GlobalFlags.GridLineTypes.Running:
                    Dispatcher.Invoke(new Action(() => lvitem.Foreground = Brushes.Green));
                    break;

                case GlobalFlags.GridLineTypes.Done:
                    Dispatcher.Invoke(new Action(() => lvitem.Foreground = Brushes.Gray));
                    break;

                case GlobalFlags.GridLineTypes.Ready:
                    Dispatcher.Invoke(new Action(() => lvitem.Foreground = Brushes.Blue));
                    break;
                }
            }
        }