Esempio n. 1
0
 public bool SpawnVM(StartupParams startup, ISpawnHandler spawnHandler)
 {
     try
     {
         _spawnHandler       = spawnHandler;
         _spawnCorrelationID = Guid.NewGuid();
         Logger.Write(string.Format("Sending VMSpawnMessage with {0} and {1}", _spawnCorrelationID, startup.WatchToken));
         var thread = new Thread(send);
         thread.Start(new VMSpawnMeessage(_spawnCorrelationID, 0, startup.WatchToken));
         var timeout = DateTime.Now.AddSeconds(1);
         while (DateTime.Now < timeout)
         {
             Thread.Sleep(10);
             if (_host == null)
             {
                 continue;
             }
             if (thread.ThreadState == ThreadState.Stopped)
             {
                 break;
             }
         }
         thread.Abort();
         if (_host == null)
         {
             return(false);
         }
         return(_host.IsConnected);
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
         return(false);
     }
 }
Esempio n. 2
0
 public void Start(StartupParams startup, IStartupHandler handler)
 {
     _startupParams = startup;
     _startupHandler = handler;
     ConnectToVM();
     _license = new RhinoValidator(GetAppDataFolder());
 }
Esempio n. 3
0
 public bool SpawnVM(StartupParams startup, ISpawnHandler spawnHandler)
 {
     try
     {
         _spawnHandler = spawnHandler;
         _spawnCorrelationID = Guid.NewGuid();
         Logger.Write(string.Format("Sending VMSpawnMessage with {0} and {1}", _spawnCorrelationID, startup.WatchToken));
         var thread = new Thread(send);
         thread.Start(new VMSpawnMeessage(_spawnCorrelationID, 0, startup.WatchToken));
         var timeout = DateTime.Now.AddSeconds(1);
         while (DateTime.Now < timeout)
         {
             Thread.Sleep(10);
             if (_host == null)
                 continue;
             if (thread.ThreadState == ThreadState.Stopped)
                 break;
         }
         thread.Abort();
         if (_host == null)
             return false;
         return _host.IsConnected;
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
         return false;
     }
 }
Esempio n. 4
0
 private void SpawnVM(StartupParams startup, IStartupHandler handler)
 {
     if (!ConnectToHost(startup, handler))
     {
         SpawnStandaloneVM(startup, handler);
     }
 }
Esempio n. 5
0
 public void Start(StartupParams startup, IStartupHandler handler)
 {
     _startupParams  = startup;
     _startupHandler = handler;
     ConnectToVM();
     _license = new RhinoValidator(GetAppDataFolder());
 }
Esempio n. 6
0
 private void SpawnStandaloneVM(StartupParams startup, IStartupHandler handler)
 {
     ShutdownCreator();
     _standaloneVmCreator            = new StandaloneVMCreator(startup, handler);
     _standaloneVmCreator.VMSpawned += StandaloneVmCreatorVmSpawned;
     _standaloneVmCreator.Create();
 }
Esempio n. 7
0
 private bool ConnectToHost(StartupParams startup, IStartupHandler handler)
 {
     return _host.SpawnVM(startup, handler);
 }
Esempio n. 8
0
 private void SpawnStandaloneVM(StartupParams startup, IStartupHandler handler)
 {
     ShutdownCreator();
     _standaloneVmCreator = new StandaloneVMCreator(startup, handler);
     _standaloneVmCreator.VMSpawned += StandaloneVmCreatorVmSpawned;
     _standaloneVmCreator.Create();
 }
Esempio n. 9
0
 private void SpawnVM(StartupParams startup, IStartupHandler handler)
 {
     if (!ConnectToHost(startup, handler))
         SpawnStandaloneVM(startup, handler);
 }
 public StandaloneVMCreator(StartupParams startup, IStartupHandler handler)
 {
     _params = startup;
     _server = new TcpServer(this);
 }
Esempio n. 11
0
 public StandaloneVMCreator(StartupParams startup, IStartupHandler handler)
 {
     _params = startup;
     _server = new TcpServer(this);
 }
Esempio n. 12
0
 private bool ConnectToHost(StartupParams startup, IStartupHandler handler)
 {
     return(_host.SpawnVM(startup, handler));
 }