Browse Source
- ported Profiler option panels to new architecture git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4898 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
13 changed files with 219 additions and 261 deletions
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Windows.Forms; |
||||
using System.Windows.Forms.Integration; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.Profiler.Controller; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using System.Windows.Threading; |
||||
|
||||
namespace ICSharpCode.Profiler.AddIn.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Description of General
|
||||
/// </summary>
|
||||
public partial class General : OptionPanel |
||||
{ |
||||
public General() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<gui:OptionPanel |
||||
x:Class="ICSharpCode.Profiler.AddIn.OptionPanels.General" |
||||
xmlns:sd="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:addin="clr-namespace:ICSharpCode.Profiler.AddIn.OptionPanels;assembly=ICSharpCode.Profiler.AddIn"> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<GroupBox |
||||
Header="{sd:Localize AddIns.Profiler.Options.General.DataCollection.Header}"> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<CheckBox |
||||
Margin="3" |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.EnableDC}" |
||||
VerticalAlignment="Top"> |
||||
<TextBlock |
||||
TextWrapping="Wrap" |
||||
Text="{sd:Localize AddIns.Profiler.Options.General.DataCollection.EnableDC}" /> |
||||
</CheckBox> |
||||
<CheckBox |
||||
Margin="3" |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.EnableDCAtStart}" |
||||
VerticalAlignment="Top"> |
||||
<TextBlock |
||||
TextWrapping="Wrap" |
||||
Text="{sd:Localize AddIns.Profiler.Options.General.DataCollection.EnableDCAtStartup}" /> |
||||
</CheckBox> |
||||
<Label |
||||
Margin="3" |
||||
HorizontalAlignment="Left" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.SizeOfStorageDescription}" /> |
||||
<StackPanel |
||||
Margin="3" |
||||
Orientation="Horizontal"> |
||||
<Slider |
||||
Name="sharedMemorySize" |
||||
Margin="3" |
||||
Width="100" |
||||
IsDirectionReversed="False" |
||||
TickPlacement="Both" |
||||
Minimum="64" |
||||
Maximum="512" |
||||
TickFrequency="64" |
||||
SmallChange="64" |
||||
Value="{sd:OptionBinding addin:OptionWrapper.SharedMemorySize}" |
||||
LargeChange="128" |
||||
IsSnapToTickEnabled="True" |
||||
VerticalAlignment="Top" /> |
||||
<TextBlock |
||||
Margin="3" |
||||
HorizontalAlignment="Left" |
||||
Text="{Binding Value, ElementName=sharedMemorySize, StringFormat=\{0\} MB}" |
||||
VerticalAlignment="Center" /> |
||||
</StackPanel> |
||||
<CheckBox |
||||
Margin="3" |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.DoNotProfileNetInternals}" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.DoNotProfileNetInternals}" /> |
||||
<CheckBox |
||||
Margin="3" |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.CombineRecursiveCalls}" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.CombineRecursiveCalls}" /> |
||||
</StackPanel> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
</gui:OptionPanel> |
||||
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="siegfriedpammer@gmail.com"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
using ICSharpCode.Profiler.Controller; |
||||
using System; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace ICSharpCode.Profiler.AddIn.OptionPanels |
||||
{ |
||||
public static class OptionWrapper |
||||
{ |
||||
static Properties properties = PropertyService.Get("ProfilerOptions", new Properties()); |
||||
|
||||
public static int SharedMemorySize { |
||||
get { return properties.Get("SharedMemorySize", ProfilerOptions.DefaultSharedMemorySize) / 1024 / 1024; } |
||||
set { properties.Set("SharedMemorySize", value * 1024 * 1024); } |
||||
} |
||||
|
||||
public static bool EnableDC { |
||||
get { return !properties.Get("EnableDC", true); } |
||||
set { properties.Set("EnableDC", !value); } |
||||
} |
||||
|
||||
public static bool DoNotProfileNetInternals { |
||||
get { return properties.Get("DoNotProfileNetInternals", false); } |
||||
set { properties.Set("DoNotProfileNetInternals", value); } |
||||
} |
||||
|
||||
public static bool CombineRecursiveCalls { |
||||
get { return properties.Get("CombineRecursiveFunction", false); } |
||||
set { properties.Set("CombineRecursiveFunction", value); } |
||||
} |
||||
|
||||
public static bool EnableDCAtStart { |
||||
get { return properties.Get("EnableDCAtStart", true); } |
||||
set { properties.Set("EnableDCAtStart", value); } |
||||
} |
||||
|
||||
public static ProfilerOptions CreateProfilerOptions() |
||||
{ |
||||
return new ProfilerOptions( |
||||
properties.Get("EnableDC", true), |
||||
properties.Get("SharedMemorySize", ProfilerOptions.DefaultSharedMemorySize), |
||||
properties.Get("DoNotProfileNetInternals", false), |
||||
properties.Get("CombineRecursiveFunction", false), |
||||
properties.Get("EnableDCAtStart", true) |
||||
); |
||||
} |
||||
} |
||||
} |
||||
@ -1,82 +0,0 @@
@@ -1,82 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Windows.Forms; |
||||
using System.Windows.Forms.Integration; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.Profiler.Controller; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using System.Windows.Threading; |
||||
|
||||
namespace ICSharpCode.Profiler.AddIn.OptionsPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Description of General
|
||||
/// </summary>
|
||||
public class General : OptionPanel |
||||
{ |
||||
GeneralOptionsPanel panel; |
||||
|
||||
static Properties properties = PropertyService.Get("ProfilerOptions", new Properties()); |
||||
|
||||
public General() |
||||
{ |
||||
panel = new GeneralOptionsPanel(); |
||||
} |
||||
|
||||
public override object Control { |
||||
get { |
||||
return panel; |
||||
} |
||||
} |
||||
|
||||
public override void LoadOptions() |
||||
{ |
||||
try { |
||||
panel.SetOptionValue("EnableDC", !properties.Get("EnableDC", true)); |
||||
panel.SetOptionValue("SharedMemorySize", properties.Get("SharedMemorySize", ProfilerOptions.DefaultSharedMemorySize) / 1024 / 1024); |
||||
panel.SetOptionValue("DoNotProfileNetInternals", properties.Get("DoNotProfileNetInternals", false)); |
||||
panel.SetOptionValue("CombineRecursiveFunction", properties.Get("CombineRecursiveFunction", false)); |
||||
panel.SetOptionValue("EnableDCAtStart", properties.Get("EnableDCAtStart", true)); |
||||
base.LoadPanelContents(); |
||||
} catch (Exception e) { |
||||
MessageService.ShowError(e); |
||||
} |
||||
} |
||||
|
||||
public override bool SaveOptions() |
||||
{ |
||||
try { |
||||
properties.Set("EnableDC", !panel.GetOptionValue<bool>("EnableDC")); |
||||
properties.Set("SharedMemorySize", (int)panel.GetOptionValue<double>("SharedMemorySize") * 1024 * 1024); |
||||
properties.Set("DoNotProfileNetInternals", panel.GetOptionValue<bool>("DoNotProfileNetInternals")); |
||||
properties.Set("CombineRecursiveFunction", panel.GetOptionValue<bool>("CombineRecursiveFunction")); |
||||
properties.Set("EnableDCAtStart", panel.GetOptionValue<bool>("EnableDCAtStart")); |
||||
return base.StorePanelContents(); |
||||
} catch (Exception e) { |
||||
MessageService.ShowError(e); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
public static ProfilerOptions CreateProfilerOptions() |
||||
{ |
||||
return new ProfilerOptions( |
||||
properties.Get("EnableDC", true), |
||||
properties.Get("SharedMemorySize", ProfilerOptions.DefaultSharedMemorySize), |
||||
properties.Get("DoNotProfileNetInternals", false), |
||||
properties.Get("CombineRecursiveFunction", false), |
||||
properties.Get("EnableDCAtStart", true) |
||||
); |
||||
} |
||||
} |
||||
} |
||||
@ -1,53 +0,0 @@
@@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<UserControl |
||||
x:Class="ICSharpCode.Profiler.AddIn.OptionsPanels.GeneralOptionsPanel" xmlns:sd="http://icsharpcode.net/sharpdevelop/core" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<GroupBox |
||||
Header="{sd:Localize AddIns.Profiler.Options.General.DataCollection.Header}"> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<CheckBox Margin="3" |
||||
Name="chkEnableDC" |
||||
VerticalAlignment="Top"> |
||||
<TextBlock TextWrapping="Wrap" Text="{sd:Localize AddIns.Profiler.Options.General.DataCollection.EnableDC}" /> |
||||
</CheckBox> |
||||
<CheckBox Margin="3" |
||||
Name="chkEnableDCAtStartup" |
||||
VerticalAlignment="Top"> |
||||
<TextBlock TextWrapping="Wrap" Text="{sd:Localize AddIns.Profiler.Options.General.DataCollection.EnableDCAtStartup}" /> |
||||
</CheckBox> |
||||
<Label Margin="3" |
||||
HorizontalAlignment="Left" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.SizeOfStorageDescription}" /> |
||||
<StackPanel Margin="3" |
||||
Orientation="Horizontal"> |
||||
<Slider Margin="3" Width="100" |
||||
Name="slSharedMemorySize" |
||||
IsDirectionReversed="False" |
||||
TickPlacement="Both" |
||||
Minimum="64" |
||||
Maximum="512" |
||||
TickFrequency="64" |
||||
SmallChange="64" |
||||
LargeChange="128" |
||||
IsSnapToTickEnabled="True" |
||||
VerticalAlignment="Top" /> |
||||
<TextBlock Margin="3" |
||||
HorizontalAlignment="Left" |
||||
Text="{Binding Value, ElementName=slSharedMemorySize, StringFormat=\{0\} MB}" |
||||
VerticalAlignment="Center" /> |
||||
</StackPanel> |
||||
<CheckBox Margin="3" |
||||
Name="chkDoNotProfileNetInternals" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.DoNotProfileNetInternals}" /> |
||||
<CheckBox Margin="3" |
||||
Name="chkCombineRecursiveCalls" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.CombineRecursiveCalls}" /> |
||||
</StackPanel> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
</UserControl> |
||||
@ -1,81 +0,0 @@
@@ -1,81 +0,0 @@
|
||||
using ICSharpCode.Profiler.Interprocess; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Data; |
||||
using System.Windows.Documents; |
||||
using System.Windows.Input; |
||||
using System.Windows.Media; |
||||
using System.Windows.Media.Imaging; |
||||
using System.Windows.Navigation; |
||||
using System.Windows.Shapes; |
||||
using System.Management; |
||||
using System.Linq; |
||||
|
||||
namespace ICSharpCode.Profiler.AddIn.OptionsPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for GeneralOptionsPanel.xaml
|
||||
/// </summary>
|
||||
public partial class GeneralOptionsPanel : UserControl |
||||
{ |
||||
public GeneralOptionsPanel() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
|
||||
public T GetOptionValue<T>(string name) |
||||
{ |
||||
object o = null; |
||||
|
||||
switch (name) { |
||||
case "SharedMemorySize": |
||||
o = this.slSharedMemorySize.Value; |
||||
break; |
||||
case "EnableDC": |
||||
o = this.chkEnableDC.IsChecked; |
||||
break; |
||||
case "DoNotProfileNetInternals": |
||||
o = this.chkDoNotProfileNetInternals.IsChecked; |
||||
break; |
||||
case "CombineRecursiveFunction": |
||||
o = this.chkCombineRecursiveCalls.IsChecked; |
||||
break; |
||||
case "EnableDCAtStart": |
||||
o = this.chkEnableDCAtStartup.IsChecked; |
||||
break; |
||||
default: |
||||
throw new NotSupportedException("value '" + name + "' is not supported!"); |
||||
} |
||||
|
||||
return (T)o; |
||||
} |
||||
|
||||
public void SetOptionValue<T>(string name, T value) |
||||
{ |
||||
object o = value; |
||||
|
||||
switch (name) { |
||||
case "SharedMemorySize": |
||||
this.slSharedMemorySize.Value = (int)o; |
||||
break; |
||||
case "EnableDC": |
||||
this.chkEnableDC.IsChecked = (bool)o; |
||||
break; |
||||
case "DoNotProfileNetInternals": |
||||
this.chkDoNotProfileNetInternals.IsChecked = (bool)o; |
||||
break; |
||||
case "CombineRecursiveFunction": |
||||
this.chkCombineRecursiveCalls.IsChecked = (bool)o; |
||||
break; |
||||
case "EnableDCAtStart": |
||||
this.chkEnableDCAtStartup.IsChecked = (bool)o; |
||||
break; |
||||
default: |
||||
throw new NotSupportedException("value '" + name + "' is not supported!"); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue