private static async Task Main(string[] args)
    {
        if (args.Length == 1 && args[0] == "install")
        {
            await Console.Out.WriteLineAsync("Running installers...")
            .ConfigureAwait(false);

            var endpointConfiguration = CreateConfiguration();
            endpointConfiguration.EnableInstallers();
            await Endpoint.Create(endpointConfiguration)
            .ConfigureAwait(false);

            return;
        }

        using (var service = new ProgramService())
        {
            // to run interactive from a console or as a windows service
            if (!Environment.UserInteractive)
            {
                Run(service);
                return;
            }

            Console.Title           = "Shipping";
            Console.CancelKeyPress += (sender, e) => { service.OnStop(); };
            service.OnStart(null);
            Console.WriteLine("\r\nPress enter key to stop program\r\n");
            Console.Read();
            service.OnStop();
        }
    }
Ejemplo n.º 2
0
 static void Main()
 {
     using var service = new ProgramService();
     if (ServiceHelper.IsService())
     {
         Run(service);
         return;
     }
     service.OnStart(null);
     Console.WriteLine("Bus started. Press any key to exit");
     Console.ReadKey();
     service.OnStop();
 }
Ejemplo n.º 3
0
 static void Main()
 {
     using (var service = new ProgramService())
     {
         // so we can run interactive from Visual Studio or as a windows service
         if (Environment.UserInteractive)
         {
             service.OnStart(null);
             Console.WriteLine("\r\nPress enter key to stop program\r\n");
             Console.Read();
             service.OnStop();
             return;
         }
         Run(service);
     }
 }
Ejemplo n.º 4
0
 static void Main()
 {
     using (ProgramService service = new ProgramService())
     {
         if (Environment.UserInteractive)
         {
             service.OnStart(null);
             Console.WriteLine("Bus created and configured");
             Console.WriteLine("Press any key to exit");
             Console.ReadKey();
             service.OnStop();
             return;
         }
         Run(service);
     }
 }
Ejemplo n.º 5
0
 static void Main()
 {
     using (var service = new ProgramService())
     {
         // so we can run interactive from Visual Studio or as a windows service
         if (Environment.UserInteractive)
         {
             service.OnStart(null);
             Console.WriteLine("\r\nPress enter key to stop program\r\n");
             Console.Read();
             service.OnStop();
             return;
         }
         Run(service);
     }
 }
 static void Main()
 {
     using (ProgramService service = new ProgramService())
     {
         if (Environment.UserInteractive)
         {
             service.OnStart(null);
             Console.WriteLine("Bus created and configured");
             Console.WriteLine("Press any key to exit");
             Console.ReadKey();
             service.OnStop();
             return;
         }
         Run(service);
     }
 }
Ejemplo n.º 7
0
 public static void Main()
 {
     using (var service = new ProgramService())
     {
         // to run interactive from a console or as a windows service
         if (ServiceHelper.IsService())
         {
             Run(service);
             return;
         }
         Console.Title           = "NServiceBusWindowsService";
         Console.CancelKeyPress += (sender, e) => { service.OnStop(); };
         service.OnStart(null);
         Console.WriteLine("\r\nPress enter key to stop program\r\n");
         Console.Read();
         service.OnStop();
     }
 }
Ejemplo n.º 8
0
    static void Main()
    {
        using (var service = new ProgramService())
        {
            if (ServiceHelper.IsService())
            {
                Run(service);
                return;
            }
            Console.Title = "Samples.FirstEndpoint";
            service.OnStart(null);

            Console.WriteLine("\r\nEndpoint created and configured; press any key to stop program\r\n");
            Console.ReadKey();

            service.OnStop();
        }
    }
Ejemplo n.º 9
0
    static void Main()
    {
        using (var service = new ProgramService())
        {
            if (ServiceHelper.IsService())
            {
                Run(service);
                return;
            }
            Console.Title = "Samples.WindowsServiceAndConsole";
            service.OnStart(null);

            Console.WriteLine("Bus started. Press any key to exit");
            Console.ReadKey();

            service.OnStop();
        }
    }
Ejemplo n.º 10
0
    static void Main()
    {
        Console.Title = "Samples.FirstEndpoint";
        using (ProgramService service = new ProgramService())
        {
            if (Environment.UserInteractive)
            {
                service.OnStart(null);

                Console.WriteLine("\r\nBus created and configured; press any key to stop program\r\n");
                Console.ReadKey();

                service.OnStop();

                return;
            }
            Run(service);
        }
    }
Ejemplo n.º 11
0
    static void Main()
    {
        Console.Title = "Samples.WindowsServiceAndConsole";
        using (var service = new ProgramService())
        {
            if (Environment.UserInteractive)
            {
                service.OnStart(null);

                Console.WriteLine("Bus started. Press any key to exit");
                Console.ReadKey();

                service.OnStop();

                return;
            }
            Run(service);
        }
    }
Ejemplo n.º 12
0
    static void Main()
    {
        Console.Title = "Samples.FirstEndpoint";
        using (ProgramService service = new ProgramService())
        {
            if (Environment.UserInteractive)
            {
                service.OnStart(null);

                Console.WriteLine("\r\nBus created and configured; press any key to stop program\r\n");
                Console.ReadKey();

                service.OnStop();

                return;
            }
            Run(service);
        }
    }
Ejemplo n.º 13
0
 static void Main()
 {
     using (var service = new ProgramService())
     {
         // to run interactive from a console or as a windows service
         if (Environment.UserInteractive)
         {
             Console.CancelKeyPress += (sender, e) =>
             {
                 service.OnStop();
             };
             service.OnStart(null);
             Console.WriteLine("\r\nPress enter key to stop program\r\n");
             Console.Read();
             service.OnStop();
             return;
         }
         Run(service);
     }
 }
Ejemplo n.º 14
0
    static void Main()
    {
        //required to prevent possible occurrence of .NET Core issue https://github.com/dotnet/coreclr/issues/12668
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
        Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");

        using (var service = new ProgramService())
        {
            if (ServiceHelper.IsService())
            {
                Run(service);
                return;
            }
            Console.Title = "Samples.FirstEndpoint";
            service.OnStart(null);

            Console.WriteLine("\r\nEndpoint created and configured; press any key to stop program\r\n");
            Console.ReadKey();

            service.OnStop();
        }
    }