private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            calculator = new CalcQuick();

            this.calculator["base"]   = (3).ToString();
            this.calculator["height"] = (2.5).ToString();
        }
Пример #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            calculator = new CalcQuick();

            this.txtA.Text = "12";
            this.txtB.Text = "=[A] + [C]";
            this.txtC.Text = "13";
        }
Пример #3
0
        public GettingStartedViewModel()
        {
            CalcQuick calculate = new CalcQuick();

            foreach (string formula in calculate.Engine.LibraryFunctions.Keys)
            {
                ListOfFormula.Add(new BindList()
                {
                    Formula = formula
                });
            }

            tempListOfFormula = new ObservableCollection <BindList>(ListOfFormula.OrderBy(c => c.Formula));
            tempListOfFormula.RemoveAt(0);
            tempListOfFormula.RemoveAt(0);
            tempListOfFormula.RemoveAt(0);
            ListOfFormula = tempListOfFormula;
        }
Пример #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //TextBox Angle = new TextBox();
            this.Angle.Name = "Angle";
            this.Angle.Text = "30";

            //cosTB = new TextBox();
            this.cosTB.Name = "cosTB";
            this.cosTB.Text = "= cos([Angle] * pi() / 180) ";

            //sinTB = new TextBox();
            this.sinTB.Name = "sinTB";
            this.sinTB.Text = "= sin([Angle] * pi() / 180) ";

            //Instantiate a CalcQuick object:
            calculator = new CalcQuick();

            this.calculator["Angle"] = this.Angle.Text;
            this.calculator["cosTB"] = this.cosTB.Text;
            this.calculator["sinTB"] = this.sinTB.Text;

            //Mark the calculator dirty:
            this.calculator.SetDirty();

            //Now as the values are retrieved from the calculator, they
            //will be the newly calculated values.
            this.cosTB.Text = this.calculator["cosTB"];
            this.sinTB.Text = this.calculator["sinTB"];

            //Register the controls used in calculations.
            //The formula names used are the Control.Name strings.
            this.calculator.RegisterControlArray(new System.Windows.Controls.Control[]
            {
                this.Angle,
                this.cosTB,
                this.sinTB
            });

            //Allow the CalcQuick sheet to create dependency lists among the formula objects
            //necesary for auto-calculations.
            this.calculator.RefreshAllCalculations();
        }
Пример #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //1) Instantiate a CalcQuick object:
            calculator = new CalcQuick();

            //2) Populate your controls:
            this.txtA.Text = "12";
            this.txtB.Text = "3";
            this.txtC.Text = "= [A] + 2 * [B]";

            //C is the only formula:
            this.lblc.Content = this.txtC.Text;


            //Must enter formula names before turning on calculations.
            //3) Assign formula object names:
            calculator["A"] = this.txtA.Text;
            calculator["B"] = this.txtB.Text;
            calculator["C"] = this.txtC.Text;
            calculator["D"] = this.txtD.Text;

            //4) Turn on auto calculations:
            this.calculator.AutoCalc = true;

            //5) Subscribe to the event to set newly calculated values:
            this.calculator.ValueSet += new QuickValueSetEventHandler(calculator_ValueSet);

            //6) Subscribe to some events (in this case, Leave events) to trigger setting values into CalcQuick:
            this.txtA.LostFocus += new RoutedEventHandler(txtA_MouseLeave);
            this.txtB.LostFocus += new RoutedEventHandler(txtB_MouseLeave);
            this.txtC.LostFocus += new RoutedEventHandler(txtC_MouseLeave);
            this.txtD.LostFocus += new RoutedEventHandler(txtD_MouseLeave);

            //7) Allow the CalcQuick sheet to create dependency lists among the formula objects
            //   necesary for auto-calculations.
            this.calculator.RefreshAllCalculations();
        }