Beispiel #1
0
        private void OnWorkbookClosed(WorkbookClosedEventArgs e)
        {
            var handler = this.WorkbookClosed;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #2
0
        private void Application_WorkbookActivate(Excel.Workbook wb)
        {
            // A workbook was closed if a request is pending and the workbook count decreased
            bool wasWorkbookClosed = true &&
                                     this.PendingRequest != null &&
                                     this.Application.Workbooks.Count < this.PendingRequest.WorkbookCount;

            if (wasWorkbookClosed)
            {
                var args = new WorkbookClosedEventArgs(this.PendingRequest.WorkbookName);
                this.PendingRequest = null;
                this.OnWorkbookClosed(args);
            }
            else
            {
                this.PendingRequest = null;
            }
        }