-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProxyConfigurationWindow.xaml
More file actions
168 lines (144 loc) · 9.41 KB
/
Copy pathProxyConfigurationWindow.xaml
File metadata and controls
168 lines (144 loc) · 9.41 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
156
157
158
159
160
161
162
163
164
165
166
167
168
<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.ProxyConfigurationWindow"
Title="Chat GPT Extension - Proxy Configuration"
Background="{DynamicResource {x:Static vsshell:VsBrushes.WindowKey}}"
Foreground="{DynamicResource {x:Static vsshell:VsBrushes.WindowTextKey}}"
Height="500"
Width="600"
WindowStartupLocation="CenterScreen"
ResizeMode="NoResize">
<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="5"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBorderKey}}"/>
<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="Padding" Value="10,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 CheckBox -->
<Style TargetType="{x:Type CheckBox}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}"/>
<Setter Property="Margin" Value="5"/>
</Style>
<!-- Style for Label -->
<Style TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}"/>
<Setter Property="Margin" Value="5"/>
</Style>
<!-- Style for PasswordBox -->
<Style TargetType="{x:Type PasswordBox}">
<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="5"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBorderKey}}"/>
<Setter Property="CaretBrush" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}"/>
</Style>
</Window.Resources>
<Grid Background="{DynamicResource {x:Static vsshell:VsBrushes.WindowKey}}" Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header -->
<Label Grid.Row="0" Content="Proxy Configuration" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center"/>
<!-- Configuration Content -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" Margin="0,10">
<StackPanel>
<!-- Use System Proxy -->
<CheckBox x:Name="UseSystemProxyCheckBox" Content="Use system proxy settings" Checked="UseSystemProxyCheckBox_Checked" Unchecked="UseSystemProxyCheckBox_Unchecked"/>
<!-- Custom Proxy Section -->
<GroupBox Header="Custom Proxy Settings" Margin="0,10" x:Name="CustomProxyGroupBox">
<StackPanel>
<!-- Enable Custom Proxy -->
<CheckBox x:Name="UseCustomProxyCheckBox" Content="Use custom proxy" Checked="UseCustomProxyCheckBox_Checked" Unchecked="UseCustomProxyCheckBox_Unchecked"/>
<!-- Proxy Server and Port -->
<Grid Margin="0,10" x:Name="ProxyServerGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="Server:" VerticalAlignment="Center"/>
<TextBox x:Name="ProxyServerTextBox" Grid.Column="1" MinWidth="200"/>
<Label Grid.Column="2" Content="Port:" VerticalAlignment="Center"/>
<TextBox x:Name="ProxyPortTextBox" Grid.Column="3" Text="8080"/>
</Grid>
<!-- Authentication -->
<CheckBox x:Name="ProxyRequiresAuthCheckBox" Content="Proxy requires authentication" Checked="ProxyRequiresAuthCheckBox_Checked" Unchecked="ProxyRequiresAuthCheckBox_Unchecked" Margin="0,10,0,0"/>
<!-- Username and Password -->
<Grid Margin="0,10" x:Name="ProxyAuthGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Username:" VerticalAlignment="Center"/>
<TextBox x:Name="ProxyUsernameTextBox" Grid.Row="0" Grid.Column="1" MinWidth="200"/>
<Label Grid.Row="1" Grid.Column="0" Content="Password:" VerticalAlignment="Center"/>
<PasswordBox x:Name="ProxyPasswordBox" Grid.Row="1" Grid.Column="1" MinWidth="200"/>
</Grid>
<!-- Bypass List -->
<Label Content="Bypass list (comma-separated):" Margin="0,10,0,0"/>
<TextBox x:Name="ProxyBypassTextBox"
TextWrapping="Wrap"
AcceptsReturn="True"
VerticalScrollBarVisibility="Auto"
Height="60"
ToolTip="Enter addresses that should bypass the proxy, separated by commas (e.g., localhost,127.0.0.1,*.example.com)"/>
</StackPanel>
</GroupBox>
<!-- Test Connection -->
<StackPanel Orientation="Horizontal" Margin="0,10">
<Button x:Name="TestConnectionButton" Content="Test Connection" Click="TestConnectionButton_Click" Width="120"/>
<Label x:Name="TestStatusLabel" Content="" Margin="10,0,0,0"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
<!-- Buttons -->
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,20,0,0">
<Button x:Name="SaveButton" Content="Save" Click="SaveButton_Click" Width="100"/>
<Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="100"/>
</StackPanel>
</Grid>
</Window>