using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SimpleCalc
{
public partial class FormCalculate : Form
{
private Calculate cl;
string strNum = "";
public FormCalculate()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
cl = new Calculate(this);
}
private void btNum1_Click(object sender, EventArgs e)
{
enterNum(btNum1.Text);
}
private void btNum2_Click(object sender, EventArgs e)
{
enterNum(btNum2.Text);
}
private void btNum3_Click(object sender, EventArgs e)
{
enterNum(btNum3.Text);
}
private void btNum4_Click(object sender, EventArgs e)
{
enterNum(btNum4.Text);
}
private void btNum5_Click(object sender, EventArgs e)
{
enterNum(btNum5.Text);
}
private void btNum6_Click(object sender, EventArgs e)
{
enterNum(btNum6.Text);
}
private void btNum7_Click(object sender, EventArgs e)
{
enterNum(btNum7.Text);
}
private void btNum8_Click(object sender, EventArgs e)
{
enterNum(btNum8.Text);
}
private void btNum9_Click(object sender, EventArgs e)
{
enterNum(btNum9.Text);
}
private void btMinus_Click(object sender, EventArgs e)
{
enterAction(btMinus.Text);
}
private void btNum0_Click(object sender, EventArgs e)
{
enterNum(btNum0.Text);
}
private void btPlus_Click(object sender, EventArgs e)
{
enterAction(btPlus.Text);
}
private void btCount_Click(object sender, EventArgs e)
{
cl.ChoiceMethod(strNum);
string answ=cl.Count();
this.txtWatch.Text += " = " + answ;
strNum = answ;
listLog.Items.Add(cl.LineLog);
}
private void btShare_Click(object sender, EventArgs e)
{
enterAction(btShare.Text);
}
private void btMultiply_Click(object sender, EventArgs e)
{
enterAction(btMultiply.Text);
}
private void enterNum(string num)
{
this.txtWatch.Text += num;
strNum += num;
}
private void enterAction(string tag)
{
cl.ChoiceMethod(strNum);
cl.ChoiceMethod(tag);
strNum = "";
txtWatch.Text += strNum + " " + tag + " ";
}
private void txtWatch_TextChanged(object sender, EventArgs e)
{
if (txtWatch.Text == "")
{
strNum = "";
}
}
private void btClear_Click(object sender, EventArgs e)
{
txtWatch.Clear();
}
}
}