Merge game selection alert & prompt to 1 popup

https://projectpokemon.org/home/forums/topic/49080-multiple-exceptions-when-selecting-gen-3-blank-saves/

ty BlackShark :)
This commit is contained in:
Kurt 2019-01-15 22:26:45 -08:00
parent 53b2ca93b8
commit 9fd6d86b1d
5 changed files with 35 additions and 15 deletions

View file

@ -849,10 +849,9 @@ namespace PKHeX.WinForms
{
if (s3.IndeterminateGame || ModifierKeys == Keys.Control)
{
WinFormsUtil.Alert(string.Format(MsgFileLoadVersionDetect, sav.Generation), MsgFileLoadVersionSelect);
var g = new[] { GameVersion.R, GameVersion.S, GameVersion.E, GameVersion.FR, GameVersion.LG };
var games = g.Select(z => GameInfo.VersionDataSource.First(v => v.Value == (int)z));
var dialog = new SAV_GameSelect(games);
var dialog = new SAV_GameSelect(games, MsgFileLoadVersionDetect, MsgFileLoadVersionSelect);
dialog.ShowDialog();
sav = SaveUtil.GetG3SaveOverride(sav, dialog.Result);
@ -866,10 +865,9 @@ namespace PKHeX.WinForms
string fr = GameInfo.GetVersionName(GameVersion.FR);
string lg = GameInfo.GetVersionName(GameVersion.LG);
string dual = "{0}/{1} " + MsgFileLoadSaveDetected;
WinFormsUtil.Alert(string.Format(dual, fr, lg), MsgFileLoadSaveSelectVersion);
var g = new[] { GameVersion.FR, GameVersion.LG };
var games = g.Select(z => GameInfo.VersionDataSource.First(v => v.Value == (int)z));
var dialog = new SAV_GameSelect(games);
var dialog = new SAV_GameSelect(games, string.Format(dual, fr, lg), MsgFileLoadSaveSelectVersion);
dialog.ShowDialog();
var pt = SaveUtil.GetG3Personal(dialog.Result);

View file

@ -33,14 +33,15 @@
this.B_OK = new System.Windows.Forms.Button();
this.L_Game = new System.Windows.Forms.Label();
this.B_Cancel = new System.Windows.Forms.Button();
this.L_Prompt = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// CB_Game
//
this.CB_Game.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.CB_Game.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CB_Game.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_Game.FormattingEnabled = true;
this.CB_Game.Location = new System.Drawing.Point(66, 9);
this.CB_Game.Location = new System.Drawing.Point(69, 78);
this.CB_Game.Name = "CB_Game";
this.CB_Game.Size = new System.Drawing.Size(121, 21);
this.CB_Game.TabIndex = 0;
@ -48,9 +49,9 @@
// B_OK
//
this.B_OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_OK.Location = new System.Drawing.Point(112, 36);
this.B_OK.Location = new System.Drawing.Point(262, 77);
this.B_OK.Name = "B_OK";
this.B_OK.Size = new System.Drawing.Size(75, 23);
this.B_OK.Size = new System.Drawing.Size(60, 23);
this.B_OK.TabIndex = 11;
this.B_OK.Text = "OK";
this.B_OK.UseVisualStyleBackColor = true;
@ -58,11 +59,11 @@
//
// L_Game
//
this.L_Game.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.L_Game.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.L_Game.Location = new System.Drawing.Point(12, 9);
this.L_Game.Location = new System.Drawing.Point(12, 78);
this.L_Game.Name = "L_Game";
this.L_Game.Size = new System.Drawing.Size(48, 21);
this.L_Game.Size = new System.Drawing.Size(51, 21);
this.L_Game.TabIndex = 12;
this.L_Game.Text = "Game:";
this.L_Game.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@ -70,19 +71,31 @@
// B_Cancel
//
this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Cancel.Location = new System.Drawing.Point(29, 36);
this.B_Cancel.Location = new System.Drawing.Point(196, 77);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(75, 23);
this.B_Cancel.Size = new System.Drawing.Size(60, 23);
this.B_Cancel.TabIndex = 10;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
//
// L_Prompt
//
this.L_Prompt.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.L_Prompt.Location = new System.Drawing.Point(15, 9);
this.L_Prompt.Name = "L_Prompt";
this.L_Prompt.Size = new System.Drawing.Size(307, 65);
this.L_Prompt.TabIndex = 13;
this.L_Prompt.Text = "Prompt Text is here...";
//
// SAV_GameSelect
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(199, 71);
this.ClientSize = new System.Drawing.Size(334, 112);
this.Controls.Add(this.L_Prompt);
this.Controls.Add(this.L_Game);
this.Controls.Add(this.B_OK);
this.Controls.Add(this.B_Cancel);
@ -106,5 +119,6 @@
private System.Windows.Forms.Button B_OK;
private System.Windows.Forms.Label L_Game;
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.Label L_Prompt;
}
}

View file

@ -10,10 +10,11 @@ namespace PKHeX.WinForms
{
public GameVersion Result = GameVersion.Invalid;
public SAV_GameSelect(IEnumerable<ComboItem> items)
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;

View file

@ -129,6 +129,12 @@
<metadata name="B_Cancel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="L_Prompt.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View file

@ -93,6 +93,7 @@ namespace PKHeX.WinForms
"SAV_HoneyTree.L_Tree0", // dynamic, don't bother
"SAV_Misc3.BTN_Symbol", // symbols should stay as their current character
"SettingsEditor.BAKPrompt", // internal setting
"SAV_GameSelect.L_Prompt", // prompt text (dynamic)
};
private static readonly string[] PurgeBanlist =