} /* Model2LoadCompletion */ static public void CancelLoadWait(int maxMilliSecsToWait) { CancelLoads(); int milliSecsWaitedSoFar = 0; while (ModelsAreLoading() && (milliSecsWaitedSoFar <= maxMilliSecsToWait)) { Thread.Sleep(50); milliSecsWaitedSoFar += 50; } if (ModelsAreLoading()) { BlockStart(); if (model1LoadStatus != null) { model1LoadStatus.ForceCancelation(); model1LoadStatus = null; } if (model2LoadStatus != null) { model2LoadStatus.ForceCancelation(); model2LoadStatus = null; } BlockEnd(); } } /* CancelLoadWait */
} /* Model1LoadCompletion */ static private void Model2LoadCompletion(TrainingModelStatus sender) { if (!sender.ValidModel()) { model2 = null; } else { model2 = sender.TrainiedModel(); } model2LoadStatus = null; if (doneLoadingModel2Event != null) { doneLoadingModel2Event(model2); } } /* Model2LoadCompletion */
} /* Model1LoadStart */ static private void Model2LoadStart(String _model2Name, bool _forceRebuild, DoneLoadingEvent _doneLoadingEvent ) { model2Name = _model2Name; if (String.IsNullOrEmpty(model2Name)) { return; } doneLoadingModel2Event = _doneLoadingEvent; model2LoadStatus = new TrainingModelStatus(_model2Name, _forceRebuild, Model2LoadCompletion); model2LoadStatus.Show(); } /* Model1LoadStart */