public class FileOperationProgressSink : IFileOperationProgressSink
Public Class FileOperationProgressSink
Implements IFileOperationProgressSink
Dim instance As FileOperationProgressSink
public ref class FileOperationProgressSink : IFileOperationProgressSink
type FileOperationProgressSink =
class
interface IFileOperationProgressSink
end
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
Public NotInheritable Class Form1 : Inherits Form
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Shown
' Instance the file operation progress callback class.
Dim fsOperationProgress As New CustomFileOperationProgress() With {.TraceActionEnabled = False}
Dim fsOperation As New FileOperation(fsOperationProgress, DirectCast(Me, IWin32Window)) With {
.OperationFlags = FileOperationFlags.AddUndoRecord Or
FileOperationFlags.NoConfirmMakeDir Or
FileOperationFlags.RecycleOnDelete Or
FileOperationFlags.RenameCollision Or
FileOperationFlags.PreserveFileExtensions
}
' Declare and create the test source directory.
Dim srcDir As New DirectoryInfo("C:\Test_Source_Directory")
srcDir.Create()
' Queue a copy of test directory into its own directory.
fsOperation.QueueCopy(srcDir)
' Queue a copy of test directory the temp directory.
fsOperation.QueueCopy(srcDir, New DirectoryInfo(Path.GetTempPath), "NewDirName")
' Perform the queued copy operations.
Dim result As HResult = fsOperation.PerformOperations()
If result <> HResult.S_OK Then
Throw Marshal.GetExceptionForHR(result)
End If
End Sub
End Class
Friend Class CustomFileOperationProgress : Inherits FileOperationProgressSink
Protected Overrides Sub StartOperations()
' MyBase.StartOperations()
Console.WriteLine("Operation Started.")
End Sub
Protected Overrides Sub FinishOperations(result As HResult)
' MyBase.FinishOperations(result)
Console.WriteLine($"Operation Finished ({Me.LastResult.Value})")
End Sub
Protected Overrides Sub UpdateProgress(workTotal As UInteger, workSoFar As UInteger)
' MyBase.UpdateProgress(workTotal, workSoFar)
If workSoFar <> 0 Then
Debug.WriteLine($"Operation Progress: {workSoFar / workTotal * 100:0.00}% ( {workSoFar}/{workTotal} )")
End If
End Sub
End Class
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
FileOperationProgressSink | Initializes a new instance of the FileOperationProgressSink class |
LastResult | Gets a value indicating the result of the last performed file operation. |
TraceActionEnabled | Gets or sets a value indicating whether to trace the execution of the current file operation. If enabled, every method will make a call to TraceAction(IShellItem, HResult, String) method on execution. This is for debugging purposes only. |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetHashCode | Serves as the default hash function. (Inherited from Object) |
GetType | Gets the Type of the current instance. (Inherited from Object) |
ToString | Returns a string that represents the current object. (Inherited from Object) |
CanConvertTo |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
CanConvertToT |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions) |
IsDisposable |
Determines whether the specified object is a disposable type
(i.e., it implements IDisposable interface).
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
ThrowIfNullTException |
Throws the specified exception if the source object is null.
(Defined by ObjectExtensions) |