Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloryr committed Jun 3, 2024
1 parent dd39451 commit 5786082
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Minecraft_QQ_Core/IMinecraft_QQ.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class IMinecraft_QQ
public delegate void Gui(GuiCallType dofun);
public delegate void Log(string message);

public static ShowMessage ShowMessageCall;
public static ConfigInit ConfigInitCall;
public static ShowMessage ShowMessageCall { get; set; }
public static ConfigInit ConfigInitCall { get; set; }
public static Gui GuiCall { get; set; }
public static Log LogCall { get; set; }
}
15 changes: 12 additions & 3 deletions Minecraft_QQ_NewGui/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System;
using System.ComponentModel;
using System.Threading;
using System.Threading.Tasks;

namespace Minecraft_QQ_NewGui.Windows;

Expand Down Expand Up @@ -36,6 +37,7 @@ public MainWindow()
CommandDataGrid.PointerPressed += CommandDataGrid_PointerPressed;
DataContextChanged += MainWindow_DataContextChanged;
Closing += MainWindow_Closing;
Opened += MainWindow_Opened;

IMinecraft_QQ.ShowMessageCall = (data) =>
{
Expand Down Expand Up @@ -91,6 +93,15 @@ public MainWindow()
};
}

private async void MainWindow_Opened(object? sender, EventArgs e)
{
await Task.Run(Minecraft_QQ.Start);
if (DataContext is WindowModel model)
{
model.Load();
}
}

private void CommandDataGrid_PointerPressed(object? sender, PointerPressedEventArgs e)
{
var po = e.GetCurrentPoint(this);
Expand Down Expand Up @@ -288,13 +299,11 @@ private void ServerDataGrid_CellPointerPressed(object? sender, DataGridCellPoint
});
}

private async void MainWindow_DataContextChanged(object? sender, EventArgs e)
private void MainWindow_DataContextChanged(object? sender, EventArgs e)
{
if (DataContext is WindowModel model)
{
model.PropertyChanged += Model_PropertyChanged;
await Minecraft_QQ.Start();
model.Load();
}
}

Expand Down

0 comments on commit 5786082

Please sign in to comment.