Пример #1
0
        // Huono tapa. Toteutus sekametelinä.
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                double windowArea      = 0;
                double borderPerimeter = 0;
                double borderArea      = 0;

                double winX   = Double.Parse(txtWidth.Text);
                double winY   = Double.Parse(txtHeight.Text);
                double border = Double.Parse(txtBorder.Text);

                windowArea      = BusinessLogicWindow.CalculateArea(winX, winY);
                borderPerimeter = BusinessLogicWindow.CalculatePerimeter(winX + (border * 2), winY + (border * 2));
                borderArea      = BusinessLogicWindow.CalculateArea(winX + (border * 2), winY + (border * 2)) - windowArea;

                txtWindowArea.Text      = windowArea.ToString();
                txtBorderPerimeter.Text = borderPerimeter.ToString();
                txtBorderArea.Text      = borderArea.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //yield to an user that everything okay
            }
        }
Пример #2
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
            }
        }
Пример #3
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            //TODO
            try
            {
                double resultPer, resultArea, resultBzlArea;

                double width    = double.Parse(txtWidht.Text);
                double height   = double.Parse(txtHeight.Text);
                double bzlWidth = double.Parse(txtBzlWidth.Text);

                resultBzlArea = BusinessLogicWindow.BezelCalculateArea(bzlWidth, width, height);
                resultPer     = BusinessLogicWindow.CalculatePerimeter(width, height);
                resultArea    = BusinessLogicWindow.CalculateArea(width, height) - resultBzlArea;


                txtArea.Text    = resultArea.ToString();
                txtPer.Text     = resultPer.ToString();
                txtBzlArea.Text = resultBzlArea.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //yield to an user that everything okay
            }
        }
Пример #4
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            //TODO
            try
            {
                double width, height, karmi, areaWindow, karmiPerimeter, karmiArea;

                width  = System.Convert.ToDouble(txtWidht.Text); // Convert string to double
                height = System.Convert.ToDouble(txtHeight.Text);
                karmi  = System.Convert.ToDouble(txtKarmiWidth.Text);

                areaWindow             = BusinessLogicWindow.CalculateArea(width, height);                // Calculate area of the window
                txtIkkunaPintaAla.Text = System.Convert.ToString(areaWindow);                             // Set value to textbox

                karmiPerimeter     = BusinessLogicWindow.CalculatePerimeter(width, height, karmi);        // Calculate perimeter
                txtKarmiPiiri.Text = System.Convert.ToString(karmiPerimeter);                             // Set value to textbox

                karmiArea             = BusinessLogicWindow.CalculatePerimeterArea(width, height, karmi); // Calculate perimeter
                txtKarmiPintaAla.Text = System.Convert.ToString(karmiArea);                               // Set value to textbox
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //yield to an user that everything okay
            }
        }
Пример #5
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            //TODO
            try
            {
                double result;
                result      = BusinessLogicWindow.CalculateArea(double.Parse(txtWidht.Text), double.Parse(txtHeight.Text));
                txtAla.Text = result.ToString();

                double result2;
                result2       = BusinessLogicWindow.CalculatePerimeter(double.Parse(txtWidht.Text), double.Parse(txtHeight.Text));
                txtPiiri.Text = result2.ToString();

                double result3;
                result3    = BusinessLogicWindow.CalculateKarmi(double.Parse(txtWidht.Text), double.Parse(txtHeight.Text), double.Parse(txtKarmi.Text));
                txtKA.Text = result3.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //yield to an user that everything okay
            }
        }
Пример #6
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            double resultWndArea = 0, resultFrmArea = 0, resultFrmPerimeter = 0;

            //TODO
            try
            {
                resultWndArea      = BusinessLogicWindow.CalculateArea(Convert.ToDouble(txtWidht.Text), Convert.ToDouble(txtHeight.Text));
                resultFrmPerimeter = BusinessLogicWindow.CalculatePerimeter(Convert.ToDouble(txtWidht.Text), Convert.ToDouble(txtHeight.Text));
                resultFrmArea      = BusinessLogicWindow.CalculateArea(Convert.ToDouble(txtFrmWidth.Text), resultFrmPerimeter);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //yield to an user that everything okay
            }
            txtResultWndArea.Text      = resultWndArea.ToString();
            txtResultFrmArea.Text      = resultFrmArea.ToString();
            txtResultFrmPerimeter.Text = resultFrmPerimeter.ToString();
        }