public ActionLayout(ICalculatorPlugin calc, CalculatorHost application)
     : this()
 {
     _calc = calc;
     _app = application;
     this.Title.Text = calc.Name;
     foreach (Operation op in calc.Operations){
         var b = new Button {Tag = op, Content = op.Name};
         b.Click += b_Click;
         Actions.Children.Add(b);
     }
     ValidateButtons(application.Stack.Items.Count);
     application.StackChanged += _stackChangedHandler;
 }
 internal void Operate(ICalculatorPlugin calc, Operation op)
 {
     var operands = new double[op.NumOperands];
       for (int i = 0; i < op.NumOperands; i++)
       {
     var item = (ListViewItem) Stack.Items[0];
     operands[i] = double.Parse(item.Content.ToString());
     Stack.Items.RemoveAt(0);
       }
       if (typeof (INumericCalculator).IsAssignableFrom(calc.GetType()))
       {
     double result = ((INumericCalculator) calc).Operate(op, operands);
     var newItem = new ListViewItem {Content = result};
     Stack.Items.Insert(0, newItem);
       }
       else
       {
     UIElement visual = ((IVisualCalculator) calc).Operate(op, operands);
     CalculatorVisual.Children.Clear();
     CalculatorVisual.Children.Add(visual);
       }
       UpdateStack();
 }
 public CalculatorPluginViewToContractAddInSideAdapter(ICalculatorPlugin calculatorPlugin)
 {
     _calculatorPlugin = calculatorPlugin;
 }