Exemplo n.º 1
0
        private void listView_ItemDrag(object sender, ItemDragEventArgs e)
        {
            string selectedFile = fileSelector.SelectedFile;

            if (string.IsNullOrEmpty(selectedFile))
            {
                return;
            }

            string[] fileNames;

            try
            {
                var excludeExtensions = new List <string>();

                if (checkBoxExcludeBpfFile.Checked)
                {
                    excludeExtensions.Add(".bpf");
                }

                if (checkBoxExcludeResFile.Checked)
                {
                    excludeExtensions.Add(".res");
                }

                fileNames = MainEngine.GetProjectFiles(selectedFile, fileListElementName, fileNameElementName, excludeExtensions.ToArray()).ToArray();
            }
            catch (Exception exception)
            {
                showErrorMessage(selectedFile + "\r\n" + exception.Message);
                return;
            }

            DragDropEffects effect = listView.DoDragDrop(new DataObject(DataFormats.FileDrop, fileNames), DragDropEffects.All);
        }