Push() public method

public Push ( List files, string destPath ) : void
files List
destPath string
return void
Esempio n. 1
0
 private void pasteToolStripMenuItem_Click( object sender, EventArgs e )
 {
     if ( Clipboard.ContainsFileDropList ( ) ) {
         StringCollection files = Clipboard.GetFileDropList ( );
         List<System.IO.FileInfo> lfiles = new List<System.IO.FileInfo> ( );
         foreach ( var item in files ) {
             System.IO.FileInfo file = new System.IO.FileInfo ( item );
             if ( file.Exists ) {
                 lfiles.Add ( file );
             }
         }
         var transfer = new TransferDialog ( );
         transfer.TransferComplete += delegate ( object s, EventArgs ea ) {
             if ( this.InvokeRequired ) {
                 this.Invoke ( new NavigateToPathDelegate ( this.NavigateToPath ), new object[] { this.CurrentDirectory } );
             } else {
                 this.NavigateToPath ( this.CurrentDirectory );
             }
         };
         transfer.TransferError += delegate ( object s, EventArgs ea ) {
             if ( transfer.TransferException != null ) {
                 if ( this.InvokeRequired ) {
                     this.Invoke ( new MessageBoxDelegate ( TaskDialog.MessageBox ), new object[] { "Paste error", transfer.TransferException.Message, string.Empty, TaskDialogButtons.OK, SysIcons.Error } );
                 } else {
                     TaskDialog.MessageBox ( "Paste error", transfer.TransferException.Message, string.Empty, TaskDialogButtons.OK, SysIcons.Error );
                 }
             }
         };
         transfer.Push ( lfiles, this.CurrentDirectory.FullName );
     }
 }
Esempio n. 2
0
        void itemsList_DragDrop( object sender, DragEventArgs e )
        {
            if ( e.Data.GetDataPresent ( DataFormats.FileDrop ) ) {
                string[] fsiItems = (string[])e.Data.GetData ( DataFormats.FileDrop );
                List<System.IO.FileInfo> files = new List<System.IO.FileInfo> ( );
                foreach ( var item in fsiItems ) {
                    if ( System.IO.File.Exists ( item ) ) {
                        files.Add ( new System.IO.FileInfo ( item ) );
                    } else if ( System.IO.Directory.Exists ( item ) ) {
                        // TODO: Handle copying entire directory over.
                    }
                }

                var transfer = new TransferDialog ( );
                transfer.TransferComplete += delegate ( object s, EventArgs ea ) {
                    if ( this.InvokeRequired ) {
                        this.Invoke ( new NavigateToPathDelegate ( NavigateToPath ), new object[] { this.CurrentDirectory } );
                    } else {
                        NavigateToPath ( this.CurrentDirectory );
                    }
                };
                transfer.TransferError += delegate ( object s, EventArgs ea ) {
                    if ( transfer.TransferException != null ) { // was there an error while transfering?
                        if ( this.InvokeRequired ) {
                            this.Invoke ( new MessageBoxDelegate ( TaskDialog.MessageBox ), new object[] { "Transfer Error", transfer.TransferException.Message, string.Empty, TaskDialogButtons.OK, SysIcons.Error } );
                        } else {
                            TaskDialog.MessageBox ( "Transfer Error", transfer.TransferException.Message, string.Empty, TaskDialogButtons.OK, SysIcons.Error );
                        }
                    }
                };
                transfer.Push ( files, this.CurrentDirectory.FullName );
            }
        }