mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-18 00:13:10 +00:00
392f01cb3e
IEnumerable doesn't support LINQ methods, only the generic variant does. So this commit changes SAV_GameSelect's parameter to a generic IEnumerable of the only type being passed into it. I didn't realize it until afterward, but this is 100% the way it should have been because the databinding members expect ComboItems.
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using PKHeX.Core;
|
|
|
|
namespace PKHeX.WinForms
|
|
{
|
|
public partial class SAV_GameSelect : Form
|
|
{
|
|
public GameVersion Result = GameVersion.Invalid;
|
|
public SAV_GameSelect(IEnumerable<ComboItem> items)
|
|
{
|
|
InitializeComponent();
|
|
CB_Game.DisplayMember = nameof(ComboItem.Text);
|
|
CB_Game.ValueMember = nameof(ComboItem.Value);
|
|
CB_Game.DataSource = new BindingSource(items.ToList(), null);
|
|
CB_Game.SelectedIndex = 0;
|
|
CB_Game.Focus();
|
|
}
|
|
private void B_Cancel_Click(object sender, EventArgs e) => Close();
|
|
private void B_OK_Click(object sender, EventArgs e)
|
|
{
|
|
Result = (GameVersion)WinFormsUtil.GetIndex(CB_Game);
|
|
Close();
|
|
}
|
|
private void SAV_GameSelect_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
B_OK_Click(null, null);
|
|
if (e.KeyCode == Keys.Escape)
|
|
B_Cancel_Click(null, null);
|
|
}
|
|
}
|
|
}
|