完善MOD信息界面

This commit is contained in:
muqing 2024-07-31 11:24:52 +08:00
parent 11b73861b7
commit e182fa3649
2 changed files with 60 additions and 15 deletions

View File

@ -79,12 +79,34 @@
DefaultLabelPosition="Right"
IsOpen="False">
<CommandBar.PrimaryCommands>
<AppBarButton Icon="ReportHacked" Label="举报" />
<AppBarButton
Name="ReportButton"
Click="AppBarButton_Click"
Icon="ReportHacked"
Label="举报" />
<AppBarSeparator />
<AppBarButton Icon="Like" Label="支持" />
<AppBarButton
Name="LikeButton"
Click="AppBarButton_Click"
Icon="Like"
Label="支持" />
<AppBarSeparator />
<AppBarButton Icon="Download" Label="下载" />
<AppBarButton
Name="DownLoadButton"
Click="AppBarButton_Click"
Icon="Download"
Label="下载" />
</CommandBar.PrimaryCommands>
</CommandBar>
<TeachingTip
x:Name="Toast"
Title="底部提示"
ActionButtonClick="Toast_ActionButtonClick"
ActionButtonContent="确定"
CloseButtonContent="取消"
IsLightDismissEnabled="True"
PlacementMargin="20"
PreferredPlacement="Auto"
Subtitle="消息" />
</Grid>
</windowex:WindowEx>

View File

@ -40,21 +40,13 @@ public sealed partial class ModulePage : WindowEx
}
private async void init(string v)
{
//string json = "\r\n{\"code\":0,\"message\":\"获取成功。\",\"data\":{\"id\":\"585886886883885357567508566896\",\"name\":\"升级模组5.0\",\"describe\":\"。?,。???\",\"icon\":\"\",\"tags\":\"[,。!。]\",\"screenshots\":\"\",\"developer\":\"SDL_13964\",\"link\":\"..\\/user\\/SDL_13964\\/mods\\/585886886883885357567508566896\\/585886886883885357567508566896.rwmod\",\"downloadNumber\":\"366\",\"versionNumber\":\"1\",\"versionName\":\"1.14514\",\"updateTime\":\"2022-07-20 14:20:09\",\"creationTime\":\"2022-07-20 14:20:09\",\"unitNumber\":\"909\",\"hidden\":\"0\",\"coinNumber\":\"1\",\"minVersion\":\"\"}}";
var json = await ApiFox.mod.getInfo("", v);
var a = JsonConvert.DeserializeObject<ModInfo>(json);
if (a != null)
{
Mod = a.data;
if (Mod.IconUrl.Equals(""))
{
Mod.IconUrl = "/Assets/image/image_106.svg";
}
else
{
Mod.IconUrl = Mod.IconUrl.Replace("..", wl.api);
}
Mod.IconUrl = Mod.IconUrl.Equals("") ? "/Assets/image/image_106.svg" : Mod.IconUrl.Replace("..", wl.api);
Mod.Link = Mod.Link.Replace("..", wl.api);
Title = Mod.Name;
var l = " | ";
title_b.Text = "单位数" + Mod.UnitNumber + l + Mod.DownloadNumber + "次下载" + l + "版本名称" + Mod.VersionName;
@ -89,9 +81,7 @@ public sealed partial class ModulePage : WindowEx
private void WindowEx_SizeChanged(object sender, WindowSizeChangedEventArgs args)
{
gj.sc(Width);
DescriptionText.Width = Width-50;
}
@ -100,4 +90,37 @@ public sealed partial class ModulePage : WindowEx
// 当窗口关闭时,从列表中移除
ModulePageList.Remove(this);
}
private void AppBarButton_Click(object sender, RoutedEventArgs e)
{
var label = ((AppBarButton)sender).Name;
gj.sc(label);
switch (label)
{
case "ReportButton":
gj.sc("举报这个模组抄袭");
//if (Toast.IsOpen) Toast.IsOpen = false;
Toast.Title = "举报此模组";
Toast.Subtitle = "请合理举报,拒接无脑举报!";
Toast.IsOpen = true;
break;
case "LikeButton":
gj.sc("给这个模组投了一个币");
//if (Toast.IsOpen) Toast.IsOpen = false;
Toast.Title = "支持此模组";
Toast.Subtitle = "支持后自动扣除你的一个硬币,如果没有则支持失败";
Toast.IsOpen = true;
break;
case "DownLoadButton":
gj.sc("下载此模组:"+Mod.Link);
break;
}
}
private void Toast_ActionButtonClick(TeachingTip sender, object args)
{
}
}