From bfd65e84a825a88ce9b7119c01cb6416a3a48d91 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 3 Apr 2009 19:40:43 +0000 Subject: [PATCH] added work-around for Windows Forms bug in ElementHost, because WpfViewer was sometimes not displayed. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3949 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Misc/Profiler/Controller/Data/CallTreeNode.cs | 11 ++++++++++- .../Controller/Data/ProfilingDataSQLiteWriter.cs | 2 +- .../Profiler/Controller/Data/SQLiteCallTreeNode.cs | 8 +++----- .../Profiler/Controller/Data/UnmanagedCallTreeNode.cs | 4 ++-- .../Frontend/AddIn/Src/Commands/ProfileProject.cs | 2 +- .../AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs | 2 +- .../Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs | 10 ++++++++-- .../Misc/Profiler/Frontend/Controls/QueryView.xaml.cs | 1 + 8 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs b/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs index 86a2553729..e343114d6e 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs @@ -49,7 +49,16 @@ namespace ICSharpCode.Profiler.Controller.Data /// /// Gets the number of calls to the method represented by the CallTreeNode. /// - public abstract int CallCount { get; } + public abstract int RawCallCount { get; } + + /// + /// Gets the number of calls to the method represented by the CallTreeNode. + /// + public virtual int CallCount { + get { + return this.RawCallCount + (this.IsActiveAtStart ? 1 : 0); + } + } /// /// Gets whether the function call started in a previous data set that's not selected. diff --git a/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteWriter.cs b/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteWriter.cs index 832135e7d0..9c5fd59626 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteWriter.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteWriter.cs @@ -190,7 +190,7 @@ namespace ICSharpCode.Profiler.Controller.Data throw new InvalidOperationException("Too large CpuCyclesSpent - there's something wrong in the data"); } - dataParams.callCount.Value = node.CallCount; + dataParams.callCount.Value = node.RawCallCount; dataParams.isActiveAtStart.Value = node.IsActiveAtStart; dataParams.cpuCyclesSpent.Value = node.CpuCyclesSpent; dataParams.dataSetId.Value = dataSetCount; diff --git a/src/AddIns/Misc/Profiler/Controller/Data/SQLiteCallTreeNode.cs b/src/AddIns/Misc/Profiler/Controller/Data/SQLiteCallTreeNode.cs index 9c8440f520..9e472bdbc9 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/SQLiteCallTreeNode.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/SQLiteCallTreeNode.cs @@ -46,12 +46,10 @@ namespace ICSharpCode.Profiler.Controller.Data } } - /// - /// Gets the number of calls to the method represented by the CallTreeNode. - /// - public override int CallCount { + /// + public override int RawCallCount { get { - return this.callCount + (isActiveAtStart ? 1 : 0); + return this.callCount; } } diff --git a/src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs b/src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs index 8efc8eb13d..899379f9e3 100644 --- a/src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs +++ b/src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs @@ -55,10 +55,10 @@ namespace ICSharpCode.Profiler.Controller.Data } } - public override int CallCount { + public override int RawCallCount { get { dataSet.VerifyAccess(); // need to verify before deferencing data - return this.data->CallCount + (IsActiveAtStart ? 1 : 0); + return this.data->CallCount; } } diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/ProfileProject.cs b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/ProfileProject.cs index 6dc756dcbd..c93dd07543 100644 --- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/ProfileProject.cs +++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Commands/ProfileProject.cs @@ -58,7 +58,7 @@ namespace ICSharpCode.Profiler.AddIn.Commands currentProj.Save(); }; - WorkbenchSingleton.CallLater(20, updater); + WorkbenchSingleton.SafeThreadCall(updater); }; } diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs index 050021f968..c28ef7e46e 100644 --- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs +++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs @@ -49,7 +49,7 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs runner.RunFinished += delegate { string title = Path.GetFileName(outputPath); ProfilingDataProvider provider = new ProfilingDataSQLiteProvider(outputPath); - WorkbenchSingleton.CallLater(20, () => WorkbenchSingleton.Workbench.ShowView(new WpfViewer(provider, title))); + WorkbenchSingleton.SafeThreadCall(() => WorkbenchSingleton.Workbench.ShowView(new WpfViewer(provider, title))); }; runner.Run(); diff --git a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs index 862567bb6a..d28e0a0753 100644 --- a/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs +++ b/src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs @@ -44,7 +44,13 @@ namespace ICSharpCode.Profiler.AddIn.Views this.TabPageText = title; this.TitleName = this.TabPageText; this.host = new SharpDevelopElementHost(dataView = new ProfilerView(this.provider)); - this.host.Dock = DockStyle.Fill; + // HACK : Make host.Child visible + WorkbenchSingleton.SafeThreadAsyncCall( + () => { + this.host.Dock = DockStyle.None; + this.host.Dock = DockStyle.Fill; + } + ); } /// @@ -66,5 +72,5 @@ namespace ICSharpCode.Profiler.AddIn.Views this.provider.Close(); base.Dispose(); } - } + } } diff --git a/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs b/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs index 9570520ac9..a9ded74af5 100644 --- a/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs +++ b/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs @@ -106,6 +106,7 @@ namespace ICSharpCode.Profiler.Controls this.RangeEnd = end; this.searchRoot = new CallTreeNodeViewModel(this.Provider.GetRoot(start, end), null); this.Invalidate(); + this.InvalidateArrange(); } public void Invalidate()