Created
January 21, 2016 08:06
-
-
Save MagnusThor/34cee223568e74ee1b81 to your computer and use it in GitHub Desktop.
Keep alive using System.Timers.Timer();
This file contains hidden or 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
public override async Task OnOpened() { | |
var t = new System.Timers.Timer(); | |
// do your onOpen Stuff... | |
t.Interval = 1000 * 15; | |
t.Elapsed += (sender, args) => { | |
this.Invoke(new { | |
ts = DateTime.Now.Second | |
}, "ping"); | |
}; | |
t.Start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment