Skip to content

Commit

Permalink
新增 更新版本显示
Browse files Browse the repository at this point in the history
  • Loading branch information
MakesYT committed Aug 17, 2024
1 parent 7c6e5f0 commit 525ad4d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions Core/SDKs/Services/Plugin/PluginInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public partial class PluginInfo
[ObservableProperty] public bool unloadFailed;

[ObservableProperty] private bool canUpdata;
[ObservableProperty] private string canUpdateVersion;
public int UpdateTargetVersion { set; get; }
public string ToPlgString() => $"{Id}_{AuthorId}_{NameSign}";

Expand Down
5 changes: 3 additions & 2 deletions Core/SDKs/Services/Plugin/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ await Parallel.ForAsync(0, AllPluginInfos.Count, (i, token) =>
.GetAsync($"https://www.ncserver.top:5111/api/plugin/{AllPluginInfos[i].Id}").Result;
var httpContent = httpResponseMessage.Content.ReadAsStringAsync().Result;
var deserializeObject = (JObject)JsonConvert.DeserializeObject(httpContent);
AllPluginInfos[i].CanUpdata = deserializeObject["data"]["lastVersionId"].ToObject<int>() >
AllPluginInfos[i].VersionId;
var o = deserializeObject["data"];
AllPluginInfos[i].CanUpdata = o["lastVersionId"].ToObject<int>() > AllPluginInfos[i].VersionId;
AllPluginInfos[i].CanUpdateVersion= o["lastVersion"].ToString();
}
catch (Exception e)
{
Expand Down
14 changes: 14 additions & 0 deletions KitopiaAvalonia/Pages/PluginManagerPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@
<StackPanel Orientation="Horizontal" Spacing="5">
<TextBlock VerticalAlignment="Top"
Text="{Binding Version}" />
<StackPanel Orientation="Horizontal" Spacing="5" >
<TextBlock VerticalAlignment="Top" Text=">" IsVisible="{Binding CanUpdata}">
<TextBlock.Foreground>
<SolidColorBrush Color="{DynamicResource SemiOrange4Color}" />
</TextBlock.Foreground>
</TextBlock>
<TextBlock VerticalAlignment="Top"
Text="{Binding CanUpdateVersion}">
<TextBlock.Foreground>
<SolidColorBrush Color="{DynamicResource SemiOrange4Color}" />
</TextBlock.Foreground>
</TextBlock>
</StackPanel>

<TextBlock VerticalAlignment="Top"
Text="{Binding AuthorName}" />
</StackPanel>
Expand Down

0 comments on commit 525ad4d

Please sign in to comment.