-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added polling count down
- Loading branch information
Luka Grabarevic
authored
Jul 11, 2018
1 parent
45fca7d
commit 9aed531
Showing
9 changed files
with
154 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
|
||
namespace BuildsAppReborn.Contracts | ||
{ | ||
public interface IProgressComponent | ||
{ | ||
Double MaximumProgress { get; } | ||
|
||
event PollingProgressUpdated ProgressUpdated; | ||
} | ||
|
||
public delegate void PollingProgressUpdated(Double progress); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Timers; | ||
|
||
namespace BuildsAppReborn.Infrastructure | ||
{ | ||
public class ProgressTimer | ||
{ | ||
public ProgressTimer() | ||
{ | ||
this.mainTimer = new Timer(); | ||
this.progressTimer = new Timer(); | ||
this.stopWatch = new Stopwatch(); | ||
|
||
this.mainTimer.Elapsed += (sender, args) => this.stopWatch.Restart(); | ||
} | ||
|
||
public Double CurrentInterval => this.stopWatch.ElapsedMilliseconds; | ||
|
||
public Double Interval | ||
{ | ||
get { return this.mainTimer.Interval; } | ||
set { this.mainTimer.Interval = value; } | ||
} | ||
|
||
public void Start() | ||
{ | ||
this.mainTimer.Start(); | ||
this.progressTimer.Start(); | ||
this.stopWatch.Start(); | ||
} | ||
|
||
public void Stop() | ||
{ | ||
this.mainTimer.Stop(); | ||
this.progressTimer.Stop(); | ||
this.stopWatch.Stop(); | ||
} | ||
|
||
public event ElapsedEventHandler Elapsed | ||
{ | ||
add { this.mainTimer.Elapsed += value; } | ||
remove { this.mainTimer.Elapsed -= value; } | ||
} | ||
|
||
public event ElapsedEventHandler ProgressElapsed | ||
{ | ||
add { this.progressTimer.Elapsed += value; } | ||
remove { this.progressTimer.Elapsed -= value; } | ||
} | ||
|
||
private readonly Timer mainTimer; | ||
private readonly Timer progressTimer; | ||
private readonly Stopwatch stopWatch; | ||
} | ||
} |