Skip to content

Commit

Permalink
Fixing warning message in tile remapping dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
MainMemory committed Feb 3, 2015
1 parent 74197be commit 3714f17
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
3 changes: 1 addition & 2 deletions SonLVL/TileRemappingDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 15 additions & 20 deletions SonLVL/TileRemappingDialog.cs
Expand Up @@ -22,26 +22,6 @@ public TileRemappingDialog(string title, List<Bitmap> images, int imageSize)
TileMap = new Dictionary<int, int>();
}

private void okButton_Click(object sender, EventArgs e)
{
bool warn = false;
foreach (int item in TileMap.Keys)
if (!TileMap.ContainsValue(item))
{
warn = true;
break;
}
if (warn)
if (MessageBox.Show(this, "Not all source items are replaced in the destination. All source items that are not replaced in the destination will be duplicated in both positions. Is this OK?", Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != System.Windows.Forms.DialogResult.OK)
return;
Close();
}

private void cancelButton_Click(object sender, EventArgs e)
{
Close();
}

public Dictionary<int, int> TileMap { get; private set; }

private void SourceTileList_SelectedIndexChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -106,5 +86,20 @@ private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
button2.Enabled = listBox1.SelectedIndex != -1;
}

private void TileRemappingDialog_FormClosing(object sender, FormClosingEventArgs e)
{
if (DialogResult != System.Windows.Forms.DialogResult.OK) return;
bool warn = false;
foreach (int item in TileMap.Keys)
if (!TileMap.ContainsValue(item))
{
warn = true;
break;
}
if (warn)
if (MessageBox.Show(this, "Not all source items are replaced in the destination. All source items that are not replaced in the destination will be duplicated in both positions. Is this OK?", Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != System.Windows.Forms.DialogResult.OK)
e.Cancel = true;
}
}
}

0 comments on commit 3714f17

Please sign in to comment.