Esempio n. 1
0
        public void HandleMovePKM(PictureBox pb, int slot, int box, bool encrypt)
        {
            // Create a temporary PKM file to perform a drag drop operation.

            // Set flag to prevent re-entering.
            DragInfo.DragDropInProgress = true;

            DragInfo.Source.Parent = pb.Parent;
            DragInfo.Source.Slot   = slot;
            DragInfo.Source.Box    = box;
            DragInfo.Source.Offset = SE.GetPKMOffset(DragInfo.Source.Slot, DragInfo.Source.Box);

            // Prepare Data
            DragInfo.Source.OriginalData = SAV.GetData(DragInfo.Source.Offset, SAV.SIZE_STORED);

            // Make a new file name based off the PID
            string newfile = CreateDragDropPKM(pb, box, encrypt, out bool external);

            DragInfo.Reset();
            SetCursor(SE.GetDefaultCursor, pb);

            // Browser apps need time to load data since the file isn't moved to a location on the user's local storage.
            // Tested 10ms -> too quick, 100ms was fine. 500ms should be safe?
            int delay = external ? 500 : 0;

            DeleteAsync(newfile, delay);
            if (DragInfo.Source.IsParty || DragInfo.Destination.IsParty)
            {
                SE.SetParty();
            }
        }
Esempio n. 2
0
        public void DragDrop(object sender, DragEventArgs e)
        {
            PictureBox pb   = (PictureBox)sender;
            var        view = WinFormsUtil.FindFirstControlOfType <ISlotViewer <PictureBox> >(pb);
            var        src  = view.GetSlotData(pb);

            if (!src.Editable || SAV.IsSlotLocked(src.Box, src.Slot))
            {
                SystemSounds.Asterisk.Play();
                e.Effect = DragDropEffects.Copy;
                DragInfo.Reset();
                return;
            }

            bool overwrite = Control.ModifierKeys == Keys.Alt;
            bool clone     = Control.ModifierKeys == Keys.Control;

            DragInfo.Destination = src;
            HandleDropPKM(sender, e, overwrite, clone);
        }
Esempio n. 3
0
 public void Reset() => Info.Reset();