Repository navigation
Expand file tree
/
Copy pathMonitorLayoutDialog.cs
More file actions
408 lines (390 loc) · 21.9 KB
/
Copy pathMonitorLayoutDialog.cs
File metadata and controls
408 lines (390 loc) · 21.9 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
// Edits per-display layouts on copies. The caller saves Layouts only after OK.
internal sealed class MonitorLayoutDialog : Form
{
readonly Settings baseline;
readonly bool nativeReady;
readonly List<Screen> screens;
readonly ListBox displayList = new();
readonly CheckBox appearanceEnabled = new();
readonly ComboBox style = new();
readonly ModernButton colorButton = new();
readonly OpacitySlider opacity = new();
readonly CheckBox autoContrast = new();
readonly CheckBox appAccent = new();
readonly CheckBox contextStyle = new();
readonly ComboBox maximizedStyle = new();
readonly CheckBox clockEnabled = new();
readonly ComboBox clockLayout = new();
readonly ComboBox secondZone = new();
readonly CheckBox rightEnabled = new();
readonly ComboBox[] rightModes = [new(), new(), new(), new()];
readonly CheckBox pinnedEnabled = new();
readonly CheckBox hidePinned = new();
readonly NumericUpDown keepPinned = new();
readonly CheckBox stacksEnabled = new();
readonly CheckedListBox stacks = new();
readonly List<TimeZoneInfo> timeZones = [.. TimeZoneInfo.GetSystemTimeZones()];
Screen? selectedScreen;
MonitorLayout? draft;
bool loading;
public List<MonitorLayout> Layouts { get; }
public MonitorLayoutDialog(Settings baseline, IEnumerable<MonitorLayout>? layouts,
bool nativePerMonitorReady = false)
{
RegisterCopy();
this.baseline = baseline;
nativeReady = nativePerMonitorReady;
Layouts = (layouts ?? []).Select(layout => layout.Copy()).ToList();
screens = [.. Screen.AllScreens.OrderByDescending(screen => screen.Primary).ThenBy(screen => screen.DeviceName)];
Text = "winBar · Monitore";
ClientSize = new Size(760, 560);
MinimumSize = new Size(680, 500);
StartPosition = FormStartPosition.CenterParent;
ShowInTaskbar = false;
Font = new Font("Segoe UI", 9.5f);
BackColor = Color.FromArgb(246, 248, 252);
AutoScaleDimensions = new SizeF(96, 96);
AutoScaleMode = AutoScaleMode.Dpi;
var shell = new TableLayoutPanel { Dock = DockStyle.Fill, ColumnCount = 1, RowCount = 3 };
shell.RowStyles.Add(new RowStyle(SizeType.Absolute, 88));
shell.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
shell.RowStyles.Add(new RowStyle(SizeType.Absolute, 64));
Controls.Add(shell);
var header = new Panel { Dock = DockStyle.Fill, BackColor = Color.FromArgb(27, 41, 61) };
header.Controls.Add(new Label { Text = "Monitore", Font = new Font("Segoe UI Semibold", 19, FontStyle.Bold),
ForeColor = Color.White, AutoSize = true, Location = new Point(22, 12) });
header.Controls.Add(new Label { Text = nativeReady ? "Design, Uhr und Elemente pro Bildschirm." : "Die Uhr auf jedem Bildschirm passend einstellen.",
ForeColor = Color.FromArgb(180, 202, 230), AutoSize = true, Location = new Point(25, 53) });
header.Paint += (_, e) => { using var brush = new SolidBrush(Color.FromArgb(102, 154, 219)); e.Graphics.FillRectangle(brush, 0, header.Height - 3, header.Width, 3); };
shell.Controls.Add(header, 0, 0);
var body = new TableLayoutPanel { Dock = DockStyle.Fill, ColumnCount = 2, Padding = new Padding(18, 16, 18, 8) };
body.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 37));
body.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 63));
shell.Controls.Add(body, 0, 1);
var left = new TableLayoutPanel { Dock = DockStyle.Fill, RowCount = 3, Margin = new Padding(0, 0, 14, 0) };
left.RowStyles.Add(new RowStyle(SizeType.AutoSize));
left.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
left.RowStyles.Add(new RowStyle(SizeType.AutoSize));
left.Controls.Add(Title("Verbunden"), 0, 0);
displayList.Dock = DockStyle.Fill;
displayList.IntegralHeight = false;
displayList.BorderStyle = BorderStyle.FixedSingle;
displayList.SelectedIndexChanged += (_, _) => SelectDisplay();
left.Controls.Add(displayList, 0, 1);
left.Controls.Add(new Label { Text = "Getrennte Bildschirme behalten ihre Einstellungen.", AutoSize = true,
MaximumSize = new Size(240, 0), ForeColor = Color.FromArgb(93, 110, 133), Margin = new Padding(3, 10, 3, 2) }, 0, 2);
body.Controls.Add(left, 0, 0);
var tabs = new TabControl { Dock = DockStyle.Fill };
body.Controls.Add(tabs, 1, 0);
if (nativeReady) tabs.TabPages.Add(BuildAppearancePage());
tabs.TabPages.Add(BuildClockPage());
if (nativeReady) tabs.TabPages.Add(BuildElementsPage());
var footer = new TableLayoutPanel { Dock = DockStyle.Fill, ColumnCount = 2, Padding = new Padding(20, 12, 18, 12) };
footer.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
footer.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
footer.Controls.Add(new Label { Text = "Änderungen gelten nach dem Speichern.", AutoSize = true,
ForeColor = Color.FromArgb(93, 110, 133), Anchor = AnchorStyles.Left }, 0, 0);
var actions = new FlowLayoutPanel { AutoSize = true, FlowDirection = FlowDirection.RightToLeft, WrapContents = false };
var cancel = new ModernButton { Text = "Abbrechen", AutoSize = true, MinimumSize = new Size(96, 32) };
cancel.Click += (_, _) => { DialogResult = DialogResult.Cancel; Close(); };
var save = new ModernButton { Text = "Speichern", AutoSize = true, MinimumSize = new Size(96, 32),
BackColor = Color.FromArgb(62, 107, 174), ForeColor = Color.White, FlatStyle = FlatStyle.Flat };
save.FlatAppearance.BorderSize = 0;
save.Click += (_, _) => { SaveCurrent(); DialogResult = DialogResult.OK; Close(); };
actions.Controls.AddRange([save, cancel]);
footer.Controls.Add(actions, 1, 0);
shell.Controls.Add(footer, 0, 2);
AcceptButton = save;
CancelButton = cancel;
foreach (var screen in screens) displayList.Items.Add(new DisplayChoice(screen));
if (displayList.Items.Count > 0) displayList.SelectedIndex = 0;
else tabs.Enabled = false;
loading = true;
try { Localization.Apply(this); }
finally { loading = false; }
}
static void RegisterCopy()
{
Localization.Register("winBar · Monitors", "winBar · Monitore");
Localization.Register("Monitors", "Monitore");
Localization.Register("Design, clock and elements for each display.", "Design, Uhr und Elemente pro Bildschirm.");
Localization.Register("Set the clock for each display.", "Die Uhr auf jedem Bildschirm passend einstellen.");
Localization.Register("Connected", "Verbunden");
Localization.Register("Disconnected displays keep their settings.", "Getrennte Bildschirme behalten ihre Einstellungen.");
Localization.Register("Changes take effect when you save.", "Änderungen gelten nach dem Speichern.");
Localization.Register("Cancel", "Abbrechen");
Localization.Register("Save", "Speichern");
Localization.Register("Appearance", "Aussehen");
Localization.Register("Use a separate look on this monitor", "Eigenes Design auf diesem Monitor");
Localization.Register("Windows default", "Windows-Standard");
Localization.Register("Transparent", "Transparent");
Localization.Register("Tinted", "Getönt");
Localization.Register("Blur", "Blur");
Localization.Register("Acrylic", "Acrylic");
Localization.Register("Style", "Stil");
Localization.Register("Color", "Farbe");
Localization.Register("Opacity", "Deckkraft");
Localization.Register("Windows accent as tint", "Windows-Akzent als Tönung");
Localization.Register("Active app color", "Farbe der aktiven App");
Localization.Register("Different style for maximized windows", "Anderer Stil bei maximiertem Fenster");
Localization.Register("Then", "Dann");
Localization.Register("Clock", "Uhr");
Localization.Register("Use a separate clock on this monitor", "Eigene Uhr auf diesem Monitor");
Localization.Register("Off", "Aus");
Localization.Register("Time only", "Nur Uhrzeit");
Localization.Register("Time and date", "Uhrzeit und Datum");
Localization.Register("Display", "Anzeige");
Localization.Register("No second time zone", "Keine zweite Zeitzone");
Localization.Register("On hover", "Beim Darüberfahren");
Localization.Register("This setting applies to this display. The second time zone appears on hover.", "Diese Einstellung gilt für diesen Bildschirm. Die zweite Zeitzone öffnet sich bei Mausnähe.");
Localization.Register("Elements", "Elemente");
Localization.Register("Configure the right side separately", "Rechte Seite getrennt einstellen");
Localization.Register("Clock / notifications", "Uhr / Mitteilungen");
Localization.Register("Wi-Fi / volume / battery", "WLAN / Lautstärke / Akku");
Localization.Register("Tray icons", "Tray-Icons");
Localization.Register("Language", "Sprache");
Localization.Register("Always", "Immer");
Localization.Register("With Alt or hover", "Bei Alt oder Mausnähe");
Localization.Register("Only with Alt", "Nur mit Alt");
Localization.Register("Contrast clear", "Kontrast-Transparent");
Localization.Register("Configure pinned apps separately", "Angeheftete Apps getrennt einstellen");
Localization.Register("Show only with Alt", "Erst mit Alt zeigen");
Localization.Register("Always visible", "Immer sichtbar");
Localization.Register("Choose app stacks separately", "App-Stapel getrennt auswählen");
}
TabPage BuildAppearancePage()
{
var (tab, panel) = Page("Aussehen");
appearanceEnabled.Text = "Eigenes Design auf diesem Monitor";
appearanceEnabled.AutoSize = true;
appearanceEnabled.CheckedChanged += (_, _) => EnableFields();
Full(panel, appearanceEnabled, 0);
Options(style, ["Windows-Standard", "Transparent", "Getönt", "Blur", "Acrylic", "Kontrast-Transparent"]);
style.SelectedIndexChanged += (_, _) => { PrepareAcrylicTint(); EnableFields(); };
Row(panel, 1, "Stil", style);
colorButton.AutoSize = true;
colorButton.FlatStyle = FlatStyle.Flat;
colorButton.Click += (_, _) =>
{
using var picker = new ColorDialog { Color = Color.FromArgb((draft?.Color ?? baseline.Color) | unchecked((int)0xFF000000)), FullOpen = true };
if (picker.ShowDialog(this) != DialogResult.OK) return;
var alpha = (draft?.Color ?? baseline.Color) & unchecked((int)0xFF000000);
if (draft != null) draft.Color = alpha | (picker.Color.ToArgb() & 0xFFFFFF);
ShowColor();
};
Row(panel, 2, "Farbe", colorButton);
opacity.Dock = DockStyle.Top;
opacity.ValueChanged += (_, _) =>
{
if (!loading && draft != null) draft.Color = (opacity.Value << 24) | (draft.Color & 0xFFFFFF);
};
Row(panel, 3, "Deckkraft", opacity);
autoContrast.Text = "Windows-Akzent als Tönung";
autoContrast.AutoSize = true;
autoContrast.CheckedChanged += (_, _) => EnableFields();
Full(panel, autoContrast, 4);
appAccent.Text = "Farbe der aktiven App";
appAccent.AutoSize = true;
appAccent.CheckedChanged += (_, _) => EnableFields();
Full(panel, appAccent, 5);
contextStyle.Text = "Anderer Stil bei maximiertem Fenster";
contextStyle.AutoSize = true;
contextStyle.CheckedChanged += (_, _) => { PrepareAcrylicTint(); EnableFields(); };
Full(panel, contextStyle, 6);
Options(maximizedStyle, ["Windows-Standard", "Transparent", "Getönt", "Blur", "Acrylic", "Kontrast-Transparent"]);
maximizedStyle.SelectedIndexChanged += (_, _) => { PrepareAcrylicTint(); EnableFields(); };
Row(panel, 7, "Dann", maximizedStyle);
return tab;
}
TabPage BuildClockPage()
{
var (tab, panel) = Page("Uhr");
clockEnabled.Text = "Eigene Uhr auf diesem Monitor";
clockEnabled.AutoSize = true;
clockEnabled.CheckedChanged += (_, _) => EnableFields();
Full(panel, clockEnabled, 0);
Options(clockLayout, ["Aus", "Nur Uhrzeit", "Uhrzeit und Datum"]);
Row(panel, 1, "Anzeige", clockLayout);
secondZone.DropDownStyle = ComboBoxStyle.DropDownList;
secondZone.Items.Add("Keine zweite Zeitzone");
foreach (var zone in timeZones) secondZone.Items.Add(zone.DisplayName);
secondZone.SelectedIndex = 0;
secondZone.Dock = DockStyle.Top;
Row(panel, 2, "Beim Darüberfahren", secondZone);
Full(panel, new Label { Text = "Diese Einstellung gilt für diesen Bildschirm. Die zweite Zeitzone öffnet sich bei Mausnähe.",
AutoSize = true, MaximumSize = new Size(360, 0), ForeColor = Color.FromArgb(93, 110, 133),
Margin = new Padding(3, 18, 3, 3) }, 3);
return tab;
}
TabPage BuildElementsPage()
{
var (tab, panel) = Page("Elemente");
rightEnabled.Text = "Rechte Seite getrennt einstellen";
rightEnabled.AutoSize = true;
rightEnabled.CheckedChanged += (_, _) => EnableFields();
Full(panel, rightEnabled, 0);
string[] labels = ["Uhr / Mitteilungen", "WLAN / Lautstärke / Akku", "Tray-Icons", "Sprache"];
for (int i = 0; i < rightModes.Length; i++)
{
Options(rightModes[i], ["Immer", "Bei Alt oder Mausnähe", "Nur mit Alt", "Aus"]);
Row(panel, i + 1, labels[i], rightModes[i]);
}
pinnedEnabled.Text = "Angeheftete Apps getrennt einstellen";
pinnedEnabled.AutoSize = true;
pinnedEnabled.CheckedChanged += (_, _) => EnableFields();
Full(panel, pinnedEnabled, 5);
hidePinned.Text = "Erst mit Alt zeigen";
hidePinned.AutoSize = true;
Full(panel, hidePinned, 6);
keepPinned.Minimum = 0;
keepPinned.Maximum = 5;
keepPinned.Width = 64;
Row(panel, 7, "Immer sichtbar", keepPinned);
stacksEnabled.Text = "App-Stapel getrennt auswählen";
stacksEnabled.AutoSize = true;
stacksEnabled.CheckedChanged += (_, _) => EnableFields();
Full(panel, stacksEnabled, 8);
stacks.CheckOnClick = true;
stacks.Height = 74;
stacks.Dock = DockStyle.Top;
foreach (var group in baseline.AppStacks.Groups) stacks.Items.Add(new StackChoice(group.Id.ToString("N"), group.Name));
Full(panel, stacks, 9);
return tab;
}
static (TabPage Tab, TableLayoutPanel Panel) Page(string title)
{
var tab = new TabPage(title) { BackColor = Color.FromArgb(250, 252, 255) };
var panel = new TableLayoutPanel { Dock = DockStyle.Fill, AutoScroll = true, ColumnCount = 2, RowCount = 11,
Padding = new Padding(14, 18, 14, 12) };
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 48));
panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 52));
for (int i = 0; i < 10; i++) panel.RowStyles.Add(new RowStyle(SizeType.AutoSize));
panel.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
tab.Controls.Add(panel);
return (tab, panel);
}
static void Options(ComboBox box, string[] options)
{
box.DropDownStyle = ComboBoxStyle.DropDownList;
box.Items.AddRange(options);
box.SelectedIndex = 0;
box.Dock = DockStyle.Top;
}
static void Row(TableLayoutPanel panel, int row, string label, Control input)
{
panel.Controls.Add(new Label { Text = label, AutoSize = true, Anchor = AnchorStyles.Left,
ForeColor = Color.FromArgb(52, 70, 94), Margin = new Padding(3, 8, 6, 8) }, 0, row);
panel.Controls.Add(input, 1, row);
}
static void Full(TableLayoutPanel panel, Control control, int row)
{
control.Margin = new Padding(3, 6, 3, 8);
panel.Controls.Add(control, 0, row);
panel.SetColumnSpan(control, 2);
}
static Label Title(string text) => new() { Text = text, AutoSize = true,
Font = new Font("Segoe UI Semibold", 11, FontStyle.Bold), ForeColor = Color.FromArgb(30, 45, 67),
Margin = new Padding(2, 0, 2, 9) };
void SelectDisplay()
{
if (loading) return;
SaveCurrent();
selectedScreen = (displayList.SelectedItem as DisplayChoice)?.Screen;
if (selectedScreen == null) return;
draft = Layouts.FirstOrDefault(layout => string.Equals(layout.DeviceName, selectedScreen.DeviceName,
StringComparison.OrdinalIgnoreCase))?.Copy() ?? MonitorLayout.Capture(selectedScreen, baseline);
loading = true;
try
{
appearanceEnabled.Checked = draft.AppearanceEnabled;
style.SelectedIndex = Math.Clamp(draft.Style, 0, 5);
opacity.Value = (draft.Color >> 24) & 0xFF;
autoContrast.Checked = draft.AutoContrast;
appAccent.Checked = draft.AppAccent;
contextStyle.Checked = draft.ContextStyle;
maximizedStyle.SelectedIndex = Math.Clamp(draft.MaximizedStyle, 0, 5);
clockEnabled.Checked = draft.ClockEnabled;
clockLayout.SelectedIndex = Math.Clamp(draft.ClockLayout, 0, 2);
secondZone.SelectedIndex = Math.Max(0, timeZones.FindIndex(zone => zone.Id == draft.SecondaryTimeZoneId) + 1);
rightEnabled.Checked = draft.NativeVisibilityEnabled;
var modes = SceneSnapshot.NormalizeModes(draft.RightModes) ?? [0, 0, 0, 0];
for (int i = 0; i < rightModes.Length; i++) rightModes[i].SelectedIndex = RightAreaModes.ToUiIndex(modes[i]);
pinnedEnabled.Checked = draft.NativePinnedEnabled;
hidePinned.Checked = draft.HidePinnedUntilAlt;
keepPinned.Value = Math.Clamp(draft.KeepPinnedCount, 0, 5);
stacksEnabled.Checked = draft.NativeStacksEnabled;
var selected = new HashSet<string>(draft.VisibleStackIds ?? [], StringComparer.OrdinalIgnoreCase);
for (int i = 0; i < stacks.Items.Count; i++)
stacks.SetItemChecked(i, stacks.Items[i] is StackChoice choice && selected.Contains(choice.Id));
ShowColor();
}
finally { loading = false; }
EnableFields();
}
void SaveCurrent()
{
if (selectedScreen == null || draft == null) return;
if (nativeReady)
{
draft.AppearanceEnabled = appearanceEnabled.Checked;
draft.Style = style.SelectedIndex;
draft.Color = (opacity.Value << 24) | (draft.Color & 0xFFFFFF);
draft.AutoContrast = autoContrast.Checked;
draft.AppAccent = appAccent.Checked;
draft.ContextStyle = contextStyle.Checked;
draft.MaximizedStyle = maximizedStyle.SelectedIndex;
draft.NativeVisibilityEnabled = rightEnabled.Checked;
draft.RightModes = rightModes.Select(box => RightAreaModes.FromUiIndex(box.SelectedIndex)).ToArray();
draft.NativePinnedEnabled = pinnedEnabled.Checked;
draft.HidePinnedUntilAlt = hidePinned.Checked;
draft.KeepPinnedCount = (int)keepPinned.Value;
draft.NativeStacksEnabled = stacksEnabled.Checked;
draft.VisibleStackIds = stacks.CheckedItems.OfType<StackChoice>().Select(choice => choice.Id).ToList();
}
draft.ClockEnabled = clockEnabled.Checked;
draft.ClockLayout = clockLayout.SelectedIndex;
draft.SecondaryTimeZoneId = secondZone.SelectedIndex > 0 ? timeZones[secondZone.SelectedIndex - 1].Id : null;
Layouts.RemoveAll(layout => string.Equals(layout.DeviceName, selectedScreen.DeviceName, StringComparison.OrdinalIgnoreCase));
if (draft.ClockEnabled || draft.AppearanceEnabled || draft.NativeVisibilityEnabled ||
draft.NativePinnedEnabled || draft.NativeStacksEnabled) Layouts.Add(draft.Copy());
}
void EnableFields()
{
bool enabled = nativeReady && appearanceEnabled.Checked;
bool usesTint = MonitorAccent.UsesManualTint(style.SelectedIndex) ||
(contextStyle.Checked && MonitorAccent.UsesManualTint(maximizedStyle.SelectedIndex));
style.Enabled = autoContrast.Enabled = appAccent.Enabled = contextStyle.Enabled = enabled;
colorButton.Enabled = enabled && usesTint && !autoContrast.Checked && !appAccent.Checked;
opacity.Enabled = enabled && usesTint;
maximizedStyle.Enabled = enabled && contextStyle.Checked;
clockLayout.Enabled = secondZone.Enabled = clockEnabled.Checked;
foreach (var box in rightModes) box.Enabled = nativeReady && rightEnabled.Checked;
hidePinned.Enabled = keepPinned.Enabled = nativeReady && pinnedEnabled.Checked;
stacks.Enabled = nativeReady && stacksEnabled.Checked;
}
void PrepareAcrylicTint()
{
if (loading || draft == null || opacity.Value != 0 ||
(style.SelectedIndex != 4 && !(contextStyle.Checked && maximizedStyle.SelectedIndex == 4))) return;
int rgb = draft.Color & 0xFFFFFF;
draft.Color = unchecked((int)0xA0000000) | (rgb == 0 ? 0x002A405A : rgb);
opacity.Value = 160;
ShowColor();
}
void ShowColor()
{
if (draft == null) return;
var color = Color.FromArgb(draft.Color | unchecked((int)0xFF000000));
colorButton.BackColor = color;
colorButton.ForeColor = color.GetBrightness() > 0.5f ? Color.Black : Color.White;
colorButton.Text = Localization.T($"#{color.R:X2}{color.G:X2}{color.B:X2} change", $"#{color.R:X2}{color.G:X2}{color.B:X2} ändern");
}
sealed record DisplayChoice(Screen Screen)
{
public override string ToString() => $"{(Screen.Primary ? Localization.T("Primary display", "Hauptmonitor") : "Monitor")} · {Screen.Bounds.Width}×{Screen.Bounds.Height} · {Screen.DeviceName}";
}
sealed record StackChoice(string Id, string Name)
{
public override string ToString() => Name;
}
}