private IExecutionContext CreateContext(string cookie) { IExecutionContext context = new Gin.Context.ExecutionContext(_ginRoot); Logging.Logging loggingObject = new Logging.Logging(); Directory.CreateDirectory(_cookiePath); string mainLoggerPath = Path.Combine(_ginRoot, Gin.ExecutionLogger.EXECUTION_LOG_FILENAME); ExecutionLogger mainFileLogger = new ExecutionLoggerTextFile(mainLoggerPath); loggingObject.AddLogger(mainFileLogger); string textLoggerPath = Path.Combine(_cookiePath, Gin.ExecutionLogger.EXECUTION_LOG_FILENAME); ExecutionLogger textFileLogger = new ExecutionLoggerTextFile(textLoggerPath); loggingObject.AddLogger(textFileLogger); _state.LogPath = textLoggerPath; _progressProxy = new ExecutionProgressProxy(OnProgress); loggingObject.SetProgress(_progressProxy); context.Log = loggingObject; return(context); }
/// <summary> /// Calls a method that raises the AsyncProgressChanged event when the async progress changes, and raises a notification if the progress was reporting a notification. /// </summary> private void Progress_ProgressChanged(object sender, ExecutionProgress e) { OnAsyncProgressChanged(new ProgressEventArgs(e)); if (e.ProgressType == ProgressType.Notification) { RaiseNotification(new NotificationEventArgs(e.NotificationType, e.Message)); } }
public void SetExecutionProgress(ExecutionProgress progress) { }
public ProgressEventArgs(ExecutionProgress progress) { Progress = progress; }
/// <summary> /// /// </summary> /// <param name="queries"></param> /// <param name="worksheet"></param> private void ExecuteQuery(List <Query> queries, bool worksheet) { if (queries.Count == 0) { return; } if (_user == null) { return; } _addressQueries = new List <string>(); bool clearFormat = false; List <Report> reportList = new List <Report>(); int profileCounter = 0; int cellOffset = 0; foreach (Query query in queries) { _reportManager = new ReportManager(); _executionProgressWindow = new ExecutionProgress(_reportManager); _executionProgressWindow.Show(); _currentReport = _reportManager.GetReport(query, _user.AuthToken, profileCounter); if (!_currentReport.ValidateResult()) { continue; } reportList.Add(_currentReport); if (profileCounter == 0 && _currentReport != null && _currentReport.ValidateResult()) { if (ActiveCellHasQueryResult || worksheet) { clearFormat = Excel2007Addin.Settings.Default.CellFormatting == (int)WPFUIv2.CellFormattingEnum.never || (Excel2007Addin.Settings.Default.CellFormatting == (int)WPFUIv2.CellFormattingEnum.ask && MessageBox.Show("Do you want to erase the format of your excel query columns?", "Document format", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes); ClearPreviousQueryResult(clearFormat, worksheet, query); } } if (!worksheet) { // If a query is executed containing more than one profile the active cell cursor must be // moved to prevent clearing the prior report in Excel. PresentResult(query, _currentReport, profileCounter, cellOffset); cellOffset += _currentReport.Data.GetLength(1) + 1; // +1 for space if (query.Ids.Count > profileCounter) { profileCounter++; } } } int i = 0; if (_user != null && worksheet) { foreach (Query query in queries) { PresentResultUpdate(query, reportList[i], profileCounter); i++; } } }
/// <summary> /// Fires the execution progress event. /// </summary> private void FireExecutionProgressEvent() { ExecutionProgress?.Invoke(this, new ExecutionProgressEventArgs(RunSummary)); }