mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-28 15:40:56 +01:00
Moves control panel tabs into their own folder
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TGServiceInterface;
|
||||
|
||||
namespace TGControlPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// The main <see cref="ControlPanel"/> form
|
||||
/// </summary>
|
||||
partial class ControlPanel : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="TGServiceInterface.Interface"/> instance for this <see cref="ControlPanel"/>
|
||||
/// </summary>
|
||||
readonly Interface Interface;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a <see cref="ControlPanel"/>
|
||||
/// </summary>
|
||||
/// <param name="I">The <see cref="TGServiceInterface.Interface"/> for the <see cref="ControlPanel"/></param>
|
||||
public ControlPanel(Interface I)
|
||||
{
|
||||
Interface = I;
|
||||
InitializeComponent();
|
||||
if (Interface.VersionMismatch(out string error) && MessageBox.Show(error, "Warning", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
Panels.SelectedIndexChanged += Panels_SelectedIndexChanged;
|
||||
Panels.SelectedIndex += Math.Min(Properties.Settings.Default.LastPageIndex, Panels.TabCount - 1);
|
||||
InitRepoPage();
|
||||
InitBYONDPage();
|
||||
InitServerPage();
|
||||
LoadChatPage();
|
||||
InitStaticPage();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called from <see cref="Dispose(bool)"/>
|
||||
/// </summary>
|
||||
void Cleanup()
|
||||
{
|
||||
Interface.Dispose();
|
||||
}
|
||||
|
||||
private void Main_Resize(object sender, EventArgs e)
|
||||
{
|
||||
Panels.Location = new Point(10, 10);
|
||||
Panels.Width = ClientSize.Width - 20;
|
||||
Panels.Height = ClientSize.Height - 20;
|
||||
}
|
||||
|
||||
private void Panels_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (Panels.SelectedIndex)
|
||||
{
|
||||
case 0: //repo
|
||||
PopulateRepoFields();
|
||||
break;
|
||||
case 1: //byond
|
||||
UpdateBYONDButtons();
|
||||
break;
|
||||
case 2: //scp
|
||||
LoadServerPage();
|
||||
break;
|
||||
case 3: //chat
|
||||
LoadChatPage();
|
||||
break;
|
||||
}
|
||||
Properties.Settings.Default.LastPageIndex = Panels.SelectedIndex;
|
||||
}
|
||||
|
||||
bool CheckAdminWithWarning()
|
||||
{
|
||||
if (!Interface.ConnectToInstance().HasFlag(ConnectivityLevel.Administrator))
|
||||
{
|
||||
MessageBox.Show("Only system administrators may use this command!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user