Beispiel #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
            }
        }
Beispiel #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
            }
        }
Beispiel #3
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            //TODO
            double width;
            double height;
            double frame;
            double perimeter;
            double windowarea;
            double framearea;

            try
            {
                width     = double.Parse(txtWidht.Text);
                height    = double.Parse(txtHeight.Text);
                frame     = double.Parse(txtFrameWidth.Text);
                perimeter = BusinessLogicWindow.CalculatePerimeter(width, height, frame);
                // double result;
                // result = BusinessLogicWindow.CalculatePerimeter(1, 1);
                //Ei näin: BusinessLogicWindow.CalculatePerimeter(1, 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //yield to an user that everything okay
            }
        }
Beispiel #4
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            double WindowWidth;
            double WindowHeight;
            double FrameHorizontal;
            double FrameVertical;
            double WidthWithFrame;
            double HeightWithFrame;
            double area;
            double perimeter;
            double FrameArea;

            //TODO
            try {
                double FrameWidth = double.Parse((txtWidthFrame.Text));

                area = BusinessLogicWindow.CalculateWindowArea(WindowWidth = double.Parse(txtWidthWindow.Text), WindowHeight = double.Parse(txtHeightWindow.Text)) / 1000000;
                tbWindowAreaResult.Text = area.ToString("0.##") + " m^2";

                perimeter = BusinessLogicWindow.CalculateFramePerimeter(FrameHorizontal = WindowWidth, FrameVertical = WindowHeight + double.Parse((txtWidthFrame.Text)) * 2) / 1000;
                tbFramePerimeterResult.Text = perimeter.ToString("0.##") + " m";

                FrameArea = BusinessLogicWindow.CalculateFrameArea(WidthWithFrame = WindowWidth + FrameWidth * 2, HeightWithFrame = WindowHeight + FrameWidth * 2, WindowWidth, WindowHeight) / 1000000;
                tbFrameAreaResult.Text = FrameArea.ToString("0.###") + " m^2";
            }
            catch (Exception ex) {
                MessageBox.Show("Joku kenttä jäi tyhjäksi!");
            }
            finally {
                //tell user that everything is okay
            }
        }
Beispiel #5
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            //TODO
            try
            {
                double result;
                double windowheight = Convert.ToDouble(txtHeight.Text.ToString());
                double windowwidth  = Convert.ToDouble(txtWidht.Text.ToString());
                double karmi        = Convert.ToDouble(txtKarmi.Text.ToString());
                //Laitetaan koot suorakulmiolle
                myRectangle.Height          = windowheight;
                myRectangle.Width           = windowwidth;
                myRectangle.StrokeThickness = karmi;
                //Ikkunan pinta-ala
                result             = BusinessLogicWindow.CalculatePerimeter(windowheight, windowwidth);
                txtWindowArea.Text = result.ToString();

                //Karmin piiri...
                result             = BusinessLogicWindow.Calculate(windowwidth, windowheight, karmi);
                txtKarmiPiiri.Text = result.ToString();

                //Karmin pinta-ala...
                result             = BusinessLogicWindow.CalculatePerimeter2(windowwidth, windowheight, karmi);
                txtKarmiPinta.Text = result.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //yield to an user that everything okay
            }
        }
Beispiel #6
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");
            }
        }
Beispiel #7
0
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                double width          = double.Parse(txtWidth.Text);
                double height         = double.Parse(txtHeight.Text);
                double frameWidth     = double.Parse(txtFrameWidth.Text);
                double windowArea     = BusinessLogicWindow.CalculateWindowArea(width, height) * (1E-6);
                double frameArea      = BusinessLogicWindow.CalculateFrameArea(width, height, frameWidth) * (1E-6);
                double framePerimeter = BusinessLogicWindow.CalculatePerimeter(width, height, frameWidth);

                txtWindowArea.Text     = windowArea.ToString() + "m\xB2";
                txtFrameArea.Text      = frameArea.ToString() + "m\xB2";
                txtFramePerimeter.Text = framePerimeter.ToString() + "mm";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #8
0
        public static double CalculateFrameArea(double width, double height, double windowwidth, double windowheight)
        {
            double area = (width * height) - BusinessLogicWindow.CalculateWindowArea(windowwidth, windowheight);

            return(area);
        }