- 일반 설정의 AX Commander 섹션에 성능, 포모도로, 메모, 날씨, 일정, 배터리 위젯 표시 토글을 추가 - 런처 하단의 Ollama, API, MCP 서버 상태 위젯을 완전히 제거하고 남은 위젯만 설정값 기준으로 표시되도록 정리 - 배터리 위젯은 실제 배터리 가용 상태와 사용자 토글을 함께 반영하고 위젯이 모두 꺼지면 하단 바 전체를 숨기도록 조정 - README와 DEVELOPMENT 문서를 2026-04-05 15:16 (KST) 기준으로 갱신하고 dotnet build 검증에서 경고 0 오류 0 확인
This commit is contained in:
@@ -8,24 +8,17 @@ namespace AxCopilot.Views;
|
||||
public partial class LauncherWindow
|
||||
{
|
||||
private DispatcherTimer? _widgetTimer;
|
||||
private static readonly SolidColorBrush DotOnline = new(Color.FromRgb(0x10, 0xB9, 0x81));
|
||||
private static readonly SolidColorBrush DotOffline = new(Color.FromRgb(0x9E, 0x9E, 0x9E));
|
||||
private int _widgetBatteryTick;
|
||||
private int _widgetWeatherTick;
|
||||
|
||||
internal void StartWidgetUpdates()
|
||||
{
|
||||
var settings = CurrentApp?.SettingsService?.Settings;
|
||||
|
||||
PerformanceMonitorService.Instance.StartPolling();
|
||||
ServerStatusService.Instance.Start(settings);
|
||||
PomodoroService.Instance.StateChanged -= OnPomoStateChanged;
|
||||
PomodoroService.Instance.StateChanged += OnPomoStateChanged;
|
||||
ServerStatusService.Instance.StatusChanged -= OnServerStatusChanged;
|
||||
ServerStatusService.Instance.StatusChanged += OnServerStatusChanged;
|
||||
|
||||
_vm.UpdateWidgets();
|
||||
UpdateServerDots();
|
||||
UpdateWidgetVisibility();
|
||||
UpdateBatteryWidget();
|
||||
_ = RefreshWeatherAsync();
|
||||
|
||||
@@ -38,7 +31,7 @@ public partial class LauncherWindow
|
||||
_widgetTimer.Tick += (_, _) =>
|
||||
{
|
||||
_vm.UpdateWidgets();
|
||||
UpdateServerDots();
|
||||
UpdateWidgetVisibility();
|
||||
if (_vm.Widget_PerfText.Length > 0 && _widgetBatteryTick++ % 30 == 0)
|
||||
UpdateBatteryWidget();
|
||||
if (_widgetWeatherTick++ % 120 == 0)
|
||||
@@ -55,7 +48,6 @@ public partial class LauncherWindow
|
||||
_widgetTimer?.Stop();
|
||||
PerformanceMonitorService.Instance.StopPolling();
|
||||
PomodoroService.Instance.StateChanged -= OnPomoStateChanged;
|
||||
ServerStatusService.Instance.StatusChanged -= OnServerStatusChanged;
|
||||
}
|
||||
|
||||
private void OnPomoStateChanged(object? sender, EventArgs e)
|
||||
@@ -64,23 +56,10 @@ public partial class LauncherWindow
|
||||
{
|
||||
_vm.UpdateWidgets();
|
||||
UpdatePomoWidgetStyle();
|
||||
UpdateWidgetVisibility();
|
||||
});
|
||||
}
|
||||
|
||||
private void OnServerStatusChanged(object? sender, EventArgs e)
|
||||
=> Dispatcher.InvokeAsync(UpdateServerDots);
|
||||
|
||||
private void UpdateServerDots()
|
||||
{
|
||||
var server = ServerStatusService.Instance;
|
||||
if (OllamaStatusDot != null)
|
||||
OllamaStatusDot.Fill = server.OllamaOnline ? DotOnline : DotOffline;
|
||||
if (LlmStatusDot != null)
|
||||
LlmStatusDot.Fill = server.LlmOnline ? DotOnline : DotOffline;
|
||||
if (McpStatusDot != null)
|
||||
McpStatusDot.Fill = server.McpOnline ? DotOnline : DotOffline;
|
||||
}
|
||||
|
||||
private void UpdatePomoWidgetStyle()
|
||||
{
|
||||
if (WgtPomo == null)
|
||||
@@ -92,6 +71,37 @@ public partial class LauncherWindow
|
||||
: new SolidColorBrush(Color.FromArgb(0x0D, 0xF5, 0x9E, 0x0B));
|
||||
}
|
||||
|
||||
private void UpdateWidgetVisibility()
|
||||
{
|
||||
var launcher = CurrentApp?.SettingsService?.Settings?.Launcher;
|
||||
if (launcher == null)
|
||||
return;
|
||||
|
||||
if (WgtPerf != null)
|
||||
WgtPerf.Visibility = launcher.ShowWidgetPerf ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (WgtPomo != null)
|
||||
WgtPomo.Visibility = launcher.ShowWidgetPomo ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (WgtNote != null)
|
||||
WgtNote.Visibility = launcher.ShowWidgetNote ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (WgtWeather != null)
|
||||
WgtWeather.Visibility = launcher.ShowWidgetWeather ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (WgtCal != null)
|
||||
WgtCal.Visibility = launcher.ShowWidgetCalendar ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (WgtBattery != null)
|
||||
WgtBattery.Visibility = launcher.ShowWidgetBattery && _vm.Widget_BatteryVisible ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
var hasAny =
|
||||
launcher.ShowWidgetPerf ||
|
||||
launcher.ShowWidgetPomo ||
|
||||
launcher.ShowWidgetNote ||
|
||||
launcher.ShowWidgetWeather ||
|
||||
launcher.ShowWidgetCalendar ||
|
||||
(launcher.ShowWidgetBattery && _vm.Widget_BatteryVisible);
|
||||
|
||||
if (WidgetBar != null)
|
||||
WidgetBar.Visibility = hasAny ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void WgtPerf_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
_vm.InputText = "info ";
|
||||
@@ -110,14 +120,6 @@ public partial class LauncherWindow
|
||||
InputBox?.Focus();
|
||||
}
|
||||
|
||||
private void WgtServer_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
var settings = CurrentApp?.SettingsService?.Settings;
|
||||
ServerStatusService.Instance.Refresh(settings);
|
||||
_vm.InputText = "port";
|
||||
InputBox?.Focus();
|
||||
}
|
||||
|
||||
private void WgtWeather_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
var internalMode = CurrentApp?.SettingsService?.Settings.InternalModeEnabled ?? true;
|
||||
@@ -153,7 +155,7 @@ public partial class LauncherWindow
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogService.Warn($"달력 열기 실패: {ex.Message}");
|
||||
LogService.Warn($"일정 열기 실패: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,6 +181,7 @@ public partial class LauncherWindow
|
||||
if (pct > 1.0f || pct < 0f)
|
||||
{
|
||||
_vm.Widget_BatteryVisible = false;
|
||||
UpdateWidgetVisibility();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -192,11 +195,13 @@ public partial class LauncherWindow
|
||||
: pctInt >= 50 ? "\uEBA3"
|
||||
: pctInt >= 25 ? "\uEBA1"
|
||||
: "\uEBA0";
|
||||
UpdateWidgetVisibility();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogService.Warn($"배터리 위젯 갱신 실패: {ex.Message}");
|
||||
LogService.Warn($"배터리 상태 갱신 실패: {ex.Message}");
|
||||
_vm.Widget_BatteryVisible = false;
|
||||
UpdateWidgetVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +209,10 @@ public partial class LauncherWindow
|
||||
{
|
||||
var internalMode = CurrentApp?.SettingsService?.Settings.InternalModeEnabled ?? true;
|
||||
await WeatherWidgetService.RefreshAsync(internalMode);
|
||||
await Dispatcher.InvokeAsync(() => { _vm.Widget_WeatherText = WeatherWidgetService.CachedText; });
|
||||
await Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
_vm.Widget_WeatherText = WeatherWidgetService.CachedText;
|
||||
UpdateWidgetVisibility();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user