Пример #1
0
        private ErrorListBoxItem NewErrorListBoxItem(string text, Tuple <int, int> errorPos)
        {
            ErrorListBoxItem item = new ErrorListBoxItem();

            item.Message       = text;
            item.ErrorPosition = errorPos;
            return(item);
        }
Пример #2
0
        private void ListBoxErrors_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ErrorListBoxItem item = sender as ErrorListBoxItem;

            if (item == null)
            {
                return;
            }
            if (item.ErrorPosition == null)
            {
                return;
            }
            textBoxSql.Select(item.ErrorPosition.Item1, item.ErrorPosition.Item2);
            int l = textBoxSql.GetLineIndexFromCharacterIndex(item.ErrorPosition.Item1);

            textBoxSql.ScrollToLine(l);
            textBoxSql.Focus();
        }
Пример #3
0
        private void AddLog(string text, string sql, ParameterStoreCollection parameters, LogStatus status, bool notice, Tuple <int, int> errorPos = null)
        {
            LogListBoxItem item = NewLogListBoxItem(text, sql, parameters, status, notice, errorPos);

            item.RedoSql += Item_RedoSql;
            listBoxLog.Items.Add(item);
            listBoxLog.SelectedItem = item;
            listBoxLog.ScrollIntoView(item);
            if (notice)
            {
                tabControlResult.SelectedItem = tabItemLog;
            }
            if (status == LogStatus.Error && errorPos != null)
            {
                ErrorListBoxItem err = NewErrorListBoxItem(text, errorPos);
                err.MouseDoubleClick += ListBoxErrors_MouseDoubleClick;
                listBoxErrors.Items.Add(err);
                listBoxErrors.SelectedItem = err;
                listBoxErrors.ScrollIntoView(err);
                listBoxErrors.Visibility = Visibility.Visible;
            }
        }