API Help
Eplan.EplApi.Base Namespace / Progress Class
Members Example

In This Topic
    Progress Class
    In This Topic
    This class enables you to access the functions of the progress bar in EPLAN.
    Inheritance Hierarchy

    System.Object
       Eplan.EplApi.Base.Progress

    Syntax
    public class Progress 
    public ref class Progress 
    Remarks
    There are different kinds of progress bars. It can be created by functions and passed to another function as a parameter object (often in a Context). Please call Progress::EndPart(true) at the end to close the dialog. Please don't use steps (SetNeededSteps and Step methods) when a nested EPLAN progress (i.e. from API method) could be called afterwards.
    Example
    Example of using Progress class
    Progress oProgress = new Progress("SimpleProgress");
    oProgress.ShowImmediately();
    
    //part 1
    oProgress.BeginPart(25.0, "");
    oProgress.SetActionText("part1");
    oProgress.SetNeededSteps(1);
    oProgress.Step(1);
    System.Threading.Thread.Sleep(2500);    // TODO: Some processing
    oProgress.EndPart(false);
    
    //part 2
    oProgress.BeginPart(30.0, "");
    oProgress.SetNeededSteps(3);            // call SetNeededSteps with the count of steps following
    oProgress.SetActionText("part2 step1");
    oProgress.Step(1);
    System.Threading.Thread.Sleep(1000);    // TODO: Some processing
    
    oProgress.SetActionText("part2 step2");
    oProgress.Step(1);
    System.Threading.Thread.Sleep(1000);    // TODO: Some processing
    
    oProgress.SetActionText("part2 step3");
    oProgress.Step(1);
    System.Threading.Thread.Sleep(1000);    // TODO: Some processing
    oProgress.EndPart(false);
    
    //part 3
    oProgress.BeginPart(45.0, "");          // Here is a sum of 100% reached!
    oProgress.SetActionText("part3");
    oProgress.SetNeededSteps(1);
    oProgress.Step(1);
    System.Threading.Thread.Sleep(4500);    // TODO: Some processing
    oProgress.EndPart(true);                // The window is destroyed with the call EndPart(true) and the progress is prepared to be destroyed.
    
    
    
    Progress progress = new Progress("SimpleProgress");
    progress.SetAllowCancel(true);
    progress.SetAskOnCancel(true);
    progress.SetTitle("Replace parts");
    progress.ShowImmediately();
    
    DMObjectsFinder finder = new DMObjectsFinder(oProject);
    ArticleReference[] articleReferences = finder.GetArticleReferences(null);
    int nIteration = 0;
    foreach (ArticleReference articleReference in articleReferences)
    {
        // Set new values
        progress.BeginPart(100.0 / articleReferences.Length, "Iteration : " + (nIteration++).ToString());
        articleReference.PartNr = "New part number";
        articleReference.VariantNr = "New variant";
        articleReference.StoreToObject();
        new DeviceService().UpdateDevice(articleReference.ParentObject);
        progress.EndPart();
    }
    
    progress.EndPart(true);
    
    
    
    Public Constructors
     NameDescription
    Public ConstructorOverloaded.   
    Top
    Public Methods
     NameDescription
    Public MethodStarts a new segment. All parallel segments should result in a sum of 100%.  
    Public MethodQueries whether the operation was canceled.  
    Public MethodDestructor for deterministic finalization of Progress object.  
    Public MethodOverloaded. Ends segment and closes the window when it is not used. Don't forget to call it at the end, otherwise a progress dialog may lock P8.  
    Public MethodFor internal use only.  
    Public MethodSets a new action text.  
    Public MethodAllows canceling.  
    Public MethodAsks to confirm the cancel request.  
    Public MethodSpecifies how many segments are required.  
    Public MethodIndicates how many steps are required to reach 100%. E.g. used for loops.  
    Public MethodSets a new action text.  
    Public MethodSets the title of the progress bar.  
    Public MethodShows the progress bar without any further delay. When ShowImmediately isnt't called the dialog appears later (with delay), it prevents the dialog to show unnecessarily (to prevent that the progress flickers up for a short running actions).  
    Public MethodSpecifies the nesting level up to which a display is made.  
    Public MethodUses a step  
    Top
    See Also