refactor(tray): remove two unused tray menu helpers (~240 lines) (#251)
* refactor(tray): remove unused BuildTrayMenuFlyout Method was never called. Active tray menu is driven by BuildTrayMenuPopup(TrayMenuWindow) via ShowTrayMenuPopup(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(tray): remove legacy unused BuildTrayMenu Method was explicitly marked "for reference" in a comment but never called. BuildTrayMenuPopup(TrayMenuWindow) is the active implementation. Removes the comment and the entire method body. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: AlexAlves87 <alexalves87@github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
61ef7d14c0
commit
72ffc78b62
@ -441,107 +441,6 @@ public partial class App : Application
|
||||
ShowTrayMenuPopup();
|
||||
}
|
||||
|
||||
private MenuFlyout BuildTrayMenuFlyout()
|
||||
{
|
||||
// Pre-fetch data (fire and forget - flyout will show with cached data)
|
||||
if (_gatewayClient != null && _currentStatus == ConnectionStatus.Connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
_ = _gatewayClient.CheckHealthAsync();
|
||||
_ = _gatewayClient.RequestSessionsAsync();
|
||||
_ = _gatewayClient.RequestUsageAsync();
|
||||
}
|
||||
catch { /* ignore */ }
|
||||
}
|
||||
|
||||
var flyout = new MenuFlyout();
|
||||
|
||||
// Brand header
|
||||
var header = new MenuFlyoutItem { Text = "🦞 Molty", IsEnabled = false };
|
||||
header.FontWeight = Microsoft.UI.Text.FontWeights.Bold;
|
||||
flyout.Items.Add(header);
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
|
||||
// Status
|
||||
var statusIcon = MenuDisplayHelper.GetStatusIcon(_currentStatus);
|
||||
var statusItem = new MenuFlyoutItem { Text = $"{statusIcon} Status: {_currentStatus}" };
|
||||
statusItem.Click += (s, e) => ShowStatusDetail();
|
||||
flyout.Items.Add(statusItem);
|
||||
|
||||
// Activity (if any)
|
||||
if (_currentActivity != null && _currentActivity.Kind != OpenClaw.Shared.ActivityKind.Idle)
|
||||
{
|
||||
flyout.Items.Add(new MenuFlyoutItem
|
||||
{
|
||||
Text = $"{_currentActivity.Glyph} {_currentActivity.DisplayText}",
|
||||
IsEnabled = false
|
||||
});
|
||||
}
|
||||
|
||||
// Usage
|
||||
if (_lastUsage != null)
|
||||
{
|
||||
flyout.Items.Add(new MenuFlyoutItem
|
||||
{
|
||||
Text = $"📊 {_lastUsage.DisplayText}",
|
||||
IsEnabled = false
|
||||
});
|
||||
}
|
||||
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
|
||||
// Sessions
|
||||
if (_lastSessions.Length > 0)
|
||||
{
|
||||
var sessionsMenu = new MenuFlyoutSubItem { Text = $"📋 {string.Format(LocalizationHelper.GetString("Menu_SessionsFormat"), _lastSessions.Length)}" };
|
||||
foreach (var session in _lastSessions.Take(5))
|
||||
{
|
||||
var sessionItem = new MenuFlyoutItem { Text = session.DisplayText };
|
||||
var sessionKey = session.Key;
|
||||
sessionItem.Click += (s, e) => OpenDashboard($"sessions/{sessionKey}");
|
||||
sessionsMenu.Items.Add(sessionItem);
|
||||
}
|
||||
flyout.Items.Add(sessionsMenu);
|
||||
}
|
||||
|
||||
// Quick actions
|
||||
var dashboardItem = new MenuFlyoutItem { Text = "🌐 Open Dashboard" };
|
||||
dashboardItem.Click += (s, e) => OpenDashboard();
|
||||
flyout.Items.Add(dashboardItem);
|
||||
|
||||
var chatItem = new MenuFlyoutItem { Text = "💬 Web Chat" };
|
||||
chatItem.Click += (s, e) => ShowWebChat();
|
||||
flyout.Items.Add(chatItem);
|
||||
|
||||
var quickSendItem = new MenuFlyoutItem { Text = "✉️ Quick Send" };
|
||||
quickSendItem.Click += (s, e) => ShowQuickSend();
|
||||
flyout.Items.Add(quickSendItem);
|
||||
|
||||
var historyItem = new MenuFlyoutItem { Text = "📜 Notification History" };
|
||||
historyItem.Click += (s, e) => ShowNotificationHistory();
|
||||
flyout.Items.Add(historyItem);
|
||||
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
|
||||
// Settings & Exit
|
||||
var settingsItem = new MenuFlyoutItem { Text = "⚙️ Settings" };
|
||||
settingsItem.Click += (s, e) => ShowSettings();
|
||||
flyout.Items.Add(settingsItem);
|
||||
|
||||
var logItem = new MenuFlyoutItem { Text = "📄 View Log" };
|
||||
logItem.Click += (s, e) => OpenLogFile();
|
||||
flyout.Items.Add(logItem);
|
||||
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
|
||||
var exitItem = new MenuFlyoutItem { Text = "❌ Exit" };
|
||||
exitItem.Click += (s, e) => ExitApplication();
|
||||
flyout.Items.Add(exitItem);
|
||||
|
||||
return flyout;
|
||||
}
|
||||
|
||||
private async void ShowTrayMenuPopup()
|
||||
{
|
||||
try
|
||||
@ -1077,143 +976,6 @@ public partial class App : Application
|
||||
menu.AddMenuItem(LocalizationHelper.GetString("Menu_Exit"), "❌", "exit");
|
||||
}
|
||||
|
||||
// Keep the old MenuFlyout method for reference but it won't be used
|
||||
private void BuildTrayMenu(MenuFlyout flyout)
|
||||
{
|
||||
// Brand header
|
||||
var brandItem = new MenuFlyoutItem
|
||||
{
|
||||
Text = "🦞 OpenClaw Tray",
|
||||
IsEnabled = false
|
||||
};
|
||||
flyout.Items.Add(brandItem);
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
|
||||
// Status
|
||||
var statusIcon = MenuDisplayHelper.GetStatusIcon(_currentStatus);
|
||||
var statusItem = new MenuFlyoutItem
|
||||
{
|
||||
Text = $"{statusIcon} Status: {_currentStatus}"
|
||||
};
|
||||
statusItem.Click += (s, e) => ShowStatusDetail();
|
||||
flyout.Items.Add(statusItem);
|
||||
|
||||
// Activity (if any)
|
||||
if (_currentActivity != null && _currentActivity.Kind != OpenClaw.Shared.ActivityKind.Idle)
|
||||
{
|
||||
var activityItem = new MenuFlyoutItem
|
||||
{
|
||||
Text = $"{_currentActivity.Glyph} {_currentActivity.DisplayText}",
|
||||
IsEnabled = false
|
||||
};
|
||||
flyout.Items.Add(activityItem);
|
||||
}
|
||||
|
||||
// Usage
|
||||
if (_lastUsage != null)
|
||||
{
|
||||
var usageItem = new MenuFlyoutItem
|
||||
{
|
||||
Text = $"📊 {_lastUsage.DisplayText}",
|
||||
IsEnabled = false
|
||||
};
|
||||
flyout.Items.Add(usageItem);
|
||||
}
|
||||
|
||||
// Sessions
|
||||
if (_lastSessions.Length > 0)
|
||||
{
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
var sessionsHeader = new MenuFlyoutItem
|
||||
{
|
||||
Text = $"💬 {string.Format(LocalizationHelper.GetString("Menu_SessionsFormat"), _lastSessions.Length)}"
|
||||
};
|
||||
sessionsHeader.Click += (s, e) => OpenDashboard("sessions");
|
||||
flyout.Items.Add(sessionsHeader);
|
||||
|
||||
foreach (var session in _lastSessions.Take(5))
|
||||
{
|
||||
var sessionItem = new MenuFlyoutItem
|
||||
{
|
||||
Text = $" • {session.DisplayText}"
|
||||
};
|
||||
sessionItem.Click += (s, e) => OpenDashboard($"sessions/{session.Key}");
|
||||
flyout.Items.Add(sessionItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Channels
|
||||
if (_lastChannels.Length > 0)
|
||||
{
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
var channelsHeader = new MenuFlyoutItem
|
||||
{
|
||||
Text = "📡 Channels",
|
||||
IsEnabled = false
|
||||
};
|
||||
flyout.Items.Add(channelsHeader);
|
||||
|
||||
foreach (var channel in _lastChannels)
|
||||
{
|
||||
var channelIcon = MenuDisplayHelper.GetChannelStatusIcon(channel.Status);
|
||||
var channelItem = new MenuFlyoutItem
|
||||
{
|
||||
Text = $" {channelIcon} {channel.Name}"
|
||||
};
|
||||
channelItem.Click += (s, e) => ToggleChannel(channel.Name);
|
||||
flyout.Items.Add(channelItem);
|
||||
}
|
||||
}
|
||||
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
|
||||
// Actions
|
||||
var dashboardItem = new MenuFlyoutItem { Text = "🌐 Open Dashboard" };
|
||||
dashboardItem.Click += (s, e) => OpenDashboard();
|
||||
flyout.Items.Add(dashboardItem);
|
||||
|
||||
var webChatItem = new MenuFlyoutItem { Text = "💬 Open Web Chat" };
|
||||
webChatItem.Click += (s, e) => ShowWebChat();
|
||||
flyout.Items.Add(webChatItem);
|
||||
|
||||
var quickSendItem = new MenuFlyoutItem { Text = "📤 Quick Send..." };
|
||||
quickSendItem.Click += (s, e) => ShowQuickSend();
|
||||
flyout.Items.Add(quickSendItem);
|
||||
|
||||
var historyItem = new MenuFlyoutItem { Text = "📋 Notification History..." };
|
||||
historyItem.Click += (s, e) => ShowNotificationHistory();
|
||||
flyout.Items.Add(historyItem);
|
||||
|
||||
var healthCheckItem = new MenuFlyoutItem { Text = "🔄 Run Health Check" };
|
||||
healthCheckItem.Click += async (s, e) => await RunHealthCheckAsync(userInitiated: true);
|
||||
flyout.Items.Add(healthCheckItem);
|
||||
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
|
||||
// Settings
|
||||
var settingsItem = new MenuFlyoutItem { Text = "⚙️ Settings..." };
|
||||
settingsItem.Click += (s, e) => ShowSettings();
|
||||
flyout.Items.Add(settingsItem);
|
||||
|
||||
var autoStartItem = new ToggleMenuFlyoutItem
|
||||
{
|
||||
Text = "🚀 Auto-start",
|
||||
IsChecked = _settings?.AutoStart ?? false
|
||||
};
|
||||
autoStartItem.Click += (s, e) => ToggleAutoStart();
|
||||
flyout.Items.Add(autoStartItem);
|
||||
|
||||
flyout.Items.Add(new MenuFlyoutSeparator());
|
||||
|
||||
var logItem = new MenuFlyoutItem { Text = "📄 Open Log File" };
|
||||
logItem.Click += (s, e) => OpenLogFile();
|
||||
flyout.Items.Add(logItem);
|
||||
|
||||
var exitItem = new MenuFlyoutItem { Text = "❌ Exit" };
|
||||
exitItem.Click += (s, e) => ExitApplication();
|
||||
flyout.Items.Add(exitItem);
|
||||
}
|
||||
|
||||
#region Gateway Client
|
||||
|
||||
private void InitializeGatewayClient(bool useBootstrapHandoffAuth = false)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user