-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigurationWindow.xaml
More file actions
155 lines (142 loc) · 9.21 KB
/
Copy pathConfigurationWindow.xaml
File metadata and controls
155 lines (142 loc) · 9.21 KB
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
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ChatGPTExtension"
xmlns:vsshell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
xmlns:av="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="av" x:Class="ChatGPTExtension.ConfigurationWindow"
Title="Chat GPT Extension - Configuration"
Background="{DynamicResource {x:Static vsshell:VsBrushes.WindowKey}}"
Foreground="{DynamicResource {x:Static vsshell:VsBrushes.WindowTextKey}}"
Height="700"
Width="900"
WindowStartupLocation="CenterScreen"
Closing="ConfigurationWindow_Closing">
<Window.Resources>
<!-- Style for TextBox -->
<Style TargetType="{x:Type TextBox}">
<Setter Property="Background" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBackgroundKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBorderKey}}"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="CaretBrush" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}"/>
</Style>
<!-- Style for Button -->
<Style TargetType="{x:Type Button}">
<Setter Property="Background" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBackgroundKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}"/>
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBorderKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static vsshell:VsBrushes.CommandBarHoverOverSelectedKey}}"/>
<Setter Property="Cursor" Value="Hand"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Style for GridViewColumnHeader -->
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Background" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBackgroundKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}"/>
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBorderKey}}"/>
</Style>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}"/>
</Style>
</Window.Resources>
<Grid Background="{DynamicResource {x:Static vsshell:VsBrushes.WindowKey}}">
<!-- Define rows in the grid. The first row takes up the majority of space; the second row is for the buttons. -->
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListView x:Name="ActionListView"
ItemsSource="{Binding Path=DataContext.ActionItems, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Margin="10"
Background="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBackgroundKey}}"
Foreground="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Border
BorderBrush="Transparent"
BorderThickness="0"
Background="{TemplateBinding Background}">
<GridViewRowPresenter HorizontalAlignment="Stretch" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="Auto" Margin="0" Content="{TemplateBinding Content}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView>
<GridViewColumn Width="50">
<GridViewColumn.CellTemplate>
<DataTemplate>
<!-- The TextBlock here acts as a "handle" for dragging. -->
<TextBlock Text="≡" FontSize="32" Cursor="SizeAll" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}" ToolTip="Reorder Action"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Action Name" Width="150">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox
Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
TextChanged="ActionTextBox_TextChanged"
Width="200" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Action Prompt" Width="590">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox
Text="{Binding Prompt, UpdateSourceTrigger=PropertyChanged}"
TextChanged="ActionTextBox_TextChanged"
Width="550"
TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="50">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Content="❌" FontSize="14" Click="DeleteButton_Click" ToolTip="Delete Action"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<!-- Save and Cancel buttons at the bottom, placed in the second row -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,20,0,20" Grid.Row="1">
<Button Content="Add Action" Click="AddButton_Click" Width="100" Padding="10,5" Margin="5,5,25,5" ToolTip="Add new action" />
<Button x:Name="SaveButton" Content="Save" Click="OnSaveClick" Width="100" Padding="10,5" Margin="5" ToolTip="Save all actions" />
<Button x:Name="ResetButton" Content="Reset" Click="OnResetClick" Width="100" Padding="10,5" Margin="5" ToolTip="Reset" />
<Button x:Name="CancelButton" Content="Cancel" Click="OnCancelClick" Width="100" Padding="10,5" Margin="5" ToolTip="Cancel changes" />
<Button x:Name="ConfigureGPTWideButton" Content="GPT Wide" Click="ConfigureGPTWideButton_Click" Width="100" Padding="10,5" Margin="25,5,5,5" ToolTip="Configure GPT Wide" />
<Button x:Name="ProxyConfigButton" Content="Proxy" Click="ProxyConfigButton_Click" Width="100" Padding="10,5" Margin="5,5,5,5" ToolTip="Configure Proxy Settings" />
</StackPanel>
</Grid>
</Window>