public OperationView() { InitializeComponent(); ClientSize = OperationPanel.Size; workingPanelLeft.AllowDrop = true; argumentsChanged += (o, e) => { label1.Text = "="; label1.ForeColor = Color.Black; try { if (leftNotNull && (rightNotNull || isUnaryOrMultiarial)) { OperationController <int> .Calculate(this); } } catch { } }; argumentsInvalid += (o, e) => { label1.Text = "x"; label1.ForeColor = Color.Red; }; deleteCommand = new DeleteCommand <int>(this); changeCommand = new ChangeOperationTypeCommand <int>(this); comInvoker = CommandInvoker.getInstance(); foreach (IOperable <int> opCalc in OperationController <int> .operationCalculators) { ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = opCalc.representation; item.Click += (o, e) => { changeCommand.newType = opCalc; comInvoker.SetCommand(changeCommand); comInvoker.Run(); }; contextMenuStrip1.Items.Add(item); } }
private void button1_Click(object sender, EventArgs e) { OperationController <int> .Calculate(opView); Dispose(); }