Rename MicroSoft_IEnumerableVisualizer(from IEnumerableVisualizer)
Modified .gitignore Modified NrxDebugVisualizer/Program.cs Modified NrxDebugVisualizer/Views/MainWindow.axaml
This commit is contained in:
@@ -0,0 +1,525 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.VisualStudio.Debugger.IEnumerableVisualizer.IEnumerableVisualizerControl
|
||||
// Assembly: IEnumerableVisualizer.UI, Version=18.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
|
||||
// MVID: 8D605BCB-B575-4FCD-B6C8-446C06150F34
|
||||
// Assembly location: C:\Program Files\Microsoft Visual Studio\18\Professional\Common7\IDE\CommonExtensions\Platform\Debugger\Visualizers\IEnumerableVisualizer.UI.dll
|
||||
|
||||
using Microsoft.Internal.VisualStudio.PlatformUI;
|
||||
using Microsoft.VisualStudio.Debugger.IEnumerableVisualizer.Copilot;
|
||||
using Microsoft.VisualStudio.Debugger.Interop;
|
||||
using Microsoft.VisualStudio.Debugger.Interop.Internal;
|
||||
using Microsoft.VisualStudio.Debugger.TabularDataUIShared;
|
||||
using Microsoft.VisualStudio.Debugger.TabularDataUIShared.WPF;
|
||||
using Microsoft.VisualStudio.DebuggerVisualizers;
|
||||
using Microsoft.VisualStudio.OLE.Interop;
|
||||
using Microsoft.VisualStudio.OutOfProcessVisualizers.CommonControls.TippingService;
|
||||
using Microsoft.VisualStudio.PlatformUI;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.Utilities;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Media;
|
||||
|
||||
#nullable enable
|
||||
namespace Microsoft.VisualStudio.Debugger.IEnumerableVisualizer;
|
||||
|
||||
public class IEnumerableVisualizerControl :
|
||||
UserControl,
|
||||
IViewHelper,
|
||||
IVsWindowSearch,
|
||||
IDisposable,
|
||||
IComponentConnector,
|
||||
IStyleConnector
|
||||
{
|
||||
private
|
||||
#nullable disable
|
||||
IEnumerableViewModel m_viewModel;
|
||||
private readonly IVsWindowSearchHost m_windowSearchHost;
|
||||
private readonly Guid m_searchCategory = new Guid("BA594F87-ABA8-4847-A2FA-5C16C2DB51F3");
|
||||
private const string IEnumerableVisualizerOpenedSettingsStorePath = "IsUserAwareOfIEnumerableVisualizer";
|
||||
private CancellationTokenSource m_hoverCancellationTokenSource = new CancellationTokenSource();
|
||||
private readonly Guid m_guidCSharpLanguage = new Guid("{3f5162f8-07c6-11d3-9053-00c04fa302a1}");
|
||||
private readonly Guid m_guidFSharpLanguage = new Guid("{ab4f38c9-b6e6-43ba-be3b-58080b2ccce3}");
|
||||
private readonly Guid m_guidVBLanguage = new Guid("{3a12d0b8-c26c-11d0-b442-00a0244a1dd2}");
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal Border searchControlContainer;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal Label labelTable;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal TableComboBox comboBoxTable;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal ExportButton exportButton;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal SortableDataGrid emptyDataGridView;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal SortableDataGrid dataGridView;
|
||||
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal ProgressBar progressBar;
|
||||
private bool _contentLoaded;
|
||||
|
||||
public required IVsDebugger Debugger { get; init; }
|
||||
|
||||
public required bool AreDataTipsEnabled { get; init; }
|
||||
|
||||
public IEnumerableVisualizerControl()
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnUIThread(".ctor");
|
||||
this.InitializeComponent();
|
||||
this.comboBoxTable.SelectionChanged += new SelectionChangedEventHandler(this.ComboBoxTable_SelectionChanged);
|
||||
this.DataContextChanged += new DependencyPropertyChangedEventHandler(this.OnDataContextChanged);
|
||||
this.dataGridView.SelectedCellsChanged += new SelectedCellsChangedEventHandler(this.DataGridView_SelectedCellsChanged);
|
||||
if (ServiceProvider.GlobalProvider.GetService(typeof (SVsWindowSearchHostFactory)) is IVsWindowSearchHostFactory service)
|
||||
{
|
||||
this.m_windowSearchHost = service.CreateWindowSearchHost((object) this.searchControlContainer, (IDropTarget) null);
|
||||
this.m_windowSearchHost.SetupSearch((IVsWindowSearch) this);
|
||||
SearchControl descendant = ExtensionMethods.FindDescendant<SearchControl>((DependencyObject) this.searchControlContainer);
|
||||
((Control) descendant).TabIndex = 0;
|
||||
((UIElement) descendant).Focus();
|
||||
}
|
||||
VisualizersTippingService.Instance?.RecordVisualizerOpened("IsUserAwareOfIEnumerableVisualizer");
|
||||
}
|
||||
|
||||
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.m_viewModel = (IEnumerableViewModel) e.NewValue;
|
||||
this.comboBoxTable.TabularDataViewModel = (TabularDataViewModel) this.m_viewModel;
|
||||
this.dataGridView.TabularDataViewModel = (TabularDataViewModel) this.m_viewModel;
|
||||
this.emptyDataGridView.TabularDataViewModel = (TabularDataViewModel) this.m_viewModel;
|
||||
this.dataGridView.SelectCellByIndex(0, 0, false);
|
||||
this.m_viewModel.RefreshSelectedRowsStatusBarText();
|
||||
this.m_viewModel.ColumnsUpdateAttempted += new EventHandler<ContextMenuCommandArgs>(this.ColumnsUpdateAttempted);
|
||||
this.m_viewModel.ContinuePausedOperation += new EventHandler<PausedOperationInfo>(this.ResumeCancellableAsyncOperation);
|
||||
this.m_viewModel.AsyncUserOperationStateChanged += new EventHandler<AsyncOperationStatus>(this.OnAsyncUserOperationStateChanged);
|
||||
this.m_viewModel.SearchStarted += new EventHandler<SearchStartedEventArgs>(this.OnSearchStarted);
|
||||
this.m_viewModel.ShowErrorMessage += new EventHandler<string>(this.ShowErrorMessageBox);
|
||||
this.m_viewModel.UnderlyingDataChanged += new EventHandler(this.OnUnderlyingDataChanged);
|
||||
if (this.m_viewModel.FatalExceptionCaught)
|
||||
return;
|
||||
VsTaskLibraryHelper.FileAndForget(this.m_viewModel.UINormalPriorityJTF.RunAsync((Func<Task>) (async () => await this.m_viewModel.StartFetchingRemainingRowsAsync(this.m_viewModel.CancellableAsyncOperationToken))), this.m_viewModel.VisualizerTelemetryPrefix + TelemetryConstants.FetchingRemainingRowsFileAndForgetEvent, (string) null, (Func<Exception, bool>) null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!((sender is IEnumerableVisualizerControl visualizerControl ? visualizerControl.DataContext : (object) null) is TabularDataViewModel dataContext))
|
||||
return;
|
||||
dataContext.HandleFatalException(ex.GetType().FullName, ex.Message, ex.StackTrace);
|
||||
TelemetryUtilities.LogVisualizerWpfHandlerErrorTelemetry(dataContext, ex, nameof (OnDataContextChanged));
|
||||
}
|
||||
}
|
||||
|
||||
private void ResumeCancellableAsyncOperation(object sender, PausedOperationInfo operationInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnUIThread(nameof (ResumeCancellableAsyncOperation));
|
||||
if (!this.m_viewModel.IsCancellableAsyncOperationInProgress)
|
||||
return;
|
||||
switch (operationInfo.OperationType)
|
||||
{
|
||||
case AsyncOperationsTracker.AsyncOperationType.SORTING:
|
||||
this.dataGridView.OnSorting((object) this, new DataGridSortingEventArgs(this.dataGridView.Columns[this.dataGridView.SortingColumnIndex]));
|
||||
break;
|
||||
case AsyncOperationsTracker.AsyncOperationType.EXPORTING:
|
||||
this.exportButton.SelectedCommand.Command.Execute((object) this);
|
||||
break;
|
||||
case AsyncOperationsTracker.AsyncOperationType.FILTERING:
|
||||
this.m_windowSearchHost.SearchAsync(this.m_viewModel.LastSearchQuery);
|
||||
break;
|
||||
case AsyncOperationsTracker.AsyncOperationType.COPYING:
|
||||
this.dataGridView.ContextMenu_CopyAll((object) null, (EventArgs) null);
|
||||
break;
|
||||
case AsyncOperationsTracker.AsyncOperationType.COPYING_SELECTION:
|
||||
this.dataGridView.ContextMenu_Copy((object) null, (EventArgs) null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!(sender is TabularDataViewModel viewModel))
|
||||
return;
|
||||
TelemetryUtilities.LogVisualizerWpfHandlerErrorTelemetry(viewModel, ex, nameof (ResumeCancellableAsyncOperation));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSearchStarted(object sender, SearchStartedEventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.PerformFilterOperation(args.SearchText);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!(sender is TabularDataViewModel viewModel))
|
||||
return;
|
||||
TelemetryUtilities.LogVisualizerWpfHandlerErrorTelemetry(viewModel, ex, nameof (OnSearchStarted));
|
||||
}
|
||||
}
|
||||
|
||||
private void PerformFilterOperation(string filter)
|
||||
{
|
||||
this.dataGridView.Filter(filter);
|
||||
this.m_viewModel.RefreshSelectedRowsStatusBarText();
|
||||
}
|
||||
|
||||
[SuppressMessage("Reliability", "VSSDK007:ThreadHelper.JoinableTaskFactory.RunAsync", Justification = "This is intentional. We are using FileAndForget to catch any issues that might appear down the road.")]
|
||||
private void DataGridCell_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnUIThread(nameof (DataGridCell_MouseEnter));
|
||||
if (!this.AreDataTipsEnabled)
|
||||
return;
|
||||
DataGridCell dataGridCell = sender as DataGridCell;
|
||||
if (dataGridCell == null)
|
||||
return;
|
||||
IDebuggerInternal debuggerInternal = this.Debugger as IDebuggerInternal;
|
||||
if (debuggerInternal == null)
|
||||
return;
|
||||
IEnumerableColumnHeaderViewModel colHeaderViewModel = dataGridCell.Column.Header as IEnumerableColumnHeaderViewModel;
|
||||
if (colHeaderViewModel == null)
|
||||
return;
|
||||
CancellationToken cancellationToken = this.m_hoverCancellationTokenSource.Token;
|
||||
VsTaskLibraryHelper.FileAndForget(ThreadHelper.JoinableTaskFactory.RunAsync((Func<Task>) (async () =>
|
||||
{
|
||||
await Task.Delay(350, cancellationToken);
|
||||
if (!dataGridCell.IsMouseOver || !Utils.TryGetVisualizerExpressionContext(this.Debugger, out IDebugExpressionContext2 _) || !Utils.TryGetLanguageId(this.Debugger, out Guid _))
|
||||
return;
|
||||
Window window = Window.GetWindow((DependencyObject) this);
|
||||
Point position = e.GetPosition((IInputElement) window);
|
||||
Point devicePoint = DpiAwareness.LogicalToDevicePoint((Visual) window, position);
|
||||
POINT point = new POINT()
|
||||
{
|
||||
x = (int) devicePoint.X,
|
||||
y = (int) devicePoint.Y
|
||||
};
|
||||
Rect rect1 = dataGridCell.TransformToAncestor((Visual) window).TransformBounds(new Rect(0.0, 0.0, dataGridCell.ActualWidth, dataGridCell.ActualHeight));
|
||||
Rect deviceRect = DpiAwareness.LogicalToDeviceRect((Visual) window, rect1);
|
||||
RECT rect2 = new RECT()
|
||||
{
|
||||
left = (int) deviceRect.Left,
|
||||
top = (int) deviceRect.Top,
|
||||
bottom = (int) deviceRect.Bottom,
|
||||
right = (int) deviceRect.Right
|
||||
};
|
||||
DataTipIdentity[] dataTipIdentityArray = new DataTipIdentity[1];
|
||||
dataTipIdentityArray[0].moniker = "IEnumerableVisualizerDataTip";
|
||||
dataTipIdentityArray[0].position = 1U;
|
||||
IntPtr handle = new WindowInteropHelper(window).Handle;
|
||||
string str = $"Microsoft.VisualStudio.Debugger.IEnumerableVisualizer.IEnumerableVisualizerSource.GetObjectAt({this.m_viewModel.SelectedTableIndex},{((RowViewModel) dataGridCell.DataContext).RowIndex},{colHeaderViewModel.Index})";
|
||||
ErrorHandler.ThrowOnFailure(debuggerInternal.DataTipManager.ShowDataTipAt(point, 100, rect2, (ulong) (long) handle, str, dataTipIdentityArray));
|
||||
})), "VS/Diagnostics/Debugger/IEnumerableVisualizer/FileAndForget/ShowDataTip", (string) null, (Func<Exception, bool>) (ex => !(ex is OperationCanceledException)));
|
||||
}
|
||||
|
||||
private void DataGridCell_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnUIThread(nameof (DataGridCell_MouseLeave));
|
||||
this.m_hoverCancellationTokenSource.Cancel();
|
||||
this.m_hoverCancellationTokenSource = new CancellationTokenSource();
|
||||
}
|
||||
|
||||
private void OnUnderlyingDataChanged(object sender, EventArgs e)
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnUIThread(nameof (OnUnderlyingDataChanged));
|
||||
this.RefreshTableSelection(this.comboBoxTable.SelectedItem, true);
|
||||
if (((FrameworkElement) ExtensionMethods.FindDescendant<SearchControl>((DependencyObject) this.searchControlContainer)).DataContext is IVsUIDataSource dataContext)
|
||||
dataContext.SetValue(SearchControlDataSource.PropertyNames.SearchText, (IVsUIObject) BuiltInPropertyValue.Create(string.Empty));
|
||||
VsTaskLibraryHelper.FileAndForget(this.m_viewModel.UINormalPriorityJTF.RunAsync((Func<Task>) (async () => await this.m_viewModel.StartFetchingRemainingRowsAsync(this.m_viewModel.CancellableAsyncOperationToken))), this.m_viewModel.VisualizerTelemetryPrefix + TelemetryConstants.FetchingRemainingRowsFileAndForgetEvent, (string) null, (Func<Exception, bool>) null);
|
||||
}
|
||||
|
||||
private void ComboBoxTable_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnUIThread(nameof (ComboBoxTable_SelectionChanged));
|
||||
this.RefreshTableSelection(this.comboBoxTable.SelectedItem);
|
||||
}
|
||||
|
||||
private void RefreshTableSelection(object comboBoxSelectedItem, bool shouldRefreshInitialModels = false)
|
||||
{
|
||||
if (!this.comboBoxTable.IsEnabled)
|
||||
return;
|
||||
if (!(comboBoxSelectedItem is TableViewModel table))
|
||||
return;
|
||||
try
|
||||
{
|
||||
this.UpdateColumns(table);
|
||||
if (shouldRefreshInitialModels)
|
||||
table.LoadInitialModels();
|
||||
this.dataGridView.UnselectAll();
|
||||
if (this.dataGridView.Items.Count > 0)
|
||||
{
|
||||
this.dataGridView.SelectCellByIndex(0, 0, false);
|
||||
this.dataGridView.ScrollIntoView(this.dataGridView.Items[0]);
|
||||
this.m_viewModel.RefreshSelectedRowsStatusBarText();
|
||||
}
|
||||
this.PerformFilterOperation(this.m_viewModel.LastSearchQuery?.SearchString);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
table.LoadRows();
|
||||
if (this.m_viewModel == null)
|
||||
return;
|
||||
TelemetryUtilities.LogVisualizerWpfHandlerErrorTelemetry((TabularDataViewModel) this.m_viewModel, ex, nameof (RefreshTableSelection));
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateColumns(TableViewModel table)
|
||||
{
|
||||
this.dataGridView.ResetSortOrder();
|
||||
this.dataGridView.Columns.Clear();
|
||||
this.emptyDataGridView.Columns.Clear();
|
||||
if (table == null)
|
||||
return;
|
||||
table.LoadRows();
|
||||
SortableDataGrid sortableDataGrid = table.IsEmpty ? this.emptyDataGridView : this.dataGridView;
|
||||
Style resource1 = sortableDataGrid.FindResource((object) "CellTextBlockStyle") as Style;
|
||||
Style resource2 = sortableDataGrid.FindResource((object) "EditableCellTextBoxStyle") as Style;
|
||||
int index = 0;
|
||||
foreach (ColumnInfo column in (IEnumerable<ColumnInfo>) table.Columns)
|
||||
{
|
||||
IEnumerableColumnHeaderViewModel columnHeaderViewModel = new IEnumerableColumnHeaderViewModel(column, table.Index, this.m_viewModel);
|
||||
ObservableCollection<DataGridColumn> columns = sortableDataGrid.Columns;
|
||||
SortableDataGridColumn sortableDataGridColumn = new SortableDataGridColumn();
|
||||
sortableDataGridColumn.Binding = (BindingBase) new Binding(RowViewModel.IndexToBindingPath(index))
|
||||
{
|
||||
Mode = BindingMode.TwoWay,
|
||||
ValidatesOnNotifyDataErrors = true,
|
||||
UpdateSourceTrigger = UpdateSourceTrigger.LostFocus
|
||||
};
|
||||
sortableDataGridColumn.Header = (object) columnHeaderViewModel;
|
||||
sortableDataGridColumn.IsReadOnly = column.ReadOnly || table.IsColumnLocked(column);
|
||||
sortableDataGridColumn.ElementStyle = resource1;
|
||||
sortableDataGridColumn.Width = new DataGridLength(1.0, DataGridLengthUnitType.Auto);
|
||||
sortableDataGridColumn.MaxWidth = 200.0;
|
||||
sortableDataGridColumn.EditingElementStyle = resource2;
|
||||
sortableDataGridColumn.Visibility = columnHeaderViewModel.IsVisible ? Visibility.Visible : Visibility.Collapsed;
|
||||
sortableDataGridColumn.CanSort = this.m_viewModel.IsSortingEnabled;
|
||||
sortableDataGridColumn.IsSorted = false;
|
||||
columns.Add((DataGridColumn) sortableDataGridColumn);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAsyncUserOperationStateChanged(object sender, AsyncOperationStatus _)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (SortableDataGridColumn sortableDataGridColumn in this.dataGridView.Columns.Select<DataGridColumn, SortableDataGridColumn>((Func<DataGridColumn, SortableDataGridColumn>) (c => c as SortableDataGridColumn)))
|
||||
sortableDataGridColumn.CanSort = this.m_viewModel.IsSortingEnabled;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!(sender is TabularDataViewModel viewModel))
|
||||
return;
|
||||
TelemetryUtilities.LogVisualizerWpfHandlerErrorTelemetry(viewModel, ex, nameof (OnAsyncUserOperationStateChanged));
|
||||
}
|
||||
}
|
||||
|
||||
private void ColumnsUpdateAttempted(object sender, ContextMenuCommandArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (args.WasSuccessful)
|
||||
{
|
||||
this.UpdateColumns(this.m_viewModel.SelectedTable);
|
||||
}
|
||||
else
|
||||
{
|
||||
string caption = string.Format((IFormatProvider) CultureInfo.InvariantCulture, Microsoft.VisualStudio.Debugger.IEnumerableVisualizer.Resources.G_UpdateErrorCaption);
|
||||
int num = (int) MessageBox.Show(args.ErrorMessage, caption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
(this.comboBoxTable.SelectedItem as TableViewModel).LoadRows();
|
||||
if (!(sender is TabularDataViewModel viewModel))
|
||||
return;
|
||||
TelemetryUtilities.LogVisualizerWpfHandlerErrorTelemetry(viewModel, ex, nameof (ColumnsUpdateAttempted));
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowErrorMessageBox(object sender, string message)
|
||||
{
|
||||
string caption = string.Format((IFormatProvider) CultureInfo.InvariantCulture, Microsoft.VisualStudio.Debugger.TabularDataUIShared.Resources.G_FailedSort);
|
||||
int num = (int) MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
|
||||
private void DataGridView_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(sender is DataGrid dataGrid))
|
||||
return;
|
||||
this.m_viewModel.SelectedRows = dataGrid.SelectedCells.Select<DataGridCellInfo, RowViewModel>((Func<DataGridCellInfo, RowViewModel>) (cell => (RowViewModel) cell.Item)).Distinct<RowViewModel>();
|
||||
this.m_viewModel.RefreshSelectedRowsStatusBarText();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (!((sender is SortableDataGrid sortableDataGrid ? sortableDataGrid.DataContext : (object) null) is TabularDataViewModel dataContext))
|
||||
return;
|
||||
TelemetryUtilities.LogVisualizerWpfHandlerErrorTelemetry(dataContext, ex, nameof (DataGridView_SelectedCellsChanged));
|
||||
}
|
||||
}
|
||||
|
||||
public bool PromptToKeepChanges(string message)
|
||||
{
|
||||
string updateErrorCaption = Microsoft.VisualStudio.Debugger.IEnumerableVisualizer.Resources.G_UpdateErrorCaption;
|
||||
return MessageBox.Show(message, updateErrorCaption, MessageBoxButton.OKCancel, MessageBoxImage.Exclamation) == MessageBoxResult.OK;
|
||||
}
|
||||
|
||||
public IVsSearchTask CreateSearch(
|
||||
uint dwCookie,
|
||||
IVsSearchQuery pSearchQuery,
|
||||
IVsSearchCallback pSearchCallback)
|
||||
{
|
||||
return (IVsSearchTask) new SortableDataGridSearchTask((TabularDataViewModel) this.m_viewModel, dwCookie, pSearchQuery, pSearchCallback);
|
||||
}
|
||||
|
||||
public void ClearSearch()
|
||||
{
|
||||
if (this.m_viewModel.IsCancellableAsyncOperationInProgress && this.m_viewModel.AsyncOperationsTracker.LastUserAsyncOperation == AsyncOperationsTracker.AsyncOperationType.FILTERING)
|
||||
this.m_viewModel.CancelButtonCommand.Execute((object) this);
|
||||
this.m_viewModel.LastSearchQuery = (IVsSearchQuery) null;
|
||||
this.PerformFilterOperation((string) null);
|
||||
}
|
||||
|
||||
public void ProvideSearchSettings(IVsUIDataSource pSearchSettings)
|
||||
{
|
||||
SearchSettingsDataSource settingsDataSource = pSearchSettings as SearchSettingsDataSource;
|
||||
settingsDataSource.SearchStartType = (VSSEARCHSTARTTYPE) 2;
|
||||
settingsDataSource.SearchProgressType = (VSSEARCHPROGRESSTYPE) 2;
|
||||
settingsDataSource.ControlMaxWidth = uint.MaxValue;
|
||||
string gFilter;
|
||||
string str1 = gFilter = Microsoft.VisualStudio.Debugger.IEnumerableVisualizer.Resources.G_Filter;
|
||||
settingsDataSource.SearchStartTooltip = gFilter;
|
||||
string str2;
|
||||
string str3 = str2 = str1;
|
||||
settingsDataSource.SearchTooltip = str2;
|
||||
settingsDataSource.SearchWatermark = str3;
|
||||
settingsDataSource.SearchClearTooltip = Microsoft.VisualStudio.Debugger.IEnumerableVisualizer.Resources.G_ClearFilter;
|
||||
settingsDataSource.SearchStopTooltip = Microsoft.VisualStudio.Debugger.IEnumerableVisualizer.Resources.G_StopFilter;
|
||||
settingsDataSource.UseDefaultThemeColors = false;
|
||||
}
|
||||
|
||||
public bool OnNavigationKeyDown(uint dwNavigationKey, uint dwModifiers) => false;
|
||||
|
||||
public bool SearchEnabled => this.m_viewModel.IsSearchControlEnabled;
|
||||
|
||||
public Guid Category => this.m_searchCategory;
|
||||
|
||||
public IVsEnumWindowSearchFilters SearchFiltersEnum => (IVsEnumWindowSearchFilters) null;
|
||||
|
||||
public IVsEnumWindowSearchOptions SearchOptionsEnum => (IVsEnumWindowSearchOptions) null;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (this.m_viewModel == null)
|
||||
throw new InvalidOperationException("The IEnumerable Visualizer's view model should never be null.");
|
||||
this.comboBoxTable.SelectionChanged -= new SelectionChangedEventHandler(this.ComboBoxTable_SelectionChanged);
|
||||
this.DataContextChanged -= new DependencyPropertyChangedEventHandler(this.OnDataContextChanged);
|
||||
this.dataGridView.SelectedCellsChanged -= new SelectedCellsChangedEventHandler(this.DataGridView_SelectedCellsChanged);
|
||||
this.m_viewModel.ColumnsUpdateAttempted -= new EventHandler<ContextMenuCommandArgs>(this.ColumnsUpdateAttempted);
|
||||
this.m_viewModel.ContinuePausedOperation -= new EventHandler<PausedOperationInfo>(this.ResumeCancellableAsyncOperation);
|
||||
this.m_viewModel.AsyncUserOperationStateChanged -= new EventHandler<AsyncOperationStatus>(this.OnAsyncUserOperationStateChanged);
|
||||
this.m_viewModel.ShowErrorMessage -= new EventHandler<string>(this.ShowErrorMessageBox);
|
||||
this.m_viewModel.SearchStarted -= new EventHandler<SearchStartedEventArgs>(this.OnSearchStarted);
|
||||
this.m_viewModel.UnderlyingDataChanged -= new EventHandler(this.OnUnderlyingDataChanged);
|
||||
this.m_viewModel.WindowClosing();
|
||||
IEnumerableCopilotSessionManager.Instance.ClearAllActiveSessions();
|
||||
foreach (BaseTableViewModel table in (Collection<BaseTableViewModel>) this.m_viewModel.Tables)
|
||||
{
|
||||
table.TableRows?.Clear();
|
||||
table.ClearCache();
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
|
||||
public void InitializeComponent()
|
||||
{
|
||||
if (this._contentLoaded)
|
||||
return;
|
||||
this._contentLoaded = true;
|
||||
Application.LoadComponent((object) this, new Uri("/IEnumerableVisualizer.UI;V18.0.0.0;component/ienumerablevisualizercontrol.xaml", UriKind.Relative));
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Delegate _CreateDelegate(Type delegateType, string handler)
|
||||
{
|
||||
return Delegate.CreateDelegate(delegateType, (object) this, handler);
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
|
||||
void IComponentConnector.Connect(int connectionId, object target)
|
||||
{
|
||||
switch (connectionId)
|
||||
{
|
||||
case 2:
|
||||
this.searchControlContainer = (Border) target;
|
||||
break;
|
||||
case 3:
|
||||
this.labelTable = (Label) target;
|
||||
break;
|
||||
case 4:
|
||||
this.comboBoxTable = (TableComboBox) target;
|
||||
break;
|
||||
case 5:
|
||||
this.exportButton = (ExportButton) target;
|
||||
break;
|
||||
case 6:
|
||||
this.emptyDataGridView = (SortableDataGrid) target;
|
||||
break;
|
||||
case 7:
|
||||
this.dataGridView = (SortableDataGrid) target;
|
||||
break;
|
||||
case 8:
|
||||
this.progressBar = (ProgressBar) target;
|
||||
break;
|
||||
default:
|
||||
this._contentLoaded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
||||
void IStyleConnector.Connect(int connectionId, object target)
|
||||
{
|
||||
if (connectionId != 1)
|
||||
return;
|
||||
((Style) target).Setters.Add((SetterBase) new EventSetter()
|
||||
{
|
||||
Event = UIElement.MouseEnterEvent,
|
||||
Handler = (Delegate) new MouseEventHandler(this.DataGridCell_MouseEnter)
|
||||
});
|
||||
((Style) target).Setters.Add((SetterBase) new EventSetter()
|
||||
{
|
||||
Event = UIElement.MouseLeaveEvent,
|
||||
Handler = (Delegate) new MouseEventHandler(this.DataGridCell_MouseLeave)
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user