Example #1
0
 private static void Main()
 {
     HostFactory.Run(c =>
     {
         c.Service <ServiceHandler>(s =>
         {
             s.ConstructUsing(_ =>
             {
                 var settings = new Settings.Settings();
                 return(new ServiceHandler(settings, new TwitterService(settings), new TweetMatcher(), new SandboxService(settings)));
             });
             s.WhenStarted(x => x.Start());
             s.WhenStopped(x => x.Stop());
         });
         c.RunAsLocalSystem();
         c.StartAutomatically();
         c.SetDescription(DESCRIPTION);
         c.SetDisplayName(NAME);
         c.SetServiceName(NAME);
     });
 }
 private static void Main()
 {
     HostFactory.Run(c =>
     {
         c.Service<ServiceHandler>(s =>
         {
             s.ConstructUsing(_ =>
             {
                 var settings = new Settings.Settings();
                 return new ServiceHandler(settings, new TwitterService(settings), new TweetMatcher(), new SandboxService(settings));
             });
             s.WhenStarted(x => x.Start());
             s.WhenStopped(x => x.Stop());
         });
         c.RunAsLocalSystem();
         c.StartAutomatically();
         c.SetDescription(DESCRIPTION);
         c.SetDisplayName(NAME);
         c.SetServiceName(NAME);
     });
 }