Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Namespace
Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Namespace
Using Using Using Using Using Using Using Using Using Using Using Using Using Using Using Namespace
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication10
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
// screen.Text = "";
// screen.Focus();
//{
// compute(count);
// }
//public void compute(int count)
// {
//
// }
// Double SecondNumber;
//SecondNumber = Convert.ToDouble(screen.Text);
//screen.Text = result.ToString();
// int result = Int32.Parse(screen.Text) + Int32.Parse(screen.Text);
// int a = Convert.ToInt32(screen.Text);
//int b = Convert.ToInt32(screen.Text);
//Type scriptType = Type.GetTypeFromCLSID(Guid.Parse("0ES9F1D5-1FBE-11D0-8FF2-
00A0D10038BC"));
//dynamic obj = Activator.CreateInstance(scriptType, false);
//obj.Language = "javascript";
{
try
{
str = InputStr.Split('+');
if (str[0].Length == 0)
{
str = InputStr.Split('*');
if (str[0].Length == 0)
{
str = InputStr.Split('-');
if (str[0].Length == 0)
{
str = InputStr.Split('/');
int result = System.Convert.ToInt32(str[0]) /
System.Convert.ToInt32(str[1]);
screen.Text = result.ToString();
}
else
{
}
}
else
{
int result = System.Convert.ToInt32(str[0]) +
System.Convert.ToInt32(str[1]);
screen.Text = result.ToString();
}
//InputStr.Split()
// var res = obj.Eval(screen.Text);
// str = Convert.ToString(res);
// screen.Text = result.ToString();
InputStr = screen.Text;
// str = InputStr.Split('*');
// MessageBox.Show(screen.Text);
// MessageBox.Show(str[0]);
}
catch (Exception ex)
{
screen.Text = "Syntax Error" + ex.Message.ToString();
}
}
}
}