// 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 } }
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 } }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { //TODO try { if (double.Parse(txtHeigt.Text.ToString()) <= 0 || double.Parse(txtWidht.Text.ToString()) <= 0 || double.Parse(txtFrameWidith.Text.ToString()) <= 0) { MessageBox.Show("Syötetty arvo on 0 tai pienempi. Määritä todelliset arvot"); return; } double result; result = BusinessLogicWindow.CalculatePerimeter(double.Parse(txtHeigt.Text.ToString()), double.Parse(txtWidht.Text.ToString())); txtPerimeter.Text = result.ToString(); result = BusinessLogicWindow.CalculateWindowArea(double.Parse(txtHeigt.Text.ToString()), double.Parse(txtWidht.Text.ToString()), double.Parse(txtFrameWidith.Text.ToString())); txtWindowArea.Text = result.ToString(); result = BusinessLogicWindow.CalculateFrameArea(double.Parse(txtHeigt.Text.ToString()), double.Parse(txtWidht.Text.ToString()), double.Parse(txtFrameWidith.Text.ToString())); txtFrameArea.Text = result.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //yield to an user that everything okay } }
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 } }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { //TODO try { double result; double height = double.Parse(txtHeight.Text); double widht = double.Parse(txtWidht.Text); double karmWidht = double.Parse(txtKarmWidht.Text); BusinessLogicWindow bs = new BusinessLogicWindow(); result = bs.CalculatePerimeter(height, widht); double windowsarea = result - ((height - 2 * karmWidht) * (widht - 2 * karmWidht)); b1.Text = windowsarea.ToString(); double karmarea = result - windowsarea; a1.Text = karmarea.ToString(); double karmpiiri = widht + height + widht + height; c1.Text = karmpiiri.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //yield to an user that everything okay } }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { double ikkunaleveys = double.Parse(txtikkunaleveys.Text); double ikkunakorkeus = double.Parse(txtWindowHeight.Text); double karminpaksuus = double.Parse(txtkarminleveys.Text); //TODO try { double result; result = BusinessLogicWindow.CalculatePerimeter(ikkunaleveys, ikkunakorkeus); ikkunaP.Text = result.ToString("0.##") + " m^2"; double Karminpiiri; Karminpiiri = BusinessLogicWindow.CalculatePiiri(ikkunaleveys, ikkunakorkeus); karmiPiiri.Text = Karminpiiri.ToString("0.##") + "m"; double KarminPA; KarminPA = BusinessLogicWindow.CalculateK_pa(ikkunaleveys, ikkunakorkeus, karminpaksuus); karmiPa.Text = KarminPA.ToString("0.##") + "m^2"; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //yield to an user that everything okay } }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { try { double width = int.Parse(txtWidth.Text); double height = int.Parse(txtHeight.Text); double border = int.Parse(txtBorder.Text); double perimeter, area, borderArea; perimeter = BusinessLogicWindow.CalculatePerimeter(width, height); area = BusinessLogicWindow.CalculateWindowArea(width, height, border); borderArea = BusinessLogicWindow.CalculateBorderArea(width, height, border); tbResult.Text = ""; tbResult.Text += "Lasin pinta-ala: " + area.ToString() + "\n"; tbResult.Text += "Karmin pinta-ala: " + borderArea.ToString() + "\n"; tbResult.Text += "Karmin piiri: " + perimeter.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //yield to an user that everything okay } }
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 } }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { //TODO try { double result; double height = double.Parse(txtHeight.Text); double widht = double.Parse(txtWidht.Text); double karmWidht = double.Parse(txtKarmWidht.Text); BusinessLogicWindow bs = new BusinessLogicWindow(); result = bs.CalculatePerimeter(height, widht); double windowsarea = result - ((height - 2*karmWidht) * (widht - 2*karmWidht)); b1.Text = windowsarea.ToString(); double karmarea = result - windowsarea; a1.Text = karmarea.ToString(); double karmpiiri = widht + height + widht + height; c1.Text = karmpiiri.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //yield to an user that everything okay } }
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 } }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { //TODO try { double result; result = BusinessLogicWindow.CalculatePerimeter(1, 1); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //yield to an user that everything okay } }
private void btnCalculate_Click(object sender, RoutedEventArgs e) { try { double l = Math.Abs(double.Parse(txtWidth.Text)); double h = Math.Abs(double.Parse(txtHeight.Text)); double w = Math.Abs(double.Parse(txtFrameWidth.Text)); txtResult1.Text = BusinessLogicWindow.CalculateWindowArea(l, h, w).ToString(); txtResult2.Text = BusinessLogicWindow.CalculatePerimeter(l, h).ToString(); txtResult3.Text = BusinessLogicWindow.CalculateFrameArea(l, h, w).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //yield to an user that everything okay } }
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(); }