diff --git a/Core/AvaloniaControl/MarketPage/PluginDetail.axaml b/Core/AvaloniaControl/MarketPage/PluginDetail.axaml
new file mode 100644
index 0000000..ceb23dc
--- /dev/null
+++ b/Core/AvaloniaControl/MarketPage/PluginDetail.axaml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Core/AvaloniaControl/MarketPage/PluginDetail.axaml.cs b/Core/AvaloniaControl/MarketPage/PluginDetail.axaml.cs
new file mode 100644
index 0000000..dca3e76
--- /dev/null
+++ b/Core/AvaloniaControl/MarketPage/PluginDetail.axaml.cs
@@ -0,0 +1,60 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Threading;
+using Core.SDKs.Services.Plugin;
+using Core.ViewModel.Pages;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using PluginCore;
+
+namespace Core.AvaloniaControl.MarketPage;
+
+public partial class PluginDetail : UserControl
+{
+ public static AvaloniaProperty ContentProperty = AvaloniaProperty.Register(nameof(Content));
+ public Control Content
+ {
+ get => (Control)GetValue(ContentProperty);
+ set => SetValue(ContentProperty, value);
+ }
+
+ public static AvaloniaProperty MarkdownProperty = AvaloniaProperty.Register(nameof(Markdown));
+ public string Markdown
+ {
+ get => (string)GetValue(ContentProperty);
+ set => SetValue(ContentProperty, value);
+ }
+ public PluginDetail()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ base.OnAttachedToVisualTree(e);
+ if (DataContext is not OnlinePluginInfo pluginInfo)
+ {
+ return;
+ }
+
+ Task.Run(async () =>
+ {
+ var request = new HttpRequestMessage()
+ {
+ RequestUri = new Uri($"https://www.ncserver.top:5111/api/plugin/{pluginInfo.Id}"),
+ Method = HttpMethod.Get,
+ };
+ request.Headers.Add("AllBeforeThisVersion", true.ToString());
+ var sendAsync = await PluginManager._httpClient.SendAsync(request);
+ var stringAsync = await sendAsync.Content.ReadAsStringAsync();
+ var deserializeObject = (JObject)JsonConvert.DeserializeObject(stringAsync);
+ var list = deserializeObject["data"]["description"].ToString();
+ await Dispatcher.UIThread.InvokeAsync(() =>
+ {
+ SetValue(MarkdownProperty, list);
+ });
+
+ });
+
+ }
+}
\ No newline at end of file
diff --git a/Core/PluginManagerPage/IconCtr.cs b/Core/AvaloniaControl/PluginManagerPage/IconCtr.cs
similarity index 100%
rename from Core/PluginManagerPage/IconCtr.cs
rename to Core/AvaloniaControl/PluginManagerPage/IconCtr.cs
diff --git a/Core/PluginManagerPage/PluginDetail.axaml b/Core/AvaloniaControl/PluginManagerPage/PluginDetail.axaml
similarity index 92%
rename from Core/PluginManagerPage/PluginDetail.axaml
rename to Core/AvaloniaControl/PluginManagerPage/PluginDetail.axaml
index 82af597..d80884c 100644
--- a/Core/PluginManagerPage/PluginDetail.axaml
+++ b/Core/AvaloniaControl/PluginManagerPage/PluginDetail.axaml
@@ -4,15 +4,15 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pluginCore="clr-namespace:PluginCore;assembly=Core"
xmlns:pluginManagerPage="clr-namespace:KitopiaAvalonia.Converter.PluginManagerPage"
- xmlns:pluginManagerPage1="clr-namespace:KitopiaAvalonia.Controls.PluginManagerPage"
xmlns:mdxaml="https://github.com/whistyun/Markdown.Avalonia.Tight"
+ xmlns:pluginManagerPage1="clr-namespace:Core.AvaloniaControl.PluginManagerPage"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="pluginCore:PluginInfo"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
- x:Class="KitopiaAvalonia.Controls.PluginManagerPage.PluginDetail">
+ x:Class="Core.AvaloniaControl.PluginManagerPage.PluginDetail">
@@ -61,11 +61,14 @@
+
+
+
-
+
+ PluginDetail.axaml
+ Code
+
diff --git a/Core/ViewModel/Pages/MarketPageViewModel.cs b/Core/ViewModel/Pages/MarketPageViewModel.cs
index 220de16..7a82186 100644
--- a/Core/ViewModel/Pages/MarketPageViewModel.cs
+++ b/Core/ViewModel/Pages/MarketPageViewModel.cs
@@ -4,9 +4,21 @@
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.Presenters;
+using Avalonia.Controls.Shapes;
+using Avalonia.Media;
+using Avalonia.Styling;
+using AvaloniaEdit.Utils;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
+using Core.AvaloniaControl.PluginManagerPage;
+using Core.SDKs;
+using Core.SDKs.Services;
using Core.SDKs.Services.Plugin;
+using KitopiaAvalonia.Tools;
+using Markdown.Avalonia.Full;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PluginCore;
@@ -14,6 +26,7 @@
using Bitmap = Avalonia.Media.Imaging.Bitmap;
using Image = SixLabors.ImageSharp.Image;
using JsonSerializer = System.Text.Json.JsonSerializer;
+using Point = Avalonia.Point;
namespace Core.ViewModel.Pages;
public class ApiResponse
@@ -114,5 +127,72 @@ private async Task DownloadPlugin(OnlinePluginInfo plugin)
await PluginManager.DownloadPluginOnline(plugin);
}
-
+ [RelayCommand]
+ private async Task ShowPluginDetail(Control control)
+ {
+ if (control.DataContext is OnlinePluginInfo pluginInfo)
+ {
+ StackPanel stackPanel = new StackPanel();
+ stackPanel.Spacing = 4;
+
+ var request = new HttpRequestMessage()
+ {
+ RequestUri = new Uri($"https://www.ncserver.top:5111/api/plugin/detail/{pluginInfo.Id}/{pluginInfo.LastVersionId}"),
+ Method = HttpMethod.Get,
+ };
+ request.Headers.Add("AllBeforeThisVersion",true.ToString());
+ var sendAsync =await PluginManager._httpClient.SendAsync(request);
+ var stringAsync =await sendAsync.Content.ReadAsStringAsync();
+ var deserializeObject = (JObject)JsonConvert.DeserializeObject(stringAsync);
+ var list = deserializeObject["data"].ToObject>();
+
+ Application.Current.Styles.TryGetResource("TitleLabel",null,out var h1);
+ Application.Current.Styles.TryGetResource("SemiColorBorder",null,out var semiColorBorder);
+ var semiColorBorder2 = semiColorBorder as SolidColorBrush;
+ var controlTheme = h1 as ControlTheme;
+ var childOfType = control.GetParentOfType().GetChildOfType("DialogOvercover");
+ stackPanel.Children.Add( new Label()
+ {
+ Classes = { "H2" },
+ Theme =controlTheme,
+ Content = "版本说明"
+ });
+ stackPanel.Children.Add(new Line()
+ {
+ Stroke = semiColorBorder2,
+ EndPoint = new Point( childOfType.Bounds.Width,0)
+ });
+ for (var i = 0; i < list.Count; i++)
+ {
+ stackPanel.Children.Add( new Label()
+ {
+ Classes = { "H3" },
+ Theme =controlTheme,
+ Content = list[i]["version"]
+ });
+ stackPanel.Children.Add(new Line()
+ {
+ Stroke = semiColorBorder2,
+ EndPoint = new Point( childOfType.Bounds.Width,0)
+ });
+ stackPanel.Children.Add( new MarkdownScrollViewer()
+ {
+ Markdown = list[i]["detail"].ToString()
+ });
+ }
+ var pluginDetail = new AvaloniaControl.MarketPage.PluginDetail();
+ pluginDetail.DataContext= pluginInfo;
+ pluginDetail.Content = stackPanel;
+ var dialog = new DialogContent()
+ {
+ Content =pluginDetail,
+ Title = "插件详细信息",
+ };
+
+
+ ServiceManager.Services!.GetService()!.ShowDialogAsync(childOfType,
+ dialog,true);
+ }
+
+ }
}
\ No newline at end of file
diff --git a/Core/ViewModel/Pages/plugin/PluginManagerPageViewModel.cs b/Core/ViewModel/Pages/plugin/PluginManagerPageViewModel.cs
index 70817ce..b130d82 100644
--- a/Core/ViewModel/Pages/plugin/PluginManagerPageViewModel.cs
+++ b/Core/ViewModel/Pages/plugin/PluginManagerPageViewModel.cs
@@ -15,12 +15,12 @@
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
+using Core.AvaloniaControl.PluginManagerPage;
using Core.SDKs;
using Core.SDKs.CustomScenario;
using Core.SDKs.Services;
using Core.SDKs.Services.Config;
using Core.SDKs.Services.Plugin;
-using KitopiaAvalonia.Controls.PluginManagerPage;
using KitopiaAvalonia.Tools;
using log4net;
using Markdown.Avalonia.Full;
@@ -207,6 +207,17 @@ private async Task ShowPluginDetail(Control control)
var semiColorBorder2 = semiColorBorder as SolidColorBrush;
var controlTheme = h1 as ControlTheme;
var childOfType = control.GetParentOfType().GetChildOfType("DialogOvercover");
+ stackPanel.Children.Add( new Label()
+ {
+ Classes = { "H2" },
+ Theme =controlTheme,
+ Content = "版本说明"
+ });
+ stackPanel.Children.Add(new Line()
+ {
+ Stroke = semiColorBorder2,
+ EndPoint = new Point( childOfType.Bounds.Width,0)
+ });
for (var i = 0; i < list.Count; i++)
{
stackPanel.Children.Add( new Label()
diff --git a/KitopiaAvalonia/Controls/DialogOvercover.axaml b/KitopiaAvalonia/Controls/DialogOvercover.axaml
index 61afbe8..870edf4 100644
--- a/KitopiaAvalonia/Controls/DialogOvercover.axaml
+++ b/KitopiaAvalonia/Controls/DialogOvercover.axaml
@@ -22,9 +22,9 @@
if we put ClipToBounds=True on BackgroundElement above, it clips the shadow -->
@@ -32,8 +32,7 @@
-
+
+
+
@@ -35,10 +37,16 @@
Height="64" />
-
+
@@ -91,4 +99,6 @@
+
+
diff --git a/KitopiaAvalonia/Services/ContentDialogService.cs b/KitopiaAvalonia/Services/ContentDialogService.cs
index 684fcb5..4e43cb6 100644
--- a/KitopiaAvalonia/Services/ContentDialogService.cs
+++ b/KitopiaAvalonia/Services/ContentDialogService.cs
@@ -36,6 +36,7 @@ await Task.Run(async () =>
if (contentPresenter is ContentPresenter control)
{
control.Content = new DialogOvercover(dialogContent,canDismiss);
+
}
});
});
diff --git a/KitopiaEx/main.md b/KitopiaEx/main.md
index 4283d48..341803b 100644
--- a/KitopiaEx/main.md
+++ b/KitopiaEx/main.md
@@ -1,4 +1,3 @@
-# KitopiaEx
-## Kitopia官方拓展
-### 功能
+### Kitopia官方拓展
+#### 功能
1. 键盘模拟
\ No newline at end of file