-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
212 lines (202 loc) · 9.69 KB
/
MainWindow.xaml
File metadata and controls
212 lines (202 loc) · 9.69 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
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
210
211
212
<Window x:Class="AlwaysOnTop.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"
mc:Ignorable="d"
Title="Always On Top Manager"
Height="600"
Width="900"
MinHeight="400"
MinWidth="700"
WindowStartupLocation="CenterScreen"
Background="#F5F5F5">
<Window.Resources>
<!-- Modern button style -->
<Style x:Key="ModernButton" TargetType="Button">
<Setter Property="Background" Value="#0078D4"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Padding" Value="15,8"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="4"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#005A9E"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#CCCCCC"/>
<Setter Property="Foreground" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="SecondaryButton" TargetType="Button" BasedOn="{StaticResource ModernButton}">
<Setter Property="Background" Value="#E1E1E1"/>
<Setter Property="Foreground" Value="#333333"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#D1D1D1"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="DangerButton" TargetType="Button" BasedOn="{StaticResource ModernButton}">
<Setter Property="Background" Value="#D13438"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#A02C2F"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header -->
<StackPanel Grid.Row="0" Margin="0,0,0,15">
<TextBlock Text="Always On Top Manager"
FontSize="24"
FontWeight="Bold"
Foreground="#333333"/>
<TextBlock Text="Select windows and assign priority rankings to keep them always on top"
FontSize="12"
Foreground="#666666"
Margin="0,5,0,0"/>
</StackPanel>
<!-- Window List -->
<Border Grid.Row="1"
Background="White"
BorderBrush="#DDDDDD"
BorderThickness="1"
CornerRadius="4"
Margin="0,0,0,15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Toolbar -->
<Border Grid.Row="0"
Background="#F9F9F9"
BorderBrush="#EEEEEE"
BorderThickness="0,0,0,1"
Padding="10">
<StackPanel Orientation="Horizontal">
<Button Content="🔄 Refresh Windows"
Style="{StaticResource SecondaryButton}"
Click="RefreshButton_Click"
Margin="0,0,5,0"/>
<TextBlock Text="Windows Detected:"
VerticalAlignment="Center"
Margin="15,0,5,0"
Foreground="#666666"/>
<TextBlock x:Name="WindowCountText"
Text="0"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="#0078D4"/>
<TextBlock Text="Selected:"
VerticalAlignment="Center"
Margin="15,0,5,0"
Foreground="#666666"/>
<TextBlock x:Name="SelectedCountText"
Text="0"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="#0078D4"/>
</StackPanel>
</Border>
<!-- List -->
<ListView x:Name="WindowListView"
Grid.Row="1"
SelectionMode="Extended"
BorderThickness="0"
SelectionChanged="WindowListView_SelectionChanged">
<ListView.View>
<GridView>
<GridViewColumn Header="Select" Width="60">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSelected}"
HorizontalAlignment="Center"
Checked="WindowCheckBox_Changed"
Unchecked="WindowCheckBox_Changed"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Window Title" Width="350" DisplayMemberBinding="{Binding DisplayName}"/>
<GridViewColumn Header="Process ID" Width="80" DisplayMemberBinding="{Binding ProcessId}"/>
<GridViewColumn Header="Priority" Width="120">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Priority, UpdateSourceTrigger=PropertyChanged}"
Width="60"
TextAlignment="Center"
PreviewTextInput="PriorityTextBox_PreviewTextInput"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Status" Width="140" DisplayMemberBinding="{Binding StatusDisplay}"/>
</GridView>
</ListView.View>
</ListView>
</Grid>
</Border>
<!-- Priority Info Panel -->
<Border Grid.Row="2"
Background="#FFF9E6"
BorderBrush="#FFE082"
BorderThickness="1"
CornerRadius="4"
Padding="15"
Margin="0,0,0,15">
<StackPanel>
<TextBlock FontWeight="Bold"
Foreground="#856404"
Margin="0,0,0,5">
📋 Priority Instructions
</TextBlock>
<TextBlock TextWrapping="Wrap"
Foreground="#856404"
FontSize="12">
• Select windows using checkboxes
• Assign priority numbers (1 = highest priority, stays on top)
• Priority 1 will stay above Priority 2, Priority 2 above Priority 3, etc.
• Click "Apply Always On Top" to enforce priorities
• The app monitors and maintains window order automatically
</TextBlock>
</StackPanel>
</Border>
<!-- Action Buttons -->
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="✓ Apply Always On Top"
Style="{StaticResource ModernButton}"
Click="ApplyButton_Click"
Padding="20,10"
FontSize="16"
FontWeight="Bold"/>
<Button Content="Remove Selected"
Style="{StaticResource SecondaryButton}"
Click="RemoveButton_Click"/>
<Button Content="Clear All"
Style="{StaticResource DangerButton}"
Click="ClearAllButton_Click"/>
</StackPanel>
</Grid>
</Window>