-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
268 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:pluginCore="clr-namespace:PluginCore;assembly=Core" | ||
xmlns:mdxaml="https://github.com/whistyun/Markdown.Avalonia.Tight" | ||
xmlns:pluginManagerPage1="clr-namespace:Core.AvaloniaControl.MarketPage" | ||
xmlns:pages="clr-namespace:Core.ViewModel.Pages" | ||
xmlns:pluginManagerPage111="clr-namespace:KitopiaAvalonia.Converter.PluginManagerPage" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:DataType="pages:OnlinePluginInfo" | ||
HorizontalAlignment="Stretch" | ||
VerticalAlignment="Stretch" | ||
HorizontalContentAlignment="Stretch" | ||
VerticalContentAlignment="Stretch" | ||
x:Class="Core.AvaloniaControl.MarketPage.PluginDetail"> | ||
<UserControl.Resources> | ||
<pluginManagerPage111:IconCtr x:Key="IconCtr" /> | ||
</UserControl.Resources> | ||
<Border BorderBrush="{DynamicResource SemiColorBorder}" BorderThickness="1" | ||
CornerRadius="{DynamicResource RadiusCardCornerRadius}" | ||
HorizontalAlignment="Stretch" | ||
VerticalAlignment="Stretch" x:DataType="pages:OnlinePluginInfo"> | ||
<Panel> | ||
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" | ||
ColumnDefinitions="80,*" x:DataType="pages:OnlinePluginInfo" | ||
|
||
RowDefinitions="*,48"> | ||
<Image Grid.Column="0" HorizontalAlignment="Center" Margin="0,15,0,0" | ||
VerticalAlignment="Top" Focusable="False" Width="64" x:DataType="pages:OnlinePluginInfo" | ||
Source="{Binding Icon,Converter={StaticResource IconCtr},ConverterParameter={Binding .}}" | ||
Height="64" /> | ||
<StackPanel Grid.Column="1" Margin="0,15,0,5" VerticalAlignment="Top" Spacing="5" | ||
HorizontalAlignment="Stretch"> | ||
<StackPanel Orientation="Horizontal" x:DataType="pages:OnlinePluginInfo" Spacing="5"> | ||
<TextBlock VerticalAlignment="Center" | ||
HorizontalAlignment="Left" | ||
x:DataType="pages:OnlinePluginInfo" | ||
Text="{Binding Name}" | ||
FontWeight="Normal" FontSize="18" | ||
Foreground="{DynamicResource DefaultForeground}"> | ||
</TextBlock> | ||
<TextBlock VerticalAlignment="Center" | ||
HorizontalAlignment="Left" | ||
x:DataType="pages:OnlinePluginInfo" | ||
Text="{Binding LastVersion}" | ||
FontWeight="Normal" FontSize="18" | ||
Foreground="{DynamicResource DefaultForeground}"> | ||
</TextBlock> | ||
</StackPanel> | ||
|
||
<TextBlock VerticalAlignment="Center" | ||
MaxWidth="{Binding $parent.Bounds.Width}" | ||
TextWrapping="Wrap" | ||
x:DataType="pages:OnlinePluginInfo" | ||
Text="{Binding DescriptionShort}" /> | ||
<Label Theme="{DynamicResource TitleLabel}" Classes="H3" Content="详细"></Label> | ||
<Line EndPoint="5000,0" HorizontalAlignment="Stretch" Stroke="{DynamicResource SemiColorBorder}"/> | ||
<ScrollViewer IsHitTestVisible="False" | ||
VerticalAlignment="Stretch" | ||
HorizontalAlignment="Stretch" | ||
HorizontalScrollBarVisibility="Hidden"> | ||
|
||
<mdxaml:MarkdownScrollViewer x:DataType="pages:OnlinePluginInfo" | ||
Markdown="{Binding $parent[pluginManagerPage1:PluginDetail].Markdown}" ></mdxaml:MarkdownScrollViewer> | ||
</ScrollViewer> | ||
<ContentPresenter HorizontalAlignment="Stretch" | ||
VerticalAlignment="Stretch" | ||
HorizontalContentAlignment="Stretch" | ||
VerticalContentAlignment="Stretch" | ||
Content="{Binding $parent[pluginManagerPage1:PluginDetail].Content}"> | ||
</ContentPresenter> | ||
|
||
</StackPanel> | ||
|
||
</Grid> | ||
|
||
|
||
</Panel> | ||
|
||
</Border> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Control> ContentProperty = AvaloniaProperty.Register<PluginDetail, Control>(nameof(Content)); | ||
public Control Content | ||
{ | ||
get => (Control)GetValue(ContentProperty); | ||
set => SetValue(ContentProperty, value); | ||
} | ||
|
||
public static AvaloniaProperty<string> MarkdownProperty = AvaloniaProperty.Register<PluginDetail, string>(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); | ||
}); | ||
}); | ||
|
||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.