![]() |
busyIndicatorCallBack Class |
Namespace: CADSharpTools.Core
The busyIndicatorCallBack type exposes the following members.
Name | Description | |
---|---|---|
![]() | busyIndicatorCallBack |
Name | Description | |
---|---|---|
![]() | CancelRequested |
Returns whether a cancel question has been initiated by the user.
|
![]() | Count |
Count of the total elements.
|
![]() | Current |
Index of the current element.
|
![]() | IsIndeterminate |
True is the operation is not deterministic, false is not.
|
![]() | Message |
Message to display to the user.
|
Name | Description | |
---|---|---|
![]() | Cancel |
Cancels operation.
|
![]() | Finish |
Announces the operation is finished and fires the Finished event.
|
[STAThread] static void Main(string[] args) { // local variables string vaultName = "PDM2019"; string relativePathName = @"costing\large customer assy\2596-A0000.sldasm"; // create pdm objects var vault = EdmObjectFactory.CreateVaultObject(vaultName); var file = EdmObjectFactory.CreateFileObjectFromRelativePath(vault, relativePathName); var folder = file.GetFolder(); string localPath = file.GetLocalPath(folder.ID); // create document var doc = new Document(file.ID, folder.ID, localPath); // define busyIndicatorCallBack var biCallback = new busyIndicatorCallBack(); // set the progress bar to indeterminate because the number of references is unknown biCallback.IsIndeterminate = true; // invoker will invoke time consuming method var biInvoker = new busyIndicatorInvoker(biCallback); biInvoker.InvokeAsync(() => { // execute timer-consuming task doc.ConstructReferenceTree(vault, biCallback); }); // create busy indicator window var biViewModel = new BusyIndicatorViewModel<busyIndicatorCallBack>(biCallback, $"Constructing reference tree for {file.Name}..."); biViewModel.ShowView(true); // get all references var references = doc.FlattenReferences(); // print results if (biCallback.CancelRequested) Console.WriteLine($"This operation has been canceled by user. Found {references.Length} references. {biViewModel.TimeElapsed}"); else Console.WriteLine($"This operation has been complete. Found {references.Length} references. {biViewModel.TimeElapsed}"); Console.ReadLine(); }