Пример #1
0
        private void Space_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                foreach (var file in files)
                {
                    FileAttributes attr = File.GetAttributes(file);

                    if (!((attr & FileAttributes.Directory) == FileAttributes.Directory))
                    {
                        this.lastSent.Content = file;
                        TransferAction.Invoke(file);
                    }
                }
            }
            if (e.Data.GetDataPresent(DataFormats.Text))
            {
                string text = (string)e.Data.GetData(DataFormats.Text);
                //Sending text function here if first if doesn't work for text as well
                this.lastSent.Content = text;
                //TransferAction.Invoke(text);
            }

            FinishAction("Finished adding files");
            var tsPanel = sender as StackPanel;

            tsPanel.Background = Brushes.Gray;
        }
Пример #2
0
        public void AddFiles(List <string> files)
        {
            foreach (var file in files)
            {
                FileAttributes attr = File.GetAttributes(file);

                if (!((attr & FileAttributes.Directory) == FileAttributes.Directory))
                {
                    this.lastSent.Content = file;
                    TransferAction.Invoke(file);
                }
            }
            FinishAction("Finished adding files");
        }