private void CellHyperlinkExpandChildRecordsClickHandler(object sender, RoutedEventArgs args) { var hyperlink = (Hyperlink)sender; var dataSource = (IReferenceDataSource)hyperlink.DataContext; var cell = (DataGridCell)hyperlink.Tag; var row = cell.FindParentVisual <DataGridRow>(); var currentRowValues = (object[])row.DataContext; var keyValues = dataSource.ColumnHeaders.Select(h => currentRowValues[h.ColumnIndex]).ToArray(); DataGridHelper.BuildDataGridCellContent(cell, t => BuildChildRecordDataGrid(dataSource, keyValues, t)); }
private void SessionDataGridMouseDoubleClickHandler(object sender, MouseButtonEventArgs args) { DataGridHelper.ShowLargeValueEditor(SessionDataGrid, r => ((DatabaseSession)r)?.Values); }
private async Task SetEditorValue() { var largeTextValue = _largeValue as ILargeTextValue; var collectionValue = _largeValue as ICollectionValue; var complexType = _largeValue as IComplexType; try { if (largeTextValue != null) { TabText.Visibility = Visibility.Visible; TabText.IsSelected = true; _isXml = true; using (var reader = new XmlTextReader(new StringReader(largeTextValue.Value))) { try { while (reader.Read()) { } } catch { _isXml = false; } } _isJson = true; try { JToken.Parse(largeTextValue.Value); } catch (Exception) { _isJson = false; } TextEditor.Text = largeTextValue.Value; if (_isXml) { TextEditor.SyntaxHighlighting = XmlHighlightingDefinition; } else if (_isJson) { TextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition(SyntaxHighlightingNameJavaScript); } TabRaw.Visibility = Visibility.Visible; await DisplayRawData(Encoding.UTF8.GetBytes(largeTextValue.Value)); } else if (_largeBinaryValue != null) { TabRaw.Visibility = Visibility.Visible; TabRaw.IsSelected = true; await DisplayRawData(_largeBinaryValue.Value); ButtonSaveRawAs.Visibility = Visibility.Visible; } else if (collectionValue != null) { TabCollection.Visibility = Visibility.Visible; TabCollection.IsSelected = true; var columnTemplate = DataGridHelper.CreateDataGridTemplateColumn(collectionValue.ColumnHeader); CollectionViewer.Columns.Add(columnTemplate); CollectionViewer.ItemsSource = collectionValue.Records.Cast <object>().Select(r => new [] { r }).ToArray(); } else if (complexType != null) { TabComplexType.Visibility = Visibility.Visible; TabComplexType.IsSelected = true; ComplexTypeViewer.ComplexType = complexType; } } catch (OperationCanceledException) { TraceLog.WriteLine("User has canceled large data editor load operation. "); Close(); } catch (Exception e) { Messages.ShowError(e.Message, owner: this); Close(); } }
private void CollectionViewerMouseDoubleClickHandler(object sender, MouseButtonEventArgs e) { DataGridHelper.ShowLargeValueEditor(CollectionViewer); }
private void ResultGridMouseDoubleClickHandler(object sender, MouseButtonEventArgs args) { var dataGrid = ((DataGridRow)sender).FindParentVisual <DataGrid>(); DataGridHelper.ShowLargeValueEditor(dataGrid); }
private void CleanUpVirtualizedItemHandler(object sender, CleanUpVirtualizedItemEventArgs args) { args.Cancel = DataGridHelper.CanBeRecycled(args.UIElement); }
private void CellHyperlinkClickHandler(object sender, RoutedEventArgs args) { var cell = (DataGridCell)(sender as Hyperlink)?.Tag; DataGridHelper.BuildDataGridCellContent(cell, t => BuildParentRecordDataGrids(cell, t)); }