using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
using AxCopilot.Services.Agent;
namespace AxCopilot.Views;
public partial class ChatWindow
{
private DispatcherTimer? _v2LiveElapsedTimer;
private DateTime _v2LiveStartTime;
private TextBlock? _v2LiveElapsedText;
private Border? _v2LiveStatusCard;
private TextBlock? _v2LiveStatusText;
private TextBlock? _v2LiveStatusDetailText;
private TextBlock? _v2LiveStatusMetaText;
/// V2: 스트리밍 시작 시 라이브 진행 컨테이너 생성
private void ShowAgentLiveCardV2(string runTab)
{
if (MessageList == null) return;
if (!string.Equals(runTab, _activeTab, StringComparison.OrdinalIgnoreCase)) return;
RemoveAgentLiveCardV2(animated: false);
_v2LiveStartTime = DateTime.UtcNow;
_v2LiveToolCards.Clear();
_v2LastLiveToolCallId = null;
var msgMaxWidth = GetMessageMaxWidth();
var accentBrush = TryFindResource("AccentColor") as Brush ?? Brushes.CornflowerBlue;
var accentColor = ResolveLiveProgressAccentColor(accentBrush);
var secondaryText = TryFindResource("SecondaryText") as Brush ?? Brushes.Gray;
var primaryText = TryFindResource("PrimaryText") as Brush ?? Brushes.White;
_v2LiveContainer = new StackPanel
{
HorizontalAlignment = HorizontalAlignment.Center,
Width = msgMaxWidth,
MaxWidth = msgMaxWidth,
Margin = new Thickness(0, 4, 0, 6),
};
var headerGrid = new Grid { Margin = new Thickness(2, 0, 0, 4) };
headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
var (agentName, _, _) = GetAgentIdentity();
var (liveIconHost, livePixels, liveGlows, liveRotate, liveScale) = CreateMiniLauncherIconEx(4.0, "none");
var canvas = liveIconHost.Children.OfType