-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
180 lines (166 loc) · 9.95 KB
/
MainWindow.xaml
File metadata and controls
180 lines (166 loc) · 9.95 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
169
170
171
172
173
174
175
176
177
178
179
180
<Window x:Class="JavaVersionSwitcher.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JavaVersionSwitcher"
mc:Ignorable="d"
Title="Java版本切换工具"
Height="450"
Width="500"
WindowStyle="SingleBorderWindow"
ResizeMode="CanMinimize"
Background="#F9FAFB"
FontFamily="Microsoft YaHei UI" FontSize="12"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<!-- 阴影效果 -->
<DropShadowEffect x:Key="ShadowEffect" BlurRadius="12" Opacity="0.15" Direction="270" ShadowDepth="4"/>
<!-- 基础文本样式 -->
<Style TargetType="TextBlock">
<Setter Property="FontFamily" Value="Microsoft YaHei UI, Segoe UI, Arial"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
</Style>
<!-- .NET 10.0 现代化按钮样式 -->
<Style x:Key="PrimaryButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="16,10"/>
<Setter Property="Margin" Value="8"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="600"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="#3B82F6"
CornerRadius="10"
Padding="16,10"
SnapsToDevicePixels="True">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#2563EB"/>
<Setter TargetName="border" Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="8" Opacity="0.3" Direction="270" ShadowDepth="3"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#1D4ED8"/>
<Setter TargetName="border" Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="4" Opacity="0.2" Direction="270" ShadowDepth="1"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Background" Value="#9CA3AF"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SecondaryButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="#1F2937"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#E5E7EB"/>
<Setter Property="Padding" Value="16,10"/>
<Setter Property="Margin" Value="8"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="500"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="White"
BorderBrush="#E5E7EB"
BorderThickness="1"
CornerRadius="10"
Padding="16,10"
SnapsToDevicePixels="True">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#F3F4F6"/>
<Setter TargetName="border" Property="BorderBrush" Value="#D1D5DB"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#E5E7EB"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Background" Value="#F9FAFB"/>
<Setter TargetName="border" Property="BorderBrush" Value="#E5E7EB"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 标题 -->
<StackPanel Grid.Row="0" Margin="0,0,0,20">
<TextBlock Text="Java版本切换工具" FontSize="28" FontWeight="700" Foreground="#111827"/>
<TextBlock Text="Windows 11 环境变量管理" FontSize="14" Foreground="#6B7280" Margin="0,4,0,0"/>
</StackPanel>
<!-- 当前状态 -->
<Border Grid.Row="1" Background="#FFFFFF" BorderBrush="#E5E7EB" BorderThickness="1" CornerRadius="12" Padding="16" Margin="0,0,0,20"
Effect="{StaticResource ShadowEffect}">
<StackPanel>
<TextBlock Text="当前Java版本状态" FontSize="16" FontWeight="600" Foreground="#1F2937" Margin="0,0,0,12"/>
<!-- 只显示当前Java版本 -->
<StackPanel Orientation="Horizontal" Margin="0,0,0,0">
<TextBlock Text="当前Java版本: " FontSize="14" Foreground="#4B5563"/>
<TextBlock x:Name="CurrentJavaVersion" FontSize="14" FontWeight="600" Foreground="#3B82F6" Margin="4,0,0,0" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel>
</Border>
<!-- 操作按钮 -->
<Border Grid.Row="2" Background="#FFFFFF" BorderBrush="#E5E7EB" BorderThickness="1" CornerRadius="12" Padding="16" Margin="0,0,0,20"
Effect="{StaticResource ShadowEffect}">
<StackPanel>
<TextBlock Text="版本切换操作" FontSize="16" FontWeight="600" Foreground="#1F2937" Margin="0,0,0,12"/>
<!-- 版本切换按钮,使用Grid两行三列布局 -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="130"/>
</Grid.ColumnDefinitions>
<!-- 第一行按钮 -->
<Button x:Name="BtnJava7" Content="Java7" Style="{StaticResource PrimaryButtonStyle}" Click="BtnJava7_Click" Grid.Row="0" Grid.Column="0" Margin="0,0,8,8"/>
<Button x:Name="BtnJava8_32" Content="Java8_32" Style="{StaticResource PrimaryButtonStyle}" Click="BtnJava8_32_Click" Grid.Row="0" Grid.Column="1" Margin="0,0,8,8"/>
<Button x:Name="BtnJava8" Content="Java8" Style="{StaticResource PrimaryButtonStyle}" Click="BtnJava8_Click" Grid.Row="0" Grid.Column="2" Margin="0,0,0,8"/>
<!-- 第二行按钮 -->
<Button x:Name="BtnJava11" Content="Java11" Style="{StaticResource PrimaryButtonStyle}" Click="BtnJava11_Click" Grid.Row="1" Grid.Column="0" Margin="0,0,8,8"/>
<Button x:Name="BtnJava17" Content="Java17" Style="{StaticResource PrimaryButtonStyle}" Click="BtnJava17_Click" Grid.Row="1" Grid.Column="1" Margin="0,0,8,8"/>
<Button x:Name="BtnJava25" Content="Java25" Style="{StaticResource PrimaryButtonStyle}" Click="BtnJava25_Click" Grid.Row="1" Grid.Column="2" Margin="0,0,0,8"/>
</Grid>
</StackPanel>
</Border>
<!-- 底部信息 -->
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Center">
<TextBlock Text="© 2026 Java版本切换工具 by:琦琦" FontSize="12" Foreground="#6B7280"/>
</StackPanel>
</Grid>
</Window>