Example #1
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            var search = new LogSetSearchOptions()
            {
                Area          = txtArea.Text,
                Category      = txtCategory.Text,
                EndDateTime   = (dtEnd.Value.HasValue) ? dtEnd.Value.Value.AddMilliseconds(999d) : new Nullable <DateTime>(),//search friendly
                EventID       = txtEventID.Text,
                Message       = txtMessage.Text,
                Process       = txtProcess.Text,
                StartDateTime = dtStart.Value,
                TID           = txtThreadId.Text
            };

            if (!string.IsNullOrEmpty(cmbLevel.Text) && cmbLevel.Text != _optionNone)
            {
                search.Level = (LogEntryLevel?)Enum.Parse(typeof(LogEntryLevel), cmbLevel.Text);
            }
            else
            {
                search.Level = null;
            }

            switch (cmbLevelOperator.Text)
            {
            case "=":
                search.LevelCompareType = ComparisonOperator.Equal;
                break;

            case ">":
                search.LevelCompareType = ComparisonOperator.GreaterThan;
                break;

            case ">=":
                search.LevelCompareType = ComparisonOperator.GreaterThanOrEqual;
                break;

            case "<":
                search.LevelCompareType = ComparisonOperator.LessThan;
                break;

            case "<=":
                search.LevelCompareType = ComparisonOperator.LessThanOrEqual;
                break;
            }

            if (DoSearch != null)
            {
                DoSearch(this, new LogSetSearchEventArgs()
                {
                    Options = search
                });
            }

            _hasSearched = true;
        }
Example #2
0
        public void ResetFields()
        {
            txtResults.Text = string.Empty;
            var options = new LogSetSearchOptions()
            {
                IsEmptySearch = true
            };

            LoadSearchOptions(options);

            if (ResetSearch != null)
            {
                ResetSearch(this, new LogSetSearchEventArgs()
                {
                    Options = options
                });
            }
        }
Example #3
0
        public void LoadSearchOptions(LogSetSearchOptions options)
        {
            if (options != null)
            {
                txtArea.Text     = options.Area;
                txtCategory.Text = options.Category;
                dtEnd.Value      = options.EndDateTime;
                txtEventID.Text  = options.EventID;
                txtMessage.Text  = options.Message;
                txtProcess.Text  = options.Process;
                dtStart.Value    = options.StartDateTime;
                txtThreadId.Text = options.TID;

                if (options.Level != null)
                {
                    cmbLevel.Text = Enum.GetName(typeof(LogEntryLevel), options.Level);
                }
                else
                {
                    cmbLevel.SelectedIndex = 0;
                }
            }
        }
 public void Search(LogSetSearchOptions options)
 {
     _searchOptions = options;
     BindGrid();
 }