Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public partial class MiServicio : ServiceBase
- {
- Timer tmrServicio = null;
- public MiServicio ()
- {
- InitializeComponent();
- tmrServicio = new Timer (1000);
- tmrServicio.Elapsed += new ElapsedEventHandler(tmrServicio_Elapsed);
- }
- void tmrServicio_Elapsed(object sender, ElapsedEnvetArgs e)
- {
- VerificarAppIniciado();
- }
- protected override void OnStart(string[] args)
- {
- tmrServicio.Start();
- }
- protected override void OnStop()
- {
- tmrServicio.Stop();
- }
- void VerificarAppIniciar()
- {
- Process[] apps = Process.GetProcessesByName("sistemaventas");
- if (apps.Length == 0)
- {
- try
- {
- Process.Start(@"C:Archivos de programaMiAppsistemaventas.exe");
- }
- catch
- {
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment