using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Threading; namespace AxCopilot.Views; public partial class ChatWindow { private void ShowAgentLiveCard(string runTab) { if (MessageList == null) return; if (!string.Equals(runTab, _activeTab, StringComparison.OrdinalIgnoreCase)) return; ShowAgentLiveCardV2(runTab); } private void UpdateAgentLiveCard(string message, string? subItem = null, string? category = null, bool clearSubItems = false) { if (_agentLiveContainer == null || _agentLiveStatusText == null) return; _agentLiveStatusText.Text = message; if (clearSubItems || (category != null && category != _agentLiveCurrentCategory)) { _agentLiveSubItemTexts.Clear(); _agentLiveSubItems?.Children.Clear(); if (category != null) _agentLiveCurrentCategory = category; } if (string.IsNullOrEmpty(subItem) || _agentLiveSubItemTexts.Contains(subItem)) return; _agentLiveSubItemTexts.Add(subItem); const int maxLiveSubItems = 8; if (_agentLiveSubItemTexts.Count > maxLiveSubItems) { _agentLiveSubItemTexts.RemoveAt(0); if (_agentLiveSubItems?.Children.Count > 0) _agentLiveSubItems.Children.RemoveAt(0); } var secondary = TryFindResource("SecondaryText") as Brush ?? Brushes.Gray; var tb = new TextBlock { Text = $"› {subItem}", FontSize = 10.5, FontFamily = s_segoeUiFont, Foreground = secondary, Opacity = 0.62, TextTrimming = TextTrimming.CharacterEllipsis, MaxWidth = 520, Margin = new Thickness(0, 1, 0, 0), }; _agentLiveSubItems?.Children.Add(tb); ForceScrollToEnd(); } private void RemoveAgentLiveCard(bool animated = true) { // V2 분기 — V2 라이브 컨테이너도 함께 정리 if (_v2LiveContainer != null) RemoveAgentLiveCardV2(animated); _agentLiveElapsedTimer?.Stop(); _agentLiveElapsedTimer = null; if (_agentLiveContainer == null) return; // 라이브 카드에 연결된 아이콘 애니메이션 상태 제거 _chatIconAnimStates.RemoveAll(s => s.Host != null && !s.Host.IsVisible); var toRemove = _agentLiveContainer; _agentLiveContainer = null; _agentLiveStatusText = null; _agentLiveSubItems = null; _agentLiveElapsedText = null; _agentLiveSubItemTexts.Clear(); _agentLiveCurrentCategory = null; if (animated && ContainsTranscriptElement(toRemove) && !IsLightweightLiveProgressMode()) { var anim = new DoubleAnimation(toRemove.Opacity, 0, TimeSpan.FromMilliseconds(160)); anim.Completed += (_, _) => RemoveTranscriptElement(toRemove); toRemove.BeginAnimation(UIElement.OpacityProperty, anim); return; } RemoveTranscriptElement(toRemove); } }