mirror of
https://github.com/JuniorDark/RustyHearts-Launcher.git
synced 2026-05-07 05:21:44 -04:00
Version 1.2.0
This commit is contained in:
parent
9b3a0e00a2
commit
e74d93fab9
83 changed files with 110087 additions and 47507 deletions
120
RHLauncher.Forms/MsgBoxForm.cs
Normal file
120
RHLauncher.Forms/MsgBoxForm.cs
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
using RHLauncher.RHLauncher.i8n;
|
||||
|
||||
namespace RHLauncher
|
||||
{
|
||||
public partial class MsgBoxForm : Form
|
||||
{
|
||||
public new DialogResult DialogResult { get; private set; }
|
||||
|
||||
public MsgBoxForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Text = LocalizedStrings.MsgBoxFormTitle;
|
||||
YesButton.Text = LocalizedStrings.Yes;
|
||||
NoButton.Text = LocalizedStrings.No;
|
||||
}
|
||||
|
||||
#region Form Events
|
||||
private void MsgBoxForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
TitleLabel.Left = (ClientSize.Width - TitleLabel.Width) / 2;
|
||||
OkButton.Left = (ClientSize.Width - OkButton.Width) / 2;
|
||||
}
|
||||
|
||||
private void MsgBoxForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Button Click Events
|
||||
private void YesButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Yes;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void NoButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.No;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OkButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public static void Show(string message, string title)
|
||||
{
|
||||
MsgBoxForm msgBox = new();
|
||||
msgBox.tbMessage.Visible = false;
|
||||
msgBox.YesButton.Visible = false;
|
||||
msgBox.NoButton.Visible = false;
|
||||
msgBox.TextLabel.Text = message;
|
||||
msgBox.TitleLabel.Text = title;
|
||||
msgBox.ShowDialog();
|
||||
}
|
||||
|
||||
public static void ShowST(string message, string title, string stacktrace)
|
||||
{
|
||||
MsgBoxForm msgBox = new();
|
||||
msgBox.tbMessage.Visible = true;
|
||||
msgBox.YesButton.Visible = false;
|
||||
msgBox.NoButton.Visible = false;
|
||||
msgBox.TextLabel.Text = message;
|
||||
msgBox.tbMessage.Text = stacktrace;
|
||||
msgBox.TitleLabel.Text = title;
|
||||
msgBox.ShowDialog();
|
||||
}
|
||||
|
||||
public static DialogResult ShowYN(string message, string title)
|
||||
{
|
||||
MsgBoxForm msgBox = new();
|
||||
msgBox.tbMessage.Visible = false;
|
||||
msgBox.OkButton.Visible = false;
|
||||
msgBox.YesButton.Visible = true;
|
||||
msgBox.NoButton.Visible = true;
|
||||
msgBox.TextLabel.Text = message;
|
||||
msgBox.TitleLabel.Text = title;
|
||||
msgBox.ShowDialog();
|
||||
|
||||
return msgBox.DialogResult;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Button Events
|
||||
private void Button_MouseHover(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is Button button)
|
||||
{
|
||||
button.ImageIndex = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is Button button)
|
||||
{
|
||||
button.ImageIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (sender is Button button)
|
||||
{
|
||||
button.ImageIndex = 2;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue