Update slot drag / view/set/delete behavior

This commit is contained in:
Kurt 2018-07-28 09:56:13 -07:00
parent 2092d55b23
commit 5d4c3d3390
3 changed files with 15 additions and 6 deletions

View file

@ -32,7 +32,7 @@ namespace PKHeX.WinForms.Controls
public new void Stop()
{
if (pb == null)
if (pb == null || !Enabled)
return;
Enabled = false;

View file

@ -35,6 +35,8 @@ namespace PKHeX.WinForms.Controls
if ((sender as PictureBox)?.Image == null)
{ System.Media.SystemSounds.Asterisk.Play(); return; }
m.HoverCancel();
m.SE.PKME_Tabs.PopulateFields(m.GetPKM(info), false, true);
m.SetColor(info.Box, info.Slot, Resources.slotView);
}
@ -60,6 +62,8 @@ namespace PKHeX.WinForms.Controls
if (errata.Count > 0 && DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, string.Join(Environment.NewLine, errata), MsgContinue))
return;
m.HoverCancel();
if (info.Type == StorageSlotType.Party) // Party
{
// If info.Slot isn't overwriting existing PKM, make it write to the lowest empty PKM info.Slot
@ -102,6 +106,8 @@ namespace PKHeX.WinForms.Controls
if (sav.IsSlotLocked(info.Box, info.Slot))
{ WinFormsUtil.Alert(MsgSaveSlotLocked); return; }
m.HoverCancel();
if (info.Type == StorageSlotType.Party) // Party
{
m.SetPKM(sav.BlankPKM, info, true, Resources.slotDel);

View file

@ -101,15 +101,17 @@ namespace PKHeX.WinForms.Controls
private void EndHoverSlot()
{
if (HoveredSlot != null)
{
HoverWorker.Stop();
HoveredSlot.BackgroundImage = OriginalBackground;
HoveredSlot = null;
}
HoverCancel();
ShowSet.RemoveAll();
Sounds.Stop();
}
public void HoverCancel()
{
HoverWorker.Stop();
HoveredSlot = null;
}
public void RefreshHoverSlot(ISlotViewer<PictureBox> parent)
{
if (HoveredSlot == null || !parent.SlotPictureBoxes.Contains(HoveredSlot))
@ -300,6 +302,7 @@ namespace PKHeX.WinForms.Controls
File.WriteAllBytes(newfile, encrypt ? pkx.EncryptedBoxData : pkx.DecryptedBoxData);
var img = (Bitmap)pb.Image;
SetCursor(new Cursor(img.GetHicon()), pb);
HoverCancel();
pb.Image = null;
pb.BackgroundImage = Resources.slotDrag;
// Thread Blocks on DoDragDrop