Example #1
0
        public void HandleMovePKM(PictureBox pb, bool encrypt)
        {
            // Create a temporary PKM file to perform a drag drop operation.

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

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

            // Make a new file name based off the PID
            string newfile = CreateDragDropPKM(pb, 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();
            }
        }