private void Calc(object sender, RoutedEventArgs e) { if (tx_strana1.Text != "" && tx_strana2.Text != "") { try { s1 = Convert.ToDouble(tx_strana1.Text); s2 = Convert.ToDouble(tx_strana2.Text); tx_strana3.Text = ""; } catch { Universal.Error(1); } if ((ci_a1.IsSelected == true && ci_b2.IsSelected == true) || (ci_b1.IsSelected == true && ci_a2.IsSelected == true)) { v = Math.Sqrt(s1 * s1 + s2 * s2); tx_ch.Text = ":c"; } else if ((ci_a1.IsSelected == true || ci_b1.IsSelected == true) && ci_c2.IsSelected == true) { v = Math.Sqrt(s2 * s2 - s1 * s1); if (ci_a1.IsSelected == true) { tx_ch.Text = ":b"; } else if (ci_b1.IsSelected == true) { tx_ch.Text = ":a"; } } else if (ci_c1.IsSelected == true && (ci_a2.IsSelected == true || ci_b2.IsSelected == true)) { v = Math.Sqrt(s1 * s1 - s2 * s2); if (ci_a2.IsSelected == true) { tx_ch.Text = ":b"; } else if (ci_b2.IsSelected == true) { tx_ch.Text = ":a"; } } else { tx_ch.Text = ""; Universal.Error(3); } if (Universal.error == false) { tx_strana3.Text = v.ToString(); } } Universal.error = false; }
private void MemRead(object sender, RoutedEventArgs e) { try { if (Universal.memory != "" && Convert.ToDouble(Universal.memory) % 1 == 0) { tx_vypis.Text = Universal.memory; } } catch { Universal.Error(4); } }
private void MemRead(object sender, RoutedEventArgs e) { try { if (Universal.memory != "" && Convert.ToDouble(Universal.memory) % 1 == 0 && focus != "tx_strana3") { ((TextBox)this.FindName(focus)).Text = Universal.memory; } } catch { Universal.Error(4); } }
private void Calc(object sender, RoutedEventArgs e) { if (ci_dec1.IsSelected == true) { from = 10; } else if (ci_bin1.IsSelected == true) { from = 2; } else if (ci_oct1.IsSelected == true) { from = 8; } else if (ci_hex1.IsSelected == true) { from = 16; } if (ci_dec2.IsSelected == true) { to = 10; } else if (ci_bin2.IsSelected == true) { to = 2; } else if (ci_oct2.IsSelected == true) { to = 8; } else if (ci_hex2.IsSelected == true) { to = 16; } if (tx_vstup.Text != "") { try { tx_vypis.Text = Convert.ToString(Convert.ToInt32(tx_vstup.Text, from), to); } catch { Universal.Error(1); } } }
private void Calc(object sender, RoutedEventArgs e) { if (tx_vypis.Text != "" && op != "") { try { if (op != "xⁿ") { x = Convert.ToDouble(tx_vypis.Text); } else { y = Convert.ToDouble(tx_vypis.Text); } tx_vypis.Text = ""; if (op == "+") { v += x; } else if (op == "-") { v -= x; } else if (op == "*") { v *= x; } else if (op == "/") { if (x == 0) { Universal.Error(2); } else { v /= x; } } else if (op == "xⁿ") { x = v; v = Math.Pow(x, y); } if (Universal.error == false) { tx_vypis.Text = v.ToString(); } else { ClearAll(); } op = ""; } catch { Universal.Error(1); } } Universal.error = false; }
private void Maths(object sender, RoutedEventArgs e) { if (tx_vypis.Text != "") { try { if (op != "xⁿ") { x = Convert.ToDouble(tx_vypis.Text); } else { y = Convert.ToDouble(tx_vypis.Text); } tx_vypis.Text = ""; if (op != "" && op != "x²" && op != "√x") { if (op == "+") { v += x; } else if (op == "-") { v -= x; } else if (op == "*") { v *= x; } else if (op == "/") { if (x == 0) { Universal.Error(2); } else { v /= x; } } else if (op == "xⁿ") { x = v; v = Math.Pow(x, y); } x = v; } if (Universal.error == false) { op = ((Button)sender).Content.ToString(); if (op == "x²") { v = Math.Pow(x, 2); } else if (op == "√x") { v = Math.Sqrt(x); } tx_vypis.Text = v.ToString(); } else { ClearAll(); } } catch { Universal.Error(1); } } Universal.error = false; }