CheckCell.WorkbookState.FixError C# (CSharp) Method

FixError() private method

private FixError ( Action setUIState ) : void
setUIState Action
return void
        internal void FixError(Action<WorkbookState> setUIState)
        {
            var cell = _flagged_cell.GetCOMObject(_app);
            // this callback gets run when the user clicks "OK"
            System.Action callback = () =>
            {
                // add the cell to the known good list
                _known_good.Add(_flagged_cell);

                // unflag the cell
                _flagged_cell = null;
                try
                {
                    // when a user fixes something, we need to re-run the analysis
                    Analyze(MAX_DURATION_IN_MS);
                    // and flag again
                    Flag();
                    // and then set the UI state
                    setUIState(this);
                }
                catch (ExcelParserUtility.ParseException ex)
                {
                    System.Windows.Forms.Clipboard.SetText(ex.Message);
                    System.Windows.Forms.MessageBox.Show("Could not parse the formula string:\n" + ex.Message);
                    return;
                }
                catch (System.OutOfMemoryException ex)
                {
                    System.Windows.Forms.MessageBox.Show("Insufficient memory to perform analysis.");
                    return;
                }

            };
            // show the form
            var fixform = new CellFixForm(cell, GREEN, callback);
            fixform.Show();

            // restore output colors
            RestoreOutputColors();
        }

Usage Example

Example #1
0
 private void FixErrorButton_Click(object sender, RibbonControlEventArgs e)
 {
     current_workbook.FixError(SetUIState);
 }