Repository navigation
Expand file tree
/
Copy pathMainForm.Tray.cs
More file actions
584 lines (509 loc) · 25.3 KB
/
Copy pathMainForm.Tray.cs
File metadata and controls
584 lines (509 loc) · 25.3 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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.WinForms;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Wrok
{
public partial class MainForm
{
// ------------------------------------------------------------------
// Tray-Icon
// ------------------------------------------------------------------
private void InitializeTrayIcon()
{
trayMenu = new ContextMenuStrip { ShowItemToolTips = true };
trayMenu.Items.Add(Properties.Resources.ShowWindow, null, (s, e) => Reactivate());
trayMenu.Items.Add(Properties.Resources.Reload, null, async (s, e) =>
{
try
{
if (_webView?.CoreWebView2 != null) _webView.CoreWebView2.Reload();
else await LoadUrlAsync(baseUrl, bringToFront: false);
}
catch { }
});
trayMenu.Items.Add(new ToolStripSeparator());
// ---------- Makros (oberste Ebene: meistgenutzte Funktion) ----------
InitializeMacrosMenu();
if (macrosMenu != null) trayMenu.Items.Add(macrosMenu);
trayMenu.Items.Add(new ToolStripSeparator());
// ---------- Einstellungen ----------
var settingsMenu = new ToolStripMenuItem(Properties.Resources.Settings);
// Einstellungen → App
var appMenu = new ToolStripMenuItem(Properties.Resources.MenuApp);
var inactivityMenu = new ToolStripMenuItem(Properties.Resources.Inaktivity);
_inactivityMenu = inactivityMenu; // Referenz merken: liegt jetzt verschachtelt
int current = Properties.Settings.Default.InactivityTimeoutSeconds;
foreach (var sec in inactivityOptions)
{
var item = new ToolStripMenuItem(sec == 0
? string.Format(Properties.Resources._0Deactivated, sec)
: string.Format(Properties.Resources._0Seconds, sec))
{
Tag = sec,
CheckOnClick = false,
Checked = current == sec
};
item.Click += InactivityMenuItem_Click;
inactivityMenu.DropDownItems.Add(item);
}
appMenu.DropDownItems.Add(inactivityMenu);
var macroIoMenu = new ToolStripMenuItem(Properties.Resources.MacrosImportExport);
macroIoMenu.DropDownItems.Add(Properties.Resources.MacrosExportActive, null, (s, e) => ExportMacros(allProfiles: false));
macroIoMenu.DropDownItems.Add(Properties.Resources.MacrosExportAll, null, (s, e) => ExportMacros(allProfiles: true));
macroIoMenu.DropDownItems.Add(new ToolStripSeparator());
macroIoMenu.DropDownItems.Add(Properties.Resources.MacrosImport, null, (s, e) => ImportMacros());
appMenu.DropDownItems.Add(macroIoMenu);
// F1-F10 direkt als Makro-Hotkeys, Strg+F5 = Reload, Strg+Umschalt+F1-3
// wechselt das Profil - siehe MainForm.HandleFKeyOverride. Default aus.
// Schaltet zusaetzlich live AreBrowserAcceleratorKeysEnabled um (siehe
// WebViewManager.ConfigureCore) und synchronisiert den JS-Helper
// (WrokHelper.js: __wrokSetFKeyEnabled), damit die Umstellung sofort
// greift - kein Neustart/Reload noetig.
var fKeyOverrideItem = new ToolStripMenuItem(Properties.Resources.FKeyOverrideMenuItem)
{
CheckOnClick = false,
Checked = Properties.Settings.Default.FKeyMacroOverrideEnabled
};
fKeyOverrideItem.ToolTipText = Properties.Resources.FKeyOverrideHint;
fKeyOverrideItem.Click += (s, e) =>
{
bool desired = !fKeyOverrideItem.Checked;
Properties.Settings.Default.FKeyMacroOverrideEnabled = desired;
Properties.Settings.Default.Save();
if (_webView?.CoreWebView2 != null)
_webView.CoreWebView2.Settings.AreBrowserAcceleratorKeysEnabled = !desired;
_ = _webViewManager?.ExecuteScriptAsync(
$"if (window.__wrokSetFKeyEnabled) window.__wrokSetFKeyEnabled({(desired ? "true" : "false")});");
fKeyOverrideItem.Checked = desired;
};
appMenu.DropDownItems.Add(fKeyOverrideItem);
var autostartItem = new ToolStripMenuItem(Properties.Resources.StartWithWindows)
{
CheckOnClick = false,
Checked = AutostartManager.IsEnabled()
};
autostartItem.Click += (s, e) =>
{
bool desired = !autostartItem.Checked;
if (AutostartManager.SetEnabled(desired))
autostartItem.Checked = AutostartManager.IsEnabled();
};
appMenu.DropDownItems.Add(autostartItem);
// Chromiums eigener Passwort-Manager fuers Grok-Login (siehe
// WebViewManager.ConfigureCore) - wirkt sofort, kein Neustart noetig.
var passwordAutosaveItem = new ToolStripMenuItem(Properties.Resources.PasswordAutosaveMenuItem)
{
CheckOnClick = false,
Checked = Properties.Settings.Default.PasswordAutosaveEnabled
};
passwordAutosaveItem.Click += (s, e) =>
{
bool desired = !passwordAutosaveItem.Checked;
Properties.Settings.Default.PasswordAutosaveEnabled = desired;
Properties.Settings.Default.Save();
if (_webView?.CoreWebView2 != null)
_webView.CoreWebView2.Settings.IsPasswordAutosaveEnabled = desired;
passwordAutosaveItem.Checked = desired;
};
appMenu.DropDownItems.Add(passwordAutosaveItem);
var proxyItem = new ToolStripMenuItem(Properties.Resources.ProxyMenuItem);
proxyItem.Click += (s, e) => ShowProxyDialog();
appMenu.DropDownItems.Add(proxyItem);
// Update-Prüfung: kontaktiert beim Start GitHub, deshalb abschaltbar.
var updateCheckItem = new ToolStripMenuItem(Properties.Resources.CheckForUpdatesMenuItem)
{
CheckOnClick = false,
Checked = Properties.Settings.Default.CheckForUpdates
};
updateCheckItem.ToolTipText = Properties.Resources.CheckForUpdatesHint;
updateCheckItem.Click += (s, e) =>
{
bool desired = !updateCheckItem.Checked;
Properties.Settings.Default.CheckForUpdates = desired;
Properties.Settings.Default.Save();
updateCheckItem.Checked = desired;
};
appMenu.DropDownItems.Add(updateCheckItem);
settingsMenu.DropDownItems.Add(appMenu);
// Einstellungen → Grok (öffnet Groks eigene Einstellungsseite)
foreach (var page in menuPages)
{
var item = new ToolStripMenuItem(page.name);
item.Click += async (s, e) => await LoadUrlAsync(baseUrl + page.url);
settingsMenu.DropDownItems.Add(item);
}
trayMenu.Items.Add(settingsMenu);
// ---------- Werkzeuge ----------
var toolsMenu = new ToolStripMenuItem(Properties.Resources.MenuTools);
_rateLimitMenu = new ToolStripMenuItem(Properties.Resources.RateLimits);
_rateLimitMenu.DropDownItems.Add(new ToolStripMenuItem(Properties.Resources.RateLimitLoading) { Enabled = false });
var refreshItem = new ToolStripMenuItem(Properties.Resources.RateLimitRefresh);
refreshItem.Click += async (s, e) =>
{
if (_rateLimitManager != null)
await _rateLimitManager.RefreshAsync();
};
_rateLimitMenu.DropDownItems.Add(new ToolStripSeparator());
_rateLimitMenu.DropDownItems.Add(refreshItem);
toolsMenu.DropDownItems.Add(_rateLimitMenu);
toolsMenu.DropDownItems.Add(new ToolStripSeparator());
toolsMenu.DropDownItems.Add(Properties.Resources.OpenImageFromClipboard, null,
async (s, e) => await OpenImageFromClipboardAsync());
toolsMenu.DropDownItems.Add(Properties.Resources.OpenLastImage, null,
(s, e) => OpenLastImage());
// Groks eigene Dateiverwaltung (grok.com/files) - Uploads und von
// Grok/Imagine erzeugte Dateien ansehen, herunterladen, löschen.
// Eigenes Fenster statt Navigation im Hauptfenster, siehe FilesViewerForm.
toolsMenu.DropDownItems.Add(Properties.Resources.ManageFilesMenuItem, null,
(s, e) => ShowFilesViewer());
toolsMenu.DropDownItems.Add(new ToolStripSeparator());
toolsMenu.DropDownItems.Add(Properties.Resources.ClearCache, null,
async (s, e) => await ClearCacheAsync());
trayMenu.Items.Add(toolsMenu);
// ---------- Über / Beenden ----------
trayMenu.Items.Add(new ToolStripSeparator());
trayMenu.Items.Add(Properties.Resources.AboutWrok, null, (s, e) =>
{
using var dlg = new AboutForm();
// Nicht direkt ShowDialog(this): ist Wrok gerade in die Tray
// minimiert, verschiebt Windows das Hauptfenster intern weit aus
// dem Bildschirm - CenterParent würde den Dialog dann relativ zu
// dieser verschobenen Position zeigen statt zentriert.
Dialogs.ShowCentered(dlg, this);
// Hat die manuelle Prüfung im Dialog ein Update gefunden (und wurde
// es dort nicht installiert), den Menüeintrag nachziehen – ohne
// Ballon, der Nutzer hat den Hinweis gerade eben gesehen.
var pending = UpdateChecker.GetPendingUpdate();
if (pending != null) ShowUpdateNotice(pending, showBalloon: false);
});
trayMenu.Items.Add(new ToolStripSeparator());
trayMenu.Items.Add(Properties.Resources.Exit, null, (s, e) => Application.Exit());
var initialIcon = ThemeManager.CurrentIcon();
try
{
trayIcon = new NotifyIcon
{
Text = Properties.Resources.WrokClickToOpen,
ContextMenuStrip = trayMenu,
Visible = true,
Icon = (System.Drawing.Icon)initialIcon.Clone()
};
}
catch
{
trayIcon = new NotifyIcon
{
Text = Properties.Resources.WrokClickToOpen,
ContextMenuStrip = trayMenu,
Visible = true,
Icon = initialIcon
};
}
try { this.Icon = (System.Drawing.Icon)initialIcon.Clone(); }
catch { this.Icon = initialIcon; }
if (trayIcon != null)
{
trayIcon.MouseClick += (s, e) => { if (e.Button == MouseButtons.Left) Reactivate(); };
// Klick auf den Update-Ballon stößt Download+Installation an
// (bzw. öffnet als Fallback die Release-Seite, siehe InstallOrOpenPendingUpdate).
trayIcon.BalloonTipClicked += (s, e) => InstallOrOpenPendingUpdate();
}
}
private void EnsureTrayIconVisible()
{
try
{
if (trayIcon == null) { InitializeTrayIcon(); _theme?.ApplyIcon(); }
if (trayIcon != null && !trayIcon.Visible) trayIcon.Visible = true;
}
catch { }
}
private void DisposeTrayIcon()
{
if (trayIcon == null) return;
try { trayIcon.Visible = false; } catch { }
try
{
var ico = trayIcon.Icon;
trayIcon.Dispose();
trayIcon = null;
try { ico?.Dispose(); } catch { }
}
catch { trayIcon = null; }
}
// ------------------------------------------------------------------
// Update-Prüfung
// ------------------------------------------------------------------
/// <summary>
/// Stößt die Update-Prüfung an (best-effort, ohne den Start zu blockieren).
/// Bei einer neueren Version erscheint ein Tray-Ballon und ein Menüeintrag.
/// </summary>
/// <summary>
/// Wrok läuft oft tagelang durch; ohne diesen Timer würde ein neues Release
/// erst beim nächsten Start bemerkt. Der Timer fragt NICHT stündlich bei
/// GitHub an – CheckAsync hält die 20-Stunden-Drossel ein und liefert
/// dazwischen nur das gemerkte Update (ohne Netzzugriff).
/// </summary>
private void StartUpdateTimer()
{
try
{
_updateTimer = new System.Windows.Forms.Timer { Interval = (int)TimeSpan.FromHours(1).TotalMilliseconds };
_updateTimer.Tick += (s, e) => StartUpdateCheck();
_updateTimer.Start();
}
catch (Exception ex) { Log(ex, "Update-Timer konnte nicht gestartet werden"); }
}
private void StartUpdateCheck()
{
_ = Task.Run(async () =>
{
try
{
var info = await UpdateChecker.CheckAsync();
if (info == null || this.IsDisposed) return;
this.BeginInvoke((MethodInvoker)(() => ShowUpdateNotice(info)));
}
catch (Exception ex) { Log(ex, "Update-Prüfung fehlgeschlagen"); }
});
}
private void ShowUpdateNotice(UpdateInfo info, bool showBalloon = true)
{
try
{
// Dasselbe Update wird schon angezeigt (z. B. stündlicher Timer
// innerhalb der Drosselzeit) → nichts tun, vor allem kein neuer Ballon.
if (_pendingUpdate != null &&
string.Equals(_pendingUpdate.TagName, info.TagName, StringComparison.OrdinalIgnoreCase))
{
_pendingUpdate = info; // URLs könnten sich geändert haben
return;
}
_pendingUpdate = info;
// Eintrag existiert schon (ältere Version angekündigt) → nur umbenennen.
if (_updateMenuItem != null)
_updateMenuItem.Text = string.Format(Properties.Resources.UpdateAvailableMenuItem, info.TagName);
// Menüeintrag ganz oben – bleibt sichtbar, auch wenn der Ballon weg ist.
if (_updateMenuItem == null && trayMenu != null)
{
var item = new ToolStripMenuItem(
string.Format(Properties.Resources.UpdateAvailableMenuItem, info.TagName))
{
Font = new Font(trayMenu.Font, FontStyle.Bold)
};
item.Click += (s, e) => InstallOrOpenPendingUpdate();
trayMenu.Items.Insert(0, new ToolStripSeparator());
trayMenu.Items.Insert(0, item);
_updateMenuItem = item;
}
if (!showBalloon) return;
trayIcon?.ShowBalloonTip(
8000,
Properties.Resources.UpdateAvailableTitle,
string.Format(Properties.Resources.UpdateAvailableBalloon, info.TagName),
ToolTipIcon.Info);
}
catch (Exception ex) { Log(ex, "Update-Hinweis anzeigen fehlgeschlagen"); }
}
/// <summary>
/// Reaktion auf Klick (Ballon oder Menüeintrag): Nach Rückfrage Installer
/// herunterladen, signaturprüfen und starten, dann die App über
/// Program.RestartApplicationForUpdate neu starten. Ohne passendes
/// Installer-Asset im Release (z. B. ein reines Vorab-/Quelltext-Release)
/// fällt das Verhalten auf das bisherige "Release-Seite im Browser öffnen"
/// zurück.
/// </summary>
private async void InstallOrOpenPendingUpdate()
{
var info = _pendingUpdate;
if (info == null) return;
if (string.IsNullOrWhiteSpace(info.InstallerUrl))
{
OpenReleasePage(info.ReleaseUrl);
return;
}
var answer = MessageBox.Show(
this,
string.Format(Properties.Resources.UpdateInstallConfirm, info.TagName),
Properties.Resources.UpdateAvailableTitle,
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (answer != DialogResult.Yes) return;
try
{
trayIcon?.ShowBalloonTip(
4000,
Properties.Resources.UpdateAvailableTitle,
Properties.Resources.UpdateDownloading,
ToolTipIcon.Info);
var installerPath = await UpdateInstaller.DownloadAsync(info);
Program.RestartApplicationForUpdate(installerPath);
}
catch (Exception ex)
{
Log(ex, "Update-Installation fehlgeschlagen");
MessageBox.Show(
this,
Properties.Resources.UpdateInstallFailed,
Properties.Resources.UpdateAvailableTitle,
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void OpenReleasePage(string url)
{
if (string.IsNullOrWhiteSpace(url)) return;
try
{
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
}
catch (Exception ex) { Log(ex, "Release-Seite öffnen fehlgeschlagen"); }
}
private void UpdateTrayMenuInactivityState()
{
// Direkte Referenz statt Suche: das Untermenü hängt seit der Menü-
// Umstrukturierung unter „Einstellungen → App" und wäre auf der
// obersten Ebene nicht mehr auffindbar.
if (_inactivityMenu == null) return;
int current = Properties.Settings.Default.InactivityTimeoutSeconds;
foreach (var item in _inactivityMenu.DropDownItems.OfType<ToolStripMenuItem>())
if (item.Tag is int sec)
item.Checked = sec == current;
}
// ------------------------------------------------------------------
// Inaktivitäts-Timer
// ------------------------------------------------------------------
private void InactivityMenuItem_Click(object? sender, EventArgs e)
{
if (sender is not ToolStripMenuItem clicked) return;
int seconds = Convert.ToInt32(clicked.Tag ?? 0);
_inactivity?.SetTimeout(seconds);
if (clicked.OwnerItem is ToolStripMenuItem parent)
foreach (var item in parent.DropDownItems.OfType<ToolStripMenuItem>())
item.Checked = item == clicked;
}
// ------------------------------------------------------------------
// Thema / Dark Mode
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// Rate Limits
// ------------------------------------------------------------------
private async Task InitializeRateLimitManagerAsync()
{
// Kurz warten bis WebView initialisiert ist
await Task.Delay(3000);
if (_webViewManager == null) return;
_rateLimitManager = new RateLimitManager(_webViewManager, UpdateRateLimitMenu);
_rateLimitManager.StartAutoRefresh();
await _rateLimitManager.RefreshAsync();
}
private void UpdateRateLimitMenu()
{
if (_rateLimitMenu == null) return;
if (this.IsDisposed || !this.IsHandleCreated) return;
try
{
this.BeginInvoke((System.Windows.Forms.MethodInvoker)(() =>
{
try
{
var result = _rateLimitManager?.LastResult;
// Alle Items außer Separator und Refresh-Button entfernen
var toRemove = _rateLimitMenu.DropDownItems
.OfType<ToolStripItem>()
.Where(i => i is not ToolStripSeparator &&
i.Text != Properties.Resources.RateLimitRefresh)
.ToList();
foreach (var item in toRemove)
_rateLimitMenu.DropDownItems.Remove(item);
if (result == null)
{
_rateLimitMenu.DropDownItems.Insert(0,
new ToolStripMenuItem(Properties.Resources.RateLimitLoading) { Enabled = false });
return;
}
if (result.FetchError != null)
{
_rateLimitMenu.DropDownItems.Insert(0,
new ToolStripMenuItem(
string.Format(Properties.Resources.RateLimitError0, result.FetchError))
{ Enabled = false });
return;
}
int insertAt = 0;
// Grok 3
insertAt = InsertRateLimitItems(_rateLimitMenu, insertAt,
"Grok 3", result.Grok3);
// Grok 4 Heavy
insertAt = InsertRateLimitItems(_rateLimitMenu, insertAt,
"Grok 4 Heavy", result.Grok4Heavy);
// Zeitstempel
var tsItem = new ToolStripMenuItem(
string.Format(Properties.Resources.RateLimitUpdatedAt0,
result.FetchedAt.ToString("HH:mm:ss")))
{ Enabled = false, Font = new Font("Segoe UI", 7.5f) };
_rateLimitMenu.DropDownItems.Insert(insertAt, tsItem);
}
catch (Exception ex)
{
Trace.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} [MainForm] UpdateRateLimitMenu failed: {ex}");
}
}));
}
catch { }
}
/// <summary>
/// Farbe fuer knappe Kontingente, sonst null (dann bleibt die Standardfarbe).
/// Die Toene sind so gewaehlt, dass sie auf hellem wie dunklem Menuehintergrund
/// lesbar bleiben – reines Rot waere auf Dunkel schlecht erkennbar.
/// </summary>
private static Color? SeverityColor(RateLimitEntry entry) => entry.Severity switch
{
RateLimitSeverity.Critical => Color.FromArgb(220, 60, 60), // rot
RateLimitSeverity.Warning => Color.FromArgb(200, 130, 0), // orange
_ => null
};
private static int InsertRateLimitItems(ToolStripMenuItem menu, int insertAt, string label, RateLimitEntry? entry)
{
if (entry == null) return insertAt;
string text;
if (entry.IsError)
{
text = entry.Error == "UNAUTHORIZED"
? string.Format(Properties.Resources.RateLimitModel0NotLoggedIn, label)
: string.Format(Properties.Resources.RateLimitModel0Error1, label, entry.Error);
}
else if (entry.IsUnknown)
{
text = string.Format(Properties.Resources.RateLimitModel0Unknown, label);
}
else
{
text = string.Format(Properties.Resources.RateLimitModel0Remaining1Of2,
label, entry.RemainingQueries, entry.TotalQueries);
}
var item = new ToolStripMenuItem(text) { Enabled = false };
// Farbe erst ab "knapp": Solange reichlich Kontingent da ist, bleibt der
// Eintrag unauffaellig grau wie die uebrigen deaktivierten Menuepunkte.
// Deaktivierte Items zeichnet WinForms sonst grundsaetzlich ausgegraut,
// deshalb muss die Farbe ueber ForeColor gesetzt werden.
var accent = SeverityColor(entry);
if (accent.HasValue)
{
item.ForeColor = accent.Value;
item.Font = new Font(item.Font ?? SystemFonts.MenuFont!, FontStyle.Bold);
}
if (!entry.IsError && !entry.IsUnknown && !string.IsNullOrEmpty(entry.ResetInfo))
{
var resetItem = new ToolStripMenuItem($" {entry.ResetInfo}") { Enabled = false,
Font = new Font("Segoe UI", 7.5f) };
menu.DropDownItems.Insert(insertAt++, item);
menu.DropDownItems.Insert(insertAt++, resetItem);
}
else
{
menu.DropDownItems.Insert(insertAt++, item);
}
return insertAt;
}
}
}