/// <summary> /// Detects if an application has the port ready and then invoke the call back. /// </summary> /// <param name="instance">The instance to be checked.</param> /// <param name="callBack">The call back.</param> private static void DetectPortReady(DropletInstance instance, BoolStateBlockCallback callBack) { int attempts = 0; bool keep_going = true; while (attempts <= 1000 && instance.Properties.State == DropletInstanceState.Starting && keep_going == true) { if (instance.IsPortReady(150)) { keep_going = false; callBack(true); } else { Thread.Sleep(100); attempts++; } } if (keep_going) { callBack(false); } }
/// <summary> /// Detects the if an app is ready and run the callback. /// </summary> /// <param name="instance">The instance to be checked.</param> /// <param name="callBack">The call back.</param> private static void DetectAppReady(DropletInstance instance, BoolStateBlockCallback callBack) { DetectPortReady(instance, callBack); }