private void button10_Click(object sender, EventArgs e) { txtscreen.Clear(); eded1 = eded2 = 0; operatorr = null; lastset = LastSet.None; labelhistory.Text = ""; txtscreen.Text = "0"; }
private void Form1_Click(object sender, EventArgs e) { if (sender is Button btnopr) { operatorr = btnopr.Text; labelhistory.Text += $"{eded2} {operatorr}"; if (waitinganswer && lastset != LastSet.answer) { txtscreen.Text = hesabla().ToString(); } eded2 = eded1; operatorr = btnopr?.Text; lastset = LastSet.operatorr; waitinganswer = true; } }
private void Numbers_Click(object sender, EventArgs e) { try { if (sender is Button btnnum) { if (lastset == LastSet.None) { lastset = LastSet.eded1; } else if (lastset == LastSet.operatorr) { txtscreen.Clear(); lastset = LastSet.eded2; } if (txtscreen.Text == "0") { txtscreen.Clear(); } if (txtscreen.Text.Length == 10) { return; } txtscreen.Text += btnnum.Text; if (lastset == LastSet.eded1) { eded1 = eded2 = double.Parse(txtscreen.Text); } else if (lastset == LastSet.eded2) { eded2 = double.Parse(txtscreen.Text); } } } catch (Exception ex) { Catchexception(ex); } }