-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
153 lines (143 loc) · 7.57 KB
/
MainWindow.xaml
File metadata and controls
153 lines (143 loc) · 7.57 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
<controls:MetroWindow x:Class="Shutdown_with_timer.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:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:Shutdown_with_timer"
Title="Shutdown Timer"
Height="480"
Width="440"
BorderThickness="0"
ResizeMode="CanMinimize"
WindowStartupLocation="CenterScreen"
FontFamily="Segoe UI"
>
<Window.Resources>
<local:IntToStringConverter x:Key="IntToStringConverter"/>
</Window.Resources>
<controls:MetroWindow.RightWindowCommands>
<controls:WindowCommands>
<Button Command="{Binding ClickCommand}" ToolTip="Toggle Theme">
<iconPacks:Modern Kind="Contrast" Width="20" Height="20" />
</Button>
</controls:WindowCommands>
</controls:MetroWindow.RightWindowCommands>
<Grid Margin="30" MouseDown="Grid_MouseDown">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header -->
<TextBlock Grid.Row="0" Text="Shutdown Timer" FontSize="36" FontWeight="Bold" HorizontalAlignment="Center" Margin="0 10">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#00D8FF" />
<Style.Triggers>
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="False">
<Setter Property="Foreground" Value="#00D8FF" />
<!-- Darkmode (bleibt Türkis) -->
</DataTrigger>
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="True">
<Setter Property="Foreground" Value="Black" />
<!-- Heller Modus = Schwarz -->
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<!-- Info Text -->
<TextBlock Grid.Row="1" Text="Your PC will shut down after the specified time." FontSize="17" HorizontalAlignment="Center" Margin="0 0 0 10" />
<!-- Form -->
<StackPanel Grid.Row="2" VerticalAlignment="Center">
<ComboBox x:Name="comboBox" Width="260" Height="36" FontSize="18" FontStyle="Italic" VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Center" SelectedIndex="0">
<ComboBox.Style>
<Style TargetType="ComboBox">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="White" />
<Style.Triggers>
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="False">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="White" />
</DataTrigger>
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="True">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#1f1f1f" />
</DataTrigger>
</Style.Triggers>
</Style>
</ComboBox.Style>
<ComboBoxItem IsEnabled="False" IsSelected="True">-- Select an action --</ComboBoxItem>
<ComboBoxItem x:Name="shutdown">Shutdown</ComboBoxItem>
<ComboBoxItem x:Name="sleep">Sleep</ComboBoxItem>
<ComboBoxItem x:Name="lockdesktop">Lock</ComboBoxItem>
</ComboBox>
<TextBlock Text="Timer in minutes:" FontSize="16" Margin="0 10 0 5" />
<Border CornerRadius="6"
BorderBrush="{StaticResource BorderBrush}"
BorderThickness="1"
Background="{StaticResource InputBackgroundBrush}"
Margin="0 5 0 0"
Padding="2">
<TextBox x:Name="TextBox_Timer"
Background="Transparent"
BorderThickness="0"
Foreground="{StaticResource TextBrush}"
FontSize="22"
Height="40"
VerticalContentAlignment="Center"
TextAlignment="Center"
Text="{Binding Zeit, Converter={StaticResource IntToStringConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PreviewMouseLeftButtonDown="TextBox_Timer_PreviewMouseLeftButtonDown" />
</Border>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 10 0 0">
<CheckBox x:Name="chk" IsEnabled="{Binding ElementName=TextBox_Timer, Path=Text.Length}" />
<TextBlock Text=" Confirm?" VerticalAlignment="Center" FontSize="15" />
</StackPanel>
</StackPanel>
<!-- Button -->
<Button Grid.Row="3"
Content="EXECUTE TASK"
Width="260"
Height="55"
FontSize="18"
FontWeight="SemiBold"
Margin="0 10 0 10"
HorizontalAlignment="Center"
Click="Button_Click"
IsEnabled="{Binding ElementName=chk, Path=IsChecked}">
<Button.Style>
<Style TargetType="Button">
<Setter Property="Background" Value="#2ea043" />
<Setter Property="Foreground" Value="White" />
<Setter Property="BorderBrush" Value="#2ea043" />
<Setter Property="BorderThickness" Value="1" />
<Style.Triggers>
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="True">
<Setter Property="Background" Value="#E0E0E0" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="BorderBrush" Value="#A0A0A0" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<!-- Footer / Version -->
<TextBlock Grid.Row="4" Text="v1.0.0" FontSize="12" HorizontalAlignment="Right">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#8B949E" />
<Style.Triggers>
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="True">
<Setter Property="Foreground" Value="Gray" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</controls:MetroWindow>