mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Update slot drag / view/set/delete behavior
This commit is contained in:
parent
2092d55b23
commit
5d4c3d3390
3 changed files with 15 additions and 6 deletions
|
@ -32,7 +32,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
public new void Stop()
|
||||
{
|
||||
if (pb == null)
|
||||
if (pb == null || !Enabled)
|
||||
return;
|
||||
Enabled = false;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue