public virtual async Task RunBatch() { if (_isRunning) { return; } _isRunning = true; _logPresenter.ClearLog(); _view.CalculateEnabled = false; try { await StartBatch(); } catch (Exception e) { _batchLogger.AddError(e.FullMessage()); } _isRunning = false; _view.CalculateEnabled = true; if (shouldClose) { Exit(); } }
public async Task Start() { try { _logPresenter.ClearLog(); _view.EnableButtons(false); _logger.AddInfo(PKSimConstants.Information.LoadingSnapshot(_loadFromSnapshotDTO.SnapshotFile, typeToLoad)); await Task.Run(() => PerformLoad(_loadFromSnapshotDTO.SnapshotFile)); _logger.AddInfo(PKSimConstants.Information.SnapshotLoaded(typeToLoad)); } catch (Exception e) { _logger.AddException(e); } finally { _view.EnableButtons(cancelEnabled: true, okEnabled: ModelIsDefined, startEnabled: CanClose); } }
public async Task StartAsync() { try { _logPresenter.ClearLog(); _view.EnableButtons(false); _logger.AddInfo(PKSimConstants.Information.LoadingSnapshot(_loadFromSnapshotDTO.SnapshotFile, typeToLoad)); await Task.Run(performLoadAsync); _logger.AddInfo(PKSimConstants.Information.SnapshotLoaded(typeToLoad)); } catch (Exception e) { _logger.AddException(e); } finally { //Start is disabled if the model was loaded successfully _view.EnableButtons(cancelEnabled: true, okEnabled: ModelIsDefined, startEnabled: !ModelIsDefined); } }
public virtual async Task RunBatch() { if (_isRunning) { return; } _isRunning = true; _logPresenter.ClearLog(); _view.CalculateEnabled = false; try { await StartBatch(); } catch (Exception e) { _batchLogger.AddException(e); } _isRunning = false; _view.CalculateEnabled = true; }