Skip to content

Commit

Permalink
up 基本好了
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloryr committed Feb 19, 2024
1 parent ad581f5 commit fd908d4
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Minecraft_QQ_Cmd/Minecraft_QQ.Cmd.csproj.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>E:\code\Minecraft_QQ-C-Server-\Minecraft_QQ_Cmd\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
<_LastSelectedProfileId>E:\code\Minecraft_QQ-C-Server-\Minecraft_QQ_Cmd\Properties\PublishProfiles\linux-x64.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>
10 changes: 10 additions & 0 deletions Minecraft_QQ_Cmd/Properties/PublishProfiles/linux-x64.pubxml.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-02-19T06:58:53.6167020Z||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions Minecraft_QQ_Core/IMinecraft_QQ.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public enum GuiCallType
{
ServerList, PlayerList
ServerState, ServerList, PlayerList
}
public class IMinecraft_QQ
{
Expand All @@ -21,6 +21,6 @@ public class IMinecraft_QQ

public static ShowMessage ShowMessageCall;
public static ConfigInit ConfigInitCall;
public static Gui GuiCall;
public static Gui GuiCall { get; set; }
public static Log LogCall;
}
2 changes: 1 addition & 1 deletion Minecraft_QQ_Core/MySocket/PluginServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static class PluginServer
private static void SetState(bool st)
{
Start = st;
IMinecraft_QQ.GuiCall?.Invoke(GuiCallType.ServerList);
IMinecraft_QQ.GuiCall?.Invoke(GuiCallType.ServerState);
}

public static bool IsReady()
Expand Down
2 changes: 1 addition & 1 deletion Minecraft_QQ_NewGui/Minecraft_QQ.NewGui.csproj.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>E:\code\Minecraft_QQ-C-Server-\Minecraft_QQ_NewGui\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
<_LastSelectedProfileId>E:\code\Minecraft_QQ-C-Server-\Minecraft_QQ_NewGui\Properties\PublishProfiles\linux-x64.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-02-19T07:00:11.7822173Z||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
14 changes: 11 additions & 3 deletions Minecraft_QQ_NewGui/ViewModels/WindowModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ public void Load()
_isLoad = true;
LoadGroup();
LoadServer();
UpdateServer();
ServerList();
Config.Load();
Database.Load();
LoadPlayer();
Expand All @@ -130,7 +132,6 @@ public void LoadServer()

public void UpdateServer()
{
Servers.Clear();
if (!PluginServer.Start)
{
State = "未就绪";
Expand All @@ -153,14 +154,20 @@ public void UpdateServer()
SocketST = "关闭端口";
SocketEdit = false;
}
}

public void ServerList()
{
Servers.Clear();

foreach (var item in PluginServer.MCServers)
{
Servers.Add(new(this)
{
Name = item.Key,
Addr = item.Value.Channel.RemoteAddress.ToString() ?? ""
});
}
};
}

public void LoadGroup()
Expand Down Expand Up @@ -407,9 +414,10 @@ public void Delete(ServerModel model)
{
DialogHost.Show(new YesNoModel("是否要断开链接", () =>
{
Cancel();
PluginServer.Close(model.Name);
ShowNotify("已断开链接");
UpdateServer();
ServerList();
}, Cancel), "Main");
}

Expand Down
7 changes: 5 additions & 2 deletions Minecraft_QQ_NewGui/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ public MainWindow()
var model = (DataContext as WindowModel)!;
switch (state)
{
case GuiCallType.ServerList:
case GuiCallType.ServerState:
model.UpdateServer();
break;
case GuiCallType.ServerList:
model.ServerList();
break;
case GuiCallType.PlayerList:
model.LoadPlayer();
break;
Expand Down Expand Up @@ -280,7 +283,7 @@ private void ServerDataGrid_CellPointerPressed(object? sender, DataGridCellPoint
{
if (DataContext is WindowModel model)
{
new GroupFlyout((sender as Control)!, model, model.GroupItem);
new ServerFlyout((sender as Control)!, model.ServerItem);

Check warning on line 286 in Minecraft_QQ_NewGui/Windows/MainWindow.axaml.cs

View workflow job for this annotation

GitHub Actions / build-windows

Possible null reference argument for parameter 'model' in 'ServerFlyout.ServerFlyout(Control con, ServerModel model)'.

Check warning on line 286 in Minecraft_QQ_NewGui/Windows/MainWindow.axaml.cs

View workflow job for this annotation

GitHub Actions / build-linux

Possible null reference argument for parameter 'model' in 'ServerFlyout.ServerFlyout(Control con, ServerModel model)'.
}
});
}
Expand Down

0 comments on commit fd908d4

Please sign in to comment.