优化关注模块和登陆功能
This commit is contained in:
parent
03c697b2b6
commit
3da0341de8
25
RustTools/ApiFox/community.cs
Normal file
25
RustTools/ApiFox/community.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using RestSharp;
|
||||||
|
using RustTools.muqing;
|
||||||
|
|
||||||
|
namespace RustTools.ApiFox;
|
||||||
|
|
||||||
|
|
||||||
|
#pragma warning disable CS8981 // 该类型名称仅包含小写 ascii 字符。此类名称可能会成为该语言的保留值。
|
||||||
|
#pragma warning disable IDE1006 // 命名样式
|
||||||
|
public class community
|
||||||
|
{
|
||||||
|
public static async Task<string> getList(string account,bool isFollowMode,int limit=0)
|
||||||
|
{
|
||||||
|
//Debug.WriteLine("account:" + account);
|
||||||
|
Debug.WriteLine("isFollowMode:" + isFollowMode.ToString());
|
||||||
|
return await wl.postAsync("/php/community.php?action=getList", new string[][]{
|
||||||
|
new string[] { "account", account },
|
||||||
|
new string[] { "isFollowMode",isFollowMode.ToString().ToLower() },
|
||||||
|
new string[] { "limit", limit==0?"0" : limit.ToString() }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using Newtonsoft.Json;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
public class CommunityList
|
public class CommunityList
|
||||||
{
|
{
|
||||||
|
@ -67,7 +68,7 @@ public class CommunityList
|
||||||
public string HeadIcon
|
public string HeadIcon
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
} = string.Empty;
|
||||||
|
|
||||||
[JsonProperty("email")]
|
[JsonProperty("email")]
|
||||||
public string Email
|
public string Email
|
||||||
|
@ -93,7 +94,7 @@ public class CommunityList
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonProperty("enable")]
|
[JsonConverter(typeof(BoolStringConverter))] // 使用自定义转换器
|
||||||
public bool Enable
|
public bool Enable
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
|
@ -106,4 +107,19 @@ public class CommunityList
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class BoolStringConverter : JsonConverter<bool>
|
||||||
|
{
|
||||||
|
public override bool ReadJson(JsonReader reader, Type objectType, [AllowNull] bool existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
var value = reader.Value.ToString();
|
||||||
|
return value.ToLower() == "true";
|
||||||
|
}
|
||||||
|
// 重写 WriteJson 方法
|
||||||
|
public override void WriteJson(JsonWriter writer, bool value, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
writer.WriteValue(value ? "true" : "false");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using RustTools.Helpers;
|
using RustTools.Helpers;
|
||||||
using RustTools.muqing;
|
using RustTools.muqing;
|
||||||
|
using Windows.UI.Popups;
|
||||||
using Windows.UI.ViewManagement;
|
using Windows.UI.ViewManagement;
|
||||||
|
|
||||||
namespace RustTools;
|
namespace RustTools;
|
||||||
|
@ -24,6 +25,8 @@ public sealed partial class MainWindow : WindowEx
|
||||||
settings.ColorValuesChanged += Settings_ColorValuesChanged;
|
settings.ColorValuesChanged += Settings_ColorValuesChanged;
|
||||||
// cannot use FrameworkElement.ActualThemeChanged event
|
// cannot use FrameworkElement.ActualThemeChanged event
|
||||||
//var editorWin = new Editor.EditorWin();
|
//var editorWin = new Editor.EditorWin();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
Margin="0,0,0,16"
|
Margin="0,0,0,16"
|
||||||
Padding="16"
|
Padding="16"
|
||||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CornerRadius="{StaticResource ControlCornerRadius}">
|
CornerRadius="{StaticResource ControlCornerRadius}">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
@ -20,7 +19,7 @@
|
||||||
Width="56"
|
Width="56"
|
||||||
Height="56">
|
Height="56">
|
||||||
<Ellipse.Fill>
|
<Ellipse.Fill>
|
||||||
<ImageBrush ImageSource="/Assets/image/a.jpeg" Stretch="UniformToFill" />
|
<ImageBrush ImageSource="/Assets/image/image.svg" Stretch="UniformToFill" />
|
||||||
</Ellipse.Fill>
|
</Ellipse.Fill>
|
||||||
</Ellipse>
|
</Ellipse>
|
||||||
<StackPanel Grid.Column="1" Margin="9,0,0,0">
|
<StackPanel Grid.Column="1" Margin="9,0,0,0">
|
||||||
|
@ -41,7 +40,7 @@
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
Text="内容是大概就是这个东西了" />
|
Text="内容是大概就是这个东西了" />
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Margin="16,0,16,0"
|
Margin="16,0,0,0"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
FlowDirection="RightToLeft"
|
FlowDirection="RightToLeft"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Newtonsoft.Json;
|
||||||
using RustTools.ApiFox;
|
using RustTools.ApiFox;
|
||||||
using RustTools.DataList;
|
using RustTools.DataList;
|
||||||
using RustTools.muqing;
|
using RustTools.muqing;
|
||||||
|
using WinUIEx.Messaging;
|
||||||
|
|
||||||
namespace RustTools.Themes;
|
namespace RustTools.Themes;
|
||||||
public sealed partial class LoginPage : UserControl
|
public sealed partial class LoginPage : UserControl
|
||||||
|
@ -26,14 +27,16 @@ public sealed partial class LoginPage : UserControl
|
||||||
ZpasswordBox.PasswordChanged += ZPasswordBox_PasswordChanged;
|
ZpasswordBox.PasswordChanged += ZPasswordBox_PasswordChanged;
|
||||||
ZpasswordyesBox.PasswordChanged += ZPasswordBox_PasswordChanged;
|
ZpasswordyesBox.PasswordChanged += ZPasswordBox_PasswordChanged;
|
||||||
|
|
||||||
//ZaccountBox.Text = "muqing1";
|
|
||||||
//ZnameBox.Text = "muqing153";
|
var iniHelper = new IniHelper();
|
||||||
//ZpasswordBox.Password = "123456";
|
iniHelper.Load(IniHelper.FILE.User);
|
||||||
//ZpasswordBox.Password= "123456";
|
|
||||||
//ZemialBox.Text="123456@qq.com";
|
var account = iniHelper.GetValue(IniHelper.CODE.User, IniHelper.KEY.account);
|
||||||
|
accountBox.Text = account;
|
||||||
|
var password = iniHelper.GetValue(IniHelper.CODE.User, IniHelper.KEY.password);
|
||||||
|
passwordBox.Password = password;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 返回到登陆
|
/// 返回到登陆
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -116,7 +119,7 @@ public sealed partial class LoginPage : UserControl
|
||||||
{
|
{
|
||||||
Toast.IsOpen = false;
|
Toast.IsOpen = false;
|
||||||
var v = await user.loginPc(accountBox.Text, passwordBox.Password);
|
var v = await user.loginPc(accountBox.Text, passwordBox.Password);
|
||||||
var message = JsonConvert.DeserializeObject<Message>(v);
|
var message = JsonConvert.DeserializeObject<DataList.Message>(v);
|
||||||
if (message != null)
|
if (message != null)
|
||||||
{
|
{
|
||||||
if (message.message.Equals("请先激活您的账户"))
|
if (message.message.Equals("请先激活您的账户"))
|
||||||
|
@ -137,7 +140,8 @@ public sealed partial class LoginPage : UserControl
|
||||||
var iniHelper = new IniHelper();
|
var iniHelper = new IniHelper();
|
||||||
iniHelper.Load(IniHelper.FILE.User);
|
iniHelper.Load(IniHelper.FILE.User);
|
||||||
iniHelper.SetValue(IniHelper.CODE.User, IniHelper.KEY.token, message.data.token);
|
iniHelper.SetValue(IniHelper.CODE.User, IniHelper.KEY.token, message.data.token);
|
||||||
iniHelper.SetValue(IniHelper.CODE.User, IniHelper.KEY.account, message.data.account);
|
iniHelper.SetValue(IniHelper.CODE.User, IniHelper.KEY.password,passwordBox.Password);
|
||||||
|
iniHelper.SetValue(IniHelper.CODE.User, IniHelper.KEY.account,message.data.account);
|
||||||
iniHelper.Save();
|
iniHelper.Save();
|
||||||
LoginSucceeded?.Invoke(this, message.data.account);
|
LoginSucceeded?.Invoke(this, message.data.account);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +181,7 @@ public sealed partial class LoginPage : UserControl
|
||||||
{
|
{
|
||||||
var v = await user.register(ZaccountBox.Text, ZnameBox.Text, ZpasswordBox.Password, ZemialBox.Text);
|
var v = await user.register(ZaccountBox.Text, ZnameBox.Text, ZpasswordBox.Password, ZemialBox.Text);
|
||||||
gj.sc(v);
|
gj.sc(v);
|
||||||
var message = JsonConvert.DeserializeObject<Message>(v);
|
var message = JsonConvert.DeserializeObject<DataList.Message>(v);
|
||||||
if (message.code == 0)
|
if (message.code == 0)
|
||||||
{
|
{
|
||||||
Toast.Title = "提示";
|
Toast.Title = "提示";
|
||||||
|
@ -227,7 +231,7 @@ public sealed partial class LoginPage : UserControl
|
||||||
{
|
{
|
||||||
gj.sc(textBox.Text);
|
gj.sc(textBox.Text);
|
||||||
var v = await user.enableAccount(account, textBox.Text);
|
var v = await user.enableAccount(account, textBox.Text);
|
||||||
var message = JsonConvert.DeserializeObject<Message>(v);
|
var message = JsonConvert.DeserializeObject<DataList.Message>(v);
|
||||||
if (message != null)
|
if (message != null)
|
||||||
{
|
{
|
||||||
Toast.Title = "提示";
|
Toast.Title = "提示";
|
||||||
|
|
|
@ -8,86 +8,7 @@ namespace RustTools.ViewModels;
|
||||||
|
|
||||||
public partial class ConcernViewModel : ObservableRecipient
|
public partial class ConcernViewModel : ObservableRecipient
|
||||||
{
|
{
|
||||||
public ObservableCollection<CommunityList.Data> communitylist = new();
|
|
||||||
public ObservableCollection<MovingInfo.Data> MovingInfoList = new();
|
|
||||||
private readonly string json = @"
|
|
||||||
{
|
|
||||||
""code"": 0,
|
|
||||||
""message"": ""获取成功,共3条记录"",
|
|
||||||
""data"": [
|
|
||||||
{
|
|
||||||
""account"": ""offical"",
|
|
||||||
""cover"": ""../user/offical/cover.png"",
|
|
||||||
""introduce"": null,
|
|
||||||
""fans"": ""64"",
|
|
||||||
""follower"": ""5"",
|
|
||||||
""praise"": ""0"",
|
|
||||||
""userName"": ""铁锈助手官方"",
|
|
||||||
""headIcon"": ""http://rust.coldmint.top/user/offical/icon.png"",
|
|
||||||
""email"": ""2923268971@qq.com"",
|
|
||||||
""permission"": ""2"",
|
|
||||||
""loginTime"": ""2023-10-21 22:28:18"",
|
|
||||||
""gender"": ""1"",
|
|
||||||
""enable"": ""true"",
|
|
||||||
""dynamicColor"": ""null""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
""account"": ""coldmint"",
|
|
||||||
""cover"": ""http://rust.coldmint.top/user/coldmint/covers/181d019f-7cb7-9c07-389e-5a78b98eea54.png"",
|
|
||||||
""introduce"": ""我是薄荷老师。”"",
|
|
||||||
""fans"": ""141"",
|
|
||||||
""follower"": ""13"",
|
|
||||||
""praise"": ""0"",
|
|
||||||
""userName"": ""薄荷今天吃什么?"",
|
|
||||||
""headIcon"": ""https://rust.coldmint.top/user/coldmint/icons/4006dc55-9101-39cc-7076-34c4b32924d5.png"",
|
|
||||||
""email"": ""cold_mint@qq.com"",
|
|
||||||
""permission"": ""1"",
|
|
||||||
""loginTime"": ""2024-08-02 22:04:48"",
|
|
||||||
""gender"": ""-1"",
|
|
||||||
""enable"": ""true"",
|
|
||||||
""dynamicColor"": ""null""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
""account"": ""muqing"",
|
|
||||||
""cover"": ""../user/muqing/covers/d4083a79-1e7f-d3bc-5944-ae9bce0d6714.png"",
|
|
||||||
""introduce"": ""nihao"",
|
|
||||||
""fans"": ""1"",
|
|
||||||
""follower"": ""1"",
|
|
||||||
""praise"": ""0"",
|
|
||||||
""userName"": ""薄荷是我的老婆"",
|
|
||||||
""headIcon"": ""../user/muqing/icons/cf0582bb-584c-176f-098b-a9a95af22a44.png"",
|
|
||||||
""email"": ""2583089389@qq.com"",
|
|
||||||
""permission"": ""3"",
|
|
||||||
""loginTime"": ""2024-04-18 14:08:22"",
|
|
||||||
""gender"": ""1"",
|
|
||||||
""enable"": ""true"",
|
|
||||||
""dynamicColor"": ""null""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}";
|
|
||||||
public ConcernViewModel()
|
public ConcernViewModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
var response = JsonConvert.DeserializeObject<CommunityList>(json);
|
|
||||||
var a = new CommunityList.Data
|
|
||||||
{
|
|
||||||
UserName = "全部",
|
|
||||||
HeadIcon = "/Assets/tool.png"
|
|
||||||
};
|
|
||||||
communitylist.Add(a);
|
|
||||||
foreach (var item in response.data)
|
|
||||||
{
|
|
||||||
//item.UserName
|
|
||||||
item.HeadIcon = item.HeadIcon.Replace("..", wl.api);
|
|
||||||
communitylist.Add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
MovingInfoList.Add(new MovingInfo.Data("123123"));
|
|
||||||
MovingInfoList.Add(new MovingInfo.Data("123123"));
|
|
||||||
MovingInfoList.Add(new MovingInfo.Data("123123"));
|
|
||||||
MovingInfoList.Add(new MovingInfo.Data("123123"));
|
|
||||||
MovingInfoList.Add(new MovingInfo.Data("123123"));
|
|
||||||
MovingInfoList.Add(new MovingInfo.Data("123123"));
|
|
||||||
MovingInfoList.Add(new MovingInfo.Data("123123"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,5 @@ public partial class UserViewModel : ObservableRecipient
|
||||||
public UserViewModel()
|
public UserViewModel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
x:Class="RustTools.Views.ConcernPage"
|
x:Class="RustTools.Views.ConcernPage"
|
||||||
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:controls="using:CommunityToolkit.WinUI.Controls"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="using:RustTools.Views"
|
xmlns:local="using:RustTools.Views"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
@ -15,43 +16,49 @@
|
||||||
<TextBlock
|
<TextBlock
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Style="{StaticResource BodyStrongTextBlockStyle}"
|
Style="{StaticResource BodyStrongTextBlockStyle}"
|
||||||
Text="请登陆后使用此功能" />
|
Text="请登陆后使用此功能"
|
||||||
|
Visibility="Collapsed" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<!--<themes:NullPage x:Name="nullpage" Visibility="Visible" />-->
|
<!--<themes:NullPage x:Name="nullpage" Visibility="Visible" />-->
|
||||||
<Grid x:Name="gridview" Visibility="Collapsed">
|
<Grid x:Name="gridview" Visibility="Visible">
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition MinWidth="56" MaxWidth="320" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
|
Name="StackPanelA"
|
||||||
|
MinWidth="95"
|
||||||
|
MaxWidth="300"
|
||||||
Margin="0,9,9,9"
|
Margin="0,9,9,9"
|
||||||
Padding="9"
|
Padding="9">
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
|
||||||
<ListView
|
<ListView
|
||||||
Name="ListViewA"
|
Name="ListViewA"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
ItemTemplate="{StaticResource ConCernItem}"
|
ItemTemplate="{StaticResource ConCernItem}"
|
||||||
ItemsSource="{x:Bind ViewModels.communitylist}"
|
ItemsSource="{x:Bind communitylist}"
|
||||||
Loaded="ListViewA_Loaded"
|
Loaded="ListViewA_Loaded"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
||||||
SelectionChanged="ListViewA_SelectionChanged"
|
SelectionChanged="ListViewA_SelectionChanged"
|
||||||
SelectionMode="Single" />
|
SelectionMode="Single" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<controls:ContentSizer Grid.Column="1" TargetControl="{x:Bind StackPanelA}" />
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Column="1"
|
Grid.Column="2"
|
||||||
Margin="9"
|
Margin="9"
|
||||||
Padding="9"
|
Padding="9"
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||||
|
CornerRadius="9">
|
||||||
<ListView
|
<ListView
|
||||||
Name="ListViewB"
|
Name="ListViewB"
|
||||||
IsItemClickEnabled="False"
|
IsItemClickEnabled="False"
|
||||||
ItemTemplate="{StaticResource MovingInfo}"
|
ItemTemplate="{StaticResource MovingInfo}"
|
||||||
ItemsSource="{x:Bind ViewModels.MovingInfoList}"
|
ItemsSource="{x:Bind MovingInfoList}"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
|
||||||
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
||||||
SelectionMode="None" />
|
SelectionMode="None" />
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using RustTools.DataList;
|
||||||
using RustTools.muqing;
|
using RustTools.muqing;
|
||||||
using RustTools.ViewModels;
|
using RustTools.ViewModels;
|
||||||
|
|
||||||
|
@ -17,12 +21,17 @@ public sealed partial class ConcernPage : Page
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
public ObservableCollection<CommunityList.Data> communitylist = new();
|
||||||
|
public ObservableCollection<MovingInfo.Data> MovingInfoList = new();
|
||||||
|
private bool IsLogin = false;
|
||||||
public ConcernPage()
|
public ConcernPage()
|
||||||
{
|
{
|
||||||
ViewModels = App.GetService<ConcernViewModel>();
|
ViewModels = App.GetService<ConcernViewModel>();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
//如果未登陆
|
//如果未登陆
|
||||||
if (false)
|
|
||||||
|
Init();
|
||||||
|
if (IsLogin)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +39,60 @@ public sealed partial class ConcernPage : Page
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async void Init()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
var ini = new IniHelper();
|
||||||
|
ini.Load(IniHelper.FILE.User);
|
||||||
|
var account = ini.GetValue(IniHelper.CODE.User, IniHelper.KEY.account);
|
||||||
|
var value = await ApiFox.community.getList(account, true, 0);
|
||||||
|
//Debug.WriteLine(value);
|
||||||
|
if (value == string.Empty) return;
|
||||||
|
var response = JsonConvert.DeserializeObject<CommunityList>(value);
|
||||||
|
var a = new CommunityList.Data
|
||||||
|
{
|
||||||
|
UserName = "全部",
|
||||||
|
HeadIcon = "/Assets/tool.png"
|
||||||
|
};
|
||||||
|
communitylist.Add(a);
|
||||||
|
foreach (var item in response.data)
|
||||||
|
{
|
||||||
|
//item.UserName
|
||||||
|
item.HeadIcon = item.HeadIcon.Replace("..", wl.api);
|
||||||
|
communitylist.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ListViewA.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 每个关注的动态消息内容
|
||||||
|
/// </summary>
|
||||||
|
private void dongtaixiaoxi()
|
||||||
|
{
|
||||||
|
MovingInfoList.Clear();
|
||||||
|
MovingInfoList.Add(new MovingInfo.Data("已经在写了"));
|
||||||
|
MovingInfoList.Add(new MovingInfo.Data("已经在写了"));
|
||||||
|
MovingInfoList.Add(new MovingInfo.Data("已经在写了"));
|
||||||
|
MovingInfoList.Add(new MovingInfo.Data("已经在写了"));
|
||||||
|
MovingInfoList.Add(new MovingInfo.Data("已经在写了"));
|
||||||
|
MovingInfoList.Add(new MovingInfo.Data("已经在写了"));
|
||||||
|
MovingInfoList.Add(new MovingInfo.Data("已经在写了"));
|
||||||
|
MovingInfoList.Add(new MovingInfo.Data("已经在写了"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
@ -59,6 +122,7 @@ public sealed partial class ConcernPage : Page
|
||||||
// 获取当前选中的项目
|
// 获取当前选中的项目
|
||||||
var selectedItem = ListViewA.SelectedItem;
|
var selectedItem = ListViewA.SelectedItem;
|
||||||
gj.sc(selectedItem);
|
gj.sc(selectedItem);
|
||||||
|
dongtaixiaoxi();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListViewA_Loaded(object sender, RoutedEventArgs e)
|
private void ListViewA_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
<MenuFlyoutItem Click="Button_Rwmod" Text="打包" />
|
<MenuFlyoutItem Click="Button_Rwmod" Text="打包" />
|
||||||
<MenuFlyoutItem Click="Button_PostRwmod" Text="发布" />
|
<MenuFlyoutItem Click="Button_PostRwmod" Text="发布" />
|
||||||
<MenuFlyoutItem Click="Button_Delete" Text="删除" />
|
<MenuFlyoutItem Click="Button_Delete" Text="删除" />
|
||||||
|
<MenuFlyoutItem Click="Button_OpenDir" Text="资源管理器" />
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
</Grid.ContextFlyout>
|
</Grid.ContextFlyout>
|
||||||
<Grid
|
<Grid
|
||||||
|
|
|
@ -7,6 +7,7 @@ using RustTools.muqing;
|
||||||
using RustTools.Themes;
|
using RustTools.Themes;
|
||||||
using RustTools.ViewModels;
|
using RustTools.ViewModels;
|
||||||
using SharpCompress.Common;
|
using SharpCompress.Common;
|
||||||
|
using WinRT.Interop;
|
||||||
namespace RustTools.Views;
|
namespace RustTools.Views;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模组碎片
|
/// 模组碎片
|
||||||
|
@ -254,7 +255,7 @@ public sealed partial class ModulePage : Page
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private async void BasicGridView_DoubleTapped(object sender, Microsoft.UI.Xaml.Input.DoubleTappedRoutedEventArgs e)
|
private void BasicGridView_DoubleTapped(object sender, Microsoft.UI.Xaml.Input.DoubleTappedRoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
var gridView = sender as GridView;
|
var gridView = sender as GridView;
|
||||||
|
@ -310,6 +311,16 @@ public sealed partial class ModulePage : Page
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打开目录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Button_OpenDir(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
wj.OpenFileExplorer(ViewModel.ListMod[0].Dri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class MyItemTemplateSelector : DataTemplateSelector
|
public class MyItemTemplateSelector : DataTemplateSelector
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ public sealed partial class SettingsPage : Page
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
}
|
}
|
||||||
private async void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
var iniHelper = new IniHelper();
|
var iniHelper = new IniHelper();
|
||||||
iniHelper.Load(IniHelper.FILE.Config);
|
iniHelper.Load(IniHelper.FILE.Config);
|
||||||
|
@ -51,7 +51,7 @@ public sealed partial class SettingsPage : Page
|
||||||
MapsFileUrlText.Text = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.MapsFileUrl);
|
MapsFileUrlText.Text = iniHelper.GetValue(IniHelper.CODE.Rust, IniHelper.KEY.MapsFileUrl);
|
||||||
}
|
}
|
||||||
private bool Backone = false;
|
private bool Backone = false;
|
||||||
private async void BackgroundColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void BackgroundColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (Backone)
|
if (Backone)
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,7 @@ public sealed partial class SettingsPage : Page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void SaveModAndMaps()
|
private void SaveModAndMaps()
|
||||||
{
|
{
|
||||||
var iniHelper = new IniHelper();
|
var iniHelper = new IniHelper();
|
||||||
iniHelper.Load(IniHelper.FILE.Config);
|
iniHelper.Load(IniHelper.FILE.Config);
|
||||||
|
@ -133,7 +133,7 @@ public sealed partial class SettingsPage : Page
|
||||||
iniHelper.Save();
|
iniHelper.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ModFileUrlText_LostFocus(object sender, RoutedEventArgs e)
|
private void ModFileUrlText_LostFocus(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var a = (AutoSuggestBox)sender;
|
var a = (AutoSuggestBox)sender;
|
||||||
var iniHelper = new IniHelper();
|
var iniHelper = new IniHelper();
|
||||||
|
|
|
@ -50,6 +50,7 @@ public sealed partial class UserPage : Page
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//nulllogin();
|
||||||
await login(account);
|
await login(account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,9 +68,13 @@ public sealed partial class UserPage : Page
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 登陆成功
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="account"></param>
|
||||||
private async void LoginPage_LoginSucceeded(object sender, string account)
|
private async void LoginPage_LoginSucceeded(object sender, string account)
|
||||||
{
|
{
|
||||||
|
|
||||||
// µÇ¼³É¹¦ºó£¬´Ó Grid ÖÐÒƳý LoginPage
|
// µÇ¼³É¹¦ºó£¬´Ó Grid ÖÐÒƳý LoginPage
|
||||||
view.Children.Remove((LoginPage)sender);
|
view.Children.Remove((LoginPage)sender);
|
||||||
await login(account);
|
await login(account);
|
||||||
|
@ -91,10 +96,15 @@ public sealed partial class UserPage : Page
|
||||||
gridview.Visibility = Microsoft.UI.Xaml.Visibility.Visible;
|
gridview.Visibility = Microsoft.UI.Xaml.Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 退出登陆
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void MenuFlyoutItemLogout_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
private void MenuFlyoutItemLogout_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var iniHelper = new IniHelper(IniHelper.FILE.User);
|
var iniHelper = new IniHelper(IniHelper.FILE.User);
|
||||||
iniHelper.Clean();
|
iniHelper.SetValue(IniHelper.CODE.User, IniHelper.KEY.token, "");
|
||||||
iniHelper.Save();
|
iniHelper.Save();
|
||||||
nulllogin();
|
nulllogin();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using RustTools.muqing;
|
using System.Diagnostics;
|
||||||
|
using RustTools.muqing;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
|
|
||||||
#pragma warning disable CA1050 // 在命名空间中声明类型
|
#pragma warning disable CA1050 // 在命名空间中声明类型
|
||||||
|
@ -32,6 +33,7 @@ public class IniHelper
|
||||||
|
|
||||||
public const string token = "token";
|
public const string token = "token";
|
||||||
public const string account = "account";
|
public const string account = "account";
|
||||||
|
public const string password = "password";//密码
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +79,7 @@ public class IniHelper
|
||||||
public void Load(string a)
|
public void Load(string a)
|
||||||
{
|
{
|
||||||
filePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, a);
|
filePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, a);
|
||||||
|
//Debug.WriteLine($"加载配置文件: {filePath}");
|
||||||
if (!File.Exists(filePath))
|
if (!File.Exists(filePath))
|
||||||
{// 使用 File.Create 创建文件并立即关闭
|
{// 使用 File.Create 创建文件并立即关闭
|
||||||
using var fs = File.Create(filePath);
|
using var fs = File.Create(filePath);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
|
using Windows.UI.Popups;
|
||||||
|
using WinRT.Interop;
|
||||||
namespace RustTools.muqing;
|
namespace RustTools.muqing;
|
||||||
|
|
||||||
#pragma warning disable CS8981 // 该类型名称仅包含小写 ascii 字符。此类名称可能会成为该语言的保留值。
|
#pragma warning disable CS8981 // 该类型名称仅包含小写 ascii 字符。此类名称可能会成为该语言的保留值。
|
||||||
|
@ -134,6 +136,11 @@ public class wj
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 打开文件管理器-在资源管理器中打开
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <exception cref="Exception"></exception>
|
||||||
public static void OpenFileExplorer(string path)
|
public static void OpenFileExplorer(string path)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -147,8 +154,9 @@ public class wj
|
||||||
else
|
else
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (System.Exception other)
|
catch (Exception other)
|
||||||
{
|
{
|
||||||
|
//Dialog.DialogWarn(other.Message, App.MainWindow.XamlRoot);
|
||||||
throw other;
|
throw other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user