Exemplo n.º 1
0
        static void Main(string[] args)
        {
            CalciCompositionHelper objCalciFactory = new CalciCompositionHelper();

            //Assembles the calculator components that will participate in composition
            objCalciFactory.AssembleCalculatorComponents();

            //Gets the result
            var result1 = objCalciFactory.GetResult(100, 10, "Add");

            Console.WriteLine(result1);

            var result2 = objCalciFactory.GetResult(100, 10, "Subtract");

            Console.WriteLine(result2);

            var result3 = objCalciFactory.GetResult(100, 10, "Multiply");

            Console.WriteLine(result3);

            var result4 = objCalciFactory.GetResult(100, 10, "Divide");

            Console.WriteLine(result4);

            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main1(string[] args)
        {
            var objCompHelper = new CalciCompositionHelper();

            //Assembles the calculator components that will participate in composition
            objCompHelper.AssembleCalculatorComponents();

            var result = objCompHelper.GetResult(1, 2, "+");

            Console.ReadLine();
        }
Exemplo n.º 3
0
        private void DoCalciOperation(string operationType)
        {
            objCalciFactory = new CalciCompositionHelper();

            //Assembles the calculator components that will participate in composition
            objCalciFactory.AssembleCalculatorComponents();

            //Gets the result
            var result = objCalciFactory.GetResult(Convert.ToInt32(txtFirstNumber.Text), Convert.ToInt32(txtSecondNumber.Text), operationType);

            //Display the result
            txtResult.Text = result.ToString();
        }
Exemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();

            objCompHelper = new CalciCompositionHelper();

            //Assembles the calculator components that will participate in composition
            objCompHelper.AssembleCalculatorComponents();

            if (objCompHelper != null &&
                objCompHelper.CalciPlugins != null &&
                objCompHelper.CalciPlugins.Count() > 0)
            {
                foreach (var CalciPlugin in objCompHelper.CalciPlugins)
                {
                    comboBox.Items.Add(CalciPlugin.Metadata["CalciMetaData"]);
                }

                //comboBox.SelectedIndex = 0;
            }
        }