public static void enter_Click(object sender, EventArgs e) { string expr = COperations.preformat(CWindow.input.Text); expr = COperations.preCalculate(expr); //expr = COperations.preformat(expr); Console.WriteLine(expr); Queue <string> equation = COperations.infix_to_postfix(expr); /* * for (; equation.Count > 0; ) * { * Console.Write(equation.Dequeue()); * } * Console.WriteLine(); */ double result = COperations.calculate(equation); if (CWindow.output.Text.Length != 0) { CWindow.output.AppendText(Environment.NewLine); } CWindow.output.AppendText(CWindow.input.Text + Environment.NewLine); CWindow.output.AppendText(result + ""); CWindow.input.Clear(); CWindow.input.Focus(); CWindow.output.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; }
public void SetObjectConnection(ILController pController) { _model._LoginController = pController; _coperations = new COperations(_operations, _model); _taskpane = Globals.ThisAddIn.CustomTaskPanes.Add(_operations, "DeXrm Operation"); _taskpane.Visible = true; }
protected MMC.Numbers.CNumber.CNumberType _NumberType; // the type of numbers to create //------------------------------------------------------------ // standard constructor public CEnvironment(MMC.Numbers.CNumber.CNumberType NumberType) { //-------------------------------------------------------- // set up the type of numbers to generate _NumberType = NumberType; //-------------------------------------------------------- // initialize the last result with 0 _Result = new MMC.Calc.Functions.CTerm_Const("RES", NewNumber(0.0)); //-------------------------------------------------------- // Add the functions _Operations = new COperations(); _Operations.Set(new MMC.Calc.Functions.CTerm_AND("AND")); _Operations.Set(new MMC.Calc.Functions.CTerm_OR("OR")); _Operations.Set(new MMC.Calc.Functions.CTerm_XOR("XOR")); _Operations.Set(new MMC.Calc.Functions.CTerm_NOT("NOT")); _Operations.Set(new MMC.Calc.Functions.CTerm_Add("+")); _Operations.Set(new MMC.Calc.Functions.CTerm_Sub("-")); _Operations.Set(new MMC.Calc.Functions.CTerm_Mul("*")); _Operations.Set(new MMC.Calc.Functions.CTerm_Div("/")); _Operations.Set(new MMC.Calc.Functions.CTerm_Mod("%")); _Operations.Set(new MMC.Calc.Functions.CTerm_Power("^")); _Operations.Set(new MMC.Calc.Functions.CTerm_Square("sqr")); _Operations.Set(new MMC.Calc.Functions.CTerm_SquareRoot("sqrt")); _Operations.Set(new MMC.Calc.Functions.CTerm_Sinus("sin")); _Operations.Set(new MMC.Calc.Functions.CTerm_SinusHyperbolicus("sinh")); _Operations.Set(new MMC.Calc.Functions.CTerm_Cosinus("cos")); _Operations.Set(new MMC.Calc.Functions.CTerm_CosinusHyperbolicus("cosh")); _Operations.Set(new MMC.Calc.Functions.CTerm_Tangens("tan")); _Operations.Set(new MMC.Calc.Functions.CTerm_TangensHyperbolicus("tanh")); _Operations.Set(new MMC.Calc.Functions.CTerm_Radiant("rad")); _Operations.Set(new MMC.Calc.Functions.CTerm_Degree("deg")); _Operations.Set(new MMC.Calc.Functions.CTerm_Diagonale("diag")); _Operations.Set(new MMC.Calc.Functions.CTerm_Date("date")); _Operations.Set(new MMC.Calc.Functions.CTerm_Day("day")); //-------------------------------------------------------- // add the initial constants _Constants = new COperations(); _Constants.Set(new MMC.Calc.Functions.CTerm_Const("pi", NewNumber(Math.PI))); _Constants.Set(new MMC.Calc.Functions.CTerm_Const("e", NewNumber(Math.E))); _Constants.Set(_Result); //-------------------------------------------------------- // add the supporting cast _Support = new COperations(); _Support.Set(new MMC.Calc.Functions.CTerm_Bracket("(")); _Support.Set(new MMC.Calc.Functions.CTerm_BracketClose(")")); //_Support.Set(new MMC.Calc.Functions.CTerm_Separator(",")); // possible decimal separator! _Support.Set(new MMC.Calc.Functions.CTerm_Separator(";")); _Support.Set(new MMC.Calc.Functions.CTerm_Assignment("=")); //-------------------------------------------------------- // create the table for the user defined variables _Variables = new COperations(); }
public void SetEntities(COperations pOperation) { this.cbEntities.DataSource = pOperation._ListEntities; this.cbEntities.DisplayMember = "Name"; this.cbEntities.ValueMember = "PSchema"; }