Start() public method

Starts this instance.
public Start ( ) : void
return void
Exemplo n.º 1
0
        static void Main( string[ ] args )
        {
            using ( Stream stream = typeof ( Program ).Assembly.GetManifestResourceStream ( "DroidExplorer.Service.DroidExplorer.Service.log4net" ) ) {
                XmlConfigurator.Configure ( stream );
            }

            DroidExplorer.Configuration.Settings.Instance.Loaded += delegate ( object sender, EventArgs e ) {
                SetSdkPath ( );
            };

            SetSdkPath ( );

            Arguments arguments = new Arguments ( args );
            Logger.Log = LogManager.GetLogger ( MethodBase.GetCurrentMethod ( ).DeclaringType );
            Logger.Level = Logger.Levels.Info | Logger.Levels.Error | Logger.Levels.Warn;

            if ( arguments.Contains( "console" ,"c" ) ) {
                DevicesMonitor dm = new DevicesMonitor ( );
                dm.Start ( );
                Console.WriteLine ( "Press {ENTER} to exit" );
                Console.ReadLine ( );
                dm.Stop ( );
            } else {
                try {
                    // start the service.
                    System.ServiceProcess.ServiceBase.Run ( new DeviceService ( ) );
                } catch ( Exception ex ) {
                    Logger.LogError ( typeof ( Program ), ex.Message, ex );
                    throw;
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            using (Stream stream = typeof(Program).Assembly.GetManifestResourceStream("DroidExplorer.Service.DroidExplorer.Service.log4net")) {
                XmlConfigurator.Configure(stream);
            }

            DroidExplorer.Configuration.Settings.Instance.Loaded += delegate(object sender, EventArgs e) {
                SetSdkPath( );
            };

            SetSdkPath( );

            Arguments arguments = new Arguments(args);

            Logger.Log   = LogManager.GetLogger(MethodBase.GetCurrentMethod( ).DeclaringType);
            Logger.Level = Logger.Levels.Info | Logger.Levels.Error | Logger.Levels.Warn;

            if (arguments.Contains("console", "c"))
            {
                DevicesMonitor dm = new DevicesMonitor( );
                dm.Start( );
                Console.WriteLine("Press {ENTER} to exit");
                Console.ReadLine( );
                dm.Stop( );
            }
            else
            {
                try {
                    // start the service.
                    System.ServiceProcess.ServiceBase.Run(new DeviceService( ));
                } catch (Exception ex) {
                    Logger.LogError(typeof(Program), ex.Message, ex);
                    throw;
                }
            }
        }