xsharp_service_sample
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | xsharp_service_sample [2018/07/29 06:14] (current) – created wolfgangriedmann | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Windows Service Sample ====== | ||
+ | |||
+ | X# is very well suited for Windows Services. A Windows Service is a GUI less application that runs in the background of any Windows machine, and even without any logged in user. Therefore services are well suited for background tasks. | ||
+ | |||
+ | The .NET Framework has a base class for all Windows Services: the '' | ||
+ | |||
+ | The X# code is very simple: | ||
+ | <code visualfoxpro> | ||
+ | constructor() | ||
+ | |||
+ | super() | ||
+ | self: | ||
+ | |||
+ | return | ||
+ | |||
+ | virtual method InitializeComponent() as void | ||
+ | |||
+ | self: | ||
+ | self: | ||
+ | | ||
+ | // These Flags set whether or not to handle that specific | ||
+ | // type of event. Set to true if you need it, false otherwise. | ||
+ | self: | ||
+ | self: | ||
+ | self: | ||
+ | self: | ||
+ | self: | ||
+ | |||
+ | return | ||
+ | protected virtual method OnStart( args as string[] ) as void | ||
+ | |||
+ | super: | ||
+ | |||
+ | return | ||
+ | |||
+ | protected virtual method OnStop() as void | ||
+ | |||
+ | super: | ||
+ | |||
+ | return | ||
+ | |||
+ | protected virtual method OnPause() as void | ||
+ | |||
+ | super: | ||
+ | |||
+ | return | ||
+ | |||
+ | protected virtual method OnContinue() as void | ||
+ | |||
+ | super: | ||
+ | |||
+ | return | ||
+ | |||
+ | protected virtual method OnTimeOut( oSender as object, e as ElapsedEventArgs ) as void | ||
+ | |||
+ | | ||
+ | |||
+ | You can find a complete working sample as XIDE export file here: {{ : | ||
+ | |||
+ | |||
xsharp_service_sample.txt · Last modified: 2018/07/29 06:14 by wolfgangriedmann