update AutoFetcher class
This commit is contained in:
parent
94b356dddb
commit
62e9484014
|
@ -114,7 +114,7 @@ public class SparklePonyUI {
|
|||
// Get all the folders in ~/Collaboration
|
||||
string [] Folders = Directory.GetDirectories (FoldersPath);
|
||||
Repositories = new Repository [Folders.Length];
|
||||
AutoFetcher AutoFetcher = new AutoFetcher (Repositories);
|
||||
|
||||
|
||||
int i = 0;
|
||||
foreach (string Folder in Folders) {
|
||||
|
@ -122,6 +122,8 @@ public class SparklePonyUI {
|
|||
i++;
|
||||
}
|
||||
|
||||
AutoFetcher AutoFetcher = new AutoFetcher (Repositories);
|
||||
|
||||
if (!HideUI) {
|
||||
|
||||
// Create the window
|
||||
|
@ -162,35 +164,23 @@ public class SparklePonyStatusIcon : StatusIcon {
|
|||
|
||||
}
|
||||
|
||||
public class AutoFetcher {
|
||||
public class AutoFetcher : Timer {
|
||||
|
||||
private Timer Timer;
|
||||
public AutoFetcher (Repository [] Repositories) : base () {
|
||||
|
||||
public AutoFetcher (Repository [] Repositories) {
|
||||
Timer = new Timer();
|
||||
// Fetch changes every 30 seconds
|
||||
Timer.Interval = 5000;
|
||||
Timer.Elapsed += delegate (object o, ElapsedEventArgs args) {
|
||||
Interval = 5000;
|
||||
Elapsed += delegate (object o, ElapsedEventArgs args) {
|
||||
foreach (Repository Repository in Repositories) {
|
||||
Timer.Stop ();
|
||||
Stop ();
|
||||
if (!Repository.MonitorOnly)
|
||||
Repository.Fetch ();
|
||||
Timer.Start ();
|
||||
Start ();
|
||||
}
|
||||
};
|
||||
Timer.Start();
|
||||
}
|
||||
|
||||
public void StartTimer () {
|
||||
Timer.Start ();
|
||||
}
|
||||
Start();
|
||||
|
||||
public void StopTimer () {
|
||||
Timer.Stop ();
|
||||
}
|
||||
|
||||
public bool isRunning () {
|
||||
return Timer.Enabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue