10 changed files with 314 additions and 33 deletions
@ -0,0 +1,22 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<gui:OptionPanel |
||||||
|
x:Class="ReflectorAddIn.OptionPanels.ChangeReflectorPath" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" 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"> |
||||||
|
<StackPanel |
||||||
|
Orientation="Vertical"> |
||||||
|
<GroupBox |
||||||
|
Header="{core:Localize ReflectorAddIn.SetReflectorPathDialogTitle}"> |
||||||
|
<widgets:StackPanelWithSpacing> |
||||||
|
<TextBlock |
||||||
|
TextWrapping="Wrap" |
||||||
|
Height="46" |
||||||
|
Name="StatusLabel" /> |
||||||
|
<Button |
||||||
|
HorizontalAlignment="Center" |
||||||
|
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||||
|
Name="OpenSearchPathButton" |
||||||
|
Content="{core:Localize ReflectorAddIn.IdeOptions.FindReflectorPath}" |
||||||
|
Click="FindReflectorPathClick" /> |
||||||
|
</widgets:StackPanelWithSpacing> |
||||||
|
</GroupBox> |
||||||
|
</StackPanel> |
||||||
|
</gui:OptionPanel> |
@ -0,0 +1,35 @@ |
|||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
|
||||||
|
namespace ReflectorAddIn.OptionPanels |
||||||
|
{ |
||||||
|
public partial class ChangeReflectorPath : OptionPanel |
||||||
|
{ |
||||||
|
public ChangeReflectorPath() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
|
||||||
|
Loaded += delegate { ShowStatus(); }; |
||||||
|
} |
||||||
|
|
||||||
|
void ShowStatus() |
||||||
|
{ |
||||||
|
string path = PropertyService.Get(ReflectorSetupHelper.ReflectorExePathPropertyName); |
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(path)) { |
||||||
|
StatusLabel.Text = StringParser.Parse("${res:ReflectorAddIn.ReflectorPathNotSet}"); |
||||||
|
} else { |
||||||
|
StatusLabel.Text = StringParser.Parse("${res:ReflectorAddIn.IdeOptions.ReflectorFoundInPath}") |
||||||
|
+ Environment.NewLine + path; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void FindReflectorPathClick(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
ReflectorSetupHelper.OpenReflectorExeFullPathInteractiver(); |
||||||
|
ShowStatus(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,105 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Window |
||||||
|
x:Class="ReflectorAddIn.Windows.SetReflectorPath" |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||||
|
WindowStartupLocation="CenterOwner" |
||||||
|
Style="{x:Static core:GlobalStyles.DialogWindowStyle}" |
||||||
|
ResizeMode="NoResize" |
||||||
|
WindowStyle="ToolWindow" |
||||||
|
ShowInTaskbar="False" |
||||||
|
Height="230" |
||||||
|
Width="446"> |
||||||
|
<Window.Resources> |
||||||
|
<Style |
||||||
|
x:Key="LinkButton" |
||||||
|
TargetType="Button" BasedOn="{x:Static core:GlobalStyles.ButtonStyle}"> |
||||||
|
<Setter |
||||||
|
Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate |
||||||
|
TargetType="Button"> |
||||||
|
<ControlTemplate.Resources> |
||||||
|
<Style |
||||||
|
TargetType="{x:Type TextBlock}"> |
||||||
|
<Setter |
||||||
|
Property="TextDecorations" |
||||||
|
Value="Underline" /> |
||||||
|
</Style> |
||||||
|
</ControlTemplate.Resources> |
||||||
|
<ContentPresenter /> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
<Setter |
||||||
|
Property="Foreground" |
||||||
|
Value="Blue" /> |
||||||
|
<Setter |
||||||
|
Property="Cursor" |
||||||
|
Value="Hand" /> |
||||||
|
<Style.Triggers> |
||||||
|
<Trigger |
||||||
|
Property="IsMouseOver" |
||||||
|
Value="true"> |
||||||
|
<Setter |
||||||
|
Property="Foreground" |
||||||
|
Value="Red" /> |
||||||
|
</Trigger> |
||||||
|
</Style.Triggers> |
||||||
|
</Style> |
||||||
|
</Window.Resources> |
||||||
|
<StackPanel> |
||||||
|
<widgets:StackPanelWithSpacing> |
||||||
|
<TextBlock |
||||||
|
Margin="12,12,12,0" |
||||||
|
HorizontalAlignment="Left" |
||||||
|
TextWrapping="Wrap" |
||||||
|
Name="txtReason"/> |
||||||
|
<TextBlock |
||||||
|
Margin="12" |
||||||
|
TextWrapping="Wrap" |
||||||
|
HorizontalAlignment="Left" |
||||||
|
Name="txtReflectorExplanation" |
||||||
|
Text="{core:Localize ReflectorAddIn.SetReflectorPathDialog.ReflectorInfo}"/> |
||||||
|
<Button Margin="20,0,0,15" |
||||||
|
Name="OpenReflectorPageButton" |
||||||
|
Content="http://reflector.red-gate.com/Download.aspx" |
||||||
|
Style="{StaticResource LinkButton}" |
||||||
|
Click="OpenReflectorPageButton_Click" /> |
||||||
|
<GroupBox Margin="12,0,0,15" |
||||||
|
Header="{core:Localize ReflectorAddIn.SetReflectorPathDialog.PathToReflectorExe}"> |
||||||
|
<widgets:StackPanelWithSpacing |
||||||
|
Orientation="Horizontal"> |
||||||
|
<TextBox |
||||||
|
IsReadOnly="True" |
||||||
|
Name="slePath" |
||||||
|
Width="310" |
||||||
|
Height="20" /> |
||||||
|
<Button Margin="15,0,0,0" |
||||||
|
HorizontalAlignment="Right" |
||||||
|
Name="BrowseButton" |
||||||
|
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||||
|
Content="{core:Localize Global.BrowseButtonText}" |
||||||
|
Click="BrowseButton_Click" /> |
||||||
|
</widgets:StackPanelWithSpacing> |
||||||
|
</GroupBox> |
||||||
|
<widgets:StackPanelWithSpacing |
||||||
|
Orientation="Horizontal" |
||||||
|
HorizontalAlignment="Right"> |
||||||
|
<Button |
||||||
|
Name="OkButton" |
||||||
|
IsDefault="False" |
||||||
|
Content="{core:Localize Global.OKButtonText}" |
||||||
|
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||||
|
Click="OkButton_Click"/> |
||||||
|
<Button |
||||||
|
Name="CancelButton" |
||||||
|
IsDefault="False" |
||||||
|
Content="{core:Localize Global.CancelButtonText}" |
||||||
|
Click="CancelButton_Click" |
||||||
|
Style="{x:Static core:GlobalStyles.ButtonStyle}" /> |
||||||
|
</widgets:StackPanelWithSpacing> |
||||||
|
</widgets:StackPanelWithSpacing> |
||||||
|
</StackPanel> |
||||||
|
</Window> |
@ -0,0 +1,79 @@ |
|||||||
|
|
||||||
|
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 ICSharpCode.Core; |
||||||
|
using Microsoft.Win32; |
||||||
|
|
||||||
|
namespace ReflectorAddIn.Windows |
||||||
|
{ |
||||||
|
public partial class SetReflectorPath : Window |
||||||
|
{ |
||||||
|
public SetReflectorPath(string oldPath, string reason) |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
|
||||||
|
this.Title = ResourceService.GetString("ReflectorAddIn.SetReflectorPathDialogTitle"); |
||||||
|
|
||||||
|
this.txtReason.Text = reason; |
||||||
|
if (!String.IsNullOrEmpty(oldPath)) { |
||||||
|
this.slePath.Text = oldPath; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string SelectedFile { |
||||||
|
get { |
||||||
|
return slePath.Text; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void OpenReflectorPageButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
try { |
||||||
|
using(System.Diagnostics.Process.Start("http://reflector.red-gate.com/Download.aspx")) { |
||||||
|
} |
||||||
|
} catch (Exception ex) { |
||||||
|
MessageService.ShowError(ex.Message); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void OkButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
this.DialogResult = true; |
||||||
|
Close(); |
||||||
|
} |
||||||
|
|
||||||
|
void CancelButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
this.DialogResult = false; |
||||||
|
Close(); |
||||||
|
} |
||||||
|
|
||||||
|
void BrowseButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
OpenFileDialog dialog = new OpenFileDialog(); |
||||||
|
|
||||||
|
dialog.Title = this.Title; |
||||||
|
dialog.DefaultExt = "exe"; |
||||||
|
dialog.RestoreDirectory = true; |
||||||
|
dialog.Filter = "Reflector.exe|Reflector.exe"; |
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(this.slePath.Text)) { |
||||||
|
dialog.FileName = this.slePath.Text; |
||||||
|
} |
||||||
|
|
||||||
|
bool? result = dialog.ShowDialog(this); |
||||||
|
|
||||||
|
if (result.HasValue && result.Value) { |
||||||
|
this.slePath.Text = dialog.FileName; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue