Exemplo n.º 1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     MyLogger.Trace("Entering " + MethodBase.GetCurrentMethod().Name);
     MyLogger.Info("Start");
     OrekService orekService = null;
     try
     {
         orekService = new OrekService();
     }
     catch (Exception ex)
     {
         MyLogger.Fatal("Initiation Failed, exiting service: {0}",ex.Message);
         MyLogger.Debug(ex);
         Environment.Exit(1);
     }
     if (args.Contains("-admin"))
     {
         MyLogger.Info("Starting AdminGui");
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new AdminGui(orekService));
         MyLogger.Info("AdminGui exited");
         Console.WriteLine("Press any key to exit");
         Console.ReadKey();
     }
     else
     {
         if (Environment.UserInteractive)
         {
             MyLogger.Debug("Userinteractive session found, starting on console..");
             orekService.StartConsole(args);
             Console.WriteLine("Press any key to stop program");
             Console.Read();
             MyLogger.Debug("Key pressed, stopping console run....");
             orekService.StopConsole();
             Console.WriteLine("Press any key to exit");
             Console.ReadKey();
         }
         else
         {
             MyLogger.Debug("Not Interactive Startup, starting as Service");
             ServiceBase.Run(orekService);
         }
     }
     MyLogger.Info("Finished");
 }
Exemplo n.º 2
0
 public AdminGui(OrekService orekServices)
 {
     OrekService = orekServices;
     InitializeComponent();
     LoadConfig();
 }