mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Finished BackupServer and UpdateServer
This commit is contained in:
parent
824daed0d1
commit
0f3c6e6be9
28 changed files with 618 additions and 216 deletions
|
|
@ -10,7 +10,7 @@
|
|||
xmlns:com="clr-namespace:ServerManagerTool.Common;assembly=ServerManager.Common"
|
||||
xmlns:enum="clr-namespace:ServerManagerTool.Enums"
|
||||
MinWidth="900" MinHeight="600" Width="1100" Height="900" Left="50" Top="50" WindowState="Normal"
|
||||
Loaded="Window_Loaded" SizeChanged="Window_SizeChanged" StateChanged="Window_StateChanged" LocationChanged="Window_LocationChanged"
|
||||
Loaded="MainWindow_Loaded" SizeChanged="MainWindow_SizeChanged" StateChanged="MainWindow_StateChanged" LocationChanged="MainWindow_LocationChanged"
|
||||
Name="Main" Icon="../Art/favicon.ico" Title="{DynamicResource MainWindow_Title}">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using ServerManagerTool.Common.Utils;
|
|||
using ServerManagerTool.Enums;
|
||||
using ServerManagerTool.Lib;
|
||||
using ServerManagerTool.Plugin.Common;
|
||||
using ServerManagerTool.Utils;
|
||||
using ServerManagerTool.Windows;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -169,7 +170,7 @@ namespace ServerManagerTool
|
|||
GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent += ResourceDictionaryChangedEvent;
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//
|
||||
// Kick off the initialization.
|
||||
|
|
@ -199,15 +200,7 @@ namespace ServerManagerTool
|
|||
this.scheduledTaskChecker.PostAction(CheckForScheduledTasks).DoNotWait();
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is Window window)
|
||||
window.Closed -= Window_Closed;
|
||||
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
private void Window_LocationChanged(object sender, EventArgs e)
|
||||
private void MainWindow_LocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.WindowState == WindowState.Normal)
|
||||
{
|
||||
|
|
@ -216,7 +209,7 @@ namespace ServerManagerTool
|
|||
}
|
||||
}
|
||||
|
||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (this.WindowState == WindowState.Normal)
|
||||
{
|
||||
|
|
@ -225,7 +218,7 @@ namespace ServerManagerTool
|
|||
}
|
||||
}
|
||||
|
||||
private void Window_StateChanged(object sender, EventArgs e)
|
||||
private void MainWindow_StateChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Config.Default.MainWindow_MinimizeToTray && this.WindowState == WindowState.Minimized)
|
||||
{
|
||||
|
|
@ -233,8 +226,26 @@ namespace ServerManagerTool
|
|||
}
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is Window window)
|
||||
window.Closed -= Window_Closed;
|
||||
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (DiscordBotHelper.HasRunningCommands)
|
||||
{
|
||||
var result = MessageBox.Show(_globalizer.GetResourceString("MainWindow_DiscordBot_RunningCommandsLabel"), _globalizer.GetResourceString("MainWindow_DiscordBot_RunningCommandsTitle"), MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.No)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnClosing(e);
|
||||
RCONWindow.CloseAllWindows();
|
||||
PlayerListWindow.CloseAllWindows();
|
||||
|
|
|
|||
|
|
@ -623,7 +623,7 @@ namespace ServerManagerTool.Windows
|
|||
|
||||
await Task.Delay(1000);
|
||||
|
||||
var branch = new ServerBranchSnapshot() { BranchName = serverProfile.BranchName, BranchPassword = serverProfile.BranchPassword };
|
||||
var branch = BranchSnapshot.Create(serverProfile);
|
||||
return await server.UpgradeAsync(_upgradeCancellationSource.Token, updateServer, branch, true, updateMods, (p, m, n) => { TaskUtils.RunOnUIThreadAsync(() => { window?.AddMessage(m, n); }).DoNotWait(); });
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -4266,7 +4266,7 @@ namespace ServerManagerTool
|
|||
|
||||
await Task.Delay(1000);
|
||||
|
||||
var branch = new ServerBranchSnapshot() { BranchName = this.Server.Profile.BranchName, BranchPassword = this.Server.Profile.BranchPassword };
|
||||
var branch = BranchSnapshot.Create(this.Server.Profile);
|
||||
return await this.Server.UpgradeAsync(_upgradeCancellationSource.Token, updateServer, branch, true, updateMods, (p, m, n) => { TaskUtils.RunOnUIThreadAsync(() => { window?.AddMessage(m, n); }).DoNotWait(); });
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue