这次内容更新超多,肝了一整天
24
RustTools/App.config
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||||
|
<section name="RustTools.Assets.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
<section name="RustTools.Assets.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
|
</sectionGroup>
|
||||||
|
</configSections>
|
||||||
|
<userSettings>
|
||||||
|
<RustTools.Assets.Settings>
|
||||||
|
<setting name="设置" serializeAs="String">
|
||||||
|
<value>1</value>
|
||||||
|
</setting>
|
||||||
|
</RustTools.Assets.Settings>
|
||||||
|
<RustTools.Assets.Settings1>
|
||||||
|
<setting name="主题颜色" serializeAs="String">
|
||||||
|
<value>1</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="Mod" serializeAs="String">
|
||||||
|
<value />
|
||||||
|
</setting>
|
||||||
|
</RustTools.Assets.Settings1>
|
||||||
|
</userSettings>
|
||||||
|
</configuration>
|
|
@ -12,26 +12,64 @@
|
||||||
<ResourceDictionary Source="/Styles/Thickness.xaml" />
|
<ResourceDictionary Source="/Styles/Thickness.xaml" />
|
||||||
<ResourceDictionary Source="/Styles/TextBlock.xaml" />
|
<ResourceDictionary Source="/Styles/TextBlock.xaml" />
|
||||||
<ResourceDictionary Source="/Styles/ItemView.xaml" />
|
<ResourceDictionary Source="/Styles/ItemView.xaml" />
|
||||||
|
<ResourceDictionary Source="/Styles/TitleSubtitleControlStyle.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
|
|
||||||
<!-- 用于动态界面的关注用户视图 -->
|
<!-- 用于动态界面的关注用户视图 -->
|
||||||
|
|
||||||
<DataTemplate x:Key="ConCernItem">
|
<DataTemplate x:Key="ConCernItem">
|
||||||
<ItemContainer Width="260" Margin="0,0,0,9">
|
|
||||||
<StackPanel Padding="5" Orientation="Horizontal">
|
<StackPanel Padding="5" Orientation="Horizontal">
|
||||||
|
<Border Margin="0,0,0,0" CornerRadius="9">
|
||||||
<Image
|
<Image
|
||||||
Width="56"
|
Width="56"
|
||||||
Height="56"
|
Height="56"
|
||||||
|
VerticalAlignment="Center"
|
||||||
Source="{Binding HeadIcon}"
|
Source="{Binding HeadIcon}"
|
||||||
Stretch="UniformToFill" />
|
Stretch="UniformToFill" />
|
||||||
|
</Border>
|
||||||
|
<TextBlock
|
||||||
|
Margin="3,0,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{ThemeResource SubtitleTextBlockStyle}"
|
||||||
|
Text="{Binding UserName}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<!-- 模组列表的视图 -->
|
||||||
|
<DataTemplate x:Key="HomePageListItem">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Border
|
||||||
|
Width="56"
|
||||||
|
Height="56"
|
||||||
|
BorderBrush="White"
|
||||||
|
BorderThickness="0"
|
||||||
|
CornerRadius="9">
|
||||||
|
<Border.Background>
|
||||||
|
<ImageBrush ImageSource="{Binding Icon}" Stretch="UniformToFill" />
|
||||||
|
</Border.Background>
|
||||||
|
</Border>
|
||||||
|
<StackPanel Margin="10,10,10,10" Orientation="Vertical">
|
||||||
|
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="{Binding Name}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="3,0,0,0"
|
Width="500"
|
||||||
VerticalAlignment="Center"
|
MaxLines="2"
|
||||||
Style="{ThemeResource SubtitleTextBlockStyle}"
|
Style="{StaticResource BodyStrongTextBlockStyle}"
|
||||||
Text="{Binding UserName}" />
|
Text="{Binding Description}"
|
||||||
|
TextTrimming="CharacterEllipsis"
|
||||||
|
TextWrapping="Wrap" />
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding UpdateTime}" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="10,0,0,0"
|
||||||
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
|
Text="{Binding CoinNumber}" />
|
||||||
|
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="次下载" />
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ItemContainer>
|
|
||||||
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ public partial class App : Microsoft.UI.Xaml.Application
|
||||||
|
|
||||||
protected async override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
|
protected async override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
|
||||||
{
|
{
|
||||||
|
base.OnLaunched(args);
|
||||||
|
|
||||||
var activatedEventArgs = Microsoft.Windows.AppLifecycle.AppInstance.GetCurrent().GetActivatedEventArgs();
|
var activatedEventArgs = Microsoft.Windows.AppLifecycle.AppInstance.GetCurrent().GetActivatedEventArgs();
|
||||||
if (activatedEventArgs.Kind == Microsoft.Windows.AppLifecycle.ExtendedActivationKind.File)
|
if (activatedEventArgs.Kind == Microsoft.Windows.AppLifecycle.ExtendedActivationKind.File)
|
||||||
|
@ -154,7 +154,7 @@ public partial class App : Microsoft.UI.Xaml.Application
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
base.OnLaunched(args);
|
//MainWindow.Activate();
|
||||||
await App.GetService<IActivationService>().ActivateAsync(args);
|
await App.GetService<IActivationService>().ActivateAsync(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
RustTools/Assets/Icon.ico
Normal file
After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 206 KiB After Width: | Height: | Size: 264 KiB |
|
@ -2,68 +2,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
public class ModData
|
|
||||||
{
|
|
||||||
[JsonProperty("id")]
|
|
||||||
public string Id
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("name")]
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("describe")]
|
|
||||||
public string Description
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("icon")]
|
|
||||||
public string Icon
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("developer")]
|
|
||||||
public string Developer
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("downloadNumber")]
|
|
||||||
public string DownloadNumber
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("updateTime")]
|
|
||||||
public DateTime UpdateTime
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("coinNumber")]
|
|
||||||
public string CoinNumber
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("unitNumber")]
|
|
||||||
public string UnitNumber
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("versionNumber")]
|
|
||||||
public string VersionNumber
|
|
||||||
{
|
|
||||||
get; set;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ModListResponse
|
public class ModListResponse
|
||||||
{
|
{
|
||||||
|
@ -84,4 +22,66 @@ public class ModListResponse
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
public class ModData
|
||||||
|
{
|
||||||
|
[JsonProperty("id")]
|
||||||
|
public string Id
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("describe")]
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("icon")]
|
||||||
|
public string Icon
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("developer")]
|
||||||
|
public string Developer
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("downloadNumber")]
|
||||||
|
public string DownloadNumber
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("updateTime")]
|
||||||
|
public DateTime UpdateTime
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("coinNumber")]
|
||||||
|
public string CoinNumber
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("unitNumber")]
|
||||||
|
public string UnitNumber
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonProperty("versionNumber")]
|
||||||
|
public string VersionNumber
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
using RustTools.Helpers;
|
using System.Resources;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using RustTools.Helpers;
|
||||||
using RustTools.muqing;
|
using RustTools.muqing;
|
||||||
|
using Windows.Storage;
|
||||||
using Windows.UI.ViewManagement;
|
using Windows.UI.ViewManagement;
|
||||||
|
|
||||||
namespace RustTools;
|
namespace RustTools;
|
||||||
|
@ -8,30 +11,23 @@ public sealed partial class MainWindow : WindowEx
|
||||||
{
|
{
|
||||||
private readonly Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue;
|
private readonly Microsoft.UI.Dispatching.DispatcherQueue dispatcherQueue;
|
||||||
|
|
||||||
private readonly UISettings settings;
|
private readonly UISettings settings = new();
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
//gj.SetBackTheme(this);
|
gj.SetBackTheme(this);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
//AppWindow.SetIcon("Assets/tool.png");
|
//gj.sc("lujing"+ AppContext.BaseDirectory);
|
||||||
|
//Resources
|
||||||
AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/WindowIcon.ico"));
|
AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/WindowIcon.ico"));
|
||||||
|
//AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/Icon.ico"));
|
||||||
Content = null;
|
Content = null;
|
||||||
Title = "AppDisplayName".GetLocalized();
|
Title = "AppDisplayName".GetLocalized();
|
||||||
|
|
||||||
// Theme change code picked from https://github.com/microsoft/WinUI-Gallery/pull/1239
|
// Theme change code picked from https://github.com/microsoft/WinUI-Gallery/pull/1239
|
||||||
dispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread();
|
dispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread();
|
||||||
settings = new UISettings();
|
settings.ColorValuesChanged += Settings_ColorValuesChanged;
|
||||||
settings.ColorValuesChanged += Settings_ColorValuesChanged; // cannot use FrameworkElement.ActualThemeChanged event
|
// cannot use FrameworkElement.ActualThemeChanged event
|
||||||
//settings.Color
|
|
||||||
//if(wj.cz(wj.FILE.UUID))
|
|
||||||
//{
|
|
||||||
// gj.sc(wj.dqwb(wj.FILE.UUID));
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// wj.xrwb("win.uuid", gj.GetUUID());
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this handles updating the caption button colors correctly when indows system theme is changed
|
// this handles updating the caption button colors correctly when indows system theme is changed
|
||||||
|
|
|
@ -30,11 +30,13 @@
|
||||||
<AppxPackageDir>D:\RustTools</AppxPackageDir>
|
<AppxPackageDir>D:\RustTools</AppxPackageDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Remove="Assets\Icon.ico" />
|
||||||
<Content Remove="Assets\WindowIcon.ico" />
|
<Content Remove="Assets\WindowIcon.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Assets\image\image_106.svg" />
|
<None Remove="Assets\image\image_106.svg" />
|
||||||
<None Remove="Styles\ItemView.xaml" />
|
<None Remove="Styles\ItemView.xaml" />
|
||||||
|
<None Remove="Styles\TitleSubtitleControlStyle.xaml" />
|
||||||
<None Remove="Views\ConcernPage.xaml" />
|
<None Remove="Views\ConcernPage.xaml" />
|
||||||
<None Remove="Views\HomePage.xaml" />
|
<None Remove="Views\HomePage.xaml" />
|
||||||
<None Remove="Views\ModulePage.xaml" />
|
<None Remove="Views\ModulePage.xaml" />
|
||||||
|
@ -42,6 +44,9 @@
|
||||||
<None Remove="Views\UserPage.xaml" />
|
<None Remove="Views\UserPage.xaml" />
|
||||||
<None Remove="WindowUI\ImportModule.xaml" />
|
<None Remove="WindowUI\ImportModule.xaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Remove="Themes\Generic.xaml" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Manifest Include="$(ApplicationManifest)" />
|
<Manifest Include="$(ApplicationManifest)" />
|
||||||
|
@ -70,6 +75,12 @@
|
||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
<PackagePath>\</PackagePath>
|
<PackagePath>\</PackagePath>
|
||||||
</None>
|
</None>
|
||||||
|
<Page Update="Styles\TitleSubtitleControlStyle.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<None Update="Themes\Generic.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</None>
|
||||||
<Page Update="Styles\ItemView.xaml">
|
<Page Update="Styles\ItemView.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
@ -96,10 +107,6 @@
|
||||||
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
||||||
<ProjectCapability Include="Msix" />
|
<ProjectCapability Include="Msix" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Themes\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
||||||
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
|
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
|
||||||
|
|
54
RustTools/Styles/TitleSubtitleControl.cs
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Data;
|
||||||
|
using Microsoft.UI.Xaml.Documents;
|
||||||
|
using Microsoft.UI.Xaml.Input;
|
||||||
|
using Microsoft.UI.Xaml.Media;
|
||||||
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
|
||||||
|
namespace RustTools.Styles;
|
||||||
|
public sealed class TitleSubtitleControl : Control
|
||||||
|
{
|
||||||
|
public TitleSubtitleControl()
|
||||||
|
{
|
||||||
|
DefaultStyleKey = typeof(TitleSubtitleControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TitleText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (string)GetValue(TitleTextProperty);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetValue(TitleTextProperty, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty TitleTextProperty =
|
||||||
|
DependencyProperty.Register("TitleText", typeof(string), typeof(TitleSubtitleControl), new PropertyMetadata(""));
|
||||||
|
|
||||||
|
public string SubtitleText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (string)GetValue(SubtitleTextProperty);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetValue(SubtitleTextProperty, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty SubtitleTextProperty =
|
||||||
|
DependencyProperty.Register("SubtitleText", typeof(string), typeof(TitleSubtitleControl), new PropertyMetadata(""));
|
||||||
|
}
|
22
RustTools/Styles/TitleSubtitleControlStyle.xaml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:RustTools.Styles">
|
||||||
|
<Style x:Key="TitleSubtitleControlStyle" TargetType="local:TitleSubtitleControl">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="local:TitleSubtitleControl">
|
||||||
|
<StackPanel
|
||||||
|
Margin="16,0,16,0"
|
||||||
|
Padding="3"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center">
|
||||||
|
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="{TemplateBinding TitleText}" />
|
||||||
|
<TextBlock Style="{StaticResource BodyStrongTextBlockStyle}" Text="{TemplateBinding SubtitleText}" />
|
||||||
|
</StackPanel>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
19
RustTools/Themes/Generic.xaml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:RustTools">
|
||||||
|
|
||||||
|
<Style TargetType="local2:CustomControl1" xmlns:local2="using:RustTools.Styles">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="local2:CustomControl1">
|
||||||
|
<Border
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}">
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
|
@ -8,8 +8,8 @@ namespace RustTools.ViewModels;
|
||||||
|
|
||||||
public partial class HomePageViewModel : ObservableRecipient
|
public partial class HomePageViewModel : ObservableRecipient
|
||||||
{
|
{
|
||||||
public ObservableCollection<ModData> randomList = new();
|
public ObservableCollection<ModListResponse.ModData> randomList = new();
|
||||||
public ObservableCollection<ModData> latestTimeList = new();
|
public ObservableCollection<ModListResponse.ModData> latestTimeList = new();
|
||||||
public HomePageViewModel()
|
public HomePageViewModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,27 @@
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using RustTools.muqing;
|
||||||
|
|
||||||
namespace RustTools.ViewModels;
|
namespace RustTools.ViewModels;
|
||||||
|
|
||||||
public partial class RankingViewModel : ObservableRecipient
|
public partial class RankingViewModel : ObservableRecipient
|
||||||
{
|
{
|
||||||
|
public ObservableCollection<ModListResponse.ModData> RankingList { get; set; } = new();
|
||||||
public RankingViewModel()
|
public RankingViewModel()
|
||||||
{
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
private async void Init()
|
||||||
|
{
|
||||||
|
//List必须小于10才能重新加载
|
||||||
|
var StringList = await ApiFox.mod.list("downloadNumber", "10", "");
|
||||||
|
var modData = JsonConvert.DeserializeObject<ModListResponse>(StringList);
|
||||||
|
foreach (var item in modData.Data)
|
||||||
|
{
|
||||||
|
item.Icon = item.Icon.Equals("") ? "/Assets/image/image.svg" : item.Icon.Replace("..", "https://rust.coldmint.top");
|
||||||
|
RankingList.Add(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ using Windows.ApplicationModel;
|
||||||
using Windows.Storage.AccessCache;
|
using Windows.Storage.AccessCache;
|
||||||
using Windows.Storage.Pickers;
|
using Windows.Storage.Pickers;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
|
using RustTools.muqing;
|
||||||
|
|
||||||
namespace RustTools.ViewModels;
|
namespace RustTools.ViewModels;
|
||||||
|
|
||||||
|
|
|
@ -18,17 +18,19 @@
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Margin="0,9,9,0"
|
Margin="0,9,9,9"
|
||||||
Padding="9"
|
Padding="9"
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||||
<ItemsView
|
<ListView
|
||||||
Name="ListViewA"
|
Name="ListViewA"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
ItemInvoked="ItemsView_ItemInvoked"
|
|
||||||
ItemTemplate="{StaticResource ConCernItem}"
|
ItemTemplate="{StaticResource ConCernItem}"
|
||||||
ItemsSource="{x:Bind ViewModels.communitylist}"
|
ItemsSource="{x:Bind ViewModels.communitylist}"
|
||||||
|
Loaded="ListViewA_Loaded"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Hidden" />
|
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
||||||
|
SelectionChanged="ListViewA_SelectionChanged"
|
||||||
|
SelectionMode="Single" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Microsoft.UI;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||||
|
@ -30,15 +31,12 @@ public sealed partial class ConcernPage : Page
|
||||||
{
|
{
|
||||||
ViewModels = App.GetService<ConcernViewModel>();
|
ViewModels = App.GetService<ConcernViewModel>();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
|
||||||
|
|
||||||
private void ItemsView_ItemInvoked(ItemsView sender, ItemsViewItemInvokedEventArgs args)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -47,7 +45,7 @@ public sealed partial class ConcernPage : Page
|
||||||
// 检查是否为有效的数值
|
// 检查是否为有效的数值
|
||||||
if (!double.IsNaN(height) && !double.IsInfinity(height) && height > 16)
|
if (!double.IsNaN(height) && !double.IsInfinity(height) && height > 16)
|
||||||
{
|
{
|
||||||
ListViewA.Height = height - 16;
|
ListViewA.Height = height - 36;
|
||||||
ListViewB.Height = height - 16;
|
ListViewB.Height = height - 16;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -56,4 +54,24 @@ public sealed partial class ConcernPage : Page
|
||||||
ListViewB.Height = 500; // 或者其他适当的默认值
|
ListViewB.Height = 500; // 或者其他适当的默认值
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ItemsView_ItemInvoked(ItemsView sender, ItemsViewItemInvokedEventArgs args)
|
||||||
|
{
|
||||||
|
gj.sc("You invoked ");
|
||||||
|
}
|
||||||
|
private void ListViewA_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
// 获取当前选中的项目
|
||||||
|
var selectedItem = ListViewA.SelectedItem;
|
||||||
|
gj.sc(selectedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListViewA_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 检查是否有项目并设置默认选中项为第一个项
|
||||||
|
if (ListViewA.Items.Count > 0)
|
||||||
|
{
|
||||||
|
ListViewA.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,41 +10,6 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
SizeChanged="Page_SizeChanged"
|
SizeChanged="Page_SizeChanged"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Page.Resources>
|
|
||||||
<DataTemplate x:Key="HomePageListItem" x:DataType="local:HomePage">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<Border
|
|
||||||
Width="56"
|
|
||||||
Height="56"
|
|
||||||
BorderBrush="White"
|
|
||||||
BorderThickness="0"
|
|
||||||
CornerRadius="9">
|
|
||||||
<Border.Background>
|
|
||||||
<ImageBrush ImageSource="{Binding Icon}" Stretch="UniformToFill" />
|
|
||||||
</Border.Background>
|
|
||||||
</Border>
|
|
||||||
<StackPanel Margin="10,10,10,10" Orientation="Vertical">
|
|
||||||
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="{Binding Name}" />
|
|
||||||
<TextBlock
|
|
||||||
Width="500"
|
|
||||||
MaxLines="2"
|
|
||||||
Style="{StaticResource BodyStrongTextBlockStyle}"
|
|
||||||
Text="{Binding Description}"
|
|
||||||
TextTrimming="CharacterEllipsis"
|
|
||||||
TextWrapping="Wrap" />
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding UpdateTime}" />
|
|
||||||
<TextBlock
|
|
||||||
Margin="10,0,0,0"
|
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
|
||||||
Text="{Binding CoinNumber}" />
|
|
||||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="次下载" />
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</Page.Resources>
|
|
||||||
|
|
||||||
|
|
||||||
<ScrollView HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
|
<ScrollView HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
|
||||||
|
@ -81,10 +46,9 @@
|
||||||
</RelativePanel>
|
</RelativePanel>
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
x:Name="list"
|
x:Name="ListA"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
IsItemClickEnabled="True"
|
IsItemClickEnabled="True"
|
||||||
ItemClick="ListAClick"
|
|
||||||
ItemTemplate="{StaticResource HomePageListItem}"
|
ItemTemplate="{StaticResource HomePageListItem}"
|
||||||
ItemsSource="{x:Bind ViewModel.randomList}"
|
ItemsSource="{x:Bind ViewModel.randomList}"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
|
@ -99,10 +63,10 @@
|
||||||
RelativePanel.AlignRightWithPanel="True" />
|
RelativePanel.AlignRightWithPanel="True" />
|
||||||
</RelativePanel>
|
</RelativePanel>
|
||||||
<ListView
|
<ListView
|
||||||
|
Name="ListB"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Margin="0,0,0,50"
|
Margin="0,0,0,50"
|
||||||
IsItemClickEnabled="True"
|
IsItemClickEnabled="True"
|
||||||
ItemClick="ListAClick"
|
|
||||||
ItemTemplate="{StaticResource HomePageListItem}"
|
ItemTemplate="{StaticResource HomePageListItem}"
|
||||||
ItemsSource="{x:Bind ViewModel.latestTimeList}"
|
ItemsSource="{x:Bind ViewModel.latestTimeList}"
|
||||||
SelectionMode="None" />
|
SelectionMode="None" />
|
||||||
|
|
|
@ -30,6 +30,8 @@ public sealed partial class HomePage : Page
|
||||||
ViewModel.random();
|
ViewModel.random();
|
||||||
ViewModel.Latest();
|
ViewModel.Latest();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
ListA.ItemClick += ListAClick;
|
||||||
|
ListB.ItemClick += ListAClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
@ -41,9 +43,9 @@ public sealed partial class HomePage : Page
|
||||||
//Banner.Height = a;
|
//Banner.Height = a;
|
||||||
|
|
||||||
}
|
}
|
||||||
private void ListAClick(object sender, ItemClickEventArgs e)
|
public static void ListAClick(object sender, ItemClickEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.ClickedItem is not ModData item) { return; }
|
if (e.ClickedItem is not ModListResponse.ModData item) { return; }
|
||||||
|
|
||||||
// 查找已存在的 ModulePage,如果存在则激活它
|
// 查找已存在的 ModulePage,如果存在则激活它
|
||||||
var existingWindow = ModulePage.ModulePageList.FirstOrDefault(window => window.Mod.Id == item.Id);
|
var existingWindow = ModulePage.ModulePageList.FirstOrDefault(window => window.Mod.Id == item.Id);
|
||||||
|
|
|
@ -1,15 +1,49 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Page
|
<Page
|
||||||
x:Class="RustTools.Views.RankingPage"
|
x:Class="RustTools.Views.RankingPage"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="using:RustTools.Views"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="using:RustTools.Views"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
SizeChanged="Page_SizeChanged"
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<AppBarButton
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="0,3,9,0"
|
||||||
|
Icon="Sort"
|
||||||
|
IsCompact="False"
|
||||||
|
Label="下载量"
|
||||||
|
ToolTipService.ToolTip="Sort">
|
||||||
|
<AppBarButton.Flyout>
|
||||||
|
<MenuFlyout>
|
||||||
|
<MenuFlyoutItem Tag="rating" Text="下载量" />
|
||||||
|
<MenuFlyoutItem Tag="match" Text="投币数" />
|
||||||
|
<MenuFlyoutItem Tag="distance" Text="单位数" />
|
||||||
|
<MenuFlyoutItem Tag="d" Text="更新次数" />
|
||||||
|
</MenuFlyout>
|
||||||
|
</AppBarButton.Flyout>
|
||||||
|
</AppBarButton>
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
x:Name="list"
|
||||||
|
Grid.Row="1"
|
||||||
|
Padding="0,0,16,0"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
IsItemClickEnabled="True"
|
||||||
|
ItemTemplate="{StaticResource HomePageListItem}"
|
||||||
|
ItemsSource="{x:Bind ViewModel.RankingList}"
|
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||||
|
SelectionMode="None" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -13,6 +13,9 @@ using Microsoft.UI.Xaml.Input;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
using Microsoft.UI.Xaml.Navigation;
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
using RustTools.ViewModels;
|
using RustTools.ViewModels;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using RustTools.muqing;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
// To learn more about WinUI, the WinUI project structure,
|
// To learn more about WinUI, the WinUI project structure,
|
||||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||||
|
@ -27,9 +30,18 @@ public sealed partial class RankingPage : Page
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RankingPage()
|
public RankingPage()
|
||||||
{
|
{
|
||||||
ViewModel=App.GetService<RankingViewModel>();
|
ViewModel=App.GetService<RankingViewModel>();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
list.ItemClick +=HomePage.ListAClick;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
{
|
||||||
|
list.Height = ActualHeight - 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Microsoft.UI.Xaml.Media;
|
||||||
|
|
||||||
using RustTools.Contracts.Services;
|
using RustTools.Contracts.Services;
|
||||||
using RustTools.Helpers;
|
using RustTools.Helpers;
|
||||||
|
using RustTools.muqing;
|
||||||
using RustTools.ViewModels;
|
using RustTools.ViewModels;
|
||||||
|
|
||||||
using Windows.System;
|
using Windows.System;
|
||||||
|
@ -41,11 +42,13 @@ public sealed partial class ShellPage : Page
|
||||||
App.MainWindow.ExtendsContentIntoTitleBar = true;
|
App.MainWindow.ExtendsContentIntoTitleBar = true;
|
||||||
App.MainWindow.SetTitleBar(AppTitleBar);
|
App.MainWindow.SetTitleBar(AppTitleBar);
|
||||||
App.MainWindow.Activated += MainWindow_Activated;
|
App.MainWindow.Activated += MainWindow_Activated;
|
||||||
|
App.MainWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/WindowIcon.ico"));
|
||||||
AppTitleBarText.Text = "app_name".GetLocalized() +" " +"app_version".GetLocalized();
|
AppTitleBarText.Text = "app_name".GetLocalized() +" " +"app_version".GetLocalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
private void OnLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
//gj.sc(RequestedTheme);
|
||||||
TitleBarHelper.UpdateTitleBar(RequestedTheme);
|
TitleBarHelper.UpdateTitleBar(RequestedTheme);
|
||||||
|
|
||||||
KeyboardAccelerators.Add(BuildKeyboardAccelerator(VirtualKey.Left, VirtualKeyModifiers.Menu));
|
KeyboardAccelerators.Add(BuildKeyboardAccelerator(VirtualKey.Left, VirtualKeyModifiers.Menu));
|
||||||
|
|
|
@ -1,15 +1,115 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Page
|
<Page
|
||||||
x:Class="RustTools.Views.UserPage"
|
x:Class="RustTools.Views.UserPage"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="using:RustTools.Views"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="using:RustTools.Views"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
xmlns:styles="using:RustTools.Styles"
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="110" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Border
|
||||||
|
Grid.Column="0"
|
||||||
|
Padding="9,9,26,9"
|
||||||
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||||
|
CornerRadius="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<PersonPicture
|
||||||
|
Grid.Column="0"
|
||||||
|
Width="86"
|
||||||
|
Height="86"
|
||||||
|
HorizontalContentAlignment="Right"
|
||||||
|
ProfilePicture="/Assets/tool.png" />
|
||||||
|
<StackPanel Grid.Column="1" Margin="16,0,0,0">
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,9,0,0"
|
||||||
|
Style="{StaticResource TitleTextBlockStyle}"
|
||||||
|
Text="Muqing" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,6,0,0"
|
||||||
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
|
Text="测试员,开发者,这里是签名哦" />
|
||||||
|
</StackPanel>
|
||||||
|
<FontIcon Grid.Column="2" Glyph="" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
<Border
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="16,0,0,0"
|
||||||
|
Padding="30,9,30,9"
|
||||||
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||||
|
CornerRadius="10">
|
||||||
|
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
||||||
|
|
||||||
|
<styles:TitleSubtitleControl
|
||||||
|
Style="{StaticResource TitleSubtitleControlStyle}"
|
||||||
|
SubtitleText="关注"
|
||||||
|
TitleText="99" />
|
||||||
|
<Rectangle
|
||||||
|
Width="1"
|
||||||
|
Height="10"
|
||||||
|
Margin="16,0,16,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Fill="Gray" />
|
||||||
|
|
||||||
|
<styles:TitleSubtitleControl
|
||||||
|
Style="{StaticResource TitleSubtitleControlStyle}"
|
||||||
|
SubtitleText="粉丝"
|
||||||
|
TitleText="99" />
|
||||||
|
<Rectangle
|
||||||
|
Width="1"
|
||||||
|
Height="10 "
|
||||||
|
Margin="16,0,16,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Fill="Gray" />
|
||||||
|
<styles:TitleSubtitleControl
|
||||||
|
Style="{StaticResource TitleSubtitleControlStyle}"
|
||||||
|
SubtitleText="获赞"
|
||||||
|
TitleText="99" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
<Pivot Grid.Row="1" Grid.Column="0">
|
||||||
|
<PivotItem Header="模组">
|
||||||
|
<TextBlock Text="这里是你全部发布的模组" />
|
||||||
|
</PivotItem>
|
||||||
|
<PivotItem Header="动态">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Text="这里是你全部发布的动态" />
|
||||||
|
<Button
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="16,16,0,16"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Content="我要发布动态" />
|
||||||
|
</Grid>
|
||||||
|
</PivotItem>
|
||||||
|
</Pivot>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
MinWidth="500"
|
MinWidth="500"
|
||||||
MinHeight="500"
|
MinHeight="500"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Grid Name="GridView" Margin="16,16,16,16">
|
<Grid Name="GridView" Margin="16,16,16,16">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions />
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||||
<Border
|
<Border
|
||||||
Width="106"
|
Width="106"
|
||||||
|
|
|
@ -1,22 +1,14 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
|
||||||
using Windows.Foundation;
|
|
||||||
using Windows.Foundation.Collections;
|
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
|
||||||
using Microsoft.UI.Xaml.Data;
|
|
||||||
using Microsoft.UI.Xaml.Input;
|
|
||||||
using Microsoft.UI.Xaml.Media;
|
|
||||||
using Microsoft.UI.Xaml.Navigation;
|
|
||||||
using RustTools.muqing;
|
using RustTools.muqing;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using RustTools.DataList;
|
|
||||||
using RustTools.Helpers;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using Windows.ApplicationModel.Core;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Windows.UI.ViewManagement;
|
||||||
|
using Microsoft.UI.Xaml.Media;
|
||||||
|
using Microsoft.UI;
|
||||||
// To learn more about WinUI, the WinUI project structure,
|
// To learn more about WinUI, the WinUI project structure,
|
||||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||||
|
|
||||||
|
@ -29,14 +21,29 @@ namespace RustTools.WindowUI;
|
||||||
public sealed partial class ModulePage : WindowEx
|
public sealed partial class ModulePage : WindowEx
|
||||||
{
|
{
|
||||||
public static List<ModulePage> ModulePageList = new();
|
public static List<ModulePage> ModulePageList = new();
|
||||||
public ObservableCollection<string> ScreenshotsList =new();
|
public ObservableCollection<string> ScreenshotsList = new();
|
||||||
public ModInfo.Data Mod { get; set; } = new();
|
public ModInfo.Data Mod { get; set; } = new();
|
||||||
public ModulePage(string v)
|
public ModulePage(string v)
|
||||||
{
|
{
|
||||||
gj.SetBackTheme(this);
|
|
||||||
|
|
||||||
|
// 设置窗口背景颜色
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ExtendsContentIntoTitleBar = true;
|
ExtendsContentIntoTitleBar = true;
|
||||||
|
gj.SetBackTheme(this);
|
||||||
init(v);
|
init(v);
|
||||||
|
var frame = App.AppTitlebar as FrameworkElement;
|
||||||
|
if (frame != null)
|
||||||
|
{
|
||||||
|
gj.UpdateTitleBar(this, frame.ActualTheme);
|
||||||
|
grid.RequestedTheme = frame.ActualTheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool IsColorLight(Windows.UI.Color clr)
|
||||||
|
{
|
||||||
|
return (((5 * clr.G) + (2 * clr.R) + clr.B) > (8 * 128));
|
||||||
}
|
}
|
||||||
private async void init(string v)
|
private async void init(string v)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +88,7 @@ public sealed partial class ModulePage : WindowEx
|
||||||
|
|
||||||
private void WindowEx_SizeChanged(object sender, WindowSizeChangedEventArgs args)
|
private void WindowEx_SizeChanged(object sender, WindowSizeChangedEventArgs args)
|
||||||
{
|
{
|
||||||
DescriptionText.Width = Width-50;
|
DescriptionText.Width = Width - 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +121,7 @@ public sealed partial class ModulePage : WindowEx
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "DownLoadButton":
|
case "DownLoadButton":
|
||||||
gj.sc("ÏÂÔØ´ËÄ£×é:"+Mod.Link);
|
gj.sc("下载此模组:" + Mod.Link);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using RustTools.muqing;
|
using RustTools.muqing;
|
||||||
|
using Windows.Storage;
|
||||||
|
|
||||||
public class IniHelper
|
public class IniHelper
|
||||||
{
|
{
|
||||||
|
@ -121,6 +122,37 @@ public class IniHelper
|
||||||
sw.WriteLine(); // Add an empty line for readability
|
sw.WriteLine(); // Add an empty line for readability
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
///更高级的配置保存方式 为什么不用呢,因为不可视化保存后是个TMD二进制
|
||||||
|
//private void Load()
|
||||||
|
//{
|
||||||
|
// ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
|
||||||
|
|
||||||
|
// // load a setting that is local to the device
|
||||||
|
// String localValue = localSettings.Values["test setting"] as string;
|
||||||
|
|
||||||
|
// // load a composite setting
|
||||||
|
// Windows.Storage.ApplicationDataCompositeValue composite = (ApplicationDataCompositeValue)localSettings.Values["FontInfo"];
|
||||||
|
// if (composite != null)
|
||||||
|
// {
|
||||||
|
// String fontName = composite["Font"] as string;
|
||||||
|
// int fontSize = (int)composite["FontSize"];
|
||||||
|
// gj.sc(fontName + " " + ApplicationData.Current.LocalSettings.Locality);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//private void save()
|
||||||
|
//{
|
||||||
|
// ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
|
||||||
|
|
||||||
|
// // Save a setting locally on the device
|
||||||
|
// localSettings.Values["test setting"] = "a device specific setting";
|
||||||
|
|
||||||
|
// // Save a composite setting locally on the device
|
||||||
|
// Windows.Storage.ApplicationDataCompositeValue composite = new Windows.Storage.ApplicationDataCompositeValue();
|
||||||
|
// composite["Font"] = "Calibri";
|
||||||
|
// composite["FontSize"] = 11;
|
||||||
|
// localSettings.Values["FontInfo"] = composite;
|
||||||
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取配置数据
|
/// 读取配置数据
|
||||||
|
|
|
@ -6,11 +6,15 @@ using System.Diagnostics.Tracing;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using Microsoft.UI;
|
using Microsoft.UI;
|
||||||
using Microsoft.UI.Composition.SystemBackdrops;
|
using Microsoft.UI.Composition.SystemBackdrops;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
|
using Windows.UI.ViewManagement;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
using Windows.UI;
|
||||||
class gj
|
class gj
|
||||||
{
|
{
|
||||||
public static void sc(object obj)
|
public static void sc(object? obj)
|
||||||
{
|
{
|
||||||
obj ??= "null";
|
obj ??= "null";
|
||||||
Debug.WriteLine(obj);
|
Debug.WriteLine(obj);
|
||||||
|
@ -79,6 +83,100 @@ class gj
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetBackColor(WindowEx windowEx)
|
||||||
|
{
|
||||||
|
UISettings uISettings = new UISettings();
|
||||||
|
// 获取当前的背景颜色
|
||||||
|
var backgroundColor = uISettings.GetColorValue(UIColorType.Background);
|
||||||
|
|
||||||
|
// 判断主题模式
|
||||||
|
if (backgroundColor == Colors.Black)
|
||||||
|
{
|
||||||
|
// 设置背景色为黑色
|
||||||
|
//uISettings.SetColorValue(UIColorType.Background, Colors.Black);
|
||||||
|
//uISettings.SetColorValue(UIColorType.Foreground, Colors.White);
|
||||||
|
}
|
||||||
|
else if (backgroundColor == Colors.White)
|
||||||
|
{
|
||||||
|
// 设置背景色为白色
|
||||||
|
//uISettings.SetColorValue(UIColorType.Background, Colors.White);
|
||||||
|
//uISettings.SetColorValue(UIColorType.Foreground, Colors.Black);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Current theme mode is unknown.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private const int WAINACTIVE = 0x00;
|
||||||
|
private const int WAACTIVE = 0x01;
|
||||||
|
private const int WMACTIVATE = 0x0006;
|
||||||
|
public static void UpdateTitleBar(WindowEx a,ElementTheme theme)
|
||||||
|
{
|
||||||
|
if (a.ExtendsContentIntoTitleBar)
|
||||||
|
{
|
||||||
|
if (theme == ElementTheme.Default)
|
||||||
|
{
|
||||||
|
var uiSettings = new UISettings();
|
||||||
|
var background = uiSettings.GetColorValue(UIColorType.Background);
|
||||||
|
|
||||||
|
theme = background == Colors.White ? ElementTheme.Light : ElementTheme.Dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theme == ElementTheme.Default)
|
||||||
|
{
|
||||||
|
theme = Application.Current.RequestedTheme == ApplicationTheme.Light ? ElementTheme.Light : ElementTheme.Dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.AppWindow.TitleBar.ButtonForegroundColor = theme switch
|
||||||
|
{
|
||||||
|
ElementTheme.Dark => Colors.White,
|
||||||
|
ElementTheme.Light => Colors.Black,
|
||||||
|
_ => Colors.Transparent
|
||||||
|
};
|
||||||
|
|
||||||
|
a.AppWindow.TitleBar.ButtonHoverForegroundColor = theme switch
|
||||||
|
{
|
||||||
|
ElementTheme.Dark => Colors.White,
|
||||||
|
ElementTheme.Light => Colors.Black,
|
||||||
|
_ => Colors.Transparent
|
||||||
|
};
|
||||||
|
|
||||||
|
a.AppWindow.TitleBar.ButtonHoverBackgroundColor = theme switch
|
||||||
|
{
|
||||||
|
ElementTheme.Dark => Color.FromArgb(0x33, 0xFF, 0xFF, 0xFF),
|
||||||
|
ElementTheme.Light => Color.FromArgb(0x33, 0x00, 0x00, 0x00),
|
||||||
|
_ => Colors.Transparent
|
||||||
|
};
|
||||||
|
|
||||||
|
a.AppWindow.TitleBar.ButtonPressedBackgroundColor = theme switch
|
||||||
|
{
|
||||||
|
ElementTheme.Dark => Color.FromArgb(0x66, 0xFF, 0xFF, 0xFF),
|
||||||
|
ElementTheme.Light => Color.FromArgb(0x66, 0x00, 0x00, 0x00),
|
||||||
|
_ => Colors.Transparent
|
||||||
|
};
|
||||||
|
|
||||||
|
a.AppWindow.TitleBar.BackgroundColor = Colors.Transparent;
|
||||||
|
|
||||||
|
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(a);
|
||||||
|
if (hwnd == GetActiveWindow())
|
||||||
|
{
|
||||||
|
SendMessage(hwnd, WMACTIVATE, WAINACTIVE, IntPtr.Zero);
|
||||||
|
SendMessage(hwnd, WMACTIVATE, WAACTIVE, IntPtr.Zero);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendMessage(hwnd, WMACTIVATE, WAACTIVE, IntPtr.Zero);
|
||||||
|
SendMessage(hwnd, WMACTIVATE, WAINACTIVE, IntPtr.Zero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern IntPtr GetActiveWindow();
|
||||||
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
|
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|