-
Notifications
You must be signed in to change notification settings - Fork 296
/
ExtractMethodView.xaml
209 lines (208 loc) · 10.9 KB
/
ExtractMethodView.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<UserControl x:Class="Rubberduck.UI.Refactorings.ExtractMethodView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:converters="clr-namespace:Rubberduck.UI.Converters"
xmlns:extractMethod="clr-namespace:Rubberduck.Refactorings.ExtractMethod"
xmlns:controls="clr-namespace:Rubberduck.UI.Controls"
mc:Ignorable="d"
d:DesignHeight="400" d:DesignWidth="300">
<UserControl.Resources>
<converters:BoolToHiddenVisibilityConverter x:Key="BoolToHiddenVisibility" />
<LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFD9F4FF" Offset="0"/>
<GradientStop Color="#FF9BDDFB" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFEEEDED" Offset="0"/>
<GradientStop Color="#FFDDDDDD" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />
<Style x:Key="PrettifyRow" TargetType="{x:Type DataGridRow}">
<Style.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Style.Resources>
<Setter Property="BorderThickness" Value="0,.5,0,0" />
<Setter Property="BorderBrush" Value="DarkGray" />
<Setter Property="Height" Value="26" />
<Setter Property="TextBlock.FontWeight" Value="Normal" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="BorderThickness" Value="1.5" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True" />
<Condition Property="Selector.IsSelectionActive" Value="True" />
</MultiTrigger.Conditions>
<Setter Property="BorderBrush" Value="#adc6e5"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True" />
<Condition Property="Selector.IsSelectionActive" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="100" />
<RowDefinition Height="5*" />
<RowDefinition Height="5*" MinHeight="150" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<StackPanel Background="White">
<Label Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ExtractMethod_TitleText}" FontWeight="Bold" />
<TextBlock Text="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ExtractMethod_InstructionsText}"
Margin="5,0" />
</StackPanel>
<StackPanel Grid.Row="1" Margin="5,0">
<Grid VerticalAlignment="Top" Margin="0,0,5,0">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=NameLabelText}" />
<TextBox Grid.Row="1"
Margin="5,-2,0,0"
Height="22"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Text="{Binding NewMethodName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Image Grid.Row="1"
Source="../../../Resources/cross-circle.png"
Height="16"
Margin="0,-10,-8,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Visibility="{Binding IsValidMethodName, Converter={StaticResource BoolToHiddenVisibility}}"/>
</Grid>
<Grid VerticalAlignment="Top" Margin="0,0,5,0">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ExtractMethodReturnTypeSelection}" />
<ComboBox Grid.Row="1"
Margin="5,2,0,0"
Height="22"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
ItemsSource="{Binding ReturnParameters, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="Name"
SelectedItem="{Binding ReturnParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</StackPanel>
<DockPanel Grid.Row="2" Dock="Top">
<Grid>
<GroupBox Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=ExtractMethod_ParametersLabel}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Margin="0">
<DataGrid ItemsSource="{Binding Parameters}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
AutoGenerateColumns="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="True"
IsReadOnly="False"
IsSynchronizedWithCurrentItem="True"
SelectionMode="Single"
CanUserAddRows="False"
HeadersVisibility="None"
GridLinesVisibility="All"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
ItemContainerStyle="{StaticResource PrettifyRow}"
ColumnHeaderHeight="22"
BorderThickness="0">
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridComboBoxColumn
SelectedValueBinding="{Binding ParameterType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Source={x:Static extractMethod:ExtractedParameter.ParameterNewTypes}}"
SelectedValuePath="Key"
DisplayMemberPath="Value"
Width="*"
IsReadOnly="False" />
<DataGridTextColumn
Binding="{Binding Name}"
Width="*"
IsReadOnly="True"
SortMemberPath="Name" />
<DataGridTextColumn
Binding="{Binding TypeName}"
Width="*"
IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</Grid>
</DockPanel>
<DockPanel Grid.Row="3" Dock="Bottom" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label
Grid.Row="0"
Content="{Binding PreviewCaption}" />
<controls:BindableTextEditor
Grid.Row="1"
Margin="0,5,5,5"
AllowDrop="False"
FontFamily="Courier New"
ShowLineNumbers="True"
BorderThickness="1"
BorderBrush="{x:Static SystemColors.ActiveBorderBrush}"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
IsReadOnly="True"
Text="{Binding PreviewCode, Mode=OneWay}"/>
</Grid>
</DockPanel>
<DockPanel Grid.Row="4" Dock="Bottom">
<Grid Background="{x:Static SystemColors.ControlDarkBrush}" Grid.IsSharedSizeScope="True">
<Grid HorizontalAlignment="Right"
Margin="5,0">
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="SettingsButtons" />
<ColumnDefinition SharedSizeGroup="SettingsButtons" />
</Grid.ColumnDefinitions>
<Button Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=OK}"
Grid.Column="0"
Height="20"
Margin="5,0"
Padding="10,0"
IsEnabled="{Binding IsValidMethodName}"
Command="{Binding OkButtonCommand}" />
<Button Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=CancelButtonText}"
Grid.Column="1"
Height="20"
Margin="5,0"
Padding="10,0"
Command="{Binding CancelButtonCommand}">
</Button>
</Grid>
</Grid>
</DockPanel>
</Grid>
</UserControl>