using System; using System.Windows.Forms; namespace PaintDotNet { public interface IProgressEvents { /// /// This method is called at the very beginning of the operation. /// /// /// If the operation has a modal window open, this represents it. Otherwise, this is null and you should /// use your own current modal window. /// /// You must call this method after initializing any UI you want to display. /// If you will not be displaying UI, you must call this anyway. /// /// An object that can be used to cancel the operation at any time after callWhenUIShown is invoked, /// and any time before EndOperation() is called. /// /// /// This method must not return until EndOperation() is called. Note that EndOperation() will /// be called from a separate thread. /// void BeginOperation(IWin32Window owner, EventHandler callWhenUIShown, ICancelable cancelSink); /// /// Called to report the total number of work items that are part of the operation. /// /// The total number of work items that are part of the operation. void SetItemCount(int itemCount); /// /// Called to change which work item of the operation is in progress. /// /// /// /// This method is called after BeginOperation() but before BeginItem(), /// or after EndItem() but before BeginItem(). /// void SetItemOrdinal(int itemOrdinal); /// /// Called to report information about the current work item. /// /// Operation-dependent information about the current work item. void SetItemInfo(TItemInfo itemInfo); /// /// Reports the total number of work units that are involved in completing the current work item. /// /// The total number of work units that comprise the current work item. void SetItemWorkTotal(long totalWork); /// /// Called when a work item is starting. /// /// void BeginItem(); /// /// Reports the total amount of progress for the current work item. /// /// The total number of work units that have completed for the current work item. void SetItemWorkProgress(long totalProgress); /// /// Called when there is an error while completing the current work item. /// /// The exception that was encountered while completing the current work item. /// You must return a value from the ItemFailedUserChoice enumeration. WorkItemFailureAction ReportItemFailure(Exception ex); /// /// Called after a work item is finished. /// void EndItem(WorkItemResult result); /// /// Called after the operation is complete. /// /// Indicates whether the operation finished, or was cancelled. /// /// Even if the operation finished, individual work items may not have succeeded. /// You will need to track the data passed to to EndItem() ReportItemError() to be able to monitor this. /// You must close any UI shown during BeginOperation(), and then return from that method. /// void EndOperation(OperationResult result); } }