public WorkbookContext GetWorkBookContext(Excel.Workbook workbook) { if (null == workbook) { throw new ArgumentNullException("workbook"); } bool isNotCurrent = false; WorkbookContext workbookContext = null; if (null == this.currentWorkbookContext) { isNotCurrent = true; } else if (this.currentWorkbookContext.Id != WorkbookContext.GetContextId(workbook)) { isNotCurrent = true; } if (isNotCurrent) { workbookContext = new WorkbookContext(workbook); } else { workbookContext = this.currentWorkbookContext; workbookContext.Update(); } return(workbookContext); }
public void Update() { var workbookContext = this.GetActiveWorkbookContext(); if (null == workbookContext) { this.GetActiveWindowContext().WorkbookContext = null; // this.listControl.TestCases = null; this.currentWorkbookContext = null; } else if (null == this.currentWorkbookContext) { this.currentWorkbookContext = workbookContext; this.GetActiveWindowContext().WorkbookContext = this.currentWorkbookContext; // this.listControl.TestCases = this.currentWorkbookContext.TestCases; } else if (this.currentWorkbookContext.Id != workbookContext.Id) { this.currentWorkbookContext = workbookContext; this.GetActiveWindowContext().WorkbookContext = this.currentWorkbookContext; // this.listControl.TestCases = this.currentWorkbookContext.TestCases; } ActionManager.Update(); }
private void Excel_WorkbookBeforeSave(Excel.Workbook workbook, bool saveAsUI, ref bool cancel) { #if DEBUG Log.Logger.Debug("WorkbookBeforeSave"); #endif WorkbookContext workbookConext = this.GetWorkBookContext(workbook); workbookConext.SaveSettings(); }
public TestContextImpl(WorkbookContext workbookContext) { if (null == workbookContext) { throw new ArgumentNullException("workbookContext"); } this.WorkbookContext = workbookContext; this.BaseUrl = workbookContext.BaseUrl; this.Timeout = App.Context.Settings.Timeout; this.TestSequence = new TestSequence(); this.StoreVariables = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); this.Clear(); }
private void Purge() { var now = DateTime.Now; if ((now - this.purgeTime).TotalHours < 1) { return; } this.purgeTime = now; foreach (Excel.Workbook workbook in App.Excel.Workbooks) { var workbookContextId = WorkbookContext.GetContextId(workbook); if (!this.dic.ContainsKey(workbookContextId)) { this.dic.Remove(workbookContextId); } } }