Exemple #1
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                double width, height, borderWidth, result;
                width       = double.Parse(tbWindowWidth.Text);
                height      = double.Parse(tbWindowHeight.Text);
                borderWidth = double.Parse(tbBorderWidth.Text);

                result = BusinessLogicWindow.CalculateArea(width, height);
                lblDisplay_WindowArea.Content = result;

                result = BusinessLogicWindow.CalculatePerimeter(width, height);
                lblDisplay_BorderLength.Content = result;

                result = BusinessLogicWindow.CalculateBorderArea(width, height, borderWidth);
                lblDisplay_BorderArea.Content = result;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //yield to an user that everything okay
            }
        }
Exemple #2
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            double RecWidth  = double.Parse(txtWidth.Text);
            double RecHeight = double.Parse(txtHeight.Text);
            double RecStroke = double.Parse(txtBorder.Text);
            double PerimResult;
            double AreaResult;
            double FrameResult;

            //TODO
            try
            {
                PerimResult = BusinessLogicWindow.CalculatePerimeter(RecWidth, RecHeight);
                string PerimResultText = Convert.ToString(PerimResult);
                tbPerimResult.Text = PerimResultText;
                AreaResult         = BusinessLogicWindow.CalculateArea(RecWidth, RecHeight);
                string AreaResultText = Convert.ToString(AreaResult);
                tbPerimResult.Text = PerimResultText;
                FrameResult        = BusinessLogicWindow.CalculateFrame(RecWidth, RecHeight, RecStroke);
                string FrameResultText = Convert.ToString(FrameResult);
                tbPerimResult.Text = PerimResultText;
                tbAreaResult.Text  = AreaResultText;
                tbFrameResult.Text = FrameResultText;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //yield to an user that everything okay
            }
        }
Exemple #3
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            double windowWidth  = double.Parse(txtWidth.Text);
            double windowHeight = double.Parse(txtHeight.Text);
            double windowBorder = double.Parse(txtBorder.Text);

            try
            {
                double area;
                area         = BusinessLogicWindow.CalculateArea(windowWidth, windowHeight);
                txtArea.Text = area.ToString("0.##") + " m^2";

                double perimeter;
                perimeter = BusinessLogicWindow.CalculatePerimeter(windowWidth, windowHeight);
                txtBorderPerimeter.Text = perimeter.ToString("0.##") + " m";

                double borderArea;
                borderArea         = BusinessLogicWindow.CalculateBorderArea(windowWidth, windowHeight, windowBorder);
                txtBorderArea.Text = borderArea.ToString("0.##") + " m^2";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //MessageBox.Show("Ikkunan koko laskettu");
            }
        }