mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-22 15:05:32 +00:00
45 lines
1013 B
C#
45 lines
1013 B
C#
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PckStudio.Core.Additional_Popups
|
|
{
|
|
public partial class ItemSelectionPopUp : Form
|
|
{
|
|
public string SelectedItem => DialogResult == DialogResult.OK ? ComboBox.Text : string.Empty;
|
|
public int SelectedIndex => DialogResult == DialogResult.OK ? ComboBox.SelectedIndex : -1;
|
|
|
|
public string LabelText
|
|
{
|
|
get => label2.Text;
|
|
set => label2.Text = value;
|
|
}
|
|
public string ButtonText
|
|
{
|
|
get => okBtn.Text;
|
|
set => okBtn.Text = value;
|
|
}
|
|
|
|
public ItemSelectionPopUp(params string[] items)
|
|
{
|
|
InitializeComponent();
|
|
ComboBox.Items.AddRange(items);
|
|
}
|
|
|
|
private void okBtn_Click(object sender, EventArgs e)
|
|
{
|
|
if(ComboBox.SelectedIndex <= -1)
|
|
{
|
|
cancelButton_Click(sender, e);
|
|
return;
|
|
}
|
|
DialogResult = DialogResult.OK;
|
|
}
|
|
|
|
private void cancelButton_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.Cancel;
|
|
Close();
|
|
}
|
|
}
|
|
}
|