Beispiel #1
0
 private void gridEvents_Loaded(object sender, RoutedEventArgs e)
 {
     // Hide the select all button to avoid users from select the entire grid, 
     var dataGrid = (DataGrid)sender;
     HideSelectAllButton(dataGrid);
     this.GridColumns = new Dictionary<string, DataGridColumn>();
     foreach (var column in dataGrid.Columns)
     {
         this.GridColumns.Add(DataGridUtil.GetName(column), column);
     }
     this.detailsWindow = new EventDetails();
     this.detailsWindow.Closing += (s, args) =>
     {
         this.detailsWindow.Hide();
         args.Cancel = true;
     };
 }
Beispiel #2
0
 void gridEvents_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     object source = e.OriginalSource;
     DependencyObject dep = DataGridUtil.GetDataGridRow(source);
     DataGridRow row = dep as DataGridRow;
     if (row != null)
     {                
         EventRecordProxy item = row.Item as EventRecordProxy;
         if (item != null)
         {
             this.detailsWindow.Title = "EVENT DETAILS ROW " + row.Header;
             this.detailsWindow.DataContext = item.Details.ToString();
             if (!this.detailsWindow.IsVisible || !this.detailsWindow.IsActive)
             {
                 this.detailsWindow.Show();
                 this.detailsWindow.Activate();
             }
         }
     }
 }
Beispiel #3
0
        private void gridEvents_PreviewKeyDown(object sender, KeyEventArgs e)
        {

            bool exclude = false;
            bool addFilter = false;

            if ((Keyboard.Modifiers & ModifierKeys.Control) > 0 &&
                (Keyboard.Modifiers & ModifierKeys.Shift) > 0 &&
                (Keyboard.IsKeyDown(Key.C) || Keyboard.IsKeyDown(Key.E)))
            {
                addFilter = true;
                exclude = Keyboard.IsKeyDown(Key.E);
            }

            if (addFilter)
            {
                DataGrid grid = sender as DataGrid;
                if (grid == null)
                {
                    return;
                }

                DependencyObject dep = e.OriginalSource as DependencyObject;
                DataGridCell cell;
                DataGridRow row;
                EventRecordProxy proxy;
                dep = GetCellRow(dep, out cell, out row);

                if (cell != null && row != null)
                {
                    TextBlock txtBlock = cell.Content as TextBlock;
                    if (txtBlock == null)
                    {
                        return;
                    }

                    proxy = row.Item as EventRecordProxy;
                    if (proxy == null)
                    {
                        return;
                    }
                    string op = exclude ? "!=" : "=";
                    string filter = null;
                    string value = txtBlock.Text;
                    string columnName = DataGridUtil.GetName(cell.Column);
                    switch (columnName)
                    {
                        case "Id":
                        case "Level":
                        case "Pid":
                        case "Tid":
                            filter = string.Format("{0}{1}{2}", columnName, op, value);
                            break;
                        case "ActivityId":
                        case "RelatedActivityId":
                            if (exclude)
                            {
                                filter = string.Format("(ActivityId!={0} and RelatedActivityId!={0})", value);
                            }
                            else
                            {
                                filter = string.Format("(ActivityId={0} OR RelatedActivityId={0})", value);
                            }
                            break;
                        case "Symbol":
                            filter = "Id=" + proxy.Id;
                            break;
                        case "TimeStamp":
                            filter = "TimeStamp=DateTime.Parse(\"" + proxy.TimeStamp.ToString() + "\")";
                            break;
                        case "Message":
                            filter = string.Format("Message.Contains(\"{0}\")", value);
                            if (exclude)
                            {
                                filter = string.Format("!({0})", filter);
                            }
                            break;
                    }



                    if (this.OnCellCopy != null && filter != null)
                    {
                        this.OnCellCopy(filter, proxy);
                    }
                }
            }
        }