public override double Operate(AddInView.Operation op, double[] operands)
 {
     switch (op.Name)
     {
         case "+":
             return operands[0] + operands[1];
         case "-":
             return operands[0] - operands[1];
         case "*":
             return operands[0] * operands[1];
         case "/":
             return operands[0] / operands[1];
         default:
             throw new InvalidOperationException("Can not perform operation: " +op.Name);
     }
 }
 public override void Initialize(AddInView.HostObject hostObj)
 {
     host = hostObj;
 }
 public NumberProcessorViewToContractAdapter(AddInView.NumberProcessorAddInView view)
 {
     this.view = view;
 }
 public CalculatorViewToContractAddInAdapter(AddInView.Calculator view)
 {
     _view = view;
 }
示例#5
0
 public ImageProcessorViewToContractAdapter(AddInView.ImageProcessorAddInView view)
 {
     this.view = view;
 }
 public static Calculator.Contracts.IOperationContract ViewToContractAdapter(AddInView.Operation view)
 {
     return new OperationViewToContractAddInAdapter(view);
 }
 public OperationViewToContractAddInAdapter(AddInView.Operation view)
 {
     _view = view;
 }