am i controlling service
i am now minute small bootstrap formula use run console. radically boils down job onstart() slight instead controlling servicebase start stop use (because doesn't run concentration isn't hallowed use creates debugging nightmare).
right i am controlling debugger.isattached establish i should servicebase.run [service].onstart, nonetheless i know isn't best thought since times finish users wish run use console (to cost etc. realtime).
any ideas i establish windows use controller started 'me', user started 'me' console? apparantly answer. i guess controlling commandline args, nonetheless seems 'dirty'.
i always try-catch matter around servicebase.run, nonetheless seems dirty. edit: try locate doesn't work.
i have solution: putting adult here prying stackers:
open vacant run()
{
(debugger.isattached || environment.getcommandlineargs().contains<string>("-console"))
{
runallservices();
}
else
{
try
{
twine temp = console.title;
servicebase.run((servicebase[])componentstorun);
}
catch
{
runallservices();
}
}
} // vacant run
private vacant runallservices()
{
foreach (consoleservice member componentstorun)
{
component.start();
}
waitforctrlc();
foreach (consoleservice member componentstorun)
{
component.stop();
}
}
edit: there another doubt where man problems environment.currentdirectory being "c:\windows\system32" looks competence answer. i exam today.
Comments
Post a Comment