There were various scenarios where we need to keep track of time taken for the particular function or workflow or the loop to execute and needs to monitor time while performing some action in web applications as some applications needs to be refreshed at specific intervals or needs to handle some popups after some particular amount of time. This can be handled with the help of stopwatch class and by using Invoke method activity in UiPath . I have created custom activities to avoid using of code and can be easily used in all the projects .

What it does

What is Stopwatch? Before moving further have look at some basic definitions Stopwatch is a timepiece that can be started or stopped for exact timing as of a race or any activity It is very useful when you want to do some performance testing in your code or to get timings for whatever reason. It is useful for micro-benchmarks in code optimization. It can perform routine and continuous performance monitoring.

ElapsedTime:This is the time difference between the start time when we initialized the stopwatch instance and current time. ElapsedTime = StartTime - CurrentTime There were total 6 Activities in this component

  1. Start New : This method is called to create a new instance of Stopwatch. It will return the new stop watch instance and rests the elapsed time to '0'
  2. Start : The Start method tells the Stopwatch to store the current time.
  3. Stop : This tells the Stopwatch to capture the current tick count of the system, also very accurate.
  4. GetElapsedTime: This will returns the Time difference between Start and Stop Methods. Then type is Timespan and also return the time in Hours/seconds/Minutes/Milliseconds/Elapsed Ticks
  5. Restart :Restart sets the timer information to zero. It then calls Start again on the Stopwatch, so you can time further statements. This is like calling Reset and Start.
  6. IsRunning : This will checks whether the particular instance is Running or not. It will return Boolean value based on the result.
  7. Reset : Reset, meanwhile, only sets the timer information to zero. It does not call Start on the Stopwatch.

How I Built It:

This Component is built using C#,Visual studio.

Challenges I ran into

The challenges were how to provide multiple options as input and output for the activities as it will help to include more functionalities in single activity to avoid many activities

Accomplishments that I'm proud of

This will reduce the effort required to implement stopwatch activities using code and can be easily used by the users in all their projects .

What I learned

I learned various concepts about stopwatch class and its uses in various scenarios and different methods of stopwatch class and creating custom components and what are the different ways to create custom activities while implementing this

What's next for CustomStopWatchActivities

I am planning to implement complex custom activities with this experience and will try to research further on creating activities which can access Lotus Notes client.

Built With

Share this project: