2018-09-06 07:46:02 -07:00
|
|
|
/*
|
|
|
|
* Efl Core Poll examples.
|
|
|
|
*
|
|
|
|
* This example sets up poll callbacks for LOW, MEDIUM and HIGH frequency events.
|
|
|
|
* We run for 30 seconds and print to stdout to show when each is called.
|
|
|
|
* Depending on your system this may not include any LOW frequency polls.
|
|
|
|
*/
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
2019-03-26 04:19:13 -07:00
|
|
|
public class Example : Efl.Csharp.Application
|
2018-09-06 07:46:02 -07:00
|
|
|
{
|
2019-03-26 04:19:13 -07:00
|
|
|
protected override void OnInitialize(Eina.Array<System.String> args)
|
2018-09-06 07:46:02 -07:00
|
|
|
{
|
|
|
|
// Retrieve the application's main loop
|
2018-12-20 07:28:15 -08:00
|
|
|
var mainloop = Efl.App.AppMain;
|
2018-09-06 07:46:02 -07:00
|
|
|
|
|
|
|
// Register to all Poll events
|
|
|
|
mainloop.PollLowEvt += (object sender, EventArgs e) => {
|
|
|
|
Console.Write("L");
|
|
|
|
};
|
|
|
|
mainloop.PollMediumEvt += (object sender, EventArgs e) => {
|
|
|
|
Console.Write("M");
|
|
|
|
};
|
|
|
|
mainloop.PollHighEvt += (object sender, EventArgs e) => {
|
|
|
|
Console.Write(".");
|
|
|
|
};
|
|
|
|
|
|
|
|
// Use a timer to exit the application
|
2019-01-27 23:03:49 -08:00
|
|
|
var timer = new Efl.LoopTimer(mainloop, 30);
|
2019-03-09 07:00:08 -08:00
|
|
|
timer.TimerTickEvt += (object sender, EventArgs e) => {
|
2019-01-18 07:53:55 -08:00
|
|
|
Console.WriteLine("\nTIMER: timer callback called, exiting.");
|
2019-03-26 04:19:13 -07:00
|
|
|
mainloop.Quit(0);
|
2019-01-18 07:53:55 -08:00
|
|
|
};
|
2019-03-26 04:19:13 -07:00
|
|
|
}
|
2018-09-06 07:46:02 -07:00
|
|
|
|
2019-03-26 04:19:13 -07:00
|
|
|
#if WIN32
|
|
|
|
[STAThreadAttribute()]
|
|
|
|
#endif
|
|
|
|
public static void Main()
|
|
|
|
{
|
|
|
|
var example = new Example();
|
|
|
|
example.Launch();
|
2018-09-06 07:46:02 -07:00
|
|
|
}
|
|
|
|
}
|