diff --git a/src/App.ruleset b/src/App.ruleset index 68d91f4..1f87eb3 100644 --- a/src/App.ruleset +++ b/src/App.ruleset @@ -89,6 +89,18 @@ + + + + + + + + + + + + diff --git a/src/Console/RodelAudio.Console/RodelAudio.Console.csproj b/src/Console/RodelAudio.Console/RodelAudio.Console.csproj index 3a3131e..810c97e 100644 --- a/src/Console/RodelAudio.Console/RodelAudio.Console.csproj +++ b/src/Console/RodelAudio.Console/RodelAudio.Console.csproj @@ -7,11 +7,11 @@ enable - - - - - + + + + + diff --git a/src/Console/RodelChat.Console/RodelChat.Console.csproj b/src/Console/RodelChat.Console/RodelChat.Console.csproj index a21c37e..aa42976 100644 --- a/src/Console/RodelChat.Console/RodelChat.Console.csproj +++ b/src/Console/RodelChat.Console/RodelChat.Console.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/src/Console/RodelDraw.Console/RodelDraw.Console.csproj b/src/Console/RodelDraw.Console/RodelDraw.Console.csproj index 04a1272..4c61c46 100644 --- a/src/Console/RodelDraw.Console/RodelDraw.Console.csproj +++ b/src/Console/RodelDraw.Console/RodelDraw.Console.csproj @@ -7,39 +7,39 @@ enable - - - - - + + + + + - - - - - - - + + + + + + + - - - True - True - DrawService.resx - - + + + True + True + DrawService.resx + + - - - ResXFileCodeGenerator - DrawService.Designer.cs - - + + + ResXFileCodeGenerator + DrawService.Designer.cs + + - - - PreserveNewest - - + + + PreserveNewest + + diff --git a/src/Console/RodelTranslate.Console/RodelTranslate.Console.csproj b/src/Console/RodelTranslate.Console/RodelTranslate.Console.csproj index 62b9e47..2e2b0bb 100644 --- a/src/Console/RodelTranslate.Console/RodelTranslate.Console.csproj +++ b/src/Console/RodelTranslate.Console/RodelTranslate.Console.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/src/Core/RodelAgent.Context/RodelAgent.Context.csproj b/src/Core/RodelAgent.Context/RodelAgent.Context.csproj index 5d22876..cf02fff 100644 --- a/src/Core/RodelAgent.Context/RodelAgent.Context.csproj +++ b/src/Core/RodelAgent.Context/RodelAgent.Context.csproj @@ -7,12 +7,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/Core/RodelAgent.Models/RodelAgent.Models.csproj b/src/Core/RodelAgent.Models/RodelAgent.Models.csproj index d776809..3614f47 100644 --- a/src/Core/RodelAgent.Models/RodelAgent.Models.csproj +++ b/src/Core/RodelAgent.Models/RodelAgent.Models.csproj @@ -7,8 +7,8 @@ - - - + + + diff --git a/src/Core/RodelAgent.Statics/RodelAgent.Statics.csproj b/src/Core/RodelAgent.Statics/RodelAgent.Statics.csproj index bbf2578..f413337 100644 --- a/src/Core/RodelAgent.Statics/RodelAgent.Statics.csproj +++ b/src/Core/RodelAgent.Statics/RodelAgent.Statics.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Core/RodelAudio.Models/RodelAudio.Models.csproj b/src/Core/RodelAudio.Models/RodelAudio.Models.csproj index df3c8d0..53aa2b2 100644 --- a/src/Core/RodelAudio.Models/RodelAudio.Models.csproj +++ b/src/Core/RodelAudio.Models/RodelAudio.Models.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Core/RodelChat.Core/RodelChat.Core.csproj b/src/Core/RodelChat.Core/RodelChat.Core.csproj index ffeb5fe..e603c5a 100644 --- a/src/Core/RodelChat.Core/RodelChat.Core.csproj +++ b/src/Core/RodelChat.Core/RodelChat.Core.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - SKEXP0110;SKEXP0010;SKEXP0001 + $(NoWarn);SKEXP0110 diff --git a/src/Core/RodelChat.Models/RodelChat.Models.csproj b/src/Core/RodelChat.Models/RodelChat.Models.csproj index 76f8994..bce8e53 100644 --- a/src/Core/RodelChat.Models/RodelChat.Models.csproj +++ b/src/Core/RodelChat.Models/RodelChat.Models.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Core/RodelDraw.Models/RodelDraw.Models.csproj b/src/Core/RodelDraw.Models/RodelDraw.Models.csproj index 46927b5..4eda58c 100644 --- a/src/Core/RodelDraw.Models/RodelDraw.Models.csproj +++ b/src/Core/RodelDraw.Models/RodelDraw.Models.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Core/RodelTranslate.Core/RodelTranslate.Core.csproj b/src/Core/RodelTranslate.Core/RodelTranslate.Core.csproj index b82d14e..f10cf88 100644 --- a/src/Core/RodelTranslate.Core/RodelTranslate.Core.csproj +++ b/src/Core/RodelTranslate.Core/RodelTranslate.Core.csproj @@ -19,6 +19,6 @@ - + diff --git a/src/Core/RodelTranslate.Interfaces/RodelTranslate.Interfaces.csproj b/src/Core/RodelTranslate.Interfaces/RodelTranslate.Interfaces.csproj index 0788afc..2ea0a8d 100644 --- a/src/Core/RodelTranslate.Interfaces/RodelTranslate.Interfaces.csproj +++ b/src/Core/RodelTranslate.Interfaces/RodelTranslate.Interfaces.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Core/RodelTranslate.Models/RodelTranslate.Models.csproj b/src/Core/RodelTranslate.Models/RodelTranslate.Models.csproj index c54b6b7..b84ad88 100644 --- a/src/Core/RodelTranslate.Models/RodelTranslate.Models.csproj +++ b/src/Core/RodelTranslate.Models/RodelTranslate.Models.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Desktop/RodelAgent.UI.Models/Constants/SettingNames.cs b/src/Desktop/RodelAgent.UI.Models/Constants/SettingNames.cs index b67279a..edac954 100644 --- a/src/Desktop/RodelAgent.UI.Models/Constants/SettingNames.cs +++ b/src/Desktop/RodelAgent.UI.Models/Constants/SettingNames.cs @@ -48,5 +48,6 @@ public enum SettingNames IsDrawHistoryColumnManualHide, IsAudioHistoryColumnManualHide, LastSelectedFeaturePage, + IsInternalPromptTest, } #pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释 diff --git a/src/Desktop/RodelAgent.UI.ResourceGenerator/RodelAgent.UI.ResourceGenerator.csproj b/src/Desktop/RodelAgent.UI.ResourceGenerator/RodelAgent.UI.ResourceGenerator.csproj index ef71f22..ddf1ca0 100644 --- a/src/Desktop/RodelAgent.UI.ResourceGenerator/RodelAgent.UI.ResourceGenerator.csproj +++ b/src/Desktop/RodelAgent.UI.ResourceGenerator/RodelAgent.UI.ResourceGenerator.csproj @@ -7,10 +7,10 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/Desktop/RodelAgent.UI/App.xaml b/src/Desktop/RodelAgent.UI/App.xaml index a8382e6..160f797 100644 --- a/src/Desktop/RodelAgent.UI/App.xaml +++ b/src/Desktop/RodelAgent.UI/App.xaml @@ -54,6 +54,8 @@ + 850 + diff --git a/src/Desktop/RodelAgent.UI/App.xaml.cs b/src/Desktop/RodelAgent.UI/App.xaml.cs index d8109af..a7c363c 100644 --- a/src/Desktop/RodelAgent.UI/App.xaml.cs +++ b/src/Desktop/RodelAgent.UI/App.xaml.cs @@ -1,5 +1,6 @@ // Copyright (c) Rodel. All rights reserved. +using System.Web; using H.NotifyIcon; using Microsoft.UI.Dispatching; using Microsoft.Windows.AppLifecycle; @@ -126,47 +127,60 @@ private void InitializeTrayIcon() private async Task LaunchWindowAsync(IActivatedEventArgs args = default) { + var instance = AppInstance.FindOrRegisterForKey(Id); if (args is IProtocolActivatedEventArgs protocolArgs && !string.IsNullOrEmpty(protocolArgs.Uri.Host)) { - // 处理协议启动. + if (protocolArgs.Uri.Host == "internal") + { + var query = protocolArgs.Uri.Query; + var queryItems = HttpUtility.ParseQueryString(query); + var feature = queryItems["feature"]?.ToLower() ?? string.Empty; + if (!string.IsNullOrEmpty(feature)) + { + if (feature == "prompt-test") + { + SettingsToolkit.WriteLocalSetting(SettingNames.IsInternalPromptTest, true); + } + else if(feature == "clear") + { + SettingsToolkit.WriteLocalSetting(SettingNames.IsInternalPromptTest, false); + } + } + } } - else + + // If the current instance is not the previously registered instance + if (!instance.IsCurrent) { - var instance = AppInstance.FindOrRegisterForKey(Id); + var activatedArgs = AppInstance.GetCurrent().GetActivatedEventArgs(); - // If the current instance is not the previously registered instance - if (!instance.IsCurrent) - { - var activatedArgs = AppInstance.GetCurrent().GetActivatedEventArgs(); + // Redirect to the existing instance + await instance.RedirectActivationToAsync(activatedArgs); - // Redirect to the existing instance - await instance.RedirectActivationToAsync(activatedArgs); + // Kill the current instance + Current.Exit(); + return; + } - // Kill the current instance - Current.Exit(); - return; - } + var shouldSkipStartup = SettingsToolkit.ReadLocalSetting(SettingNames.ShouldSkipStartup, false); + if (!shouldSkipStartup) + { + var window = new StartupWindow(); + window.Activate(); + } + else + { + _window = new MainWindow(); + _window.Closed += OnMainWindowClosedAsync; - var shouldSkipStartup = SettingsToolkit.ReadLocalSetting(SettingNames.ShouldSkipStartup, false); - if (!shouldSkipStartup) + HandleCloseEvents = SettingsToolkit.ReadLocalSetting(SettingNames.HideWhenCloseWindow, true); + if (HandleCloseEvents) { - var window = new StartupWindow(); - window.Activate(); + InitializeTrayIcon(); } - else - { - _window = new MainWindow(); - _window.Closed += OnMainWindowClosedAsync; - HandleCloseEvents = SettingsToolkit.ReadLocalSetting(SettingNames.HideWhenCloseWindow, true); - if (HandleCloseEvents) - { - InitializeTrayIcon(); - } - - _window.Activate(); - } + _window.Activate(); } } diff --git a/src/Desktop/RodelAgent.UI/Controls/Audio/AudioHistorySection.xaml b/src/Desktop/RodelAgent.UI/Controls/Audio/AudioHistorySection.xaml index e92aff6..91b9943 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Audio/AudioHistorySection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Audio/AudioHistorySection.xaml @@ -3,10 +3,10 @@ x:Class="RodelAgent.UI.Controls.Audio.AudioHistorySection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:client="using:RodelAudio.Models.Client" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" xmlns:ic="using:FluentIcons.WinUI" + xmlns:items="using:RodelAgent.UI.ViewModels.Items" xmlns:local="using:RodelAgent.UI.Controls.Audio" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> @@ -63,7 +63,7 @@ - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Audio/AudioSessionItemControl.xaml b/src/Desktop/RodelAgent.UI/Controls/Audio/AudioSessionItemControl.xaml index 4d121fe..ab3f821 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Audio/AudioSessionItemControl.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Audio/AudioSessionItemControl.xaml @@ -38,11 +38,11 @@ Foreground="{ThemeResource TextFillColorSecondaryBrush}" MaxLines="2" Style="{StaticResource CaptionTextBlockStyle}" - Text="{x:Bind ViewModel.Text, Mode=OneWay}" + Text="{x:Bind ViewModel.Data.Text, Mode=OneWay}" TextTrimming="CharacterEllipsis" TextWrapping="Wrap"> - + + Text="{x:Bind ViewModel.Data.Voice, Mode=OneWay}" /> @@ -68,7 +68,7 @@ VerticalAlignment="Center" AvatarPadding="4" IsAvatar="True" - Provider="{x:Bind ViewModel.Provider, Mode=OneWay}" /> + Provider="{x:Bind ViewModel.Data.Provider, Mode=OneWay}" /> InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(AudioSessionItemViewModel? oldValue, AudioSessionItemViewModel? newValue) => Initialize(); /// @@ -35,9 +35,9 @@ private void Initialize() return; } - var time = !ViewModel.Time.HasValue + var time = !ViewModel.Data.Time.HasValue ? "-/-" - : ViewModel.Time.Value.ToString("yyyy-MM-dd HH:mm:ss"); + : ViewModel.Data.Time.Value.ToString("yyyy-MM-dd HH:mm:ss"); DateBlock.Text = time; } @@ -45,7 +45,7 @@ private void OnSessionClick(object sender, RoutedEventArgs e) => GetSessionViewModel().LoadSessionCommand.Execute(ViewModel); private void OnOpenItemClick(object sender, RoutedEventArgs e) - => GetSessionViewModel().OpenAudioCommand.Execute(AppToolkit.GetSpeechPath(ViewModel.Id)); + => GetSessionViewModel().OpenAudioCommand.Execute(AppToolkit.GetSpeechPath(ViewModel.Data.Id)); private void OnDeleteItemClick(object sender, RoutedEventArgs e) { @@ -57,6 +57,6 @@ private void OnDeleteItemClick(object sender, RoutedEventArgs e) /// /// 会话项控件基类. /// -public abstract class AudioSessionItemControlBase : LayoutUserControlBase +public abstract class AudioSessionItemControlBase : LayoutUserControlBase { } diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatGroupHistory.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatGroupHistory.xaml.cs index b2caf61..f8f6911 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatGroupHistory.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatGroupHistory.xaml.cs @@ -15,14 +15,14 @@ public sealed partial class ChatGroupHistory : ChatGroupControlBase public ChatGroupHistory() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatGroupViewModel? oldValue, ChatGroupViewModel? newValue) { - if (e.OldValue is ChatGroupViewModel oldVm) + if (oldValue is ChatGroupViewModel oldVm) { oldVm.RequestScrollToBottom -= OnRequestScrollToBottomAsync; } - if (e.NewValue is ChatGroupViewModel newVm) + if (newValue is ChatGroupViewModel newVm) { newVm.RequestScrollToBottom += OnRequestScrollToBottomAsync; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatGroupInput.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatGroupInput.xaml.cs index efb0a9d..9243a82 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatGroupInput.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatGroupInput.xaml.cs @@ -18,14 +18,14 @@ public sealed partial class ChatGroupInput : ChatGroupControlBase public ChatGroupInput() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatGroupViewModel? oldValue, ChatGroupViewModel? newValue) { - if (e.OldValue is ChatGroupViewModel oldVm) + if (oldValue is ChatGroupViewModel oldVm) { oldVm.RequestFocusInput -= OnRequestFocusInput; } - if (e.NewValue is ChatGroupViewModel newVm) + if (newValue is ChatGroupViewModel newVm) { newVm.RequestFocusInput += OnRequestFocusInput; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatMessageItemControl.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatMessageItemControl.xaml.cs index ce601d4..7effca6 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatMessageItemControl.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatMessageItemControl.xaml.cs @@ -15,9 +15,9 @@ public sealed partial class ChatMessageItemControl : ChatMessageItemControlBase public ChatMessageItemControl() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatMessageItemViewModel? oldValue, ChatMessageItemViewModel? newValue) { - if (e.NewValue is ChatMessageItemViewModel vm) + if (newValue is ChatMessageItemViewModel vm) { _ = vm.IsUser ? VisualStateManager.GoToState(this, nameof(MyState), false) diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatProviderOptionPanel.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatProviderOptionPanel.xaml.cs index 3722ed6..78dd984 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatProviderOptionPanel.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatProviderOptionPanel.xaml.cs @@ -4,7 +4,7 @@ using RodelAgent.Interfaces; using RodelAgent.Models.Abstractions; using RodelAgent.Models.Constants; -using RodelChat.Models.Client; +using RodelAgent.UI.ViewModels.Items; namespace RodelAgent.UI.Controls.Chat; @@ -41,7 +41,7 @@ public bool IsMaxRoundEnabled } /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatPresetItemViewModel? oldValue, ChatPresetItemViewModel? newValue) { _isInitialized = false; if (IsLoaded) @@ -56,15 +56,15 @@ protected override void OnControlLoaded() private void Initialize() { - if (ViewModel?.Parameters == null) + if (ViewModel?.Data.Parameters == null) { return; } - StreamOutputSwitch.IsOn = ViewModel.UseStreamOutput; - MaxTurnSlider.Value = ViewModel.MaxRounds; + StreamOutputSwitch.IsOn = ViewModel.Data.UseStreamOutput; + MaxTurnSlider.Value = ViewModel.Data.MaxRounds; CustomPanel.Children.Clear(); - var properties = ViewModel.Parameters.GetType().GetProperties(); + var properties = ViewModel.Data.Parameters.GetType().GetProperties(); for (var i = 0; i < properties.Length; i++) { var property = properties[i]; @@ -107,7 +107,7 @@ private void Initialize() private FrameworkElement CreateBooleanElement(BaseFieldAttribute attr, PropertyInfo property) { var boolAttr = attr as BooleanFieldAttribute; - var value = property.GetValue(ViewModel.Parameters) as bool?; + var value = property.GetValue(ViewModel.Data.Parameters) as bool?; var toggleSwitch = new ToggleSwitch { IsOn = value ?? false, @@ -116,8 +116,8 @@ private FrameworkElement CreateBooleanElement(BaseFieldAttribute attr, PropertyI toggleSwitch.Toggled += (s, e) => { - property.SetValue(ViewModel.Parameters, toggleSwitch.IsOn); - ViewModel.Parameters.ToDictionary(); + property.SetValue(ViewModel.Data.Parameters, toggleSwitch.IsOn); + ViewModel.Data.Parameters.ToDictionary(); PropertyChanged?.Invoke(this, EventArgs.Empty); }; @@ -131,7 +131,7 @@ private FrameworkElement CreateBooleanElement(BaseFieldAttribute attr, PropertyI private FrameworkElement CreateRangeFloatElement(BaseFieldAttribute attr, PropertyInfo property) { var rangeAttr = attr as RangeFloatFieldAttribute; - var value = property.GetValue(ViewModel.Parameters) as double?; + var value = property.GetValue(ViewModel.Data.Parameters) as double?; var min = rangeAttr.Minimum; var max = rangeAttr.Maximum; @@ -152,8 +152,8 @@ private FrameworkElement CreateRangeFloatElement(BaseFieldAttribute attr, Proper numberBox.ValueChanged += (s, e) => { - property.SetValue(ViewModel.Parameters, numberBox.Value); - ViewModel.Parameters.ToDictionary(); + property.SetValue(ViewModel.Data.Parameters, numberBox.Value); + ViewModel.Data.Parameters.ToDictionary(); PropertyChanged?.Invoke(this, EventArgs.Empty); }; @@ -172,8 +172,8 @@ private FrameworkElement CreateRangeFloatElement(BaseFieldAttribute attr, Proper slider.ValueChanged += (s, e) => { - property.SetValue(ViewModel.Parameters, slider.Value); - ViewModel.Parameters.ToDictionary(); + property.SetValue(ViewModel.Data.Parameters, slider.Value); + ViewModel.Data.Parameters.ToDictionary(); PropertyChanged?.Invoke(this, EventArgs.Empty); }; @@ -189,7 +189,7 @@ private FrameworkElement CreateRangeFloatElement(BaseFieldAttribute attr, Proper private FrameworkElement CreateRangeIntElement(BaseFieldAttribute attr, PropertyInfo property) { var rangeAttr = attr as RangeIntFieldAttribute; - var value = property.GetValue(ViewModel.Parameters) as int?; + var value = property.GetValue(ViewModel.Data.Parameters) as int?; var min = rangeAttr.Minimum; var max = rangeAttr.Maximum; object innerElement = null; @@ -210,8 +210,8 @@ private FrameworkElement CreateRangeIntElement(BaseFieldAttribute attr, Property numberBox.ValueChanged += (s, e) => { - property.SetValue(ViewModel.Parameters, Convert.ToInt32(numberBox.Value)); - ViewModel.Parameters.ToDictionary(); + property.SetValue(ViewModel.Data.Parameters, Convert.ToInt32(numberBox.Value)); + ViewModel.Data.Parameters.ToDictionary(); PropertyChanged?.Invoke(this, EventArgs.Empty); }; @@ -230,8 +230,8 @@ private FrameworkElement CreateRangeIntElement(BaseFieldAttribute attr, Property slider.ValueChanged += (s, e) => { - property.SetValue(ViewModel.Parameters, (int)slider.Value); - ViewModel.Parameters.ToDictionary(); + property.SetValue(ViewModel.Data.Parameters, (int)slider.Value); + ViewModel.Data.Parameters.ToDictionary(); PropertyChanged?.Invoke(this, EventArgs.Empty); }; @@ -247,7 +247,7 @@ private FrameworkElement CreateRangeIntElement(BaseFieldAttribute attr, Property private FrameworkElement CreateRangeLongElement(BaseFieldAttribute attr, PropertyInfo property) { var rangeAttr = attr as RangeLongFieldAttribute; - var value = property.GetValue(ViewModel.Parameters) as long?; + var value = property.GetValue(ViewModel.Data.Parameters) as long?; var min = rangeAttr.Minimum; var max = rangeAttr.Maximum; var numberBox = new NumberBox @@ -263,8 +263,8 @@ private FrameworkElement CreateRangeLongElement(BaseFieldAttribute attr, Propert numberBox.ValueChanged += (s, e) => { - property.SetValue(ViewModel.Parameters, Convert.ToInt64(numberBox.Value)); - ViewModel.Parameters.ToDictionary(); + property.SetValue(ViewModel.Data.Parameters, Convert.ToInt64(numberBox.Value)); + ViewModel.Data.Parameters.ToDictionary(); PropertyChanged?.Invoke(this, EventArgs.Empty); }; @@ -277,7 +277,7 @@ private FrameworkElement CreateRangeLongElement(BaseFieldAttribute attr, Propert private FrameworkElement CreateSelectionElement(BaseFieldAttribute attr, PropertyInfo property) { var selectionAttr = attr as SelectionFieldAttribute; - var value = property.GetValue(ViewModel.Parameters) as string; + var value = property.GetValue(ViewModel.Data.Parameters) as string; var comboBox = new ComboBox { ItemsSource = selectionAttr.Options, @@ -287,8 +287,8 @@ private FrameworkElement CreateSelectionElement(BaseFieldAttribute attr, Propert comboBox.SelectionChanged += (s, e) => { - property.SetValue(ViewModel.Parameters, comboBox.SelectedItem); - ViewModel.Parameters.ToDictionary(); + property.SetValue(ViewModel.Data.Parameters, comboBox.SelectedItem); + ViewModel.Data.Parameters.ToDictionary(); PropertyChanged?.Invoke(this, EventArgs.Empty); }; @@ -300,15 +300,15 @@ private FrameworkElement CreateSelectionElement(BaseFieldAttribute attr, Propert private FrameworkElement CreateTextElement(BaseFieldAttribute attr, PropertyInfo property) { - var value = property.GetValue(ViewModel.Parameters) as string; + var value = property.GetValue(ViewModel.Data.Parameters) as string; var panel = TextTemplate.LoadContent() as StackPanel; var box = panel.Children.OfType().First(); box.Text = value; box.TextChanged += (s, e) => { - property.SetValue(ViewModel.Parameters, box.Text); - ViewModel.Parameters.ToDictionary(); + property.SetValue(ViewModel.Data.Parameters, box.Text); + ViewModel.Data.Parameters.ToDictionary(); PropertyChanged?.Invoke(this, EventArgs.Empty); }; @@ -323,7 +323,7 @@ private void OnStreamOutputChanged(object sender, RoutedEventArgs e) return; } - ViewModel.UseStreamOutput = StreamOutputSwitch.IsOn; + ViewModel.Data.UseStreamOutput = StreamOutputSwitch.IsOn; PropertyChanged?.Invoke(this, EventArgs.Empty); } @@ -351,7 +351,7 @@ private void OnChatTruenChanged(object sender, RangeBaseValueChangedEventArgs e) return; } - ViewModel.MaxRounds = Convert.ToInt32(MaxTurnSlider.Value); + ViewModel.Data.MaxRounds = Convert.ToInt32(MaxTurnSlider.Value); PropertyChanged?.Invoke(this, EventArgs.Empty); } } @@ -359,6 +359,6 @@ private void OnChatTruenChanged(object sender, RangeBaseValueChangedEventArgs e) /// /// 聊天服务选项面板基类. /// -public abstract class ChatProviderOptionPanelBase : LayoutUserControlBase +public abstract class ChatProviderOptionPanelBase : LayoutUserControlBase { } diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatSessionHistory.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatSessionHistory.xaml.cs index 203b359..9da7d8f 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatSessionHistory.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatSessionHistory.xaml.cs @@ -15,14 +15,14 @@ public sealed partial class ChatSessionHistory : ChatSessionControlBase public ChatSessionHistory() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatSessionViewModel? oldValue, ChatSessionViewModel? newValue) { - if (e.OldValue is ChatSessionViewModel oldVm) + if (oldValue is ChatSessionViewModel oldVm) { oldVm.RequestScrollToBottom -= OnRequestScrollToBottomAsync; } - if (e.NewValue is ChatSessionViewModel newVm) + if (newValue is ChatSessionViewModel newVm) { newVm.RequestScrollToBottom += OnRequestScrollToBottomAsync; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatSessionInput.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatSessionInput.xaml.cs index 03cfbc7..fc49a82 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Chat/ChatSessionInput.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Chat/ChatSessionInput.xaml.cs @@ -22,14 +22,14 @@ public ChatSessionInput() } /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatSessionViewModel? oldValue, ChatSessionViewModel? newValue) { - if (e.OldValue is ChatSessionViewModel oldVm) + if (oldValue is ChatSessionViewModel oldVm) { oldVm.RequestFocusInput -= OnRequestFocusInput; } - if (e.NewValue is ChatSessionViewModel newVm) + if (newValue is ChatSessionViewModel newVm) { newVm.RequestFocusInput += OnRequestFocusInput; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/PresetDetailPanel.xaml b/src/Desktop/RodelAgent.UI/Controls/Chat/PresetDetailPanel.xaml index ec94fe1..493cc63 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Chat/PresetDetailPanel.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Chat/PresetDetailPanel.xaml @@ -23,7 +23,7 @@ - + @@ -15,7 +17,7 @@ public sealed partial class SystemInstructionPanel : ChatSessionControlBase public SystemInstructionPanel() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatSessionViewModel? oldValue, ChatSessionViewModel? newValue) => UpdateInstruction(); /// diff --git a/src/Desktop/RodelAgent.UI/Controls/Draw/DrawHistorySection.xaml b/src/Desktop/RodelAgent.UI/Controls/Draw/DrawHistorySection.xaml index c49e137..ea22c74 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Draw/DrawHistorySection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Draw/DrawHistorySection.xaml @@ -3,10 +3,10 @@ x:Class="RodelAgent.UI.Controls.Draw.DrawHistorySection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:client="using:RodelDraw.Models.Client" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" xmlns:ic="using:FluentIcons.WinUI" + xmlns:items="using:RodelAgent.UI.ViewModels.Items" xmlns:local="using:RodelAgent.UI.Controls.Draw" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> @@ -63,7 +63,7 @@ - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Draw/DrawSessionItemControl.xaml b/src/Desktop/RodelAgent.UI/Controls/Draw/DrawSessionItemControl.xaml index ca3d2be..f70ed99 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Draw/DrawSessionItemControl.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Draw/DrawSessionItemControl.xaml @@ -43,11 +43,11 @@ Foreground="{ThemeResource TextFillColorSecondaryBrush}" MaxLines="2" Style="{StaticResource CaptionTextBlockStyle}" - Text="{x:Bind ViewModel.Request.Prompt, Mode=OneWay}" + Text="{x:Bind ViewModel.Data.Request.Prompt, Mode=OneWay}" TextTrimming="CharacterEllipsis" TextWrapping="Wrap"> - + @@ -69,7 +69,7 @@ VerticalAlignment="Center" AvatarPadding="4" IsAvatar="True" - Provider="{x:Bind ViewModel.Provider, Mode=OneWay}" /> + Provider="{x:Bind ViewModel.Data.Provider, Mode=OneWay}" /> InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(DrawSessionItemViewModel? oldValue, DrawSessionItemViewModel? newValue) => Initialize(); /// @@ -37,13 +37,13 @@ private void Initialize() return; } - var time = !ViewModel.Time.HasValue + var time = !ViewModel.Data.Time.HasValue ? "-/-" - : ViewModel.Time.Value.ToString("yyyy-MM-dd HH:mm:ss"); + : ViewModel.Data.Time.Value.ToString("yyyy-MM-dd HH:mm:ss"); DateBlock.Text = time; _xi = 1; - var sp = ViewModel.Request.Size.Split("x"); + var sp = ViewModel.Data.Request.Size.Split("x"); if (sp.Length == 2) { var width = double.Parse(sp[0]); @@ -79,10 +79,10 @@ private void OnSessionClick(object sender, RoutedEventArgs e) => GetSessionViewModel().LoadSessionCommand.Execute(ViewModel); private void OnCopyItemClick(object sender, RoutedEventArgs e) - => GetSessionViewModel().CopyImageCommand.Execute(AppToolkit.GetDrawPicturePath(ViewModel.Id)); + => GetSessionViewModel().CopyImageCommand.Execute(AppToolkit.GetDrawPicturePath(ViewModel.Data.Id)); private void OnOpenItemClick(object sender, RoutedEventArgs e) - => GetSessionViewModel().OpenImageCommand.Execute(AppToolkit.GetDrawPicturePath(ViewModel.Id)); + => GetSessionViewModel().OpenImageCommand.Execute(AppToolkit.GetDrawPicturePath(ViewModel.Data.Id)); private void OnDeleteItemClick(object sender, RoutedEventArgs e) { @@ -94,6 +94,6 @@ private void OnDeleteItemClick(object sender, RoutedEventArgs e) /// /// 会话项控件基类. /// -public abstract class DrawSessionItemControlBase : LayoutUserControlBase +public abstract class DrawSessionItemControlBase : LayoutUserControlBase { } diff --git a/src/Desktop/RodelAgent.UI/Controls/Draw/DrawSessionPresenter.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Draw/DrawSessionPresenter.xaml.cs index 763f452..0ac0d0a 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Draw/DrawSessionPresenter.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Draw/DrawSessionPresenter.xaml.cs @@ -21,14 +21,14 @@ public DrawSessionPresenter() } /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(DrawSessionViewModel? oldValue, DrawSessionViewModel? newValue) { - if (e.OldValue is DrawSessionViewModel oldViewModel) + if (oldValue is DrawSessionViewModel oldViewModel) { oldViewModel.DataChanged -= OnDataChanged; } - if (e.NewValue is DrawSessionViewModel newViewModel) + if (newValue is DrawSessionViewModel newViewModel) { newViewModel.DataChanged += OnDataChanged; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AboutSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/AboutSettingSection.xaml index 1bb62ee..cfd715c 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AboutSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AboutSettingSection.xaml @@ -3,20 +3,20 @@ x:Class="RodelAgent.UI.Controls.Settings.AboutSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" xmlns:local="using:RodelAgent.UI.Controls.Settings" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - + + - + - - + + - - - + + + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AliTranslateConfigSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/AliTranslateConfigSettingSection.xaml index 0a812fd..bdf2483 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AliTranslateConfigSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AliTranslateConfigSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.AliTranslateConfigSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:controls="using:RodelAgent.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" @@ -12,15 +12,15 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - + + - - - + + @@ -30,20 +30,20 @@ AutomationProperties.Name="{ext:Locale Name=AccessKey}" Loaded="OnKeyBoxLoaded" PasswordChanged="OnKeyBoxPasswordChanged" /> - - + + - - + + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AliTranslateConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/AliTranslateConfigSettingSection.xaml.cs index 457f8fc..8850911 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AliTranslateConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AliTranslateConfigSettingSection.xaml.cs @@ -16,9 +16,9 @@ public sealed partial class AliTranslateConfigSettingSection : TranslateServiceC public AliTranslateConfigSettingSection() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(TranslateServiceItemViewModel? oldValue, TranslateServiceItemViewModel? newValue) { - if (e.NewValue is not TranslateServiceItemViewModel newVM) + if (newValue is not TranslateServiceItemViewModel newVM) { return; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AppLogSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/AppLogSettingSection.xaml index 65b1901..3d26381 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AppLogSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AppLogSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.AppLogSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" xmlns:ic="using:FluentIcons.WinUI" @@ -11,14 +11,14 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - + - - + + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIAudioConfigSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIAudioConfigSettingSection.xaml index 968dbbc..e26df33 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIAudioConfigSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIAudioConfigSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.AzureOpenAIAudioConfigSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:controls="using:RodelAgent.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" @@ -13,12 +13,12 @@ xmlns:startup="using:RodelAgent.UI.Controls.Startup" mc:Ignorable="d"> - - + + - - - + + @@ -28,8 +28,8 @@ AutomationProperties.Name="{ext:Locale Name=AccessKey}" Loaded="OnKeyBoxLoaded" PasswordChanged="OnKeyBoxPasswordChanged" /> - - + @@ -39,8 +39,8 @@ AutomationProperties.Name="{ext:Locale Name=Endpoint}" PlaceholderText="https://example.openai.azure.com" TextChanged="OnEndpointBoxTextChanged" /> - - + @@ -51,13 +51,13 @@ - - + + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIAudioConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIAudioConfigSettingSection.xaml.cs index 97dff44..6f9dc74 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIAudioConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIAudioConfigSettingSection.xaml.cs @@ -20,9 +20,9 @@ public AzureOpenAIAudioConfigSettingSection() } /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(AudioServiceItemViewModel? oldValue, AudioServiceItemViewModel? newValue) { - if (e.NewValue is not AudioServiceItemViewModel newVM) + if (newValue is not AudioServiceItemViewModel newVM) { return; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIChatConfigSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIChatConfigSettingSection.xaml index d347adf..093a584 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIChatConfigSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIChatConfigSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.AzureOpenAIChatConfigSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:controls="using:RodelAgent.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" @@ -13,12 +13,12 @@ xmlns:startup="using:RodelAgent.UI.Controls.Startup" mc:Ignorable="d"> - - + + - - - + + @@ -28,8 +28,8 @@ AutomationProperties.Name="{ext:Locale Name=AccessKey}" Loaded="OnKeyBoxLoaded" PasswordChanged="OnKeyBoxPasswordChanged" /> - - + @@ -39,8 +39,8 @@ AutomationProperties.Name="{ext:Locale Name=Endpoint}" PlaceholderText="https://example.openai.azure.com" TextChanged="OnEndpointBoxTextChanged" /> - - + @@ -56,9 +56,9 @@ - - - + + + - + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIChatConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIChatConfigSettingSection.xaml.cs index e2bcb72..db0c350 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIChatConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIChatConfigSettingSection.xaml.cs @@ -23,9 +23,9 @@ public AzureOpenAIChatConfigSettingSection() } /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatServiceItemViewModel? oldValue, ChatServiceItemViewModel? newValue) { - if (e.NewValue is not ChatServiceItemViewModel newVM) + if (newValue is not ChatServiceItemViewModel newVM) { return; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIDrawConfigSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIDrawConfigSettingSection.xaml index 26c33ef..4b91724 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIDrawConfigSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIDrawConfigSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.AzureOpenAIDrawConfigSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:controls="using:RodelAgent.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" @@ -13,12 +13,12 @@ xmlns:startup="using:RodelAgent.UI.Controls.Startup" mc:Ignorable="d"> - - + + - - - + + @@ -28,8 +28,8 @@ AutomationProperties.Name="{ext:Locale Name=AccessKey}" Loaded="OnKeyBoxLoaded" PasswordChanged="OnKeyBoxPasswordChanged" /> - - + @@ -39,8 +39,8 @@ AutomationProperties.Name="{ext:Locale Name=Endpoint}" PlaceholderText="https://example.openai.azure.com" TextChanged="OnEndpointBoxTextChanged" /> - - + @@ -56,9 +56,9 @@ - - - + + + - + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIDrawConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIDrawConfigSettingSection.xaml.cs index ebeb890..3d55982 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIDrawConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureOpenAIDrawConfigSettingSection.xaml.cs @@ -23,9 +23,9 @@ public AzureOpenAIDrawConfigSettingSection() } /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(DrawServiceItemViewModel? oldValue, DrawServiceItemViewModel? newValue) { - if (e.NewValue is not DrawServiceItemViewModel newVM) + if (newValue is not DrawServiceItemViewModel newVM) { return; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureSpeechConfigSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureSpeechConfigSettingSection.xaml index ce9479d..c4ffeac 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureSpeechConfigSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureSpeechConfigSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.AzureSpeechConfigSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:controls="using:RodelAgent.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" @@ -12,12 +12,12 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - + + - - - + + @@ -27,8 +27,8 @@ AutomationProperties.Name="{ext:Locale Name=AccessKey}" Loaded="OnKeyBoxLoaded" PasswordChanged="OnKeyBoxPasswordChanged" /> - - + @@ -38,13 +38,13 @@ AutomationProperties.Name="{ext:Locale Name=Region}" PlaceholderText="eastus" TextChanged="OnRegionBoxTextChanged" /> - - + + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureSpeechConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureSpeechConfigSettingSection.xaml.cs index 6ac6072..1af9b5f 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureSpeechConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureSpeechConfigSettingSection.xaml.cs @@ -16,9 +16,9 @@ public sealed partial class AzureSpeechConfigSettingSection : AudioServiceConfig public AzureSpeechConfigSettingSection() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(AudioServiceItemViewModel? oldValue, AudioServiceItemViewModel? newValue) { - if (e.NewValue is not AudioServiceItemViewModel newVM) + if (newValue is not AudioServiceItemViewModel newVM) { return; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureTranslateConfigSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureTranslateConfigSettingSection.xaml index 19d8c21..a94c5d8 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureTranslateConfigSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureTranslateConfigSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.AzureTranslateConfigSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:controls="using:RodelAgent.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" @@ -12,12 +12,12 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - + + - - - + + @@ -27,8 +27,8 @@ AutomationProperties.Name="{ext:Locale Name=AccessKey}" Loaded="OnKeyBoxLoaded" PasswordChanged="OnKeyBoxPasswordChanged" /> - - + @@ -38,13 +38,13 @@ AutomationProperties.Name="{ext:Locale Name=Region}" PlaceholderText="eastus" TextChanged="OnRegionBoxTextChanged" /> - - + + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureTranslateConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureTranslateConfigSettingSection.xaml.cs index 0f04ca6..a2b25e7 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/AzureTranslateConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/AzureTranslateConfigSettingSection.xaml.cs @@ -16,9 +16,9 @@ public sealed partial class AzureTranslateConfigSettingSection : TranslateServic public AzureTranslateConfigSettingSection() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(TranslateServiceItemViewModel? oldValue, TranslateServiceItemViewModel? newValue) { - if (e.NewValue is not TranslateServiceItemViewModel newVM) + if (newValue is not TranslateServiceItemViewModel newVM) { return; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/DouBaoChatConfigSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/DouBaoChatConfigSettingSection.xaml index 42c8d26..f6154ec 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/DouBaoChatConfigSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/DouBaoChatConfigSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.DouBaoChatConfigSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:controls="using:RodelAgent.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" @@ -13,21 +13,21 @@ xmlns:startup="using:RodelAgent.UI.Controls.Startup" mc:Ignorable="d"> - - + + - - - + + + - - - + + + - + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/DouBaoChatConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/DouBaoChatConfigSettingSection.xaml.cs index 3f28fe9..bc7ce26 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/DouBaoChatConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/DouBaoChatConfigSettingSection.xaml.cs @@ -17,9 +17,9 @@ public sealed partial class DouBaoChatConfigSettingSection : ChatServiceConfigCo public DouBaoChatConfigSettingSection() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatServiceItemViewModel? oldValue, ChatServiceItemViewModel? newValue) { - if (e.NewValue is not ChatServiceItemViewModel newVM) + if (newValue is not ChatServiceItemViewModel newVM) { return; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanChatConfigSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanChatConfigSettingSection.xaml index 7a9d098..0a4f781 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanChatConfigSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanChatConfigSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.HunYuanChatConfigSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:controls="using:RodelAgent.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" @@ -13,20 +13,20 @@ xmlns:startup="using:RodelAgent.UI.Controls.Startup" mc:Ignorable="d"> - - + + - - - + + + - - + @@ -36,8 +36,8 @@ HorizontalAlignment="Stretch" AutomationProperties.Name="{ext:Locale Name=SecretId}" PasswordChanged="OnSecretBoxTextChanged" /> - - + @@ -48,9 +48,9 @@ - - - + + + - + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanChatConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanChatConfigSettingSection.xaml.cs index a2875ee..0fb6e44 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanChatConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanChatConfigSettingSection.xaml.cs @@ -18,9 +18,9 @@ public sealed partial class HunYuanChatConfigSettingSection : ChatServiceConfigC public HunYuanChatConfigSettingSection() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(ChatServiceItemViewModel? oldValue, ChatServiceItemViewModel? newValue) { - if (e.NewValue is not ChatServiceItemViewModel newVM) + if (newValue is not ChatServiceItemViewModel newVM) { return; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanDrawConfigSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanDrawConfigSettingSection.xaml index 5a25b7a..d7a5687 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanDrawConfigSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanDrawConfigSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.HunYuanDrawConfigSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:controls="using:RodelAgent.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" @@ -13,20 +13,20 @@ xmlns:startup="using:RodelAgent.UI.Controls.Startup" mc:Ignorable="d"> - - + + - - - + + + - - + @@ -36,8 +36,8 @@ HorizontalAlignment="Stretch" AutomationProperties.Name="{ext:Locale Name=SecretId}" PasswordChanged="OnSecretBoxTextChanged" /> - - + @@ -48,9 +48,9 @@ - - - + + + - + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanDrawConfigSettingSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanDrawConfigSettingSection.xaml.cs index a7d3a98..d7b2b75 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanDrawConfigSettingSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/HunYuanDrawConfigSettingSection.xaml.cs @@ -18,9 +18,9 @@ public sealed partial class HunYuanDrawConfigSettingSection : DrawServiceConfigC public HunYuanDrawConfigSettingSection() => InitializeComponent(); /// - protected override void OnViewModelChanged(DependencyPropertyChangedEventArgs e) + protected override void OnViewModelChanged(DrawServiceItemViewModel? oldValue, DrawServiceItemViewModel? newValue) { - if (e.NewValue is not DrawServiceItemViewModel newVM) + if (newValue is not DrawServiceItemViewModel newVM) { return; } diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/LanguageSettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/LanguageSettingSection.xaml index bca6f74..9b1c5bb 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/LanguageSettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/LanguageSettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.LanguageSettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" xmlns:ic="using:FluentIcons.WinUI" @@ -11,10 +11,10 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - + + - + - + diff --git a/src/Desktop/RodelAgent.UI/Controls/Settings/LibrarySettingSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Settings/LibrarySettingSection.xaml index 4bc2f32..70b205e 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Settings/LibrarySettingSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Settings/LibrarySettingSection.xaml @@ -3,7 +3,7 @@ x:Class="RodelAgent.UI.Controls.Settings.LibrarySettingSection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:community="using:CommunityToolkit.WinUI.Controls" + xmlns:base="using:Richasy.WinUI.Share.Base" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="using:RodelAgent.UI.Extensions" xmlns:ic="using:FluentIcons.WinUI" @@ -11,10 +11,10 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - + + - +