2017-04-02 20:42:42 +00:00
|
|
|
|
using System;
|
2018-02-05 20:12:42 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2017-04-02 20:42:42 +00:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using PKHeX.Core;
|
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
namespace PKHeX.WinForms;
|
|
|
|
|
|
|
|
|
|
public partial class SAV_GameSelect : Form
|
2017-04-02 20:42:42 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
public GameVersion Result = GameVersion.Invalid;
|
2018-08-04 17:06:06 +00:00
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
public SAV_GameSelect(IEnumerable<ComboItem> items, params string[] lines)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
|
|
|
|
|
L_Prompt.Text = string.Join(Environment.NewLine + Environment.NewLine, lines);
|
|
|
|
|
CB_Game.InitializeBinding();
|
|
|
|
|
CB_Game.DataSource = new BindingSource(items.ToList(), null);
|
|
|
|
|
CB_Game.SelectedIndex = 0;
|
|
|
|
|
CB_Game.Focus();
|
|
|
|
|
}
|
2018-08-04 17:06:06 +00:00
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
private void B_Cancel_Click(object sender, EventArgs e) => Close();
|
2018-08-04 17:06:06 +00:00
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
private void B_OK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Result = (GameVersion)WinFormsUtil.GetIndex(CB_Game);
|
|
|
|
|
Close();
|
|
|
|
|
}
|
2018-08-04 17:06:06 +00:00
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
private void SAV_GameSelect_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
|
|
B_OK_Click(sender, EventArgs.Empty);
|
|
|
|
|
if (e.KeyCode == Keys.Escape)
|
|
|
|
|
B_Cancel_Click(sender, EventArgs.Empty);
|
2017-04-02 20:42:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|