mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
source code checkin
This commit is contained in:
parent
5f8fb2c825
commit
7e57b72e35
675 changed files with 168433 additions and 0 deletions
53
src/ARKServerManager/Windows/ProgressWindow.xaml.cs
Normal file
53
src/ARKServerManager/Windows/ProgressWindow.xaml.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using ServerManagerTool.Common.Utils;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using WPFSharp.Globalizer;
|
||||
|
||||
namespace ServerManagerTool
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ProgressWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ProgressWindow : Window
|
||||
{
|
||||
private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance;
|
||||
private bool _allowClose = false;
|
||||
|
||||
public ProgressWindow(string windowTitle)
|
||||
{
|
||||
InitializeComponent();
|
||||
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(windowTitle))
|
||||
Title = windowTitle;
|
||||
Application.Current.Dispatcher.Invoke(() => MessageOutput.Cursor = System.Windows.Input.Cursors.Wait);
|
||||
|
||||
_allowClose = false;
|
||||
this.DataContext = this;
|
||||
}
|
||||
|
||||
public void AddMessage(string message, bool includeNewLine = true)
|
||||
{
|
||||
MessageOutput.AppendText(message);
|
||||
if (includeNewLine)
|
||||
MessageOutput.AppendText(Environment.NewLine);
|
||||
MessageOutput.ScrollToEnd();
|
||||
|
||||
Debug.WriteLine(message);
|
||||
}
|
||||
|
||||
public void CloseWindow()
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() => MessageOutput.Cursor = null);
|
||||
|
||||
_allowClose = true;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (!_allowClose)
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue