Beispiel #1
0
 private void SetUIState(WorkbookState wbs)
 {
     this.MarkAsOKButton.Enabled  = wbs.MarkAsOK_Enabled;
     this.FixErrorButton.Enabled  = wbs.FixError_Enabled;
     this.StartOverButton.Enabled = wbs.ClearColoringButton_Enabled;
     this.AnalyzeButton.Enabled   = wbs.Analyze_Enabled;
 }
Beispiel #2
0
 // This event is called when Excel brings an opened workbook
 // to the foreground
 private void WorkbookActivated(Excel.Workbook workbook)
 {
     // when opening a blank sheet, Excel does not emit
     // a WorkbookOpen event, so we need to call it manually
     if (!wbstates.ContainsKey(workbook))
     {
         WorkbookOpen(workbook);
     }
     current_workbook = wbstates[workbook];
     SetUIState(current_workbook);
 }
Beispiel #3
0
        // This even it called when Excel sends an opened workbook
        // to the background
        private void WorkbookDeactivated(Excel.Workbook workbook)
        {
            current_workbook = null;
            // WorkbookBeforeClose event does not fire for default workbooks
            // containing no data
            var wbs = new List <Excel.Workbook>();

            foreach (var wb in Globals.ThisAddIn.Application.Workbooks)
            {
                if (wb != workbook)
                {
                    wbs.Add((Excel.Workbook)wb);
                }
            }

            if (wbs.Count == 0)
            {
                wbstates.Clear();
                SetUIStateNoWorkbooks();
            }
        }