User Tools

Site Tools


api:dk11:net:tatukgis.ndk.tgis_busyeventmanager

TGIS_BusyEventManager class

DK for .NET | TatukGIS.NDK.TGIS_BusyEventManager | Classes | Constructors | Methods | Properties | Events

Manages busy or progress notifications for single-stage and multi-stage algorithms.

Available also on: Delphi | Java | ActiveX | Python.

Syntax

// C#
public class TGIS_BusyEventManager : TGIS_Object
{
}
' VisualBasic
Public Class TGIS_BusyEventManager
  Inherits TGIS_Object
End Class
// Oxygene
type
  TGIS_BusyEventManager = public class( TGIS_Object )
  end;

Inheritance

→ TGIS_Object

Constructors

Inherited Overrides Protected
Name Visibility Description
TGIS_BusyEventManager() public Creates a busy event manager for the specified sender.

Methods

Inherited Overrides Protected
Name Visibility Description
EndEvent public Ends the current stage and raises the final busy notification for it.
PushEvent public Increments the current stage position and raises a busy notification when needed.
PushEvent(string) public Updates the current stage name, increments its position, and raises a busy notification when needed.
StartEvent public Starts a new progress stage.

Properties

Inherited Protected
Name Visibility Description
Aborted public Indicates whether an abort was requested.
Count public Returns the number of stages.
EndValue public The real upper limit of the process position at specified stage.
EstimatedTimeLeft public Estimated remaining time of the process at specified stage.
Max public The normalized upper limit of the process position at the specified stage.
Name public Name of the process at the specified stage.
Position public Current position of the process at the specified stage.
Sender public The reference to the parent object.
UseProgressThreshold public If True, busy events are raised according to a time trigger (default).

Events

Inherited Protected
Name Visibility Description
BusyEvent public Event fired upon progress of the currently executed process.

Example

Below you can find the Python example.

from time import sleep
import tatukgis_pdk as pdk
from typing import Any
 
 
def do_busy_event(sender: Any, position: int, end_value: int, abort: bool):
    busy_manager: pdk.TGIS_BusyEventManager = sender
    if position == -1:
        return
 
    # show first stage process details
    print(f"Global position: {position} / {end_value}")
    print(f"Estimated time left: {busy_manager.EstimatedTimeLeft(0)/1000} s.")
    print(f"\t{busy_manager.Name(0)}")
    print(f"\tLocal position: {busy_manager.Position(0)} / {busy_manager.EndValue(0)}")
 
    # show second stage process details
    if busy_manager.Count == 2:
        print(f"\t\t{busy_manager.Name(1)}")
        print(f"\t\tLocal position: {busy_manager.Position(1)} / {busy_manager.EndValue(1)}")
 
    # 'abort' can be used to abort the current process
    abort = False
 
 
event_manager = pdk.TGIS_BusyEventManager(None)
 
# a busy event will be triggered every time the PushEvent() method is called
event_manager.UseProgressThreshold = False
 
# assign a callback function to track the progress
event_manager.BusyEvent = do_busy_event
 
# start a first stage of the progress
event_manager.StartEvent("LEVEL 1", 100, event_manager)
try:
    for i in range(99):
        sleep(0.2)
        event_manager.PushEvent()
 
    # start a second stage at the last iteration of the first stage
    event_manager.StartEvent("LEVEL 2", 10, event_manager)
    try:
        for j in range (10):
            # PushEvent method can change the current stage name
            event_manager.PushEvent(f"LEVEL 2 - stage: {j}")
    finally:
        # end stage 2
        event_manager.EndEvent()
finally:
    # end stage 1
    event_manager.EndEvent()

2026/09/20 23:51

Page Tools