public void endLoad(Func<bool> keepRunning) { if (job == null) { throw new InvalidOperationException("You must call beginLoad before calling endLoad"); } if (!loadedFromFile && !loadedFromServer) { while (keepRunning() && !loadedFromServer) { try { Thread.Sleep(1000); } catch { } } } job = null; }
public void beginLoad(VaultContext context, Func<bool> keepRunning) { if (job != null) { throw new InvalidOperationException("You cannot call beginLoad twice without calling endLoad in between"); } job = new InventoryRetrievalJob(context.Mapping, keepRunning); job.run(); }