public void MakePreview(BBAddIn addIn) { addIn.bbColorSmells.decolorCells(transformationCells); if (addIn.theRibbon.dropDown1.Items.Count > 0) //if we have transformations available { FSharpTransformationRule T = AllTransformations.FirstOrDefault(x => x.Name == addIn.theRibbon.dropDown1.SelectedItem.Label); Excel.Range R = (addIn.Application.Selection); string formula = BBTransformations.RemoveFirstSymbol((string)R[1, 1].Formula); addIn.theRibbon.Preview.Text = T.ApplyOn(formula); addIn.theRibbon.valuePreview.Text = getValue((ExcelRaw.Range)R[1, 1].UnderlyingObject, addIn.theRibbon.Preview.Text); addIn.theRibbon.valuePreview.ShowImage = (addIn.theRibbon.valuePreview.Text != R[1, 1].Value.ToString()); if (R.Count == 1) { foreach (Excel.Worksheet worksheet in addIn.Application.Worksheets) { applyInRange(T, (ExcelRaw.Range)worksheet.UsedRange.UnderlyingObject, true); } } else { applyInRange(T, addIn.Application.Selection, true); } } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { bbColorSmells = new BBColorSmells(this); bbTransformations = new BBTransformations(this); bbMenuRefactorings = new BBMenuRefactorings(this); #if DEBUG foreach (var startupfile in BumbleBeeDebugStartupfiles.Where(System.IO.File.Exists)) { Application.Workbooks.Open(startupfile); } #endif bbMenuRefactorings.startBBRefactorings(); }