4590 lines
142 KiB
C#
4590 lines
142 KiB
C#
using System;
|
|
using System.CodeDom.Compiler;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text.Encodings.Web;
|
|
using System.Text.Json;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Input;
|
|
using System.Windows.Markup;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Effects;
|
|
using AxCopilot.Core;
|
|
using AxCopilot.Models;
|
|
using AxCopilot.Services;
|
|
using AxCopilot.Services.Agent;
|
|
using AxCopilot.ViewModels;
|
|
using Microsoft.Win32;
|
|
|
|
namespace AxCopilot.Views;
|
|
|
|
public class SettingsWindow : Window, IComponentConnector, IStyleConnector
|
|
{
|
|
private readonly SettingsViewModel _vm;
|
|
|
|
private readonly Action<string> _previewCallback;
|
|
|
|
private readonly Action _revertCallback;
|
|
|
|
private bool _saved;
|
|
|
|
private bool _notifyMoved;
|
|
|
|
private bool _toolCardsLoaded;
|
|
|
|
private HashSet<string> _disabledTools = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
internal System.Windows.Controls.RadioButton GeneralSubTabMain;
|
|
|
|
internal System.Windows.Controls.RadioButton GeneralSubTabNotify;
|
|
|
|
internal System.Windows.Controls.RadioButton GeneralSubTabStorage;
|
|
|
|
internal ScrollViewer GeneralMainPanel;
|
|
|
|
internal System.Windows.Controls.CheckBox AiEnabledToggle;
|
|
|
|
internal System.Windows.Controls.ComboBox HotkeyCombo;
|
|
|
|
internal System.Windows.Controls.TextBox NewIndexPathBox;
|
|
|
|
internal System.Windows.Controls.TextBox NewExtensionBox;
|
|
|
|
internal ScrollViewer GeneralNotifyPanel;
|
|
|
|
internal StackPanel NotifyContent;
|
|
|
|
internal ScrollViewer GeneralStoragePanel;
|
|
|
|
internal TextBlock StorageSummaryText2;
|
|
|
|
internal TextBlock StorageDriveText2;
|
|
|
|
internal StackPanel StorageDetailPanel2;
|
|
|
|
internal System.Windows.Controls.RadioButton ThemeSubTabSelect;
|
|
|
|
internal System.Windows.Controls.RadioButton ThemeSubTabColors;
|
|
|
|
internal ScrollViewer ThemeSelectPanel;
|
|
|
|
internal ItemsControl ThemeCardsPanel;
|
|
|
|
internal Grid ThemeColorsPanel;
|
|
|
|
internal System.Windows.Controls.CheckBox ChkDockAutoShow;
|
|
|
|
internal System.Windows.Controls.CheckBox ChkDockRainbowGlow;
|
|
|
|
internal Slider SliderDockOpacity;
|
|
|
|
internal StackPanel DockItemsPanel;
|
|
|
|
internal StackPanel QuoteCategoryPanel;
|
|
|
|
internal StackPanel FunctionSubTabBar;
|
|
|
|
internal System.Windows.Controls.RadioButton FuncSubTab_AI;
|
|
|
|
internal System.Windows.Controls.RadioButton FuncSubTab_Launcher;
|
|
|
|
internal System.Windows.Controls.RadioButton FuncSubTab_Design;
|
|
|
|
internal ScrollViewer FuncPanel_AI;
|
|
|
|
internal System.Windows.Controls.CheckBox ChkEnableTextAction;
|
|
|
|
internal StackPanel TextActionCommandsPanel;
|
|
|
|
internal System.Windows.Controls.CheckBox ChkEnableFileDialog;
|
|
|
|
internal ScrollViewer FuncPanel_Launcher;
|
|
|
|
internal ScrollViewer FuncPanel_Design;
|
|
|
|
internal System.Windows.Controls.CheckBox ChkEnableAutoCategory;
|
|
|
|
internal TabItem AgentTabItem;
|
|
|
|
internal StackPanel AgentSubTabs;
|
|
|
|
internal System.Windows.Controls.RadioButton AgentTabCommon;
|
|
|
|
internal System.Windows.Controls.RadioButton AgentTabChat;
|
|
|
|
internal System.Windows.Controls.RadioButton AgentTabCoworkCode;
|
|
|
|
internal System.Windows.Controls.RadioButton AgentTabCowork;
|
|
|
|
internal System.Windows.Controls.RadioButton AgentTabCode;
|
|
|
|
internal System.Windows.Controls.RadioButton AgentTabDev;
|
|
|
|
internal System.Windows.Controls.RadioButton AgentTabTools;
|
|
|
|
internal System.Windows.Controls.RadioButton AgentTabEtc;
|
|
|
|
internal ScrollViewer AgentPanelCommon;
|
|
|
|
internal StackPanel ServiceSubTabs;
|
|
|
|
internal System.Windows.Controls.RadioButton SvcTabOllama;
|
|
|
|
internal System.Windows.Controls.RadioButton SvcTabVllm;
|
|
|
|
internal System.Windows.Controls.RadioButton SvcTabGemini;
|
|
|
|
internal System.Windows.Controls.RadioButton SvcTabClaude;
|
|
|
|
internal StackPanel SvcPanelOllama;
|
|
|
|
internal System.Windows.Controls.Button BtnAddModel;
|
|
|
|
internal System.Windows.Controls.ComboBox CboActiveModel;
|
|
|
|
internal StackPanel SvcPanelVllm;
|
|
|
|
internal System.Windows.Controls.Button BtnAddVllmModel;
|
|
|
|
internal System.Windows.Controls.ComboBox CboActiveVllmModel;
|
|
|
|
internal StackPanel SvcPanelGemini;
|
|
|
|
internal StackPanel SvcPanelClaude;
|
|
|
|
internal System.Windows.Controls.Button BtnTestConnection;
|
|
|
|
internal TextBlock StorageSummaryText;
|
|
|
|
internal TextBlock StorageDriveText;
|
|
|
|
internal StackPanel StorageDetailPanel;
|
|
|
|
internal StackPanel AgentBlockSection;
|
|
|
|
internal StackPanel HookListPanel;
|
|
|
|
internal System.Windows.Controls.Button BtnBrowseSkillFolder;
|
|
|
|
internal System.Windows.Controls.Button BtnOpenSkillFolder;
|
|
|
|
internal ScrollViewer AgentPanelChat;
|
|
|
|
internal System.Windows.Controls.Button BtnAddTemplate;
|
|
|
|
internal ScrollViewer AgentPanelCoworkCode;
|
|
|
|
internal ScrollViewer AgentPanelCowork;
|
|
|
|
internal ScrollViewer AgentPanelCode;
|
|
|
|
internal ScrollViewer AgentPanelDev;
|
|
|
|
internal System.Windows.Controls.CheckBox DevModeCheckBox;
|
|
|
|
internal StackPanel DevModeContent;
|
|
|
|
internal System.Windows.Controls.CheckBox StepApprovalCheckBox;
|
|
|
|
internal StackPanel FallbackModelsPanel;
|
|
|
|
internal System.Windows.Controls.TextBox FallbackModelsBox;
|
|
|
|
internal StackPanel McpServerListPanel;
|
|
|
|
internal System.Windows.Controls.TextBox McpServersBox;
|
|
|
|
internal ScrollViewer AgentPanelEtc;
|
|
|
|
internal StackPanel AgentEtcContent;
|
|
|
|
internal ScrollViewer AgentPanelTools;
|
|
|
|
internal StackPanel ToolCardsPanel;
|
|
|
|
internal StackPanel McpStatusPanel;
|
|
|
|
internal TextBlock VersionInfoText;
|
|
|
|
private bool _contentLoaded;
|
|
|
|
public Action<bool>? SuspendHotkeyCallback { get; set; }
|
|
|
|
private bool IsEncryptionEnabled => (System.Windows.Application.Current as App)?.SettingsService?.Settings.Llm.EncryptionEnabled == true;
|
|
|
|
public SettingsWindow(SettingsViewModel vm, Action<string> previewCallback, Action revertCallback)
|
|
{
|
|
SettingsWindow settingsWindow = this;
|
|
InitializeComponent();
|
|
_vm = vm;
|
|
_previewCallback = previewCallback;
|
|
_revertCallback = revertCallback;
|
|
base.DataContext = vm;
|
|
vm.ThemePreviewRequested += delegate
|
|
{
|
|
settingsWindow._previewCallback(vm.SelectedThemeKey);
|
|
};
|
|
vm.SaveCompleted += delegate
|
|
{
|
|
settingsWindow._saved = true;
|
|
settingsWindow.Close();
|
|
Task.Run(async delegate
|
|
{
|
|
try
|
|
{
|
|
IndexService indexService = (System.Windows.Application.Current as App)?.IndexService;
|
|
if (indexService != null)
|
|
{
|
|
await indexService.BuildAsync();
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
});
|
|
};
|
|
base.Loaded += async delegate
|
|
{
|
|
settingsWindow.RefreshHotkeyBadges();
|
|
settingsWindow.SetVersionText();
|
|
settingsWindow.EnsureHotkeyInCombo();
|
|
settingsWindow.BuildQuoteCategoryCheckboxes();
|
|
settingsWindow.BuildDockBarSettings();
|
|
settingsWindow.BuildTextActionCommandsPanel();
|
|
settingsWindow.MoveBlockSectionToEtc();
|
|
App app = System.Windows.Application.Current as App;
|
|
if (SkillService.Skills.Count <= 0 && app?.SettingsService?.Settings.Llm.EnableSkillSystem == true)
|
|
{
|
|
await Task.Run(delegate
|
|
{
|
|
SkillService.EnsureSkillFolder();
|
|
SkillService.LoadSkills(app?.SettingsService?.Settings.Llm.SkillsFolderPath);
|
|
});
|
|
}
|
|
settingsWindow.BuildToolRegistryPanel();
|
|
settingsWindow.LoadAdvancedSettings();
|
|
settingsWindow.RefreshStorageInfo();
|
|
settingsWindow.UpdateDevModeContentVisibility();
|
|
settingsWindow.ApplyAiEnabledState(app?.SettingsService?.Settings.AiEnabled == true, init: true);
|
|
};
|
|
}
|
|
|
|
private void MoveBlockSectionToEtc()
|
|
{
|
|
if (AgentBlockSection != null && AgentEtcContent != null && AgentBlockSection.Parent is System.Windows.Controls.Panel panel)
|
|
{
|
|
panel.Children.Remove(AgentBlockSection);
|
|
AgentBlockSection.Margin = new Thickness(0.0, 0.0, 0.0, 16.0);
|
|
AgentEtcContent.Children.Add(AgentBlockSection);
|
|
}
|
|
}
|
|
|
|
private Border CreateCollapsibleSection(string title, UIElement content, bool expanded = true)
|
|
{
|
|
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
|
|
SolidColorBrush headerColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AAAACC"));
|
|
StackPanel stackPanel = new StackPanel();
|
|
StackPanel contentPanel = new StackPanel
|
|
{
|
|
Visibility = ((!expanded) ? Visibility.Collapsed : Visibility.Visible)
|
|
};
|
|
if (content is System.Windows.Controls.Panel)
|
|
{
|
|
contentPanel.Children.Add(content);
|
|
}
|
|
else
|
|
{
|
|
contentPanel.Children.Add(content);
|
|
}
|
|
TextBlock arrow = new TextBlock
|
|
{
|
|
Text = "\ue70d",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 9.0,
|
|
Foreground = headerColor,
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 6.0, 0.0),
|
|
RenderTransformOrigin = new Point(0.5, 0.5),
|
|
RenderTransform = new RotateTransform(expanded ? 90 : 0)
|
|
};
|
|
TextBlock titleBlock = new TextBlock
|
|
{
|
|
Text = title,
|
|
FontSize = 10.5,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = headerColor,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
stackPanel2.Children.Add(arrow);
|
|
stackPanel2.Children.Add(titleBlock);
|
|
Border border = new Border
|
|
{
|
|
Background = Brushes.Transparent,
|
|
Cursor = System.Windows.Input.Cursors.Hand,
|
|
Padding = new Thickness(2.0, 10.0, 2.0, 6.0),
|
|
Child = stackPanel2
|
|
};
|
|
border.MouseLeftButtonUp += delegate
|
|
{
|
|
bool flag = contentPanel.Visibility == Visibility.Visible;
|
|
contentPanel.Visibility = (flag ? Visibility.Collapsed : Visibility.Visible);
|
|
arrow.RenderTransform = new RotateTransform((!flag) ? 90 : 0);
|
|
};
|
|
border.MouseEnter += delegate
|
|
{
|
|
titleBlock.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#CCCCEE"));
|
|
};
|
|
border.MouseLeave += delegate
|
|
{
|
|
titleBlock.Foreground = headerColor;
|
|
};
|
|
stackPanel.Children.Add(border);
|
|
stackPanel.Children.Add(contentPanel);
|
|
return new Border
|
|
{
|
|
Child = stackPanel,
|
|
Margin = new Thickness(0.0, 2.0, 0.0, 0.0)
|
|
};
|
|
}
|
|
|
|
private Border CreateCollapsibleSection(string title, IEnumerable<UIElement> children, bool expanded = true)
|
|
{
|
|
StackPanel stackPanel = new StackPanel();
|
|
foreach (UIElement child in children)
|
|
{
|
|
stackPanel.Children.Add(child);
|
|
}
|
|
return CreateCollapsibleSection(title, stackPanel, expanded);
|
|
}
|
|
|
|
private void BuildToolRegistryPanel()
|
|
{
|
|
//IL_07a2: Unknown result type (might be due to invalid IL or missing references)
|
|
if (AgentEtcContent == null)
|
|
{
|
|
return;
|
|
}
|
|
(string, string, string, (string, string)[])[] array = new(string, string, string, (string, string)[])[7]
|
|
{
|
|
("파일/검색", "\ue8b7", "#F59E0B", new(string, string)[7]
|
|
{
|
|
("file_read", "파일 읽기 — 텍스트/바이너리 파일의 내용을 읽습니다"),
|
|
("file_write", "파일 쓰기 — 새 파일을 생성하거나 기존 파일을 덮어씁니다"),
|
|
("file_edit", "파일 편집 — 줄 번호 기반으로 파일의 특정 부분을 수정합니다"),
|
|
("glob", "파일 패턴 검색 — 글로브 패턴으로 파일을 찾습니다 (예: **/*.cs)"),
|
|
("grep_tool", "텍스트 검색 — 정규식으로 파일 내용을 검색합니다"),
|
|
("folder_map", "폴더 구조 — 프로젝트의 디렉토리 트리를 조회합니다"),
|
|
("document_read", "문서 읽기 — PDF, DOCX 등 문서 파일의 텍스트를 추출합니다")
|
|
}),
|
|
("프로세스/빌드", "\ue756", "#06B6D4", new(string, string)[3]
|
|
{
|
|
("process", "프로세스 실행 — 외부 명령/프로그램을 실행합니다"),
|
|
("build_run", "빌드/테스트 — 프로젝트 타입을 감지하여 빌드/테스트를 실행합니다"),
|
|
("dev_env_detect", "개발 환경 감지 — IDE, 런타임, 빌드 도구를 자동으로 인식합니다")
|
|
}),
|
|
("코드 분석", "\ue943", "#818CF8", new(string, string)[6]
|
|
{
|
|
("search_codebase", "코드 키워드 검색 — TF-IDF 기반으로 관련 코드를 찾습니다"),
|
|
("code_review", "AI 코드 리뷰 — Git diff 분석, 파일 정적 검사, PR 요약"),
|
|
("lsp", "LSP 인텔리전스 — 정의 이동, 참조 검색, 심볼 목록 (C#/TS/Python)"),
|
|
("test_loop", "테스트 루프 — 테스트 생성/실행/분석 자동화"),
|
|
("git_tool", "Git 작업 — status, log, diff, commit 등 Git 명령 실행"),
|
|
("snippet_runner", "코드 실행 — C#/Python/JavaScript 스니펫 즉시 실행")
|
|
}),
|
|
("문서 생성", "\ue8a5", "#34D399", new(string, string)[9]
|
|
{
|
|
("excel_create", "Excel 생성 — .xlsx 스프레드시트를 생성합니다"),
|
|
("docx_create", "Word 생성 — .docx 문서를 생성합니다"),
|
|
("csv_create", "CSV 생성 — CSV 파일을 생성합니다"),
|
|
("markdown_create", "마크다운 생성 — .md 파일을 생성합니다"),
|
|
("html_create", "HTML 생성 — HTML 파일을 생성합니다"),
|
|
("chart_create", "차트 생성 — 데이터 시각화 차트를 생성합니다"),
|
|
("batch_create", "배치 생성 — 스크립트 파일을 생성합니다"),
|
|
("document_review", "문서 검증 — 문서 품질을 검사합니다"),
|
|
("format_convert", "포맷 변환 — 문서 형식을 변환합니다")
|
|
}),
|
|
("데이터 처리", "\ue9f5", "#F59E0B", new(string, string)[6]
|
|
{
|
|
("json_tool", "JSON 처리 — JSON 파싱, 변환, 검증, 포맷팅"),
|
|
("regex_tool", "정규식 — 정규식 테스트, 추출, 치환"),
|
|
("diff_tool", "텍스트 비교 — 두 파일/텍스트 비교, 통합 diff 출력"),
|
|
("base64_tool", "인코딩 — Base64/URL 인코딩, 디코딩"),
|
|
("hash_tool", "해시 계산 — MD5/SHA256 해시 계산 (파일/텍스트)"),
|
|
("datetime_tool", "날짜/시간 — 날짜 변환, 타임존, 기간 계산")
|
|
}),
|
|
("시스템/환경", "\ue770", "#06B6D4", new(string, string)[6]
|
|
{
|
|
("clipboard_tool", "클립보드 — Windows 클립보드 읽기/쓰기 (텍스트/이미지)"),
|
|
("notify_tool", "알림 — Windows 시스템 알림 전송"),
|
|
("env_tool", "환경변수 — 환경변수 읽기/설정 (프로세스 범위)"),
|
|
("zip_tool", "압축 — 파일 압축(zip) / 해제"),
|
|
("http_tool", "HTTP — 로컬/사내 HTTP API 호출 (GET/POST)"),
|
|
("sql_tool", "SQLite — SQLite DB 쿼리 실행 (로컬 파일)")
|
|
}),
|
|
("에이전트", "\ue99a", "#F472B6", new(string, string)[5]
|
|
{
|
|
("spawn_agent", "서브에이전트 — 하위 작업을 병렬로 실행하는 서브에이전트를 생성합니다"),
|
|
("wait_agents", "에이전트 대기 — 실행 중인 서브에이전트의 결과를 수집합니다"),
|
|
("memory", "에이전트 메모리 — 프로젝트 규칙, 선호도를 저장/검색합니다"),
|
|
("skill_manager", "스킬 관리 — 스킬 목록 조회, 상세 정보, 재로드"),
|
|
("project_rules", "프로젝트 지침 — AX.md 개발 지침을 읽고 씁니다")
|
|
})
|
|
};
|
|
List<UIElement> list = new List<UIElement>();
|
|
list.Add(new TextBlock
|
|
{
|
|
Text = $"등록된 도구/커넥터 ({array.Sum(((string Category, string Icon, string IconColor, (string Name, string Desc)[] Tools) g) => g.Tools.Length)})",
|
|
FontSize = 13.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = ((TryFindResource("PrimaryText") as Brush) ?? Brushes.White),
|
|
Margin = new Thickness(2.0, 4.0, 0.0, 4.0)
|
|
});
|
|
list.Add(new TextBlock
|
|
{
|
|
Text = "에이전트가 사용할 수 있는 도구 목록입니다. 코워크/코드 탭에서 LLM이 자동으로 호출합니다.",
|
|
FontSize = 11.0,
|
|
Foreground = ((TryFindResource("SecondaryText") as Brush) ?? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#9999BB"))),
|
|
Margin = new Thickness(2.0, 0.0, 0.0, 10.0),
|
|
TextWrapping = TextWrapping.Wrap
|
|
});
|
|
(string, string, string, (string, string)[])[] array2 = array;
|
|
for (int num = 0; num < array2.Length; num++)
|
|
{
|
|
(string, string, string, (string, string)[]) tuple = array2[num];
|
|
Border border = new Border();
|
|
border.Background = (TryFindResource("ItemBackground") as Brush) ?? Brushes.White;
|
|
border.CornerRadius = new CornerRadius(10.0);
|
|
border.Padding = new Thickness(14.0, 10.0, 14.0, 10.0);
|
|
border.Margin = new Thickness(0.0, 0.0, 0.0, 6.0);
|
|
Border border2 = border;
|
|
StackPanel stackPanel = new StackPanel();
|
|
StackPanel toolItemsPanel = new StackPanel
|
|
{
|
|
Visibility = Visibility.Collapsed
|
|
};
|
|
TextBlock arrow = new TextBlock
|
|
{
|
|
Text = "\ue70d",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 9.0,
|
|
Foreground = ((TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 6.0, 0.0),
|
|
RenderTransformOrigin = new Point(0.5, 0.5),
|
|
RenderTransform = new RotateTransform(0.0)
|
|
};
|
|
Border border3 = new Border
|
|
{
|
|
Background = Brushes.Transparent,
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
stackPanel2.Children.Add(arrow);
|
|
stackPanel2.Children.Add(new TextBlock
|
|
{
|
|
Text = tuple.Item2,
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 14.0,
|
|
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(tuple.Item3)),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0)
|
|
});
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = $"{tuple.Item1} ({tuple.Item4.Length})";
|
|
textBlock.FontSize = 12.5;
|
|
textBlock.FontWeight = FontWeights.SemiBold;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1A1B2E"));
|
|
textBlock.VerticalAlignment = VerticalAlignment.Center;
|
|
TextBlock element = textBlock;
|
|
stackPanel2.Children.Add(element);
|
|
border3.Child = stackPanel2;
|
|
border3.MouseLeftButtonDown += delegate(object s, MouseButtonEventArgs e)
|
|
{
|
|
e.Handled = true;
|
|
bool flag = toolItemsPanel.Visibility == Visibility.Visible;
|
|
toolItemsPanel.Visibility = (flag ? Visibility.Collapsed : Visibility.Visible);
|
|
arrow.RenderTransform = new RotateTransform((!flag) ? 90 : 0);
|
|
};
|
|
stackPanel.Children.Add(border3);
|
|
toolItemsPanel.Children.Add(new Border
|
|
{
|
|
Height = 1.0,
|
|
Background = ((TryFindResource("BorderColor") as Brush) ?? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F0F0F4"))),
|
|
Margin = new Thickness(0.0, 6.0, 0.0, 4.0)
|
|
});
|
|
(string, string)[] item = tuple.Item4;
|
|
for (int num2 = 0; num2 < item.Length; num2++)
|
|
{
|
|
(string, string) tuple2 = item[num2];
|
|
string item2 = tuple2.Item1;
|
|
string item3 = tuple2.Item2;
|
|
Grid grid = new Grid
|
|
{
|
|
Margin = new Thickness(0.0, 3.0, 0.0, 3.0)
|
|
};
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Auto)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition());
|
|
textBlock = new TextBlock();
|
|
textBlock.Text = item2;
|
|
textBlock.FontSize = 12.0;
|
|
textBlock.FontFamily = new FontFamily("Consolas, Cascadia Code, Segoe UI");
|
|
textBlock.Foreground = (TryFindResource("AccentColor") as Brush) ?? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4B5EFC"));
|
|
textBlock.VerticalAlignment = VerticalAlignment.Center;
|
|
textBlock.MinWidth = 130.0;
|
|
textBlock.Margin = new Thickness(4.0, 0.0, 12.0, 0.0);
|
|
TextBlock element2 = textBlock;
|
|
Grid.SetColumn(element2, 0);
|
|
grid.Children.Add(element2);
|
|
textBlock = new TextBlock();
|
|
textBlock.Text = item3;
|
|
textBlock.FontSize = 11.5;
|
|
textBlock.Foreground = (TryFindResource("SecondaryText") as Brush) ?? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6666AA"));
|
|
textBlock.VerticalAlignment = VerticalAlignment.Center;
|
|
textBlock.TextWrapping = TextWrapping.Wrap;
|
|
TextBlock element3 = textBlock;
|
|
Grid.SetColumn(element3, 1);
|
|
grid.Children.Add(element3);
|
|
toolItemsPanel.Children.Add(grid);
|
|
}
|
|
stackPanel.Children.Add(toolItemsPanel);
|
|
border2.Child = stackPanel;
|
|
list.Add(border2);
|
|
}
|
|
foreach (UIElement item4 in list)
|
|
{
|
|
AgentEtcContent.Children.Insert(AgentEtcContent.Children.Count, item4);
|
|
}
|
|
int insertIdx = AgentEtcContent.Children.Count;
|
|
BuildSkillListSection(ref insertIdx);
|
|
}
|
|
|
|
private void BuildSkillListSection(ref int insertIdx)
|
|
{
|
|
if (AgentEtcContent == null)
|
|
{
|
|
return;
|
|
}
|
|
IReadOnlyList<SkillDefinition> skills = SkillService.Skills;
|
|
if (skills.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
Color color = (Color)ColorConverter.ConvertFromString("#4B5EFC");
|
|
Color color2 = (Color)ColorConverter.ConvertFromString("#6666AA");
|
|
List<UIElement> list = new List<UIElement>();
|
|
list.Add(new TextBlock
|
|
{
|
|
Text = "/ 명령으로 호출할 수 있는 스킬 목록입니다. 앱 내장 + 사용자 추가 스킬이 포함됩니다.\n(스킬은 사용자가 직접 /명령어를 입력해야 실행됩니다. LLM이 자동 호출하지 않습니다.)",
|
|
FontSize = 11.0,
|
|
Foreground = new SolidColorBrush(color2),
|
|
Margin = new Thickness(2.0, 0.0, 0.0, 10.0),
|
|
TextWrapping = TextWrapping.Wrap
|
|
});
|
|
List<SkillDefinition> list2 = skills.Where((SkillDefinition s) => string.IsNullOrEmpty(s.Requires)).ToList();
|
|
List<SkillDefinition> list3 = skills.Where((SkillDefinition s) => !string.IsNullOrEmpty(s.Requires)).ToList();
|
|
if (list2.Count > 0)
|
|
{
|
|
Border item = CreateSkillGroupCard("내장 스킬", "\ue768", "#34D399", list2);
|
|
list.Add(item);
|
|
}
|
|
if (list3.Count > 0)
|
|
{
|
|
Border item2 = CreateSkillGroupCard("고급 스킬 (런타임 필요)", "\ue9d9", "#A78BFA", list3);
|
|
list.Add(item2);
|
|
}
|
|
StackPanel stackPanel = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal,
|
|
Margin = new Thickness(2.0, 4.0, 0.0, 10.0)
|
|
};
|
|
Border border = new Border
|
|
{
|
|
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4B5EFC")),
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(14.0, 7.0, 14.0, 7.0),
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
stackPanel2.Children.Add(new TextBlock
|
|
{
|
|
Text = "\ue8b5",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 12.0,
|
|
Foreground = Brushes.White,
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 6.0, 0.0)
|
|
});
|
|
stackPanel2.Children.Add(new TextBlock
|
|
{
|
|
Text = "스킬 가져오기 (.zip)",
|
|
FontSize = 12.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = Brushes.White,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
});
|
|
border.Child = stackPanel2;
|
|
border.MouseLeftButtonUp += SkillImport_Click;
|
|
border.MouseEnter += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
((Border)s).Opacity = 0.85;
|
|
};
|
|
border.MouseLeave += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
((Border)s).Opacity = 1.0;
|
|
};
|
|
stackPanel.Children.Add(border);
|
|
Border border2 = new Border
|
|
{
|
|
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F0F1F5")),
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(14.0, 7.0, 14.0, 7.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
StackPanel stackPanel3 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
stackPanel3.Children.Add(new TextBlock
|
|
{
|
|
Text = "\uede1",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 12.0,
|
|
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#555")),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 6.0, 0.0)
|
|
});
|
|
stackPanel3.Children.Add(new TextBlock
|
|
{
|
|
Text = "스킬 내보내기",
|
|
FontSize = 12.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#444")),
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
});
|
|
border2.Child = stackPanel3;
|
|
border2.MouseLeftButtonUp += SkillExport_Click;
|
|
border2.MouseEnter += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
((Border)s).Opacity = 0.85;
|
|
};
|
|
border2.MouseLeave += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
((Border)s).Opacity = 1.0;
|
|
};
|
|
stackPanel.Children.Add(border2);
|
|
list.Add(stackPanel);
|
|
StackPanel stackPanel4 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal,
|
|
Margin = new Thickness(2.0, 0.0, 0.0, 12.0)
|
|
};
|
|
Border border3 = new Border
|
|
{
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(14.0, 7.0, 14.0, 7.0),
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0),
|
|
Background = new SolidColorBrush(Color.FromArgb(24, 75, 94, 252)),
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
StackPanel stackPanel5 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
stackPanel5.Children.Add(new TextBlock
|
|
{
|
|
Text = "\ue768",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 12.0,
|
|
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4B5EFC")),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 6.0, 0.0)
|
|
});
|
|
stackPanel5.Children.Add(new TextBlock
|
|
{
|
|
Text = "스킬 갤러리 열기",
|
|
FontSize = 12.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4B5EFC"))
|
|
});
|
|
border3.Child = stackPanel5;
|
|
border3.MouseLeftButtonUp += delegate
|
|
{
|
|
SkillGalleryWindow skillGalleryWindow = new SkillGalleryWindow();
|
|
skillGalleryWindow.Owner = Window.GetWindow((DependencyObject)(object)this);
|
|
skillGalleryWindow.ShowDialog();
|
|
};
|
|
border3.MouseEnter += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
((Border)s).Opacity = 0.8;
|
|
};
|
|
border3.MouseLeave += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
((Border)s).Opacity = 1.0;
|
|
};
|
|
stackPanel4.Children.Add(border3);
|
|
Border border4 = new Border
|
|
{
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(14.0, 7.0, 14.0, 7.0),
|
|
Background = new SolidColorBrush(Color.FromArgb(24, 167, 139, 250)),
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
StackPanel stackPanel6 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
stackPanel6.Children.Add(new TextBlock
|
|
{
|
|
Text = "\ue9d9",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 12.0,
|
|
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#A78BFA")),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 6.0, 0.0)
|
|
});
|
|
stackPanel6.Children.Add(new TextBlock
|
|
{
|
|
Text = "실행 통계 보기",
|
|
FontSize = 12.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#A78BFA"))
|
|
});
|
|
border4.Child = stackPanel6;
|
|
border4.MouseLeftButtonUp += delegate
|
|
{
|
|
AgentStatsDashboardWindow agentStatsDashboardWindow = new AgentStatsDashboardWindow();
|
|
agentStatsDashboardWindow.Owner = Window.GetWindow((DependencyObject)(object)this);
|
|
agentStatsDashboardWindow.ShowDialog();
|
|
};
|
|
border4.MouseEnter += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
((Border)s).Opacity = 0.8;
|
|
};
|
|
border4.MouseLeave += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
((Border)s).Opacity = 1.0;
|
|
};
|
|
stackPanel4.Children.Add(border4);
|
|
list.Add(stackPanel4);
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = $"슬래시 스킬 ({skills.Count})";
|
|
textBlock.FontSize = 13.0;
|
|
textBlock.FontWeight = FontWeights.SemiBold;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.White;
|
|
textBlock.Margin = new Thickness(2.0, 16.0, 0.0, 8.0);
|
|
TextBlock element = textBlock;
|
|
AgentEtcContent.Children.Insert(insertIdx++, element);
|
|
foreach (UIElement item3 in list)
|
|
{
|
|
AgentEtcContent.Children.Insert(insertIdx++, item3);
|
|
}
|
|
}
|
|
|
|
private Border CreateSkillGroupCard(string title, string icon, string colorHex, List<SkillDefinition> skills)
|
|
{
|
|
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
|
|
Color color = (Color)ColorConverter.ConvertFromString(colorHex);
|
|
Border border = new Border();
|
|
border.Background = (TryFindResource("ItemBackground") as Brush) ?? Brushes.White;
|
|
border.CornerRadius = new CornerRadius(10.0);
|
|
border.Padding = new Thickness(14.0, 10.0, 14.0, 10.0);
|
|
border.Margin = new Thickness(0.0, 0.0, 0.0, 6.0);
|
|
Border border2 = border;
|
|
StackPanel stackPanel = new StackPanel();
|
|
StackPanel skillItemsPanel = new StackPanel
|
|
{
|
|
Visibility = Visibility.Collapsed
|
|
};
|
|
TextBlock arrow = new TextBlock
|
|
{
|
|
Text = "\ue70d",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 9.0,
|
|
Foreground = ((TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 6.0, 0.0),
|
|
RenderTransformOrigin = new Point(0.5, 0.5),
|
|
RenderTransform = new RotateTransform(0.0)
|
|
};
|
|
Border border3 = new Border
|
|
{
|
|
Background = Brushes.Transparent,
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
stackPanel2.Children.Add(arrow);
|
|
stackPanel2.Children.Add(new TextBlock
|
|
{
|
|
Text = icon,
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 14.0,
|
|
Foreground = new SolidColorBrush(color),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0)
|
|
});
|
|
stackPanel2.Children.Add(new TextBlock
|
|
{
|
|
Text = $"{title} ({skills.Count})",
|
|
FontSize = 12.5,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = ((TryFindResource("PrimaryText") as Brush) ?? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1A1B2E"))),
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
});
|
|
border3.Child = stackPanel2;
|
|
border3.MouseLeftButtonDown += delegate(object s, MouseButtonEventArgs e)
|
|
{
|
|
e.Handled = true;
|
|
bool flag = skillItemsPanel.Visibility == Visibility.Visible;
|
|
skillItemsPanel.Visibility = (flag ? Visibility.Collapsed : Visibility.Visible);
|
|
arrow.RenderTransform = new RotateTransform((!flag) ? 90 : 0);
|
|
};
|
|
stackPanel.Children.Add(border3);
|
|
skillItemsPanel.Children.Add(new Border
|
|
{
|
|
Height = 1.0,
|
|
Background = ((TryFindResource("BorderColor") as Brush) ?? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F0F0F4"))),
|
|
Margin = new Thickness(0.0, 2.0, 0.0, 4.0)
|
|
});
|
|
foreach (SkillDefinition skill in skills)
|
|
{
|
|
StackPanel stackPanel3 = new StackPanel
|
|
{
|
|
Margin = new Thickness(0.0, 4.0, 0.0, 4.0)
|
|
};
|
|
StackPanel stackPanel4 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
stackPanel4.Children.Add(new TextBlock
|
|
{
|
|
Text = "/" + skill.Name,
|
|
FontSize = 12.0,
|
|
FontFamily = new FontFamily("Consolas, Cascadia Code, Segoe UI"),
|
|
Foreground = (skill.IsAvailable ? ((TryFindResource("AccentColor") as Brush) ?? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4B5EFC"))) : Brushes.Gray),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(4.0, 0.0, 8.0, 0.0),
|
|
Opacity = (skill.IsAvailable ? 1.0 : 0.5)
|
|
});
|
|
if (!skill.IsAvailable && !string.IsNullOrEmpty(skill.Requires))
|
|
{
|
|
stackPanel4.Children.Add(new Border
|
|
{
|
|
Background = new SolidColorBrush(Color.FromArgb(32, 248, 113, 113)),
|
|
CornerRadius = new CornerRadius(4.0),
|
|
Padding = new Thickness(5.0, 1.0, 5.0, 1.0),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Child = new TextBlock
|
|
{
|
|
Text = skill.UnavailableHint,
|
|
FontSize = 9.0,
|
|
Foreground = new SolidColorBrush(Color.FromRgb(248, 113, 113)),
|
|
FontWeight = FontWeights.SemiBold
|
|
}
|
|
});
|
|
}
|
|
else if (skill.IsAvailable && !string.IsNullOrEmpty(skill.Requires))
|
|
{
|
|
stackPanel4.Children.Add(new Border
|
|
{
|
|
Background = new SolidColorBrush(Color.FromArgb(32, 52, 211, 153)),
|
|
CornerRadius = new CornerRadius(4.0),
|
|
Padding = new Thickness(5.0, 1.0, 5.0, 1.0),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Child = new TextBlock
|
|
{
|
|
Text = "✓ 사용 가능",
|
|
FontSize = 9.0,
|
|
Foreground = new SolidColorBrush(Color.FromRgb(52, 211, 153)),
|
|
FontWeight = FontWeights.SemiBold
|
|
}
|
|
});
|
|
}
|
|
stackPanel3.Children.Add(stackPanel4);
|
|
stackPanel3.Children.Add(new TextBlock
|
|
{
|
|
Text = skill.Label + " — " + skill.Description,
|
|
FontSize = 11.5,
|
|
Foreground = ((TryFindResource("SecondaryText") as Brush) ?? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6666AA"))),
|
|
TextWrapping = TextWrapping.Wrap,
|
|
Margin = new Thickness(4.0, 3.0, 0.0, 0.0),
|
|
Opacity = (skill.IsAvailable ? 1.0 : 0.5)
|
|
});
|
|
skillItemsPanel.Children.Add(stackPanel3);
|
|
}
|
|
stackPanel.Children.Add(skillItemsPanel);
|
|
border2.Child = stackPanel;
|
|
return border2;
|
|
}
|
|
|
|
private void BuildTextActionCommandsPanel()
|
|
{
|
|
if (TextActionCommandsPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
TextActionCommandsPanel.Children.Clear();
|
|
SettingsService svc = (System.Windows.Application.Current as App)?.SettingsService;
|
|
if (svc == null)
|
|
{
|
|
return;
|
|
}
|
|
List<string> enabled = svc.Settings.Launcher.TextActionCommands;
|
|
Style style = TryFindResource("ToggleSwitch") as Style;
|
|
foreach (var availableCommand in TextActionPopup.AvailableCommands)
|
|
{
|
|
string item = availableCommand.Key;
|
|
string item2 = availableCommand.Label;
|
|
Grid grid = new Grid
|
|
{
|
|
Margin = new Thickness(0.0, 3.0, 0.0, 3.0)
|
|
};
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = item2;
|
|
textBlock.FontSize = 12.5;
|
|
textBlock.VerticalAlignment = VerticalAlignment.Center;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
TextBlock element = textBlock;
|
|
Grid.SetColumn(element, 0);
|
|
grid.Children.Add(element);
|
|
string capturedKey = item;
|
|
System.Windows.Controls.CheckBox cb = new System.Windows.Controls.CheckBox
|
|
{
|
|
IsChecked = enabled.Contains<string>(item, StringComparer.OrdinalIgnoreCase),
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
if (style != null)
|
|
{
|
|
cb.Style = style;
|
|
}
|
|
cb.Checked += delegate
|
|
{
|
|
if (!enabled.Contains(capturedKey))
|
|
{
|
|
enabled.Add(capturedKey);
|
|
}
|
|
svc.Save();
|
|
};
|
|
cb.Unchecked += delegate
|
|
{
|
|
if (enabled.Count <= 1)
|
|
{
|
|
cb.IsChecked = true;
|
|
}
|
|
else
|
|
{
|
|
enabled.RemoveAll((string x) => x == capturedKey);
|
|
svc.Save();
|
|
}
|
|
};
|
|
Grid.SetColumn(cb, 1);
|
|
grid.Children.Add(cb);
|
|
TextActionCommandsPanel.Children.Add(grid);
|
|
}
|
|
}
|
|
|
|
private void ThemeSubTab_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (ThemeSelectPanel != null && ThemeColorsPanel != null)
|
|
{
|
|
System.Windows.Controls.RadioButton themeSubTabSelect = ThemeSubTabSelect;
|
|
if (themeSubTabSelect != null && themeSubTabSelect.IsChecked == true)
|
|
{
|
|
ThemeSelectPanel.Visibility = Visibility.Visible;
|
|
ThemeColorsPanel.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
ThemeSelectPanel.Visibility = Visibility.Collapsed;
|
|
ThemeColorsPanel.Visibility = Visibility.Visible;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void GeneralSubTab_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (GeneralMainPanel == null || GeneralNotifyPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
if (!_notifyMoved && NotifyContent != null)
|
|
{
|
|
MoveNotifyTabContent();
|
|
_notifyMoved = true;
|
|
}
|
|
ScrollViewer generalMainPanel = GeneralMainPanel;
|
|
System.Windows.Controls.RadioButton generalSubTabMain = GeneralSubTabMain;
|
|
generalMainPanel.Visibility = ((generalSubTabMain == null || generalSubTabMain.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
ScrollViewer generalNotifyPanel = GeneralNotifyPanel;
|
|
System.Windows.Controls.RadioButton generalSubTabNotify = GeneralSubTabNotify;
|
|
generalNotifyPanel.Visibility = ((generalSubTabNotify == null || generalSubTabNotify.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
if (GeneralStoragePanel != null)
|
|
{
|
|
ScrollViewer generalStoragePanel = GeneralStoragePanel;
|
|
System.Windows.Controls.RadioButton generalSubTabStorage = GeneralSubTabStorage;
|
|
generalStoragePanel.Visibility = ((generalSubTabStorage == null || generalSubTabStorage.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
System.Windows.Controls.RadioButton generalSubTabStorage2 = GeneralSubTabStorage;
|
|
if (generalSubTabStorage2 != null && generalSubTabStorage2.IsChecked == true)
|
|
{
|
|
RefreshStorageInfo2();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void MoveNotifyTabContent()
|
|
{
|
|
System.Windows.Controls.TabControl tabControl = ((base.Content is Grid grid) ? grid.Children.OfType<System.Windows.Controls.TabControl>().FirstOrDefault() : null) ?? FindVisualChild<System.Windows.Controls.TabControl>((DependencyObject)(object)this);
|
|
if (tabControl == null)
|
|
{
|
|
return;
|
|
}
|
|
TabItem tabItem = null;
|
|
foreach (TabItem item in (IEnumerable)tabControl.Items)
|
|
{
|
|
if (item.Header?.ToString() == "알림")
|
|
{
|
|
tabItem = item;
|
|
break;
|
|
}
|
|
}
|
|
if (tabItem?.Content is ScrollViewer { Content: StackPanel content })
|
|
{
|
|
List<UIElement> list = content.Children.Cast<UIElement>().ToList();
|
|
content.Children.Clear();
|
|
foreach (UIElement item2 in list)
|
|
{
|
|
NotifyContent.Children.Add(item2);
|
|
}
|
|
}
|
|
if (tabItem != null)
|
|
{
|
|
tabItem.Visibility = Visibility.Collapsed;
|
|
}
|
|
}
|
|
|
|
private static T? FindVisualChild<T>(DependencyObject parent) where T : DependencyObject
|
|
{
|
|
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
|
|
{
|
|
DependencyObject child = VisualTreeHelper.GetChild(parent, i);
|
|
T val = (T)(object)((child is T) ? child : null);
|
|
if (val != null)
|
|
{
|
|
return val;
|
|
}
|
|
T val2 = FindVisualChild<T>(child);
|
|
if (val2 != null)
|
|
{
|
|
return val2;
|
|
}
|
|
}
|
|
return default(T);
|
|
}
|
|
|
|
private void BuildDockBarSettings()
|
|
{
|
|
SettingsService svc = (System.Windows.Application.Current as App)?.SettingsService;
|
|
if (svc == null)
|
|
{
|
|
return;
|
|
}
|
|
LauncherSettings launcher = svc.Settings.Launcher;
|
|
ChkDockAutoShow.IsChecked = launcher.DockBarAutoShow;
|
|
ChkDockAutoShow.Checked += delegate
|
|
{
|
|
launcher.DockBarAutoShow = true;
|
|
svc.Save();
|
|
(System.Windows.Application.Current as App)?.ToggleDockBar();
|
|
};
|
|
ChkDockAutoShow.Unchecked += delegate
|
|
{
|
|
launcher.DockBarAutoShow = false;
|
|
svc.Save();
|
|
};
|
|
ChkDockRainbowGlow.IsChecked = launcher.DockBarRainbowGlow;
|
|
ChkDockRainbowGlow.Checked += delegate
|
|
{
|
|
launcher.DockBarRainbowGlow = true;
|
|
svc.Save();
|
|
RefreshDock();
|
|
};
|
|
ChkDockRainbowGlow.Unchecked += delegate
|
|
{
|
|
launcher.DockBarRainbowGlow = false;
|
|
svc.Save();
|
|
RefreshDock();
|
|
};
|
|
SliderDockOpacity.Value = launcher.DockBarOpacity;
|
|
SliderDockOpacity.ValueChanged += delegate(object _, RoutedPropertyChangedEventArgs<double> e)
|
|
{
|
|
launcher.DockBarOpacity = e.NewValue;
|
|
svc.Save();
|
|
RefreshDock();
|
|
};
|
|
if (DockItemsPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
DockItemsPanel.Children.Clear();
|
|
Style style = TryFindResource("ToggleSwitch") as Style;
|
|
List<string> enabled = launcher.DockBarItems;
|
|
foreach (var availableItem in DockBarWindow.AvailableItems)
|
|
{
|
|
string item = availableItem.Key;
|
|
string item2 = availableItem.Icon;
|
|
string item3 = availableItem.Tooltip;
|
|
Grid grid = new Grid
|
|
{
|
|
Margin = new Thickness(0.0, 3.0, 0.0, 3.0)
|
|
};
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = item3 ?? "";
|
|
textBlock.FontSize = 12.5;
|
|
textBlock.VerticalAlignment = VerticalAlignment.Center;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
TextBlock element = textBlock;
|
|
Grid.SetColumn(element, 0);
|
|
grid.Children.Add(element);
|
|
string capturedKey = item;
|
|
System.Windows.Controls.CheckBox checkBox = new System.Windows.Controls.CheckBox
|
|
{
|
|
IsChecked = enabled.Contains(item),
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
if (style != null)
|
|
{
|
|
checkBox.Style = style;
|
|
}
|
|
checkBox.Checked += delegate
|
|
{
|
|
if (!enabled.Contains(capturedKey))
|
|
{
|
|
enabled.Add(capturedKey);
|
|
}
|
|
svc.Save();
|
|
RefreshDock();
|
|
};
|
|
checkBox.Unchecked += delegate
|
|
{
|
|
enabled.RemoveAll((string x) => x == capturedKey);
|
|
svc.Save();
|
|
RefreshDock();
|
|
};
|
|
Grid.SetColumn(checkBox, 1);
|
|
grid.Children.Add(checkBox);
|
|
DockItemsPanel.Children.Add(grid);
|
|
}
|
|
}
|
|
|
|
private static SolidColorBrush BrushFromHex(string hex)
|
|
{
|
|
try
|
|
{
|
|
return new SolidColorBrush((Color)ColorConverter.ConvertFromString(hex));
|
|
}
|
|
catch
|
|
{
|
|
return new SolidColorBrush(Colors.Gray);
|
|
}
|
|
}
|
|
|
|
private static void RefreshDock()
|
|
{
|
|
(System.Windows.Application.Current as App)?.RefreshDockBar();
|
|
}
|
|
|
|
private void BtnDockResetPosition_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
MessageBoxResult messageBoxResult = CustomMessageBox.Show("독 바를 화면 하단 중앙으로 이동하시겠습니까?", "독 바 위치 초기화", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
if (messageBoxResult == MessageBoxResult.Yes)
|
|
{
|
|
SettingsService settingsService = (System.Windows.Application.Current as App)?.SettingsService;
|
|
if (settingsService != null)
|
|
{
|
|
settingsService.Settings.Launcher.DockBarLeft = -1.0;
|
|
settingsService.Settings.Launcher.DockBarTop = -1.0;
|
|
settingsService.Save();
|
|
(System.Windows.Application.Current as App)?.RefreshDockBar();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void RefreshStorageInfo()
|
|
{
|
|
if (StorageSummaryText == null)
|
|
{
|
|
return;
|
|
}
|
|
StorageReport storageReport = StorageAnalyzer.Analyze();
|
|
StorageSummaryText.Text = "앱 전체 사용량: " + StorageAnalyzer.FormatSize(storageReport.TotalAppUsage);
|
|
StorageDriveText.Text = $"드라이브 {storageReport.DriveLabel} 여유: {StorageAnalyzer.FormatSize(storageReport.DriveFreeSpace)} / {StorageAnalyzer.FormatSize(storageReport.DriveTotalSpace)}";
|
|
if (StorageDetailPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
StorageDetailPanel.Children.Clear();
|
|
(string, long)[] array = new(string, long)[8]
|
|
{
|
|
("대화 기록", storageReport.Conversations),
|
|
("감사 로그", storageReport.AuditLogs),
|
|
("앱 로그", storageReport.Logs),
|
|
("코드 인덱스", storageReport.CodeIndex),
|
|
("임베딩 DB", storageReport.EmbeddingDb),
|
|
("클립보드 히스토리", storageReport.ClipboardHistory),
|
|
("플러그인", storageReport.Plugins),
|
|
("JSON 스킬", storageReport.Skills)
|
|
};
|
|
(string, long)[] array2 = array;
|
|
for (int i = 0; i < array2.Length; i++)
|
|
{
|
|
var (text, num) = array2[i];
|
|
if (num != 0)
|
|
{
|
|
Grid grid = new Grid
|
|
{
|
|
Margin = new Thickness(0.0, 2.0, 0.0, 2.0)
|
|
};
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = text;
|
|
textBlock.FontSize = 12.0;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
textBlock.VerticalAlignment = VerticalAlignment.Center;
|
|
TextBlock element = textBlock;
|
|
Grid.SetColumn(element, 0);
|
|
grid.Children.Add(element);
|
|
TextBlock element2 = new TextBlock
|
|
{
|
|
Text = StorageAnalyzer.FormatSize(num),
|
|
FontSize = 12.0,
|
|
FontFamily = new FontFamily("Consolas"),
|
|
Foreground = Brushes.Gray,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
Grid.SetColumn(element2, 1);
|
|
grid.Children.Add(element2);
|
|
StorageDetailPanel.Children.Add(grid);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BtnStorageRefresh_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
RefreshStorageInfo();
|
|
}
|
|
|
|
private void RefreshStorageInfo2()
|
|
{
|
|
if (StorageSummaryText2 == null)
|
|
{
|
|
return;
|
|
}
|
|
StorageReport storageReport = StorageAnalyzer.Analyze();
|
|
StorageSummaryText2.Text = "앱 전체 사용량: " + StorageAnalyzer.FormatSize(storageReport.TotalAppUsage);
|
|
StorageDriveText2.Text = $"드라이브 {storageReport.DriveLabel} 여유: {StorageAnalyzer.FormatSize(storageReport.DriveFreeSpace)} / {StorageAnalyzer.FormatSize(storageReport.DriveTotalSpace)}";
|
|
if (StorageDetailPanel2 == null)
|
|
{
|
|
return;
|
|
}
|
|
StorageDetailPanel2.Children.Clear();
|
|
(string, long)[] array = new(string, long)[8]
|
|
{
|
|
("대화 기록", storageReport.Conversations),
|
|
("감사 로그", storageReport.AuditLogs),
|
|
("앱 로그", storageReport.Logs),
|
|
("코드 인덱스", storageReport.CodeIndex),
|
|
("임베딩 DB", storageReport.EmbeddingDb),
|
|
("클립보드 히스토리", storageReport.ClipboardHistory),
|
|
("플러그인", storageReport.Plugins),
|
|
("JSON 스킬", storageReport.Skills)
|
|
};
|
|
(string, long)[] array2 = array;
|
|
for (int i = 0; i < array2.Length; i++)
|
|
{
|
|
var (text, num) = array2[i];
|
|
if (num != 0)
|
|
{
|
|
Grid grid = new Grid
|
|
{
|
|
Margin = new Thickness(0.0, 2.0, 0.0, 2.0)
|
|
};
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = text;
|
|
textBlock.FontSize = 12.0;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
TextBlock element = textBlock;
|
|
Grid.SetColumn(element, 0);
|
|
grid.Children.Add(element);
|
|
TextBlock element2 = new TextBlock
|
|
{
|
|
Text = StorageAnalyzer.FormatSize(num),
|
|
FontSize = 12.0,
|
|
FontFamily = new FontFamily("Consolas"),
|
|
Foreground = Brushes.Gray
|
|
};
|
|
Grid.SetColumn(element2, 1);
|
|
grid.Children.Add(element2);
|
|
StorageDetailPanel2.Children.Add(grid);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BtnStorageRefresh2_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
RefreshStorageInfo2();
|
|
}
|
|
|
|
private void BtnStorageCleanup_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
Brush background = (TryFindResource("LauncherBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(26, 27, 46));
|
|
Brush brush = (TryFindResource("PrimaryText") as Brush) ?? Brushes.White;
|
|
Brush foreground = (TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray;
|
|
Brush brush2 = (TryFindResource("BorderColor") as Brush) ?? new SolidColorBrush(Color.FromRgb(75, 94, 252));
|
|
Brush brush3 = (TryFindResource("ItemBackground") as Brush) ?? new SolidColorBrush(Color.FromArgb(16, byte.MaxValue, byte.MaxValue, byte.MaxValue));
|
|
Brush hoverBg = (TryFindResource("ItemHoverBackground") as Brush) ?? new SolidColorBrush(Color.FromArgb(34, byte.MaxValue, byte.MaxValue, byte.MaxValue));
|
|
Color color = ((TryFindResource("ShadowColor") is Color color2) ? color2 : Colors.Black);
|
|
Window popup = new Window
|
|
{
|
|
WindowStyle = WindowStyle.None,
|
|
AllowsTransparency = true,
|
|
Background = Brushes.Transparent,
|
|
Width = 360.0,
|
|
SizeToContent = SizeToContent.Height,
|
|
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
|
Owner = this,
|
|
ShowInTaskbar = false,
|
|
Topmost = true
|
|
};
|
|
int selectedDays = -1;
|
|
Border border = new Border
|
|
{
|
|
Background = background,
|
|
CornerRadius = new CornerRadius(14.0),
|
|
BorderBrush = brush2,
|
|
BorderThickness = new Thickness(1.0),
|
|
Margin = new Thickness(16.0),
|
|
Effect = new DropShadowEffect
|
|
{
|
|
BlurRadius = 20.0,
|
|
ShadowDepth = 4.0,
|
|
Opacity = 0.3,
|
|
Color = color
|
|
}
|
|
};
|
|
StackPanel stackPanel = new StackPanel
|
|
{
|
|
Margin = new Thickness(24.0, 20.0, 24.0, 20.0)
|
|
};
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "보관 기간 선택",
|
|
FontSize = 15.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = brush,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 6.0)
|
|
});
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "선택한 기간 이전의 데이터를 삭제합니다.\n※ 통계/대화 기록은 삭제되지 않습니다.",
|
|
FontSize = 12.0,
|
|
Foreground = foreground,
|
|
TextWrapping = TextWrapping.Wrap,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 16.0)
|
|
});
|
|
(int, string)[] array = new(int, string)[4]
|
|
{
|
|
(7, "최근 7일만 보관"),
|
|
(14, "최근 14일만 보관"),
|
|
(30, "최근 30일만 보관"),
|
|
(0, "전체 삭제")
|
|
};
|
|
(int, string)[] array2 = array;
|
|
for (int i = 0; i < array2.Length; i++)
|
|
{
|
|
(int, string) tuple = array2[i];
|
|
int item = tuple.Item1;
|
|
string item2 = tuple.Item2;
|
|
int d = item;
|
|
bool flag = d == 0;
|
|
SolidColorBrush solidColorBrush = new SolidColorBrush(Color.FromArgb(24, byte.MaxValue, 68, 68));
|
|
SolidColorBrush solidColorBrush2 = new SolidColorBrush(Color.FromArgb(64, byte.MaxValue, 68, 68));
|
|
SolidColorBrush solidColorBrush3 = new SolidColorBrush(Color.FromRgb(byte.MaxValue, 102, 102));
|
|
Border border2 = new Border
|
|
{
|
|
CornerRadius = new CornerRadius(10.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand,
|
|
Padding = new Thickness(14.0, 10.0, 14.0, 10.0),
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 6.0),
|
|
Background = (flag ? solidColorBrush : brush3),
|
|
BorderBrush = (flag ? solidColorBrush2 : brush2),
|
|
BorderThickness = new Thickness(1.0)
|
|
};
|
|
border2.Child = new TextBlock
|
|
{
|
|
Text = item2,
|
|
FontSize = 13.0,
|
|
Foreground = (flag ? solidColorBrush3 : brush)
|
|
};
|
|
Brush normalBg = (flag ? solidColorBrush : brush3);
|
|
border2.MouseEnter += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
if (s is Border border4)
|
|
{
|
|
border4.Background = hoverBg;
|
|
}
|
|
};
|
|
border2.MouseLeave += delegate(object s, System.Windows.Input.MouseEventArgs _)
|
|
{
|
|
if (s is Border border4)
|
|
{
|
|
border4.Background = normalBg;
|
|
}
|
|
};
|
|
border2.MouseLeftButtonUp += delegate
|
|
{
|
|
selectedDays = d;
|
|
popup.Close();
|
|
};
|
|
stackPanel.Children.Add(border2);
|
|
}
|
|
Border border3 = new Border
|
|
{
|
|
CornerRadius = new CornerRadius(10.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand,
|
|
Padding = new Thickness(14.0, 8.0, 14.0, 8.0),
|
|
Margin = new Thickness(0.0, 6.0, 0.0, 0.0),
|
|
Background = Brushes.Transparent
|
|
};
|
|
border3.Child = new TextBlock
|
|
{
|
|
Text = "취소",
|
|
FontSize = 12.0,
|
|
Foreground = foreground,
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Center
|
|
};
|
|
border3.MouseLeftButtonUp += delegate
|
|
{
|
|
popup.Close();
|
|
};
|
|
stackPanel.Children.Add(border3);
|
|
border.Child = stackPanel;
|
|
popup.Content = border;
|
|
popup.ShowDialog();
|
|
if (selectedDays >= 0)
|
|
{
|
|
string message = ((selectedDays == 0) ? "전체 데이터를 삭제합니다. 정말 진행하시겠습니까?" : $"최근 {selectedDays}일 이전의 데이터를 삭제합니다. 정말 진행하시겠습니까?");
|
|
MessageBoxResult messageBoxResult = CustomMessageBox.Show(message, "삭제 확인", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
|
|
if (messageBoxResult == MessageBoxResult.Yes)
|
|
{
|
|
long bytes = StorageAnalyzer.Cleanup(selectedDays, cleanConversations: false, cleanAuditLogs: true, cleanLogs: true, cleanCodeIndex: true, selectedDays == 0);
|
|
CustomMessageBox.Show(StorageAnalyzer.FormatSize(bytes) + "를 확보했습니다.", "정리 완료", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
|
RefreshStorageInfo();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BuildQuoteCategoryCheckboxes()
|
|
{
|
|
if (QuoteCategoryPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
QuoteCategoryPanel.Children.Clear();
|
|
List<string> enabled = _vm.GetReminderCategories();
|
|
Style style = TryFindResource("ToggleSwitch") as Style;
|
|
(string, string, Func<int>)[] categories = QuoteService.Categories;
|
|
for (int i = 0; i < categories.Length; i++)
|
|
{
|
|
(string, string, Func<int>) tuple = categories[i];
|
|
string item = tuple.Item1;
|
|
string item2 = tuple.Item2;
|
|
Func<int> item3 = tuple.Item3;
|
|
int value = item3();
|
|
string text = ((item == "today_events") ? $"{item2} ({value}개, 오늘 {QuoteService.GetTodayMatchCount()}개)" : $"{item2} ({value}개)");
|
|
Grid grid = new Grid
|
|
{
|
|
Margin = new Thickness(0.0, 3.0, 0.0, 3.0)
|
|
};
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = text;
|
|
textBlock.FontSize = 12.5;
|
|
textBlock.VerticalAlignment = VerticalAlignment.Center;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.White;
|
|
TextBlock element = textBlock;
|
|
Grid.SetColumn(element, 0);
|
|
grid.Children.Add(element);
|
|
System.Windows.Controls.CheckBox checkBox = new System.Windows.Controls.CheckBox
|
|
{
|
|
IsChecked = enabled.Contains<string>(item, StringComparer.OrdinalIgnoreCase),
|
|
Tag = item,
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
if (style != null)
|
|
{
|
|
checkBox.Style = style;
|
|
}
|
|
checkBox.Checked += delegate(object s, RoutedEventArgs _)
|
|
{
|
|
if (s is System.Windows.Controls.CheckBox { Tag: string tag } && !enabled.Contains(tag))
|
|
{
|
|
enabled.Add(tag);
|
|
}
|
|
};
|
|
checkBox.Unchecked += delegate(object s, RoutedEventArgs _)
|
|
{
|
|
if (s is System.Windows.Controls.CheckBox { Tag: var tag })
|
|
{
|
|
string k = tag as string;
|
|
if (k != null)
|
|
{
|
|
enabled.RemoveAll((string x) => x.Equals(k, StringComparison.OrdinalIgnoreCase));
|
|
}
|
|
}
|
|
};
|
|
Grid.SetColumn(checkBox, 1);
|
|
grid.Children.Add(checkBox);
|
|
QuoteCategoryPanel.Children.Add(grid);
|
|
}
|
|
}
|
|
|
|
private void SetVersionText()
|
|
{
|
|
try
|
|
{
|
|
Assembly executingAssembly = Assembly.GetExecutingAssembly();
|
|
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(executingAssembly.Location);
|
|
string text = versionInfo.ProductVersion ?? versionInfo.FileVersion ?? "?";
|
|
int num = text.IndexOf('+');
|
|
if (num > 0)
|
|
{
|
|
text = text.Substring(0, num);
|
|
}
|
|
VersionInfoText.Text = "AX Copilot · v" + text;
|
|
}
|
|
catch
|
|
{
|
|
VersionInfoText.Text = "AX Copilot";
|
|
}
|
|
}
|
|
|
|
private void RefreshHotkeyBadges()
|
|
{
|
|
}
|
|
|
|
private void EnsureHotkeyInCombo()
|
|
{
|
|
if (HotkeyCombo == null)
|
|
{
|
|
return;
|
|
}
|
|
string hotkey = _vm.Hotkey;
|
|
if (string.IsNullOrWhiteSpace(hotkey))
|
|
{
|
|
return;
|
|
}
|
|
foreach (ComboBoxItem item in (IEnumerable)HotkeyCombo.Items)
|
|
{
|
|
if (item.Tag is string text && text == hotkey)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
string text2 = hotkey.Replace("+", " + ");
|
|
ComboBoxItem insertItem = new ComboBoxItem
|
|
{
|
|
Content = text2 + " (사용자 정의)",
|
|
Tag = hotkey
|
|
};
|
|
HotkeyCombo.Items.Insert(0, insertItem);
|
|
HotkeyCombo.SelectedIndex = 0;
|
|
}
|
|
|
|
private void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
|
{
|
|
}
|
|
|
|
private unsafe static string GetKeyName(Key key)
|
|
{
|
|
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0007: Invalid comparison between Unknown and I4
|
|
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0073: Invalid comparison between Unknown and I4
|
|
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_000c: Invalid comparison between Unknown and I4
|
|
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_01b7: Expected I4, but got Unknown
|
|
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_00e4: Expected I4, but got Unknown
|
|
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0066: Invalid comparison between Unknown and I4
|
|
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0011: Invalid comparison between Unknown and I4
|
|
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_005e: Expected I4, but got Unknown
|
|
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_00e9: Invalid comparison between Unknown and I4
|
|
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_00f3: Invalid comparison between Unknown and I4
|
|
if (1 == 0)
|
|
{
|
|
}
|
|
string result;
|
|
if ((int)key >= 44)
|
|
{
|
|
if ((int)key >= 90)
|
|
{
|
|
if ((int)key > 101)
|
|
{
|
|
switch (key - 140)
|
|
{
|
|
case 6:
|
|
break;
|
|
case 3:
|
|
goto IL_01d9;
|
|
case 1:
|
|
goto IL_01e1;
|
|
case 9:
|
|
goto IL_01e9;
|
|
case 11:
|
|
goto IL_01f1;
|
|
case 10:
|
|
case 14:
|
|
goto IL_01f9;
|
|
case 0:
|
|
goto IL_0201;
|
|
case 12:
|
|
goto IL_0209;
|
|
case 2:
|
|
goto IL_0211;
|
|
case 4:
|
|
goto IL_0219;
|
|
case 5:
|
|
goto IL_0221;
|
|
default:
|
|
goto IL_0229;
|
|
}
|
|
result = "`";
|
|
}
|
|
else
|
|
{
|
|
result = ((object)(*(Key*)(&key))/*cast due to .constrained prefix*/).ToString();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ((int)key > 69)
|
|
{
|
|
goto IL_0229;
|
|
}
|
|
result = ((object)(*(Key*)(&key))/*cast due to .constrained prefix*/).ToString();
|
|
}
|
|
}
|
|
else if ((int)key < 34)
|
|
{
|
|
switch (key - 2)
|
|
{
|
|
case 16:
|
|
goto IL_00fa;
|
|
case 4:
|
|
goto IL_0105;
|
|
case 1:
|
|
goto IL_0110;
|
|
case 0:
|
|
goto IL_011b;
|
|
case 11:
|
|
goto IL_0131;
|
|
case 20:
|
|
goto IL_013c;
|
|
case 19:
|
|
goto IL_0147;
|
|
case 17:
|
|
goto IL_0152;
|
|
case 18:
|
|
goto IL_015d;
|
|
case 21:
|
|
goto IL_0168;
|
|
case 23:
|
|
goto IL_0173;
|
|
case 22:
|
|
goto IL_017e;
|
|
case 24:
|
|
goto IL_0189;
|
|
case 2:
|
|
case 3:
|
|
case 5:
|
|
case 6:
|
|
case 7:
|
|
case 8:
|
|
case 9:
|
|
case 10:
|
|
case 12:
|
|
case 13:
|
|
case 14:
|
|
case 15:
|
|
goto IL_0229;
|
|
}
|
|
if ((int)key != 31)
|
|
{
|
|
if ((int)key != 32)
|
|
{
|
|
goto IL_0229;
|
|
}
|
|
result = "Delete";
|
|
}
|
|
else
|
|
{
|
|
result = "Insert";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
result = (key - 34).ToString();
|
|
}
|
|
goto IL_0239;
|
|
IL_0219:
|
|
result = ".";
|
|
goto IL_0239;
|
|
IL_0201:
|
|
result = ";";
|
|
goto IL_0239;
|
|
IL_01f1:
|
|
result = "]";
|
|
goto IL_0239;
|
|
IL_01e9:
|
|
result = "[";
|
|
goto IL_0239;
|
|
IL_011b:
|
|
result = "Backspace";
|
|
goto IL_0239;
|
|
IL_0110:
|
|
result = "Tab";
|
|
goto IL_0239;
|
|
IL_0105:
|
|
result = "Enter";
|
|
goto IL_0239;
|
|
IL_0131:
|
|
result = "Escape";
|
|
goto IL_0239;
|
|
IL_00fa:
|
|
result = "Space";
|
|
goto IL_0239;
|
|
IL_0152:
|
|
result = "PageUp";
|
|
goto IL_0239;
|
|
IL_015d:
|
|
result = "PageDown";
|
|
goto IL_0239;
|
|
IL_0147:
|
|
result = "End";
|
|
goto IL_0239;
|
|
IL_013c:
|
|
result = "Home";
|
|
goto IL_0239;
|
|
IL_0168:
|
|
result = "Left";
|
|
goto IL_0239;
|
|
IL_017e:
|
|
result = "Up";
|
|
goto IL_0239;
|
|
IL_0173:
|
|
result = "Right";
|
|
goto IL_0239;
|
|
IL_0189:
|
|
result = "Down";
|
|
goto IL_0239;
|
|
IL_0209:
|
|
result = "'";
|
|
goto IL_0239;
|
|
IL_0229:
|
|
result = ((object)(*(Key*)(&key))/*cast due to .constrained prefix*/).ToString();
|
|
goto IL_0239;
|
|
IL_01f9:
|
|
result = "\\";
|
|
goto IL_0239;
|
|
IL_0239:
|
|
if (1 == 0)
|
|
{
|
|
}
|
|
return result;
|
|
IL_01d9:
|
|
result = "-";
|
|
goto IL_0239;
|
|
IL_0211:
|
|
result = ",";
|
|
goto IL_0239;
|
|
IL_0221:
|
|
result = "/";
|
|
goto IL_0239;
|
|
IL_01e1:
|
|
result = "=";
|
|
goto IL_0239;
|
|
}
|
|
|
|
private void HotkeyCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
}
|
|
|
|
private async void BtnTestConnection_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
System.Windows.Controls.Button btn = sender as System.Windows.Controls.Button;
|
|
if (btn != null)
|
|
{
|
|
btn.Content = "테스트 중...";
|
|
}
|
|
try
|
|
{
|
|
LlmService llm = new LlmService(_vm.Service);
|
|
var (ok, msg) = await llm.TestConnectionAsync();
|
|
llm.Dispose();
|
|
CustomMessageBox.Show(msg, ok ? "연결 성공" : "연결 실패", MessageBoxButton.OK, ok ? MessageBoxImage.Asterisk : MessageBoxImage.Exclamation);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Exception ex2 = ex;
|
|
CustomMessageBox.Show(ex2.Message, "오류", MessageBoxButton.OK, MessageBoxImage.Hand);
|
|
}
|
|
finally
|
|
{
|
|
if (btn != null)
|
|
{
|
|
btn.Content = "테스트";
|
|
}
|
|
}
|
|
}
|
|
|
|
private string GetCurrentServiceSubTab()
|
|
{
|
|
System.Windows.Controls.RadioButton svcTabOllama = SvcTabOllama;
|
|
if (svcTabOllama != null && svcTabOllama.IsChecked == true)
|
|
{
|
|
return "ollama";
|
|
}
|
|
System.Windows.Controls.RadioButton svcTabVllm = SvcTabVllm;
|
|
if (svcTabVllm != null && svcTabVllm.IsChecked == true)
|
|
{
|
|
return "vllm";
|
|
}
|
|
System.Windows.Controls.RadioButton svcTabGemini = SvcTabGemini;
|
|
if (svcTabGemini != null && svcTabGemini.IsChecked == true)
|
|
{
|
|
return "gemini";
|
|
}
|
|
System.Windows.Controls.RadioButton svcTabClaude = SvcTabClaude;
|
|
if (svcTabClaude != null && svcTabClaude.IsChecked == true)
|
|
{
|
|
return "claude";
|
|
}
|
|
return _vm.LlmService;
|
|
}
|
|
|
|
private void BtnBrowseSkillFolder_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog
|
|
{
|
|
Description = "스킬 파일이 있는 폴더를 선택하세요",
|
|
ShowNewFolderButton = true
|
|
};
|
|
if (!string.IsNullOrEmpty(_vm.SkillsFolderPath) && Directory.Exists(_vm.SkillsFolderPath))
|
|
{
|
|
folderBrowserDialog.SelectedPath = _vm.SkillsFolderPath;
|
|
}
|
|
if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
{
|
|
_vm.SkillsFolderPath = folderBrowserDialog.SelectedPath;
|
|
}
|
|
}
|
|
|
|
private void BtnOpenSkillFolder_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string text = ((!string.IsNullOrEmpty(_vm.SkillsFolderPath) && Directory.Exists(_vm.SkillsFolderPath)) ? _vm.SkillsFolderPath : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "AxCopilot", "skills"));
|
|
if (!Directory.Exists(text))
|
|
{
|
|
Directory.CreateDirectory(text);
|
|
}
|
|
try
|
|
{
|
|
Process.Start("explorer.exe", text);
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
private void SkillImport_Click(object sender, MouseButtonEventArgs e)
|
|
{
|
|
Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog
|
|
{
|
|
Filter = "스킬 패키지 (*.zip)|*.zip",
|
|
Title = "가져올 스킬 zip 파일을 선택하세요"
|
|
};
|
|
if (openFileDialog.ShowDialog() == true)
|
|
{
|
|
int num = SkillService.ImportSkills(openFileDialog.FileName);
|
|
if (num > 0)
|
|
{
|
|
CustomMessageBox.Show($"스킬 {num}개를 성공적으로 가져왔습니\ufffd\ufffd.\n스킬 목록이 갱신됩니다.", "스킬 가져오기");
|
|
}
|
|
else
|
|
{
|
|
CustomMessageBox.Show("스킬 가져오기에 실패했습니다.\nzip 파일에 .skill.md 또는 SKILL.md 파일이 포함되어야 합니다.", "스킬 가져오기");
|
|
}
|
|
}
|
|
}
|
|
|
|
private void SkillExport_Click(object sender, MouseButtonEventArgs e)
|
|
{
|
|
IReadOnlyList<SkillDefinition> skills = SkillService.Skills;
|
|
if (skills.Count == 0)
|
|
{
|
|
CustomMessageBox.Show("내보낼 스킬이 없습니다.", "스킬 내보내기");
|
|
return;
|
|
}
|
|
Window popup = new Window
|
|
{
|
|
WindowStyle = WindowStyle.None,
|
|
AllowsTransparency = true,
|
|
Background = Brushes.Transparent,
|
|
SizeToContent = SizeToContent.WidthAndHeight,
|
|
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
|
Owner = this,
|
|
MaxHeight = 450.0
|
|
};
|
|
Brush background = (TryFindResource("LauncherBackground") as Brush) ?? Brushes.White;
|
|
Brush foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
Brush foreground2 = (TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray;
|
|
Border border = new Border
|
|
{
|
|
Background = background,
|
|
CornerRadius = new CornerRadius(12.0),
|
|
Padding = new Thickness(20.0),
|
|
MinWidth = 360.0,
|
|
Effect = new DropShadowEffect
|
|
{
|
|
BlurRadius = 20.0,
|
|
ShadowDepth = 4.0,
|
|
Opacity = 0.3,
|
|
Color = Colors.Black
|
|
}
|
|
};
|
|
StackPanel stackPanel = new StackPanel();
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "내보낼 스킬 선택",
|
|
FontSize = 15.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = foreground,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 12.0)
|
|
});
|
|
List<(System.Windows.Controls.CheckBox cb, SkillDefinition skill)> checkBoxes = new List<(System.Windows.Controls.CheckBox, SkillDefinition)>();
|
|
StackPanel stackPanel2 = new StackPanel();
|
|
foreach (SkillDefinition item in skills)
|
|
{
|
|
System.Windows.Controls.CheckBox checkBox = new System.Windows.Controls.CheckBox
|
|
{
|
|
Content = "/" + item.Name + " — " + item.Label,
|
|
FontSize = 12.5,
|
|
Foreground = foreground,
|
|
Margin = new Thickness(0.0, 3.0, 0.0, 3.0),
|
|
IsChecked = false
|
|
};
|
|
checkBoxes.Add((checkBox, item));
|
|
stackPanel2.Children.Add(checkBox);
|
|
}
|
|
ScrollViewer element = new ScrollViewer
|
|
{
|
|
Content = stackPanel2,
|
|
MaxHeight = 280.0,
|
|
VerticalScrollBarVisibility = ScrollBarVisibility.Auto
|
|
};
|
|
stackPanel.Children.Add(element);
|
|
StackPanel stackPanel3 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal,
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
|
|
Margin = new Thickness(0.0, 14.0, 0.0, 0.0)
|
|
};
|
|
Border border2 = new Border
|
|
{
|
|
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F0F1F5")),
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(16.0, 7.0, 16.0, 7.0),
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand,
|
|
Child = new TextBlock
|
|
{
|
|
Text = "취소",
|
|
FontSize = 12.0,
|
|
Foreground = foreground2
|
|
}
|
|
};
|
|
border2.MouseLeftButtonUp += delegate
|
|
{
|
|
popup.Close();
|
|
};
|
|
stackPanel3.Children.Add(border2);
|
|
Border border3 = new Border
|
|
{
|
|
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4B5EFC")),
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(16.0, 7.0, 16.0, 7.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand,
|
|
Child = new TextBlock
|
|
{
|
|
Text = "내보내기",
|
|
FontSize = 12.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = Brushes.White
|
|
}
|
|
};
|
|
border3.MouseLeftButtonUp += delegate
|
|
{
|
|
List<SkillDefinition> list = (from x in checkBoxes
|
|
where x.cb.IsChecked == true
|
|
select x.skill).ToList();
|
|
if (list.Count == 0)
|
|
{
|
|
CustomMessageBox.Show("내보낼 스킬을 선택하세요.", "스킬 내보내기");
|
|
}
|
|
else
|
|
{
|
|
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog
|
|
{
|
|
Description = "스킬 zip을 저장할 폴더를 선택하세요"
|
|
};
|
|
if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
{
|
|
int num = 0;
|
|
foreach (SkillDefinition item2 in list)
|
|
{
|
|
string text = SkillService.ExportSkill(item2, folderBrowserDialog.SelectedPath);
|
|
if (text != null)
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
popup.Close();
|
|
if (num > 0)
|
|
{
|
|
CustomMessageBox.Show($"{num}개 스킬을 내보냈습니다.\n경로: {folderBrowserDialog.SelectedPath}", "스킬 내보내기");
|
|
}
|
|
else
|
|
{
|
|
CustomMessageBox.Show("내보내기에 실패했습니다.", "스킬 내보내기");
|
|
}
|
|
}
|
|
}
|
|
};
|
|
stackPanel3.Children.Add(border3);
|
|
stackPanel.Children.Add(stackPanel3);
|
|
border.Child = stackPanel;
|
|
popup.Content = border;
|
|
popup.KeyDown += delegate(object _, System.Windows.Input.KeyEventArgs ke)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0009: Invalid comparison between Unknown and I4
|
|
if ((int)ke.Key == 13)
|
|
{
|
|
popup.Close();
|
|
}
|
|
};
|
|
popup.ShowDialog();
|
|
}
|
|
|
|
private void BtnAddModel_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string currentServiceSubTab = GetCurrentServiceSubTab();
|
|
ModelRegistrationDialog modelRegistrationDialog = new ModelRegistrationDialog(currentServiceSubTab);
|
|
modelRegistrationDialog.Owner = this;
|
|
if (modelRegistrationDialog.ShowDialog() == true)
|
|
{
|
|
_vm.RegisteredModels.Add(new RegisteredModelRow
|
|
{
|
|
Alias = modelRegistrationDialog.ModelAlias,
|
|
EncryptedModelName = CryptoService.EncryptIfEnabled(modelRegistrationDialog.ModelName, IsEncryptionEnabled),
|
|
Service = currentServiceSubTab,
|
|
Endpoint = modelRegistrationDialog.Endpoint,
|
|
ApiKey = modelRegistrationDialog.ApiKey,
|
|
AuthType = modelRegistrationDialog.AuthType,
|
|
Cp4dUrl = modelRegistrationDialog.Cp4dUrl,
|
|
Cp4dUsername = modelRegistrationDialog.Cp4dUsername,
|
|
Cp4dPassword = CryptoService.EncryptIfEnabled(modelRegistrationDialog.Cp4dPassword, IsEncryptionEnabled)
|
|
});
|
|
BuildFallbackModelsPanel();
|
|
}
|
|
}
|
|
|
|
private void BtnEditModel_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: RegisteredModelRow tag })
|
|
{
|
|
string existingModel = CryptoService.DecryptIfEnabled(tag.EncryptedModelName, IsEncryptionEnabled);
|
|
string existingCp4dPassword = CryptoService.DecryptIfEnabled(tag.Cp4dPassword ?? "", IsEncryptionEnabled);
|
|
string currentServiceSubTab = GetCurrentServiceSubTab();
|
|
ModelRegistrationDialog modelRegistrationDialog = new ModelRegistrationDialog(currentServiceSubTab, tag.Alias, existingModel, tag.Endpoint, tag.ApiKey, tag.AuthType ?? "bearer", tag.Cp4dUrl ?? "", tag.Cp4dUsername ?? "", existingCp4dPassword);
|
|
modelRegistrationDialog.Owner = this;
|
|
if (modelRegistrationDialog.ShowDialog() == true)
|
|
{
|
|
tag.Alias = modelRegistrationDialog.ModelAlias;
|
|
tag.EncryptedModelName = CryptoService.EncryptIfEnabled(modelRegistrationDialog.ModelName, IsEncryptionEnabled);
|
|
tag.Service = currentServiceSubTab;
|
|
tag.Endpoint = modelRegistrationDialog.Endpoint;
|
|
tag.ApiKey = modelRegistrationDialog.ApiKey;
|
|
tag.AuthType = modelRegistrationDialog.AuthType;
|
|
tag.Cp4dUrl = modelRegistrationDialog.Cp4dUrl;
|
|
tag.Cp4dUsername = modelRegistrationDialog.Cp4dUsername;
|
|
tag.Cp4dPassword = CryptoService.EncryptIfEnabled(modelRegistrationDialog.Cp4dPassword, IsEncryptionEnabled);
|
|
BuildFallbackModelsPanel();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BtnDeleteModel_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: RegisteredModelRow tag })
|
|
{
|
|
MessageBoxResult messageBoxResult = CustomMessageBox.Show("'" + tag.Alias + "' 모델을 삭제하시겠습니까?", "모델 삭제", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
if (messageBoxResult == MessageBoxResult.Yes)
|
|
{
|
|
_vm.RegisteredModels.Remove(tag);
|
|
BuildFallbackModelsPanel();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BtnAddTemplate_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
PromptTemplateDialog promptTemplateDialog = new PromptTemplateDialog();
|
|
promptTemplateDialog.Owner = this;
|
|
if (promptTemplateDialog.ShowDialog() == true)
|
|
{
|
|
_vm.PromptTemplates.Add(new PromptTemplateRow
|
|
{
|
|
Name = promptTemplateDialog.TemplateName,
|
|
Content = promptTemplateDialog.TemplateContent
|
|
});
|
|
}
|
|
}
|
|
|
|
private void BtnEditTemplate_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: PromptTemplateRow tag })
|
|
{
|
|
PromptTemplateDialog promptTemplateDialog = new PromptTemplateDialog(tag.Name, tag.Content);
|
|
promptTemplateDialog.Owner = this;
|
|
if (promptTemplateDialog.ShowDialog() == true)
|
|
{
|
|
tag.Name = promptTemplateDialog.TemplateName;
|
|
tag.Content = promptTemplateDialog.TemplateContent;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BtnDeleteTemplate_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: PromptTemplateRow tag })
|
|
{
|
|
MessageBoxResult messageBoxResult = CustomMessageBox.Show("'" + tag.Name + "' 템플릿을 삭제하시겠습니까?", "템플릿 삭제", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
if (messageBoxResult == MessageBoxResult.Yes)
|
|
{
|
|
_vm.PromptTemplates.Remove(tag);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void AgentSubTab_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (AgentPanelCommon == null)
|
|
{
|
|
return;
|
|
}
|
|
AgentPanelCommon.Visibility = ((AgentTabCommon.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
AgentPanelChat.Visibility = ((AgentTabChat.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
AgentPanelCoworkCode.Visibility = ((AgentTabCoworkCode.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
AgentPanelCowork.Visibility = ((AgentTabCowork.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
AgentPanelCode.Visibility = ((AgentTabCode.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
if (AgentPanelDev != null)
|
|
{
|
|
AgentPanelDev.Visibility = ((AgentTabDev.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
}
|
|
if (AgentPanelEtc != null)
|
|
{
|
|
AgentPanelEtc.Visibility = ((AgentTabEtc.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
}
|
|
if (AgentPanelTools != null)
|
|
{
|
|
bool valueOrDefault = AgentTabTools.IsChecked == true;
|
|
AgentPanelTools.Visibility = ((!valueOrDefault) ? Visibility.Collapsed : Visibility.Visible);
|
|
if (valueOrDefault)
|
|
{
|
|
LoadToolCards();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void LoadToolCards()
|
|
{
|
|
if (_toolCardsLoaded || ToolCardsPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
_toolCardsLoaded = true;
|
|
LlmSettings llmSettings = ((!(System.Windows.Application.Current is App app)) ? null : app.SettingsService?.Settings.Llm);
|
|
using ToolRegistry toolRegistry = ToolRegistry.CreateDefault();
|
|
_disabledTools = new HashSet<string>(llmSettings?.DisabledTools ?? new List<string>(), StringComparer.OrdinalIgnoreCase);
|
|
HashSet<string> disabledTools = _disabledTools;
|
|
Dictionary<string, List<IAgentTool>> dictionary = new Dictionary<string, List<IAgentTool>>
|
|
{
|
|
["파일/검색"] = new List<IAgentTool>(),
|
|
["문서 생성"] = new List<IAgentTool>(),
|
|
["문서 품질"] = new List<IAgentTool>(),
|
|
["코드/개발"] = new List<IAgentTool>(),
|
|
["데이터/유틸"] = new List<IAgentTool>(),
|
|
["시스템"] = new List<IAgentTool>()
|
|
};
|
|
Dictionary<string, string> dictionary2 = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
["file_read"] = "파일/검색",
|
|
["file_write"] = "파일/검색",
|
|
["file_edit"] = "파일/검색",
|
|
["glob"] = "파일/검색",
|
|
["grep"] = "파일/검색",
|
|
["folder_map"] = "파일/검색",
|
|
["document_read"] = "파일/검색",
|
|
["file_watch"] = "파일/검색",
|
|
["excel_skill"] = "문서 생성",
|
|
["docx_skill"] = "문서 생성",
|
|
["csv_skill"] = "문서 생성",
|
|
["markdown_skill"] = "문서 생성",
|
|
["html_skill"] = "문서 생성",
|
|
["chart_skill"] = "문서 생성",
|
|
["batch_skill"] = "문서 생성",
|
|
["pptx_skill"] = "문서 생성",
|
|
["document_planner"] = "문서 생성",
|
|
["document_assembler"] = "문서 생성",
|
|
["document_review"] = "문서 품질",
|
|
["format_convert"] = "문서 품질",
|
|
["template_render"] = "문서 품질",
|
|
["text_summarize"] = "문서 품질",
|
|
["dev_env_detect"] = "코드/개발",
|
|
["build_run"] = "코드/개발",
|
|
["git_tool"] = "코드/개발",
|
|
["lsp"] = "코드/개발",
|
|
["sub_agent"] = "코드/개발",
|
|
["wait_agents"] = "코드/개발",
|
|
["code_search"] = "코드/개발",
|
|
["test_loop"] = "코드/개발",
|
|
["code_review"] = "코드/개발",
|
|
["project_rule"] = "코드/개발",
|
|
["process"] = "시스템",
|
|
["skill_manager"] = "시스템",
|
|
["memory"] = "시스템",
|
|
["clipboard"] = "시스템",
|
|
["notify"] = "시스템",
|
|
["env"] = "시스템",
|
|
["image_analyze"] = "시스템"
|
|
};
|
|
foreach (IAgentTool item in toolRegistry.All)
|
|
{
|
|
string value;
|
|
string key = (dictionary2.TryGetValue(item.Name, out value) ? value : "데이터/유틸");
|
|
if (dictionary.ContainsKey(key))
|
|
{
|
|
dictionary[key].Add(item);
|
|
}
|
|
else
|
|
{
|
|
dictionary["데이터/유틸"].Add(item);
|
|
}
|
|
}
|
|
Brush accentBrush = (TryFindResource("AccentColor") as Brush) ?? Brushes.CornflowerBlue;
|
|
Brush secondaryText = (TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray;
|
|
Brush itemBg = (TryFindResource("ItemBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(245, 245, 248));
|
|
foreach (KeyValuePair<string, List<IAgentTool>> item2 in dictionary)
|
|
{
|
|
if (item2.Value.Count == 0)
|
|
{
|
|
continue;
|
|
}
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = $"{item2.Key} ({item2.Value.Count})";
|
|
textBlock.FontSize = 13.0;
|
|
textBlock.FontWeight = FontWeights.SemiBold;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
textBlock.Margin = new Thickness(0.0, 8.0, 0.0, 6.0);
|
|
TextBlock element = textBlock;
|
|
ToolCardsPanel.Children.Add(element);
|
|
WrapPanel wrapPanel = new WrapPanel
|
|
{
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 4.0)
|
|
};
|
|
foreach (IAgentTool item3 in item2.Value.OrderBy((IAgentTool t) => t.Name))
|
|
{
|
|
bool isEnabled = !disabledTools.Contains(item3.Name);
|
|
Border element2 = CreateToolCard(item3, isEnabled, disabledTools, accentBrush, secondaryText, itemBg);
|
|
wrapPanel.Children.Add(element2);
|
|
}
|
|
ToolCardsPanel.Children.Add(wrapPanel);
|
|
}
|
|
LoadMcpStatus();
|
|
}
|
|
|
|
private Border CreateToolCard(IAgentTool tool, bool isEnabled, HashSet<string> disabled, Brush accentBrush, Brush secondaryText, Brush itemBg)
|
|
{
|
|
Border card = new Border
|
|
{
|
|
Background = itemBg,
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(10.0, 8.0, 10.0, 8.0),
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 8.0),
|
|
Width = 240.0,
|
|
BorderBrush = (isEnabled ? Brushes.Transparent : new SolidColorBrush(Color.FromArgb(48, 220, 38, 38))),
|
|
BorderThickness = new Thickness(1.0)
|
|
};
|
|
Grid grid = new Grid();
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
StackPanel stackPanel = new StackPanel
|
|
{
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = tool.Name;
|
|
textBlock.FontSize = 12.0;
|
|
textBlock.FontWeight = FontWeights.SemiBold;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
textBlock.TextTrimming = TextTrimming.CharacterEllipsis;
|
|
TextBlock element = textBlock;
|
|
stackPanel.Children.Add(element);
|
|
string text = tool.Description;
|
|
if (text.Length > 50)
|
|
{
|
|
text = text.Substring(0, 50) + "…";
|
|
}
|
|
TextBlock element2 = new TextBlock
|
|
{
|
|
Text = text,
|
|
FontSize = 10.5,
|
|
Foreground = secondaryText,
|
|
TextTrimming = TextTrimming.CharacterEllipsis,
|
|
Margin = new Thickness(0.0, 2.0, 0.0, 0.0)
|
|
};
|
|
stackPanel.Children.Add(element2);
|
|
Grid.SetColumn(stackPanel, 0);
|
|
grid.Children.Add(stackPanel);
|
|
System.Windows.Controls.CheckBox checkBox = new System.Windows.Controls.CheckBox();
|
|
checkBox.IsChecked = isEnabled;
|
|
checkBox.Style = TryFindResource("ToggleSwitch") as Style;
|
|
checkBox.VerticalAlignment = VerticalAlignment.Center;
|
|
checkBox.Margin = new Thickness(8.0, 0.0, 0.0, 0.0);
|
|
System.Windows.Controls.CheckBox checkBox2 = checkBox;
|
|
checkBox2.Checked += delegate
|
|
{
|
|
disabled.Remove(tool.Name);
|
|
card.BorderBrush = Brushes.Transparent;
|
|
};
|
|
checkBox2.Unchecked += delegate
|
|
{
|
|
disabled.Add(tool.Name);
|
|
card.BorderBrush = new SolidColorBrush(Color.FromArgb(48, 220, 38, 38));
|
|
};
|
|
Grid.SetColumn(checkBox2, 1);
|
|
grid.Children.Add(checkBox2);
|
|
card.Child = grid;
|
|
return card;
|
|
}
|
|
|
|
private void LoadMcpStatus()
|
|
{
|
|
if (McpStatusPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
McpStatusPanel.Children.Clear();
|
|
List<McpServerEntry> list = ((!(System.Windows.Application.Current is App app)) ? null : app.SettingsService?.Settings.Llm)?.McpServers;
|
|
if (list == null || list.Count == 0)
|
|
{
|
|
McpStatusPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "등록된 MCP 서버가 없습니다.",
|
|
FontSize = 12.0,
|
|
Foreground = ((TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray),
|
|
Margin = new Thickness(0.0, 4.0, 0.0, 0.0)
|
|
});
|
|
return;
|
|
}
|
|
Brush background = (TryFindResource("ItemBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(245, 245, 248));
|
|
foreach (McpServerEntry item in list)
|
|
{
|
|
Border border = new Border
|
|
{
|
|
Background = background,
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(12.0, 8.0, 12.0, 8.0),
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 6.0)
|
|
};
|
|
Grid grid = new Grid();
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
Border element = new Border
|
|
{
|
|
Width = 8.0,
|
|
Height = 8.0,
|
|
CornerRadius = new CornerRadius(4.0),
|
|
Background = new SolidColorBrush(Color.FromRgb(52, 168, 83)),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0)
|
|
};
|
|
Grid.SetColumn(element, 0);
|
|
grid.Children.Add(element);
|
|
StackPanel stackPanel = new StackPanel
|
|
{
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = (item.Name ?? "(이름 없음)"),
|
|
FontSize = 12.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = ((TryFindResource("PrimaryText") as Brush) ?? Brushes.Black)
|
|
});
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = (item.Command ?? ""),
|
|
FontSize = 10.5,
|
|
Foreground = ((TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray),
|
|
TextTrimming = TextTrimming.CharacterEllipsis
|
|
});
|
|
Grid.SetColumn(stackPanel, 1);
|
|
grid.Children.Add(stackPanel);
|
|
TextBlock element2 = new TextBlock
|
|
{
|
|
Text = "등록됨",
|
|
FontSize = 11.0,
|
|
Foreground = new SolidColorBrush(Color.FromRgb(52, 168, 83)),
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
Grid.SetColumn(element2, 2);
|
|
grid.Children.Add(element2);
|
|
border.Child = grid;
|
|
McpStatusPanel.Children.Add(border);
|
|
}
|
|
}
|
|
|
|
private void FuncSubTab_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (FuncPanel_AI != null)
|
|
{
|
|
FuncPanel_AI.Visibility = ((FuncSubTab_AI.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
FuncPanel_Launcher.Visibility = ((FuncSubTab_Launcher.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
FuncPanel_Design.Visibility = ((FuncSubTab_Design.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
}
|
|
}
|
|
|
|
private void CollapsibleSection_Toggle(object sender, MouseButtonEventArgs e)
|
|
{
|
|
if (sender is Border { Tag: Expander tag })
|
|
{
|
|
tag.IsExpanded = !tag.IsExpanded;
|
|
}
|
|
}
|
|
|
|
private void ServiceSubTab_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (SvcPanelOllama != null)
|
|
{
|
|
SvcPanelOllama.Visibility = ((SvcTabOllama.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
SvcPanelVllm.Visibility = ((SvcTabVllm.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
SvcPanelGemini.Visibility = ((SvcTabGemini.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
SvcPanelClaude.Visibility = ((SvcTabClaude.IsChecked != true) ? Visibility.Collapsed : Visibility.Visible);
|
|
}
|
|
}
|
|
|
|
private void ThemeCard_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: string tag })
|
|
{
|
|
_vm.SelectTheme(tag);
|
|
}
|
|
}
|
|
|
|
private void ColorSwatch_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: ColorRowModel tag })
|
|
{
|
|
_vm.PickColor(tag);
|
|
}
|
|
}
|
|
|
|
private void DevModeCheckBox_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!(sender is System.Windows.Controls.CheckBox { IsChecked: var isChecked } checkBox) || isChecked != true || !base.IsLoaded)
|
|
{
|
|
return;
|
|
}
|
|
Brush background = (TryFindResource("LauncherBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(30, 30, 46));
|
|
Brush foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.White;
|
|
Brush foreground2 = (TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray;
|
|
Brush borderBrush = (TryFindResource("BorderColor") as Brush) ?? new SolidColorBrush(Color.FromRgb(64, 64, 96));
|
|
Brush background2 = (TryFindResource("ItemBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(42, 42, 64));
|
|
Window dlg = new Window
|
|
{
|
|
Title = "개발자 모드 — 비밀번호 확인",
|
|
Width = 340.0,
|
|
SizeToContent = SizeToContent.Height,
|
|
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
|
Owner = this,
|
|
ResizeMode = ResizeMode.NoResize,
|
|
WindowStyle = WindowStyle.None,
|
|
AllowsTransparency = true,
|
|
Background = Brushes.Transparent
|
|
};
|
|
Border border = new Border
|
|
{
|
|
Background = background,
|
|
CornerRadius = new CornerRadius(12.0),
|
|
BorderBrush = borderBrush,
|
|
BorderThickness = new Thickness(1.0),
|
|
Padding = new Thickness(20.0)
|
|
};
|
|
StackPanel stackPanel = new StackPanel();
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "\ud83d\udd12 개발자 모드 활성화",
|
|
FontSize = 15.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = foreground,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 12.0)
|
|
});
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "비밀번호를 입력하세요:",
|
|
FontSize = 12.0,
|
|
Foreground = foreground2,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 6.0)
|
|
});
|
|
PasswordBox pwBox = new PasswordBox
|
|
{
|
|
FontSize = 14.0,
|
|
Padding = new Thickness(8.0, 6.0, 8.0, 6.0),
|
|
Background = background2,
|
|
Foreground = foreground,
|
|
BorderBrush = borderBrush,
|
|
PasswordChar = '*'
|
|
};
|
|
stackPanel.Children.Add(pwBox);
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal,
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
|
|
Margin = new Thickness(0.0, 16.0, 0.0, 0.0)
|
|
};
|
|
System.Windows.Controls.Button button = new System.Windows.Controls.Button
|
|
{
|
|
Content = "취소",
|
|
Padding = new Thickness(16.0, 6.0, 16.0, 6.0),
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0)
|
|
};
|
|
button.Click += delegate
|
|
{
|
|
dlg.DialogResult = false;
|
|
};
|
|
stackPanel2.Children.Add(button);
|
|
System.Windows.Controls.Button button2 = new System.Windows.Controls.Button
|
|
{
|
|
Content = "확인",
|
|
Padding = new Thickness(16.0, 6.0, 16.0, 6.0),
|
|
IsDefault = true
|
|
};
|
|
button2.Click += delegate
|
|
{
|
|
if (pwBox.Password == "mouse12#")
|
|
{
|
|
dlg.DialogResult = true;
|
|
}
|
|
else
|
|
{
|
|
pwBox.Clear();
|
|
pwBox.Focus();
|
|
}
|
|
};
|
|
stackPanel2.Children.Add(button2);
|
|
stackPanel.Children.Add(stackPanel2);
|
|
border.Child = stackPanel;
|
|
dlg.Content = border;
|
|
dlg.Loaded += delegate
|
|
{
|
|
pwBox.Focus();
|
|
};
|
|
if (dlg.ShowDialog() != true)
|
|
{
|
|
_vm.DevMode = false;
|
|
checkBox.IsChecked = false;
|
|
}
|
|
UpdateDevModeContentVisibility();
|
|
}
|
|
|
|
private void DevModeCheckBox_Unchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
UpdateDevModeContentVisibility();
|
|
}
|
|
|
|
private void UpdateDevModeContentVisibility()
|
|
{
|
|
if (DevModeContent != null)
|
|
{
|
|
DevModeContent.Visibility = ((!_vm.DevMode) ? Visibility.Collapsed : Visibility.Visible);
|
|
}
|
|
}
|
|
|
|
private void ApplyAiEnabledState(bool enabled, bool init = false)
|
|
{
|
|
if (AiEnabledToggle != null && AiEnabledToggle.IsChecked != enabled)
|
|
{
|
|
AiEnabledToggle.IsChecked = enabled;
|
|
}
|
|
if (AgentTabItem != null)
|
|
{
|
|
AgentTabItem.Visibility = ((!enabled) ? Visibility.Collapsed : Visibility.Visible);
|
|
}
|
|
}
|
|
|
|
private void AiEnabled_Changed(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!base.IsLoaded)
|
|
{
|
|
return;
|
|
}
|
|
System.Windows.Controls.CheckBox aiEnabledToggle = AiEnabledToggle;
|
|
if (aiEnabledToggle == null || aiEnabledToggle.IsChecked != true)
|
|
{
|
|
App app = System.Windows.Application.Current as App;
|
|
if (app?.SettingsService?.Settings != null)
|
|
{
|
|
app.SettingsService.Settings.AiEnabled = false;
|
|
app.SettingsService.Save();
|
|
}
|
|
ApplyAiEnabledState(enabled: false);
|
|
}
|
|
else
|
|
{
|
|
if (System.Windows.Application.Current is App app2 && app2.SettingsService?.Settings.AiEnabled == true)
|
|
{
|
|
return;
|
|
}
|
|
Brush background = (TryFindResource("LauncherBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(30, 30, 46));
|
|
Brush foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.White;
|
|
Brush foreground2 = (TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray;
|
|
Brush borderBrush = (TryFindResource("BorderColor") as Brush) ?? new SolidColorBrush(Color.FromRgb(64, 64, 96));
|
|
Brush background2 = (TryFindResource("ItemBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(42, 42, 64));
|
|
Window dlg = new Window
|
|
{
|
|
Title = "AI 기능 활성화 — 비밀번호 확인",
|
|
Width = 340.0,
|
|
SizeToContent = SizeToContent.Height,
|
|
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
|
Owner = this,
|
|
ResizeMode = ResizeMode.NoResize,
|
|
WindowStyle = WindowStyle.None,
|
|
AllowsTransparency = true,
|
|
Background = Brushes.Transparent
|
|
};
|
|
Border border = new Border
|
|
{
|
|
Background = background,
|
|
CornerRadius = new CornerRadius(12.0),
|
|
BorderBrush = borderBrush,
|
|
BorderThickness = new Thickness(1.0),
|
|
Padding = new Thickness(20.0)
|
|
};
|
|
StackPanel stackPanel = new StackPanel();
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "\ud83d\udd12 AI 기능 활성화",
|
|
FontSize = 15.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = foreground,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 12.0)
|
|
});
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "비밀번호를 입력하세요:",
|
|
FontSize = 12.0,
|
|
Foreground = foreground2,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 6.0)
|
|
});
|
|
PasswordBox pwBox = new PasswordBox
|
|
{
|
|
FontSize = 14.0,
|
|
Padding = new Thickness(8.0, 6.0, 8.0, 6.0),
|
|
Background = background2,
|
|
Foreground = foreground,
|
|
BorderBrush = borderBrush,
|
|
PasswordChar = '*'
|
|
};
|
|
stackPanel.Children.Add(pwBox);
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal,
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
|
|
Margin = new Thickness(0.0, 16.0, 0.0, 0.0)
|
|
};
|
|
System.Windows.Controls.Button button = new System.Windows.Controls.Button
|
|
{
|
|
Content = "취소",
|
|
Padding = new Thickness(16.0, 6.0, 16.0, 6.0),
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0)
|
|
};
|
|
button.Click += delegate
|
|
{
|
|
dlg.DialogResult = false;
|
|
};
|
|
stackPanel2.Children.Add(button);
|
|
System.Windows.Controls.Button button2 = new System.Windows.Controls.Button
|
|
{
|
|
Content = "확인",
|
|
Padding = new Thickness(16.0, 6.0, 16.0, 6.0),
|
|
IsDefault = true
|
|
};
|
|
button2.Click += delegate
|
|
{
|
|
if (pwBox.Password == "axgo123!")
|
|
{
|
|
dlg.DialogResult = true;
|
|
}
|
|
else
|
|
{
|
|
pwBox.Clear();
|
|
pwBox.Focus();
|
|
}
|
|
};
|
|
stackPanel2.Children.Add(button2);
|
|
stackPanel.Children.Add(stackPanel2);
|
|
border.Child = stackPanel;
|
|
dlg.Content = border;
|
|
dlg.Loaded += delegate
|
|
{
|
|
pwBox.Focus();
|
|
};
|
|
if (dlg.ShowDialog() == true)
|
|
{
|
|
App app3 = System.Windows.Application.Current as App;
|
|
if (app3?.SettingsService?.Settings != null)
|
|
{
|
|
app3.SettingsService.Settings.AiEnabled = true;
|
|
app3.SettingsService.Save();
|
|
}
|
|
ApplyAiEnabledState(enabled: true);
|
|
}
|
|
else if (AiEnabledToggle != null)
|
|
{
|
|
AiEnabledToggle.IsChecked = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void StepApprovalCheckBox_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!(sender is System.Windows.Controls.CheckBox { IsChecked: var isChecked } checkBox) || isChecked != true || !base.IsLoaded)
|
|
{
|
|
return;
|
|
}
|
|
Brush background = (TryFindResource("LauncherBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(30, 30, 46));
|
|
Brush foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.White;
|
|
Brush foreground2 = (TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray;
|
|
Brush borderBrush = (TryFindResource("BorderColor") as Brush) ?? new SolidColorBrush(Color.FromRgb(64, 64, 96));
|
|
Brush background2 = (TryFindResource("ItemBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(42, 42, 64));
|
|
Window dlg = new Window
|
|
{
|
|
Title = "스텝 바이 스텝 승인 — 비밀번호 확인",
|
|
Width = 340.0,
|
|
SizeToContent = SizeToContent.Height,
|
|
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
|
Owner = this,
|
|
ResizeMode = ResizeMode.NoResize,
|
|
WindowStyle = WindowStyle.None,
|
|
AllowsTransparency = true,
|
|
Background = Brushes.Transparent
|
|
};
|
|
Border border = new Border
|
|
{
|
|
Background = background,
|
|
CornerRadius = new CornerRadius(12.0),
|
|
BorderBrush = borderBrush,
|
|
BorderThickness = new Thickness(1.0),
|
|
Padding = new Thickness(20.0)
|
|
};
|
|
StackPanel stackPanel = new StackPanel();
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "\ud83d\udd0d 스텝 바이 스텝 승인 활성화",
|
|
FontSize = 15.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = foreground,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 12.0)
|
|
});
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "개발자 비밀번호를 입력하세요:",
|
|
FontSize = 12.0,
|
|
Foreground = foreground2,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 6.0)
|
|
});
|
|
PasswordBox pwBox = new PasswordBox
|
|
{
|
|
FontSize = 14.0,
|
|
Padding = new Thickness(8.0, 6.0, 8.0, 6.0),
|
|
Background = background2,
|
|
Foreground = foreground,
|
|
BorderBrush = borderBrush,
|
|
PasswordChar = '*'
|
|
};
|
|
stackPanel.Children.Add(pwBox);
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal,
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
|
|
Margin = new Thickness(0.0, 16.0, 0.0, 0.0)
|
|
};
|
|
System.Windows.Controls.Button button = new System.Windows.Controls.Button
|
|
{
|
|
Content = "취소",
|
|
Padding = new Thickness(16.0, 6.0, 16.0, 6.0),
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0)
|
|
};
|
|
button.Click += delegate
|
|
{
|
|
dlg.DialogResult = false;
|
|
};
|
|
stackPanel2.Children.Add(button);
|
|
System.Windows.Controls.Button button2 = new System.Windows.Controls.Button
|
|
{
|
|
Content = "확인",
|
|
Padding = new Thickness(16.0, 6.0, 16.0, 6.0),
|
|
IsDefault = true
|
|
};
|
|
button2.Click += delegate
|
|
{
|
|
if (pwBox.Password == "mouse12#")
|
|
{
|
|
dlg.DialogResult = true;
|
|
}
|
|
else
|
|
{
|
|
pwBox.Clear();
|
|
pwBox.Focus();
|
|
}
|
|
};
|
|
stackPanel2.Children.Add(button2);
|
|
stackPanel.Children.Add(stackPanel2);
|
|
border.Child = stackPanel;
|
|
dlg.Content = border;
|
|
dlg.Loaded += delegate
|
|
{
|
|
pwBox.Focus();
|
|
};
|
|
if (dlg.ShowDialog() != true)
|
|
{
|
|
checkBox.IsChecked = false;
|
|
}
|
|
}
|
|
|
|
private void BtnClearMemory_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
MessageBoxResult messageBoxResult = CustomMessageBox.Show("에이전트 메모리를 초기화하면 학습된 모든 규칙과 선호도가 삭제됩니다.\n계속하시겠습니까?", "에이전트 메모리 초기화", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
|
|
if (messageBoxResult == MessageBoxResult.Yes)
|
|
{
|
|
if (System.Windows.Application.Current is App app)
|
|
{
|
|
app.MemoryService?.Clear();
|
|
}
|
|
CustomMessageBox.Show("에이전트 메모리가 초기화되었습니다.", "완료", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
|
}
|
|
}
|
|
|
|
private void AddHookBtn_Click(object sender, MouseButtonEventArgs e)
|
|
{
|
|
ShowHookEditDialog(null, -1);
|
|
}
|
|
|
|
private static TextBlock CreatePlaceholder(string text, Brush foreground, string? currentValue)
|
|
{
|
|
return new TextBlock
|
|
{
|
|
Text = text,
|
|
FontSize = 13.0,
|
|
Foreground = foreground,
|
|
Opacity = 0.45,
|
|
IsHitTestVisible = false,
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Padding = new Thickness(14.0, 8.0, 14.0, 8.0),
|
|
Visibility = ((!string.IsNullOrEmpty(currentValue)) ? Visibility.Collapsed : Visibility.Visible)
|
|
};
|
|
}
|
|
|
|
private void ShowHookEditDialog(AgentHookEntry? existing, int index)
|
|
{
|
|
Brush background = (TryFindResource("LauncherBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(30, 30, 46));
|
|
Brush foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.White;
|
|
Brush foreground2 = (TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray;
|
|
Brush borderBrush = (TryFindResource("BorderColor") as Brush) ?? new SolidColorBrush(Color.FromRgb(64, 64, 96));
|
|
Brush background2 = (TryFindResource("ItemBackground") as Brush) ?? new SolidColorBrush(Color.FromRgb(42, 42, 64));
|
|
Brush brush = (TryFindResource("AccentColor") as Brush) ?? Brushes.CornflowerBlue;
|
|
bool isNew = existing == null;
|
|
Window dlg = new Window
|
|
{
|
|
Title = (isNew ? "훅 추가" : "훅 편집"),
|
|
Width = 420.0,
|
|
SizeToContent = SizeToContent.Height,
|
|
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
|
Owner = this,
|
|
ResizeMode = ResizeMode.NoResize,
|
|
WindowStyle = WindowStyle.None,
|
|
AllowsTransparency = true,
|
|
Background = Brushes.Transparent
|
|
};
|
|
Border border = new Border
|
|
{
|
|
Background = background,
|
|
CornerRadius = new CornerRadius(12.0),
|
|
BorderBrush = borderBrush,
|
|
BorderThickness = new Thickness(1.0),
|
|
Padding = new Thickness(20.0)
|
|
};
|
|
StackPanel stackPanel = new StackPanel();
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = (isNew ? "⚙ 훅 추가" : "⚙ 훅 편집"),
|
|
FontSize = 15.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = foreground,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 14.0)
|
|
});
|
|
dlg.KeyDown += delegate(object _, System.Windows.Input.KeyEventArgs e)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0009: Invalid comparison between Unknown and I4
|
|
if ((int)e.Key == 13)
|
|
{
|
|
dlg.Close();
|
|
}
|
|
};
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "훅 이름",
|
|
FontSize = 12.0,
|
|
Foreground = foreground2,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 4.0)
|
|
});
|
|
System.Windows.Controls.TextBox nameBox = new System.Windows.Controls.TextBox
|
|
{
|
|
Text = (existing?.Name ?? ""),
|
|
FontSize = 13.0,
|
|
Foreground = foreground,
|
|
Background = background2,
|
|
BorderBrush = borderBrush,
|
|
Padding = new Thickness(12.0, 8.0, 12.0, 8.0)
|
|
};
|
|
TextBlock nameHolder = CreatePlaceholder("예: 코드 리뷰 후 알림", foreground2, existing?.Name);
|
|
nameBox.TextChanged += delegate
|
|
{
|
|
nameHolder.Visibility = ((!string.IsNullOrEmpty(nameBox.Text)) ? Visibility.Collapsed : Visibility.Visible);
|
|
};
|
|
Grid grid = new Grid();
|
|
grid.Children.Add(nameBox);
|
|
grid.Children.Add(nameHolder);
|
|
stackPanel.Children.Add(grid);
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "대상 도구 (* = 모든 도구)",
|
|
FontSize = 12.0,
|
|
Foreground = foreground2,
|
|
Margin = new Thickness(0.0, 10.0, 0.0, 4.0)
|
|
});
|
|
System.Windows.Controls.TextBox toolBox = new System.Windows.Controls.TextBox
|
|
{
|
|
Text = (existing?.ToolName ?? "*"),
|
|
FontSize = 13.0,
|
|
Foreground = foreground,
|
|
Background = background2,
|
|
BorderBrush = borderBrush,
|
|
Padding = new Thickness(12.0, 8.0, 12.0, 8.0)
|
|
};
|
|
TextBlock toolHolder = CreatePlaceholder("예: file_write, grep_tool", foreground2, existing?.ToolName ?? "*");
|
|
toolBox.TextChanged += delegate
|
|
{
|
|
toolHolder.Visibility = ((!string.IsNullOrEmpty(toolBox.Text)) ? Visibility.Collapsed : Visibility.Visible);
|
|
};
|
|
Grid grid2 = new Grid();
|
|
grid2.Children.Add(toolBox);
|
|
grid2.Children.Add(toolHolder);
|
|
stackPanel.Children.Add(grid2);
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "실행 타이밍",
|
|
FontSize = 12.0,
|
|
Foreground = foreground2,
|
|
Margin = new Thickness(0.0, 10.0, 0.0, 4.0)
|
|
});
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
System.Windows.Controls.RadioButton preRadio = new System.Windows.Controls.RadioButton
|
|
{
|
|
Content = "Pre (실행 전)",
|
|
Foreground = foreground,
|
|
FontSize = 13.0,
|
|
Margin = new Thickness(0.0, 0.0, 16.0, 0.0),
|
|
IsChecked = ((existing?.Timing ?? "post") == "pre")
|
|
};
|
|
System.Windows.Controls.RadioButton element = new System.Windows.Controls.RadioButton
|
|
{
|
|
Content = "Post (실행 후)",
|
|
Foreground = foreground,
|
|
FontSize = 13.0,
|
|
IsChecked = ((existing?.Timing ?? "post") != "pre")
|
|
};
|
|
stackPanel2.Children.Add(preRadio);
|
|
stackPanel2.Children.Add(element);
|
|
stackPanel.Children.Add(stackPanel2);
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "스크립트 경로 (.bat / .cmd / .ps1)",
|
|
FontSize = 12.0,
|
|
Foreground = foreground2,
|
|
Margin = new Thickness(0.0, 10.0, 0.0, 4.0)
|
|
});
|
|
Grid grid3 = new Grid();
|
|
grid3.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid3.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
Grid grid4 = new Grid();
|
|
System.Windows.Controls.TextBox pathBox = new System.Windows.Controls.TextBox
|
|
{
|
|
Text = (existing?.ScriptPath ?? ""),
|
|
FontSize = 13.0,
|
|
Foreground = foreground,
|
|
Background = background2,
|
|
BorderBrush = borderBrush,
|
|
Padding = new Thickness(12.0, 8.0, 12.0, 8.0)
|
|
};
|
|
TextBlock pathHolder = CreatePlaceholder("예: C:\\scripts\\review-notify.bat", foreground2, existing?.ScriptPath);
|
|
pathBox.TextChanged += delegate
|
|
{
|
|
pathHolder.Visibility = ((!string.IsNullOrEmpty(pathBox.Text)) ? Visibility.Collapsed : Visibility.Visible);
|
|
};
|
|
grid4.Children.Add(pathBox);
|
|
grid4.Children.Add(pathHolder);
|
|
Grid.SetColumn(grid4, 0);
|
|
grid3.Children.Add(grid4);
|
|
Border border2 = new Border
|
|
{
|
|
Background = background2,
|
|
CornerRadius = new CornerRadius(6.0),
|
|
Padding = new Thickness(10.0, 6.0, 10.0, 6.0),
|
|
Margin = new Thickness(6.0, 0.0, 0.0, 0.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
border2.Child = new TextBlock
|
|
{
|
|
Text = "...",
|
|
FontSize = 13.0,
|
|
Foreground = brush
|
|
};
|
|
border2.MouseLeftButtonUp += delegate
|
|
{
|
|
Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog
|
|
{
|
|
Filter = "스크립트 파일|*.bat;*.cmd;*.ps1|모든 파일|*.*",
|
|
Title = "훅 스크립트 선택"
|
|
};
|
|
if (openFileDialog.ShowDialog() == true)
|
|
{
|
|
pathBox.Text = openFileDialog.FileName;
|
|
}
|
|
};
|
|
Grid.SetColumn(border2, 1);
|
|
grid3.Children.Add(border2);
|
|
stackPanel.Children.Add(grid3);
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "추가 인수 (선택)",
|
|
FontSize = 12.0,
|
|
Foreground = foreground2,
|
|
Margin = new Thickness(0.0, 10.0, 0.0, 4.0)
|
|
});
|
|
System.Windows.Controls.TextBox argsBox = new System.Windows.Controls.TextBox
|
|
{
|
|
Text = (existing?.Arguments ?? ""),
|
|
FontSize = 13.0,
|
|
Foreground = foreground,
|
|
Background = background2,
|
|
BorderBrush = borderBrush,
|
|
Padding = new Thickness(12.0, 8.0, 12.0, 8.0)
|
|
};
|
|
TextBlock argsHolder = CreatePlaceholder("예: --verbose --output log.txt", foreground2, existing?.Arguments);
|
|
argsBox.TextChanged += delegate
|
|
{
|
|
argsHolder.Visibility = ((!string.IsNullOrEmpty(argsBox.Text)) ? Visibility.Collapsed : Visibility.Visible);
|
|
};
|
|
Grid grid5 = new Grid();
|
|
grid5.Children.Add(argsBox);
|
|
grid5.Children.Add(argsHolder);
|
|
stackPanel.Children.Add(grid5);
|
|
StackPanel stackPanel3 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal,
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
|
|
Margin = new Thickness(0.0, 16.0, 0.0, 0.0)
|
|
};
|
|
Border border3 = new Border
|
|
{
|
|
Background = background2,
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(16.0, 8.0, 16.0, 8.0),
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
border3.Child = new TextBlock
|
|
{
|
|
Text = "취소",
|
|
FontSize = 13.0,
|
|
Foreground = foreground2
|
|
};
|
|
border3.MouseLeftButtonUp += delegate
|
|
{
|
|
dlg.Close();
|
|
};
|
|
stackPanel3.Children.Add(border3);
|
|
Border border4 = new Border
|
|
{
|
|
Background = brush,
|
|
CornerRadius = new CornerRadius(8.0),
|
|
Padding = new Thickness(16.0, 8.0, 16.0, 8.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
border4.Child = new TextBlock
|
|
{
|
|
Text = (isNew ? "추가" : "저장"),
|
|
FontSize = 13.0,
|
|
Foreground = Brushes.White,
|
|
FontWeight = FontWeights.SemiBold
|
|
};
|
|
border4.MouseLeftButtonUp += delegate
|
|
{
|
|
if (string.IsNullOrWhiteSpace(nameBox.Text) || string.IsNullOrWhiteSpace(pathBox.Text))
|
|
{
|
|
CustomMessageBox.Show("훅 이름과 스크립트 경로를 입력하세요.", "입력 오류", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
}
|
|
else
|
|
{
|
|
AgentHookEntry agentHookEntry = new AgentHookEntry
|
|
{
|
|
Name = nameBox.Text.Trim(),
|
|
ToolName = (string.IsNullOrWhiteSpace(toolBox.Text) ? "*" : toolBox.Text.Trim()),
|
|
Timing = ((preRadio.IsChecked == true) ? "pre" : "post"),
|
|
ScriptPath = pathBox.Text.Trim(),
|
|
Arguments = argsBox.Text.Trim(),
|
|
Enabled = (existing?.Enabled ?? true)
|
|
};
|
|
List<AgentHookEntry> agentHooks = _vm.Service.Settings.Llm.AgentHooks;
|
|
if (isNew)
|
|
{
|
|
agentHooks.Add(agentHookEntry);
|
|
}
|
|
else if (index >= 0 && index < agentHooks.Count)
|
|
{
|
|
agentHooks[index] = agentHookEntry;
|
|
}
|
|
BuildHookCards();
|
|
dlg.Close();
|
|
}
|
|
};
|
|
stackPanel3.Children.Add(border4);
|
|
stackPanel.Children.Add(stackPanel3);
|
|
border.Child = stackPanel;
|
|
dlg.Content = border;
|
|
dlg.ShowDialog();
|
|
}
|
|
|
|
private void BuildHookCards()
|
|
{
|
|
if (HookListPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
HookListPanel.Children.Clear();
|
|
List<AgentHookEntry> hooks = _vm.Service.Settings.Llm.AgentHooks;
|
|
Brush foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
Brush foreground2 = (TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray;
|
|
Brush foreground3 = (TryFindResource("AccentColor") as Brush) ?? Brushes.Blue;
|
|
for (int i = 0; i < hooks.Count; i++)
|
|
{
|
|
AgentHookEntry agentHookEntry = hooks[i];
|
|
int idx = i;
|
|
Border border = new Border();
|
|
border.Background = (TryFindResource("ItemBackground") as Brush) ?? Brushes.LightGray;
|
|
border.CornerRadius = new CornerRadius(8.0);
|
|
border.Padding = new Thickness(10.0, 8.0, 10.0, 8.0);
|
|
border.Margin = new Thickness(0.0, 0.0, 0.0, 4.0);
|
|
Border border2 = border;
|
|
Grid grid = new Grid();
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
System.Windows.Controls.CheckBox checkBox = new System.Windows.Controls.CheckBox();
|
|
checkBox.IsChecked = agentHookEntry.Enabled;
|
|
checkBox.VerticalAlignment = VerticalAlignment.Center;
|
|
checkBox.Margin = new Thickness(0.0, 0.0, 8.0, 0.0);
|
|
checkBox.Style = TryFindResource("ToggleSwitch") as Style;
|
|
System.Windows.Controls.CheckBox checkBox2 = checkBox;
|
|
AgentHookEntry capturedHook = agentHookEntry;
|
|
checkBox2.Checked += delegate
|
|
{
|
|
capturedHook.Enabled = true;
|
|
};
|
|
checkBox2.Unchecked += delegate
|
|
{
|
|
capturedHook.Enabled = false;
|
|
};
|
|
Grid.SetColumn(checkBox2, 0);
|
|
grid.Children.Add(checkBox2);
|
|
StackPanel stackPanel = new StackPanel
|
|
{
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
string text = ((agentHookEntry.Timing == "pre") ? "PRE" : "POST");
|
|
string value = ((agentHookEntry.Timing == "pre") ? "#FF9800" : "#4CAF50");
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal
|
|
};
|
|
stackPanel2.Children.Add(new TextBlock
|
|
{
|
|
Text = agentHookEntry.Name,
|
|
FontSize = 13.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = foreground,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
});
|
|
stackPanel2.Children.Add(new Border
|
|
{
|
|
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value)),
|
|
CornerRadius = new CornerRadius(4.0),
|
|
Padding = new Thickness(5.0, 1.0, 5.0, 1.0),
|
|
Margin = new Thickness(6.0, 0.0, 0.0, 0.0),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Child = new TextBlock
|
|
{
|
|
Text = text,
|
|
FontSize = 9.0,
|
|
Foreground = Brushes.White,
|
|
FontWeight = FontWeights.Bold
|
|
}
|
|
});
|
|
if (agentHookEntry.ToolName != "*")
|
|
{
|
|
stackPanel2.Children.Add(new Border
|
|
{
|
|
Background = new SolidColorBrush(Color.FromArgb(40, 100, 100, byte.MaxValue)),
|
|
CornerRadius = new CornerRadius(4.0),
|
|
Padding = new Thickness(5.0, 1.0, 5.0, 1.0),
|
|
Margin = new Thickness(4.0, 0.0, 0.0, 0.0),
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Child = new TextBlock
|
|
{
|
|
Text = agentHookEntry.ToolName,
|
|
FontSize = 9.0,
|
|
Foreground = foreground3
|
|
}
|
|
});
|
|
}
|
|
stackPanel.Children.Add(stackPanel2);
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = Path.GetFileName(agentHookEntry.ScriptPath),
|
|
FontSize = 11.0,
|
|
Foreground = foreground2,
|
|
TextTrimming = TextTrimming.CharacterEllipsis,
|
|
MaxWidth = 200.0
|
|
});
|
|
Grid.SetColumn(stackPanel, 1);
|
|
grid.Children.Add(stackPanel);
|
|
Border border3 = new Border
|
|
{
|
|
Cursor = System.Windows.Input.Cursors.Hand,
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(4.0, 0.0, 4.0, 0.0),
|
|
Padding = new Thickness(6.0)
|
|
};
|
|
border3.Child = new TextBlock
|
|
{
|
|
Text = "\ue70f",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 12.0,
|
|
Foreground = foreground2
|
|
};
|
|
border3.MouseLeftButtonUp += delegate
|
|
{
|
|
ShowHookEditDialog(hooks[idx], idx);
|
|
};
|
|
Grid.SetColumn(border3, 2);
|
|
grid.Children.Add(border3);
|
|
Border border4 = new Border
|
|
{
|
|
Cursor = System.Windows.Input.Cursors.Hand,
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Margin = new Thickness(0.0, 0.0, 0.0, 0.0),
|
|
Padding = new Thickness(6.0)
|
|
};
|
|
border4.Child = new TextBlock
|
|
{
|
|
Text = "\ue74d",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 12.0,
|
|
Foreground = new SolidColorBrush(Color.FromRgb(239, 83, 80))
|
|
};
|
|
border4.MouseLeftButtonUp += delegate
|
|
{
|
|
hooks.RemoveAt(idx);
|
|
BuildHookCards();
|
|
};
|
|
Grid.SetColumn(border4, 3);
|
|
grid.Children.Add(border4);
|
|
border2.Child = grid;
|
|
HookListPanel.Children.Add(border2);
|
|
}
|
|
}
|
|
|
|
private void BtnAddMcpServer_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
InputDialog inputDialog = new InputDialog("MCP 서버 추가", "서버 이름:", "", "예: my-mcp-server");
|
|
inputDialog.Owner = this;
|
|
if (inputDialog.ShowDialog() == true && !string.IsNullOrWhiteSpace(inputDialog.ResponseText))
|
|
{
|
|
string name = inputDialog.ResponseText.Trim();
|
|
InputDialog inputDialog2 = new InputDialog("MCP 서버 추가", "실행 명령:", "", "예: npx -y @anthropic/mcp-server");
|
|
inputDialog2.Owner = this;
|
|
if (inputDialog2.ShowDialog() == true && !string.IsNullOrWhiteSpace(inputDialog2.ResponseText))
|
|
{
|
|
McpServerEntry item = new McpServerEntry
|
|
{
|
|
Name = name,
|
|
Command = inputDialog2.ResponseText.Trim(),
|
|
Enabled = true
|
|
};
|
|
_vm.Service.Settings.Llm.McpServers.Add(item);
|
|
BuildMcpServerCards();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BuildMcpServerCards()
|
|
{
|
|
if (McpServerListPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
McpServerListPanel.Children.Clear();
|
|
List<McpServerEntry> servers = _vm.Service.Settings.Llm.McpServers;
|
|
Brush foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
Brush foreground2 = (TryFindResource("SecondaryText") as Brush) ?? Brushes.Gray;
|
|
Brush brush = (TryFindResource("AccentColor") as Brush) ?? Brushes.Blue;
|
|
for (int i = 0; i < servers.Count; i++)
|
|
{
|
|
McpServerEntry mcpServerEntry = servers[i];
|
|
int idx = i;
|
|
Border border = new Border();
|
|
border.Background = TryFindResource("ItemBackground") as Brush;
|
|
border.CornerRadius = new CornerRadius(10.0);
|
|
border.Padding = new Thickness(14.0, 10.0, 14.0, 10.0);
|
|
border.Margin = new Thickness(0.0, 4.0, 0.0, 0.0);
|
|
border.BorderBrush = TryFindResource("BorderColor") as Brush;
|
|
border.BorderThickness = new Thickness(1.0);
|
|
Border border2 = border;
|
|
Grid grid = new Grid();
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
StackPanel stackPanel = new StackPanel
|
|
{
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
stackPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = mcpServerEntry.Name,
|
|
FontSize = 13.5,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = foreground
|
|
});
|
|
StackPanel stackPanel2 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal,
|
|
Margin = new Thickness(0.0, 3.0, 0.0, 0.0)
|
|
};
|
|
stackPanel2.Children.Add(new Border
|
|
{
|
|
Background = (mcpServerEntry.Enabled ? brush : Brushes.Gray),
|
|
CornerRadius = new CornerRadius(4.0),
|
|
Padding = new Thickness(6.0, 1.0, 6.0, 1.0),
|
|
Margin = new Thickness(0.0, 0.0, 8.0, 0.0),
|
|
Opacity = 0.8,
|
|
Child = new TextBlock
|
|
{
|
|
Text = (mcpServerEntry.Enabled ? "활성" : "비활성"),
|
|
FontSize = 10.0,
|
|
Foreground = Brushes.White,
|
|
FontWeight = FontWeights.SemiBold
|
|
}
|
|
});
|
|
stackPanel2.Children.Add(new TextBlock
|
|
{
|
|
Text = mcpServerEntry.Command + " " + string.Join(" ", mcpServerEntry.Args),
|
|
FontSize = 11.0,
|
|
Foreground = foreground2,
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
MaxWidth = 300.0,
|
|
TextTrimming = TextTrimming.CharacterEllipsis
|
|
});
|
|
stackPanel.Children.Add(stackPanel2);
|
|
Grid.SetColumn(stackPanel, 0);
|
|
grid.Children.Add(stackPanel);
|
|
StackPanel stackPanel3 = new StackPanel
|
|
{
|
|
Orientation = System.Windows.Controls.Orientation.Horizontal,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
System.Windows.Controls.Button button = new System.Windows.Controls.Button
|
|
{
|
|
Content = (mcpServerEntry.Enabled ? "\ue73e" : "\ue711"),
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 12.0,
|
|
ToolTip = (mcpServerEntry.Enabled ? "비활성화" : "활성화"),
|
|
Background = Brushes.Transparent,
|
|
BorderThickness = new Thickness(0.0),
|
|
Foreground = (mcpServerEntry.Enabled ? brush : Brushes.Gray),
|
|
Padding = new Thickness(6.0, 4.0, 6.0, 4.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
button.Click += delegate
|
|
{
|
|
servers[idx].Enabled = !servers[idx].Enabled;
|
|
BuildMcpServerCards();
|
|
};
|
|
stackPanel3.Children.Add(button);
|
|
System.Windows.Controls.Button button2 = new System.Windows.Controls.Button
|
|
{
|
|
Content = "\ue74d",
|
|
FontFamily = new FontFamily("Segoe MDL2 Assets"),
|
|
FontSize = 12.0,
|
|
ToolTip = "삭제",
|
|
Background = Brushes.Transparent,
|
|
BorderThickness = new Thickness(0.0),
|
|
Foreground = new SolidColorBrush(Color.FromRgb(221, 68, 68)),
|
|
Padding = new Thickness(6.0, 4.0, 6.0, 4.0),
|
|
Cursor = System.Windows.Input.Cursors.Hand
|
|
};
|
|
button2.Click += delegate
|
|
{
|
|
servers.RemoveAt(idx);
|
|
BuildMcpServerCards();
|
|
};
|
|
stackPanel3.Children.Add(button2);
|
|
Grid.SetColumn(stackPanel3, 1);
|
|
grid.Children.Add(stackPanel3);
|
|
border2.Child = grid;
|
|
McpServerListPanel.Children.Add(border2);
|
|
}
|
|
}
|
|
|
|
private void BtnOpenAuditLog_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
Process.Start("explorer.exe", AuditLogService.GetAuditFolder());
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
private void BuildFallbackModelsPanel()
|
|
{
|
|
if (FallbackModelsPanel == null)
|
|
{
|
|
return;
|
|
}
|
|
FallbackModelsPanel.Children.Clear();
|
|
LlmSettings llm = _vm.Service.Settings.Llm;
|
|
List<string> fallbacks = llm.FallbackModels;
|
|
Style style = TryFindResource("ToggleSwitch") as Style;
|
|
(string, string, string, List<string>)[] array = new(string, string, string, List<string>)[4]
|
|
{
|
|
("ollama", "Ollama", "#107C10", new List<string>()),
|
|
("vllm", "vLLM", "#0078D4", new List<string>()),
|
|
("gemini", "Gemini", "#4285F4", new List<string>()),
|
|
("claude", "Claude", "#8B5CF6", new List<string>())
|
|
};
|
|
foreach (RegisteredModelRow registeredModel in _vm.RegisteredModels)
|
|
{
|
|
string svc = (registeredModel.Service ?? "").ToLowerInvariant();
|
|
string text = ((!string.IsNullOrEmpty(registeredModel.Alias)) ? registeredModel.Alias : registeredModel.EncryptedModelName);
|
|
(string, string, string, List<string>) tuple = array.FirstOrDefault(((string Service, string Label, string Color, List<string> Models) s) => s.Service == svc);
|
|
if (tuple.Item4 != null && !string.IsNullOrEmpty(text) && !tuple.Item4.Contains(text))
|
|
{
|
|
tuple.Item4.Add(text);
|
|
}
|
|
}
|
|
foreach (RegisteredModel registeredModel2 in llm.RegisteredModels)
|
|
{
|
|
string svc2 = (registeredModel2.Service ?? "").ToLowerInvariant();
|
|
string text2 = ((!string.IsNullOrEmpty(registeredModel2.Alias)) ? registeredModel2.Alias : registeredModel2.EncryptedModelName);
|
|
(string, string, string, List<string>) tuple2 = array.FirstOrDefault(((string Service, string Label, string Color, List<string> Models) s) => s.Service == svc2);
|
|
if (tuple2.Item4 != null && !string.IsNullOrEmpty(text2) && !tuple2.Item4.Contains(text2))
|
|
{
|
|
tuple2.Item4.Add(text2);
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(llm.OllamaModel) && !array[0].Item4.Contains(llm.OllamaModel))
|
|
{
|
|
array[0].Item4.Add(llm.OllamaModel);
|
|
}
|
|
if (!string.IsNullOrEmpty(llm.VllmModel) && !array[1].Item4.Contains(llm.VllmModel))
|
|
{
|
|
array[1].Item4.Add(llm.VllmModel);
|
|
}
|
|
string[] array2 = new string[5] { "gemini-2.5-flash", "gemini-2.5-pro", "gemini-2.0-flash", "gemini-1.5-pro", "gemini-1.5-flash" };
|
|
foreach (string item in array2)
|
|
{
|
|
if (!array[2].Item4.Contains(item))
|
|
{
|
|
array[2].Item4.Add(item);
|
|
}
|
|
}
|
|
string[] array3 = new string[4] { "claude-sonnet-4-6", "claude-opus-4-6", "claude-haiku-4-5", "claude-sonnet-4-5" };
|
|
foreach (string item2 in array3)
|
|
{
|
|
if (!array[3].Item4.Contains(item2))
|
|
{
|
|
array[3].Item4.Add(item2);
|
|
}
|
|
}
|
|
(string, string, string, List<string>)[] array4 = array;
|
|
for (int num3 = 0; num3 < array4.Length; num3++)
|
|
{
|
|
var (text3, text4, hex, list) = array4[num3];
|
|
FallbackModelsPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = text4,
|
|
FontSize = 11.0,
|
|
FontWeight = FontWeights.SemiBold,
|
|
Foreground = BrushFromHex(hex),
|
|
Margin = new Thickness(0.0, 8.0, 0.0, 4.0)
|
|
});
|
|
if (list.Count == 0)
|
|
{
|
|
FallbackModelsPanel.Children.Add(new TextBlock
|
|
{
|
|
Text = "등록된 모델 없음",
|
|
FontSize = 11.0,
|
|
Foreground = Brushes.Gray,
|
|
FontStyle = FontStyles.Italic,
|
|
Margin = new Thickness(8.0, 2.0, 0.0, 4.0)
|
|
});
|
|
continue;
|
|
}
|
|
foreach (string item3 in list)
|
|
{
|
|
string text5 = text3 + ":" + item3;
|
|
Grid grid = new Grid
|
|
{
|
|
Margin = new Thickness(8.0, 2.0, 0.0, 2.0)
|
|
};
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = new GridLength(1.0, GridUnitType.Star)
|
|
});
|
|
grid.ColumnDefinitions.Add(new ColumnDefinition
|
|
{
|
|
Width = GridLength.Auto
|
|
});
|
|
TextBlock textBlock = new TextBlock();
|
|
textBlock.Text = item3;
|
|
textBlock.FontSize = 12.0;
|
|
textBlock.FontFamily = new FontFamily("Consolas, Courier New");
|
|
textBlock.VerticalAlignment = VerticalAlignment.Center;
|
|
textBlock.Foreground = (TryFindResource("PrimaryText") as Brush) ?? Brushes.Black;
|
|
TextBlock element = textBlock;
|
|
Grid.SetColumn(element, 0);
|
|
grid.Children.Add(element);
|
|
string captured = text5;
|
|
System.Windows.Controls.CheckBox checkBox = new System.Windows.Controls.CheckBox
|
|
{
|
|
IsChecked = fallbacks.Contains<string>(text5, StringComparer.OrdinalIgnoreCase),
|
|
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
|
|
VerticalAlignment = VerticalAlignment.Center
|
|
};
|
|
if (style != null)
|
|
{
|
|
checkBox.Style = style;
|
|
}
|
|
checkBox.Checked += delegate
|
|
{
|
|
if (!fallbacks.Contains(captured))
|
|
{
|
|
fallbacks.Add(captured);
|
|
}
|
|
FallbackModelsBox.Text = string.Join("\n", fallbacks);
|
|
};
|
|
checkBox.Unchecked += delegate
|
|
{
|
|
fallbacks.RemoveAll((string x) => x.Equals(captured, StringComparison.OrdinalIgnoreCase));
|
|
FallbackModelsBox.Text = string.Join("\n", fallbacks);
|
|
};
|
|
Grid.SetColumn(checkBox, 1);
|
|
grid.Children.Add(checkBox);
|
|
FallbackModelsPanel.Children.Add(grid);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void LoadAdvancedSettings()
|
|
{
|
|
LlmSettings llm = _vm.Service.Settings.Llm;
|
|
if (FallbackModelsBox != null)
|
|
{
|
|
FallbackModelsBox.Text = string.Join("\n", llm.FallbackModels);
|
|
}
|
|
BuildFallbackModelsPanel();
|
|
if (McpServersBox != null)
|
|
{
|
|
try
|
|
{
|
|
string text = JsonSerializer.Serialize(llm.McpServers, new JsonSerializerOptions
|
|
{
|
|
WriteIndented = true,
|
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
|
});
|
|
McpServersBox.Text = text;
|
|
}
|
|
catch
|
|
{
|
|
McpServersBox.Text = "[]";
|
|
}
|
|
}
|
|
BuildMcpServerCards();
|
|
BuildHookCards();
|
|
}
|
|
|
|
private void SaveAdvancedSettings()
|
|
{
|
|
LlmSettings llm = _vm.Service.Settings.Llm;
|
|
if (FallbackModelsBox != null)
|
|
{
|
|
llm.FallbackModels = (from s in FallbackModelsBox.Text.Split('\n', StringSplitOptions.RemoveEmptyEntries)
|
|
select s.Trim() into s
|
|
where s.Length > 0
|
|
select s).ToList();
|
|
}
|
|
if (McpServersBox != null && !string.IsNullOrWhiteSpace(McpServersBox.Text))
|
|
{
|
|
try
|
|
{
|
|
llm.McpServers = JsonSerializer.Deserialize<List<McpServerEntry>>(McpServersBox.Text) ?? new List<McpServerEntry>();
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
if (_toolCardsLoaded)
|
|
{
|
|
llm.DisabledTools = _disabledTools.ToList();
|
|
}
|
|
}
|
|
|
|
private void AddSnippet_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!_vm.AddSnippet())
|
|
{
|
|
CustomMessageBox.Show("키워드와 내용은 필수 항목입니다.\n동일한 키워드가 이미 존재하면 추가할 수 없습니다.", "입력 오류", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
}
|
|
}
|
|
|
|
private void DeleteSnippet_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: SnippetRowModel tag })
|
|
{
|
|
_vm.RemoveSnippet(tag);
|
|
}
|
|
}
|
|
|
|
private void Browse_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
_vm.BrowseTarget();
|
|
}
|
|
|
|
private void AddShortcut_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!_vm.AddShortcut())
|
|
{
|
|
CustomMessageBox.Show("키워드와 실행 대상은 필수 항목입니다.\n이미 동일한 키워드가 존재하면 추가할 수 없습니다.", "입력 오류", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
}
|
|
}
|
|
|
|
private void DeleteShortcut_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: AppShortcutModel tag })
|
|
{
|
|
_vm.RemoveShortcut(tag);
|
|
}
|
|
}
|
|
|
|
private void AddBatchCommand_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!_vm.AddBatchCommand())
|
|
{
|
|
CustomMessageBox.Show("키워드와 명령어는 필수 항목입니다.\n동일한 키워드가 이미 존재하면 추가할 수 없습니다.", "입력 오류", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
|
}
|
|
}
|
|
|
|
private void DeleteBatchCommand_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: BatchCommandModel tag })
|
|
{
|
|
_vm.RemoveBatchCommand(tag);
|
|
}
|
|
}
|
|
|
|
private void ResetCommandAliases_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
_vm.ResetSystemCommandAliases();
|
|
}
|
|
|
|
private void AddIndexPath_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string text = NewIndexPathBox?.Text?.Trim() ?? "";
|
|
if (!string.IsNullOrWhiteSpace(text))
|
|
{
|
|
_vm.AddIndexPath(text);
|
|
if (NewIndexPathBox != null)
|
|
{
|
|
NewIndexPathBox.Text = "";
|
|
}
|
|
}
|
|
}
|
|
|
|
private void BrowseIndexPath_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
_vm.BrowseIndexPath();
|
|
}
|
|
|
|
private void ResetCapPrefix_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
_vm.ResetCapPrefix();
|
|
}
|
|
|
|
private void ResetCapGlobalHotkey_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
_vm.ResetCapGlobalHotkey();
|
|
}
|
|
|
|
private unsafe void CapHotkeyRecorder_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
|
{
|
|
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0014: Invalid comparison between Unknown and I4
|
|
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_002a: Invalid comparison between Unknown and I4
|
|
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0033: Invalid comparison between Unknown and I4
|
|
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_004f: Invalid comparison between Unknown and I4
|
|
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0104: Invalid comparison between Unknown and I4
|
|
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_010b: Invalid comparison between Unknown and I4
|
|
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0112: Invalid comparison between Unknown and I4
|
|
e.Handled = true;
|
|
Key val = (((int)e.Key == 156) ? e.SystemKey : e.Key);
|
|
bool flag = ((val - 70 <= 1 || val - 116 <= 5) ? true : false);
|
|
if (!flag && (int)val != 13)
|
|
{
|
|
List<string> list = new List<string>();
|
|
if (((Enum)Keyboard.Modifiers).HasFlag((Enum)(object)(ModifierKeys)2))
|
|
{
|
|
list.Add("Ctrl");
|
|
}
|
|
if (((Enum)Keyboard.Modifiers).HasFlag((Enum)(object)(ModifierKeys)1))
|
|
{
|
|
list.Add("Alt");
|
|
}
|
|
if (((Enum)Keyboard.Modifiers).HasFlag((Enum)(object)(ModifierKeys)4))
|
|
{
|
|
list.Add("Shift");
|
|
}
|
|
if (((Enum)Keyboard.Modifiers).HasFlag((Enum)(object)(ModifierKeys)8))
|
|
{
|
|
list.Add("Win");
|
|
}
|
|
if (1 == 0)
|
|
{
|
|
}
|
|
string text = (((int)val == 7) ? "Pause" : (((int)val == 30) ? "PrintScreen" : (((int)val != 115) ? ((object)(*(Key*)(&val))/*cast due to .constrained prefix*/).ToString() : "ScrollLock")));
|
|
if (1 == 0)
|
|
{
|
|
}
|
|
string item = text;
|
|
list.Add(item);
|
|
string text2 = string.Join("+", list);
|
|
if (HotkeyParser.TryParse(text2, out var _))
|
|
{
|
|
_vm.CapGlobalHotkey = text2;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ReminderCorner_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.RadioButton { Tag: string tag })
|
|
{
|
|
_vm.ReminderCorner = tag;
|
|
}
|
|
}
|
|
|
|
private void ReminderPreview_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
SettingsService service = _vm.Service;
|
|
(string Text, string? Author) random = QuoteService.GetRandom(service.Settings.Reminder.EnabledCategories);
|
|
string item = random.Text;
|
|
string item2 = random.Author;
|
|
TimeSpan todayUsage = TimeSpan.FromMinutes(42.0);
|
|
ReminderSettings reminder = service.Settings.Reminder;
|
|
string corner = reminder.Corner;
|
|
int displaySeconds = reminder.DisplaySeconds;
|
|
reminder.Corner = _vm.ReminderCorner;
|
|
reminder.DisplaySeconds = _vm.ReminderDisplaySeconds;
|
|
ReminderPopupWindow reminderPopupWindow = new ReminderPopupWindow(item, item2, todayUsage, service);
|
|
reminderPopupWindow.Show();
|
|
reminder.Corner = corner;
|
|
reminder.DisplaySeconds = displaySeconds;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogService.Warn("알림 미리보기 실패: " + ex.Message);
|
|
}
|
|
}
|
|
|
|
private void RemoveIndexPath_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: string tag })
|
|
{
|
|
_vm.RemoveIndexPath(tag);
|
|
}
|
|
}
|
|
|
|
private void AddExtension_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string text = NewExtensionBox?.Text?.Trim() ?? "";
|
|
if (!string.IsNullOrWhiteSpace(text))
|
|
{
|
|
_vm.AddExtension(text);
|
|
if (NewExtensionBox != null)
|
|
{
|
|
NewExtensionBox.Text = "";
|
|
}
|
|
}
|
|
}
|
|
|
|
private void RemoveExtension_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is System.Windows.Controls.Button { Tag: string tag })
|
|
{
|
|
_vm.RemoveExtension(tag);
|
|
}
|
|
}
|
|
|
|
private void Save_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
SaveAdvancedSettings();
|
|
_vm.Save();
|
|
CustomMessageBox.Show("설정이 저장되었습니다.", "AX Copilot", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
|
}
|
|
|
|
private void Cancel_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void ExportSettings_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
Microsoft.Win32.SaveFileDialog saveFileDialog = new Microsoft.Win32.SaveFileDialog
|
|
{
|
|
Title = "설정 내보내기",
|
|
Filter = "AX Copilot 설정|*.axsettings",
|
|
FileName = $"AxCopilot_Settings_{DateTime.Now:yyyyMMdd}",
|
|
DefaultExt = ".axsettings"
|
|
};
|
|
if (saveFileDialog.ShowDialog() != true)
|
|
{
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
string settingsPath = SettingsService.SettingsPath;
|
|
if (File.Exists(settingsPath))
|
|
{
|
|
File.Copy(settingsPath, saveFileDialog.FileName, overwrite: true);
|
|
CustomMessageBox.Show("설정이 내보내졌습니다:\n" + saveFileDialog.FileName, "AX Copilot", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CustomMessageBox.Show("내보내기 실패: " + ex.Message, "오류");
|
|
}
|
|
}
|
|
|
|
private void ImportSettings_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog
|
|
{
|
|
Title = "설정 불러오기",
|
|
Filter = "AX Copilot 설정|*.axsettings|모든 파일|*.*"
|
|
};
|
|
if (openFileDialog.ShowDialog() != true)
|
|
{
|
|
return;
|
|
}
|
|
MessageBoxResult messageBoxResult = CustomMessageBox.Show("설정을 불러오면 현재 설정이 덮어씌워집니다.\n계속하시겠습니까?", "AX Copilot — 설정 불러오기", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
if (messageBoxResult != MessageBoxResult.Yes)
|
|
{
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
string text = File.ReadAllText(openFileDialog.FileName);
|
|
string text2 = CryptoService.PortableDecrypt(text);
|
|
if (string.IsNullOrEmpty(text2))
|
|
{
|
|
try
|
|
{
|
|
AppSettings appSettings = JsonSerializer.Deserialize<AppSettings>(text);
|
|
if (appSettings != null)
|
|
{
|
|
text2 = text;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
if (string.IsNullOrEmpty(text2))
|
|
{
|
|
CustomMessageBox.Show("유효하지 않은 설정 파일입니다.", "오류");
|
|
return;
|
|
}
|
|
AppSettings appSettings2 = JsonSerializer.Deserialize<AppSettings>(text2);
|
|
if (appSettings2 == null)
|
|
{
|
|
CustomMessageBox.Show("설정 파일을 파싱할 수 없습니다.", "오류");
|
|
return;
|
|
}
|
|
string contents = CryptoService.PortableEncrypt(text2);
|
|
File.WriteAllText(SettingsService.SettingsPath, contents);
|
|
CustomMessageBox.Show("설정이 불러와졌습니다.\n변경 사항을 적용하려면 앱을 재시작하세요.", "AX Copilot", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
|
Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CustomMessageBox.Show("불러오기 실패: " + ex.Message, "오류");
|
|
}
|
|
}
|
|
|
|
protected override void OnClosing(CancelEventArgs e)
|
|
{
|
|
base.OnClosing(e);
|
|
}
|
|
|
|
protected override void OnClosed(EventArgs e)
|
|
{
|
|
if (!_saved)
|
|
{
|
|
_revertCallback();
|
|
}
|
|
base.OnClosed(e);
|
|
}
|
|
|
|
[DebuggerNonUserCode]
|
|
[GeneratedCode("PresentationBuildTasks", "10.0.5.0")]
|
|
public void InitializeComponent()
|
|
{
|
|
if (!_contentLoaded)
|
|
{
|
|
_contentLoaded = true;
|
|
Uri resourceLocator = new Uri("/AxCopilot;component/views/settingswindow.xaml", UriKind.Relative);
|
|
System.Windows.Application.LoadComponent(this, resourceLocator);
|
|
}
|
|
}
|
|
|
|
[DebuggerNonUserCode]
|
|
[GeneratedCode("PresentationBuildTasks", "10.0.5.0")]
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
void IComponentConnector.Connect(int connectionId, object target)
|
|
{
|
|
switch (connectionId)
|
|
{
|
|
case 1:
|
|
((SettingsWindow)target).PreviewKeyDown += Window_PreviewKeyDown;
|
|
break;
|
|
case 2:
|
|
GeneralSubTabMain = (System.Windows.Controls.RadioButton)target;
|
|
GeneralSubTabMain.Checked += GeneralSubTab_Checked;
|
|
break;
|
|
case 3:
|
|
GeneralSubTabNotify = (System.Windows.Controls.RadioButton)target;
|
|
GeneralSubTabNotify.Checked += GeneralSubTab_Checked;
|
|
break;
|
|
case 4:
|
|
GeneralSubTabStorage = (System.Windows.Controls.RadioButton)target;
|
|
GeneralSubTabStorage.Checked += GeneralSubTab_Checked;
|
|
break;
|
|
case 5:
|
|
GeneralMainPanel = (ScrollViewer)target;
|
|
break;
|
|
case 6:
|
|
AiEnabledToggle = (System.Windows.Controls.CheckBox)target;
|
|
AiEnabledToggle.Checked += AiEnabled_Changed;
|
|
AiEnabledToggle.Unchecked += AiEnabled_Changed;
|
|
break;
|
|
case 7:
|
|
HotkeyCombo = (System.Windows.Controls.ComboBox)target;
|
|
HotkeyCombo.SelectionChanged += HotkeyCombo_SelectionChanged;
|
|
break;
|
|
case 9:
|
|
NewIndexPathBox = (System.Windows.Controls.TextBox)target;
|
|
break;
|
|
case 10:
|
|
((System.Windows.Controls.Button)target).Click += BrowseIndexPath_Click;
|
|
break;
|
|
case 11:
|
|
((System.Windows.Controls.Button)target).Click += AddIndexPath_Click;
|
|
break;
|
|
case 13:
|
|
NewExtensionBox = (System.Windows.Controls.TextBox)target;
|
|
break;
|
|
case 14:
|
|
((System.Windows.Controls.Button)target).Click += AddExtension_Click;
|
|
break;
|
|
case 15:
|
|
GeneralNotifyPanel = (ScrollViewer)target;
|
|
break;
|
|
case 16:
|
|
NotifyContent = (StackPanel)target;
|
|
break;
|
|
case 17:
|
|
GeneralStoragePanel = (ScrollViewer)target;
|
|
break;
|
|
case 18:
|
|
StorageSummaryText2 = (TextBlock)target;
|
|
break;
|
|
case 19:
|
|
StorageDriveText2 = (TextBlock)target;
|
|
break;
|
|
case 20:
|
|
((System.Windows.Controls.Button)target).Click += BtnStorageRefresh2_Click;
|
|
break;
|
|
case 21:
|
|
((System.Windows.Controls.Button)target).Click += BtnStorageCleanup_Click;
|
|
break;
|
|
case 22:
|
|
StorageDetailPanel2 = (StackPanel)target;
|
|
break;
|
|
case 23:
|
|
ThemeSubTabSelect = (System.Windows.Controls.RadioButton)target;
|
|
ThemeSubTabSelect.Checked += ThemeSubTab_Checked;
|
|
break;
|
|
case 24:
|
|
ThemeSubTabColors = (System.Windows.Controls.RadioButton)target;
|
|
ThemeSubTabColors.Checked += ThemeSubTab_Checked;
|
|
break;
|
|
case 25:
|
|
ThemeSelectPanel = (ScrollViewer)target;
|
|
break;
|
|
case 26:
|
|
ThemeCardsPanel = (ItemsControl)target;
|
|
break;
|
|
case 28:
|
|
ThemeColorsPanel = (Grid)target;
|
|
break;
|
|
case 30:
|
|
ChkDockAutoShow = (System.Windows.Controls.CheckBox)target;
|
|
break;
|
|
case 31:
|
|
ChkDockRainbowGlow = (System.Windows.Controls.CheckBox)target;
|
|
break;
|
|
case 32:
|
|
SliderDockOpacity = (Slider)target;
|
|
break;
|
|
case 33:
|
|
((System.Windows.Controls.Button)target).Click += BtnDockResetPosition_Click;
|
|
break;
|
|
case 34:
|
|
DockItemsPanel = (StackPanel)target;
|
|
break;
|
|
case 35:
|
|
((System.Windows.Controls.Button)target).Click += AddSnippet_Click;
|
|
break;
|
|
case 37:
|
|
((System.Windows.Controls.Button)target).Click += ResetCapPrefix_Click;
|
|
break;
|
|
case 38:
|
|
((System.Windows.Controls.TextBox)target).PreviewKeyDown += CapHotkeyRecorder_PreviewKeyDown;
|
|
break;
|
|
case 39:
|
|
((System.Windows.Controls.Button)target).Click += ResetCapGlobalHotkey_Click;
|
|
break;
|
|
case 40:
|
|
((System.Windows.Controls.RadioButton)target).Click += ReminderCorner_Click;
|
|
break;
|
|
case 41:
|
|
((System.Windows.Controls.RadioButton)target).Click += ReminderCorner_Click;
|
|
break;
|
|
case 42:
|
|
((System.Windows.Controls.RadioButton)target).Click += ReminderCorner_Click;
|
|
break;
|
|
case 43:
|
|
((System.Windows.Controls.RadioButton)target).Click += ReminderCorner_Click;
|
|
break;
|
|
case 44:
|
|
QuoteCategoryPanel = (StackPanel)target;
|
|
break;
|
|
case 45:
|
|
((System.Windows.Controls.Button)target).Click += ReminderPreview_Click;
|
|
break;
|
|
case 46:
|
|
((System.Windows.Controls.Button)target).Click += ResetCommandAliases_Click;
|
|
break;
|
|
case 47:
|
|
((System.Windows.Controls.Button)target).Click += Browse_Click;
|
|
break;
|
|
case 48:
|
|
((System.Windows.Controls.Button)target).Click += AddShortcut_Click;
|
|
break;
|
|
case 50:
|
|
((System.Windows.Controls.Button)target).Click += AddBatchCommand_Click;
|
|
break;
|
|
case 52:
|
|
FunctionSubTabBar = (StackPanel)target;
|
|
break;
|
|
case 53:
|
|
FuncSubTab_AI = (System.Windows.Controls.RadioButton)target;
|
|
FuncSubTab_AI.Checked += FuncSubTab_Checked;
|
|
break;
|
|
case 54:
|
|
FuncSubTab_Launcher = (System.Windows.Controls.RadioButton)target;
|
|
FuncSubTab_Launcher.Checked += FuncSubTab_Checked;
|
|
break;
|
|
case 55:
|
|
FuncSubTab_Design = (System.Windows.Controls.RadioButton)target;
|
|
FuncSubTab_Design.Checked += FuncSubTab_Checked;
|
|
break;
|
|
case 56:
|
|
FuncPanel_AI = (ScrollViewer)target;
|
|
break;
|
|
case 57:
|
|
ChkEnableTextAction = (System.Windows.Controls.CheckBox)target;
|
|
break;
|
|
case 58:
|
|
TextActionCommandsPanel = (StackPanel)target;
|
|
break;
|
|
case 59:
|
|
ChkEnableFileDialog = (System.Windows.Controls.CheckBox)target;
|
|
break;
|
|
case 60:
|
|
FuncPanel_Launcher = (ScrollViewer)target;
|
|
break;
|
|
case 61:
|
|
FuncPanel_Design = (ScrollViewer)target;
|
|
break;
|
|
case 62:
|
|
ChkEnableAutoCategory = (System.Windows.Controls.CheckBox)target;
|
|
break;
|
|
case 63:
|
|
AgentTabItem = (TabItem)target;
|
|
break;
|
|
case 64:
|
|
AgentSubTabs = (StackPanel)target;
|
|
break;
|
|
case 65:
|
|
AgentTabCommon = (System.Windows.Controls.RadioButton)target;
|
|
AgentTabCommon.Checked += AgentSubTab_Checked;
|
|
break;
|
|
case 66:
|
|
AgentTabChat = (System.Windows.Controls.RadioButton)target;
|
|
AgentTabChat.Checked += AgentSubTab_Checked;
|
|
break;
|
|
case 67:
|
|
AgentTabCoworkCode = (System.Windows.Controls.RadioButton)target;
|
|
AgentTabCoworkCode.Checked += AgentSubTab_Checked;
|
|
break;
|
|
case 68:
|
|
AgentTabCowork = (System.Windows.Controls.RadioButton)target;
|
|
AgentTabCowork.Checked += AgentSubTab_Checked;
|
|
break;
|
|
case 69:
|
|
AgentTabCode = (System.Windows.Controls.RadioButton)target;
|
|
AgentTabCode.Checked += AgentSubTab_Checked;
|
|
break;
|
|
case 70:
|
|
AgentTabDev = (System.Windows.Controls.RadioButton)target;
|
|
AgentTabDev.Checked += AgentSubTab_Checked;
|
|
break;
|
|
case 71:
|
|
AgentTabTools = (System.Windows.Controls.RadioButton)target;
|
|
AgentTabTools.Checked += AgentSubTab_Checked;
|
|
break;
|
|
case 72:
|
|
AgentTabEtc = (System.Windows.Controls.RadioButton)target;
|
|
AgentTabEtc.Checked += AgentSubTab_Checked;
|
|
break;
|
|
case 73:
|
|
AgentPanelCommon = (ScrollViewer)target;
|
|
break;
|
|
case 74:
|
|
ServiceSubTabs = (StackPanel)target;
|
|
break;
|
|
case 75:
|
|
SvcTabOllama = (System.Windows.Controls.RadioButton)target;
|
|
SvcTabOllama.Checked += ServiceSubTab_Checked;
|
|
break;
|
|
case 76:
|
|
SvcTabVllm = (System.Windows.Controls.RadioButton)target;
|
|
SvcTabVllm.Checked += ServiceSubTab_Checked;
|
|
break;
|
|
case 77:
|
|
SvcTabGemini = (System.Windows.Controls.RadioButton)target;
|
|
SvcTabGemini.Checked += ServiceSubTab_Checked;
|
|
break;
|
|
case 78:
|
|
SvcTabClaude = (System.Windows.Controls.RadioButton)target;
|
|
SvcTabClaude.Checked += ServiceSubTab_Checked;
|
|
break;
|
|
case 79:
|
|
SvcPanelOllama = (StackPanel)target;
|
|
break;
|
|
case 80:
|
|
BtnAddModel = (System.Windows.Controls.Button)target;
|
|
BtnAddModel.Click += BtnAddModel_Click;
|
|
break;
|
|
case 83:
|
|
CboActiveModel = (System.Windows.Controls.ComboBox)target;
|
|
break;
|
|
case 84:
|
|
SvcPanelVllm = (StackPanel)target;
|
|
break;
|
|
case 85:
|
|
BtnAddVllmModel = (System.Windows.Controls.Button)target;
|
|
BtnAddVllmModel.Click += BtnAddModel_Click;
|
|
break;
|
|
case 88:
|
|
CboActiveVllmModel = (System.Windows.Controls.ComboBox)target;
|
|
break;
|
|
case 89:
|
|
SvcPanelGemini = (StackPanel)target;
|
|
break;
|
|
case 90:
|
|
SvcPanelClaude = (StackPanel)target;
|
|
break;
|
|
case 91:
|
|
BtnTestConnection = (System.Windows.Controls.Button)target;
|
|
BtnTestConnection.Click += BtnTestConnection_Click;
|
|
break;
|
|
case 92:
|
|
StorageSummaryText = (TextBlock)target;
|
|
break;
|
|
case 93:
|
|
StorageDriveText = (TextBlock)target;
|
|
break;
|
|
case 94:
|
|
((System.Windows.Controls.Button)target).Click += BtnStorageRefresh_Click;
|
|
break;
|
|
case 95:
|
|
((System.Windows.Controls.Button)target).Click += BtnStorageCleanup_Click;
|
|
break;
|
|
case 96:
|
|
StorageDetailPanel = (StackPanel)target;
|
|
break;
|
|
case 97:
|
|
AgentBlockSection = (StackPanel)target;
|
|
break;
|
|
case 98:
|
|
HookListPanel = (StackPanel)target;
|
|
break;
|
|
case 99:
|
|
((Border)target).MouseLeftButtonUp += AddHookBtn_Click;
|
|
break;
|
|
case 100:
|
|
BtnBrowseSkillFolder = (System.Windows.Controls.Button)target;
|
|
BtnBrowseSkillFolder.Click += BtnBrowseSkillFolder_Click;
|
|
break;
|
|
case 101:
|
|
BtnOpenSkillFolder = (System.Windows.Controls.Button)target;
|
|
BtnOpenSkillFolder.Click += BtnOpenSkillFolder_Click;
|
|
break;
|
|
case 102:
|
|
AgentPanelChat = (ScrollViewer)target;
|
|
break;
|
|
case 103:
|
|
BtnAddTemplate = (System.Windows.Controls.Button)target;
|
|
BtnAddTemplate.Click += BtnAddTemplate_Click;
|
|
break;
|
|
case 106:
|
|
AgentPanelCoworkCode = (ScrollViewer)target;
|
|
break;
|
|
case 107:
|
|
((System.Windows.Controls.Button)target).Click += BtnClearMemory_Click;
|
|
break;
|
|
case 108:
|
|
AgentPanelCowork = (ScrollViewer)target;
|
|
break;
|
|
case 109:
|
|
AgentPanelCode = (ScrollViewer)target;
|
|
break;
|
|
case 110:
|
|
AgentPanelDev = (ScrollViewer)target;
|
|
break;
|
|
case 111:
|
|
DevModeCheckBox = (System.Windows.Controls.CheckBox)target;
|
|
DevModeCheckBox.Checked += DevModeCheckBox_Checked;
|
|
DevModeCheckBox.Unchecked += DevModeCheckBox_Unchecked;
|
|
break;
|
|
case 112:
|
|
DevModeContent = (StackPanel)target;
|
|
break;
|
|
case 113:
|
|
StepApprovalCheckBox = (System.Windows.Controls.CheckBox)target;
|
|
StepApprovalCheckBox.Checked += StepApprovalCheckBox_Checked;
|
|
break;
|
|
case 114:
|
|
((System.Windows.Controls.Button)target).Click += BtnOpenAuditLog_Click;
|
|
break;
|
|
case 115:
|
|
FallbackModelsPanel = (StackPanel)target;
|
|
break;
|
|
case 116:
|
|
FallbackModelsBox = (System.Windows.Controls.TextBox)target;
|
|
break;
|
|
case 117:
|
|
((System.Windows.Controls.Button)target).Click += BtnAddMcpServer_Click;
|
|
break;
|
|
case 118:
|
|
McpServerListPanel = (StackPanel)target;
|
|
break;
|
|
case 119:
|
|
McpServersBox = (System.Windows.Controls.TextBox)target;
|
|
break;
|
|
case 120:
|
|
AgentPanelEtc = (ScrollViewer)target;
|
|
break;
|
|
case 121:
|
|
AgentEtcContent = (StackPanel)target;
|
|
break;
|
|
case 122:
|
|
AgentPanelTools = (ScrollViewer)target;
|
|
break;
|
|
case 123:
|
|
ToolCardsPanel = (StackPanel)target;
|
|
break;
|
|
case 124:
|
|
McpStatusPanel = (StackPanel)target;
|
|
break;
|
|
case 125:
|
|
VersionInfoText = (TextBlock)target;
|
|
break;
|
|
case 126:
|
|
((System.Windows.Controls.Button)target).Click += ExportSettings_Click;
|
|
break;
|
|
case 127:
|
|
((System.Windows.Controls.Button)target).Click += ImportSettings_Click;
|
|
break;
|
|
case 128:
|
|
((System.Windows.Controls.Button)target).Click += Cancel_Click;
|
|
break;
|
|
case 129:
|
|
((System.Windows.Controls.Button)target).Click += Save_Click;
|
|
break;
|
|
default:
|
|
_contentLoaded = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
[DebuggerNonUserCode]
|
|
[GeneratedCode("PresentationBuildTasks", "10.0.5.0")]
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
void IStyleConnector.Connect(int connectionId, object target)
|
|
{
|
|
switch (connectionId)
|
|
{
|
|
case 8:
|
|
((System.Windows.Controls.Button)target).Click += RemoveIndexPath_Click;
|
|
break;
|
|
case 12:
|
|
((System.Windows.Controls.Button)target).Click += RemoveExtension_Click;
|
|
break;
|
|
case 27:
|
|
((System.Windows.Controls.Button)target).Click += ThemeCard_Click;
|
|
break;
|
|
case 29:
|
|
((System.Windows.Controls.Button)target).Click += ColorSwatch_Click;
|
|
break;
|
|
case 36:
|
|
((System.Windows.Controls.Button)target).Click += DeleteSnippet_Click;
|
|
break;
|
|
case 49:
|
|
((System.Windows.Controls.Button)target).Click += DeleteShortcut_Click;
|
|
break;
|
|
case 51:
|
|
((System.Windows.Controls.Button)target).Click += DeleteBatchCommand_Click;
|
|
break;
|
|
case 81:
|
|
((System.Windows.Controls.Button)target).Click += BtnEditModel_Click;
|
|
break;
|
|
case 82:
|
|
((System.Windows.Controls.Button)target).Click += BtnDeleteModel_Click;
|
|
break;
|
|
case 86:
|
|
((System.Windows.Controls.Button)target).Click += BtnEditModel_Click;
|
|
break;
|
|
case 87:
|
|
((System.Windows.Controls.Button)target).Click += BtnDeleteModel_Click;
|
|
break;
|
|
case 104:
|
|
((System.Windows.Controls.Button)target).Click += BtnEditTemplate_Click;
|
|
break;
|
|
case 105:
|
|
((System.Windows.Controls.Button)target).Click += BtnDeleteTemplate_Click;
|
|
break;
|
|
}
|
|
}
|
|
}
|