private void LoadFiles(object sender, MouseButtonEventArgs e)
        {
            if (RegisteredTypes?.Any != true)
            {
                throw new Exception("You must specify at least one supported file type.");
            }

            var dialog = new OpenFileDialog
            {
                Multiselect = true,
                Filter      = RegisteredTypes.ToString()
            };

            dialog.ShowDialog();
            if (!dialog.FileNames.Any())
            {
                return;
            }

            this.ProcessingFiles(true);
            var eventArgs = new DragAndDropEventArgs(this);

            SortData(dialog.FileNames, eventArgs);
            OnDataRecievedFromDropOperation(eventArgs);
            this.ProcessingFiles(eventArgs.WaitForAsync);
        }
        private void DragAndDropControl_OnDrop(object sender, DragEventArgs e)
        {
            var eventArgs = new DragAndDropEventArgs(this);

            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                this.ProcessingFiles(true);
                SortData((string[])e.Data.GetData(DataFormats.FileDrop), eventArgs);
                OnDataRecievedFromDropOperation(eventArgs);
            }
            this.ProcessingFiles(eventArgs.WaitForAsync);
        }
        private void SortData(string[] paPaths, DragAndDropEventArgs paSortedPapaEventArgs)
        {
            var supportedTypes = RegisteredTypes.FileTypes;

            paSortedPapaEventArgs.FilesPaths = new Dictionary <string, List <string> >();
            foreach (var supportedType in supportedTypes)
            {
                paSortedPapaEventArgs.FilesPaths.Add(supportedType, new List <string>());
            }

            foreach (var path in paPaths)
            {
                var type      = $"{path.Split('.').Last().ToLower()}";
                var typeIndex = supportedTypes.IndexOf(type);
                if (typeIndex > -1)
                {
                    paSortedPapaEventArgs.FilesPaths[supportedTypes[typeIndex]].Add(path);
                }
            }
        }
 protected virtual void OnDataRecievedFromDropOperation(DragAndDropEventArgs e)
 {
     DataRecievedFromDropOperation?.Invoke(this, e);
 }