protected override void BeforeSolveInstance() { Message = ""; _enabledThisSolve = true; if (!_solvedCallback) { _solveSerialNumber = _currentSolveSerialNumber++; if (_workingSolveList != null) { _workingSolveList.Canceled = true; } _workingSolveList = new SolveDataList(_solveSerialNumber, this, _remoteDefinition, _cacheResultsInMemory); } base.BeforeSolveInstance(); }
static public void Add(SolveDataList datalist) { if (!_idleSet && !datalist.Synchronous) { _idleSet = true; Rhino.RhinoApp.Idle += RhinoApp_Idle; } _maxConcurrentRequests = HopsAppSettings.MaxConcurrentRequests; if (datalist.Synchronous) { var stack = new ConcurrentStack <SolveDataList>(); stack.Push(datalist); var task = Task.Run(() => ProcessStack(stack)); task.Wait(); return; } _stack.Push(datalist); if (_solveTask == null || _solveTask.IsCompleted) { _solveTask = Task.Run(() => ProcessStack(_stack)); } }