Ignore:
Timestamp:
3/12/2012 7:47:48 AM (2 years ago)
Author:
lowjoel
Message:

Added the IDragAndDropConfigurer interface and allow target configurers to configure themselves, without knowledge of the underlying types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/pluginsRewrite/Eraser.DefaultPlugins/ErasureTargets/FolderErasureTargetConfigurer.cs

    r2368 r2451  
    3333 
    3434using Eraser.Util; 
     35using Eraser.Plugins; 
    3536using Eraser.Plugins.ExtensionPoints; 
    3637 
    3738namespace Eraser.DefaultPlugins 
    3839{ 
    39     public partial class FolderErasureTargetConfigurer : UserControl, IErasureTargetConfigurer 
     40    public partial class FolderErasureTargetConfigurer : UserControl, 
     41        IErasureTargetConfigurer, IDragAndDropConfigurer<IErasureTarget> 
    4042    { 
    4143        public FolderErasureTargetConfigurer() 
     
    4749        #region IConfigurer<ErasureTarget> Members 
    4850 
    49         public void LoadFrom(ErasureTarget target) 
     51        public void LoadFrom(IErasureTarget target) 
    5052        { 
    5153            FolderErasureTarget folder = target as FolderErasureTarget; 
     
    6062        } 
    6163 
    62         public bool SaveTo(ErasureTarget target) 
     64        public bool SaveTo(IErasureTarget target) 
    6365        { 
    6466            FolderErasureTarget folder = target as FolderErasureTarget; 
     
    143145        #endregion 
    144146 
     147        #region IDragAndDropConfigurer<IErasureTarget> Members 
     148 
     149        public ICollection<IErasureTarget> ProcessArgument(DragEventArgs e) 
     150        { 
     151            List<string> files = e.Data.GetDataPresent(DataFormats.FileDrop) ? 
     152                new List<string>((string[])e.Data.GetData(DataFormats.FileDrop, false)) : 
     153                new List<string>(); 
     154 
     155            List<IErasureTarget> result = new List<IErasureTarget>(); 
     156            foreach (string file in files) 
     157            { 
     158                if (File.Exists(file)) 
     159                { 
     160                    FileErasureTarget target = new FileErasureTarget(); 
     161                    target.Path = file; 
     162                    result.Add(target); 
     163                } 
     164            } 
     165 
     166            return result; 
     167        } 
     168 
     169        #endregion 
     170 
    145171        private void folderBrowse_Click(object sender, EventArgs e) 
    146172        { 
Note: See TracChangeset for help on using the changeset viewer.