Exemplo n.º 1
0
        private void Button_Increase(object sender, RoutedEventArgs e)
        {
            RepeatButton b     = (RepeatButton)e.Source;
            TextBox      tb    = (TextBox)this.FindName(b.Tag.ToString());
            double       value = 1;

            if (tb.Text != "" && TryToParse.ParseDouble(tb.Text, out value) && value != 0)
            {
                value += (double)1 / 100;
            }
            tb.Text = value.ToString();
        }
Exemplo n.º 2
0
        void TextBoxComm_TextChanged(object sender, TextChangedEventArgs e)
        {
            string str = TextBoxComm.Text;
            double value;

            if (str != "" && TryToParse.ParseDouble(str, out value) && value != 0)
            {
                commisions = value / 100;
                Recalc();
            }
            else
            {
                TextBoxComm.Text = (commisions * 100).ToString();
            }
        }
Exemplo n.º 3
0
        void TextBoxComm_TextChanged(object sender, TextChangedEventArgs e)
        {
            string str = TextBoxComm.Text;
            double value;

            if (str != "" && TryToParse.ParseDouble(str, out value) && value != 0)
            {
                if (State)
                {
                    DVar.ComBook = value;
                }
                else
                {
                    DVar.ComBf = value;
                }
                Recalc();
            }
            else
            {
                TextBoxComm.Text = State ? DVar.ComBook.ToString() : DVar.ComBf.ToString();
            }
        }
Exemplo n.º 4
0
        private void Recalc()
        {
            string buf   = TextBoxStake.Text;
            double stake = 10;

            if (buf == "" || !TryToParse.ParseDouble(buf, out stake) || stake == 0)
            {
                ShowErrors(); return;
            }

            double back = 10;

            buf = TextBoxBack.Text;
            if (buf == "" || !TryToParse.ParseDouble(buf, out back) || back == 0)
            {
                ShowErrors(); return;
            }

            double lay = 10;

            buf = TextBoxLay.Text;
            if (buf == "" || !TryToParse.ParseDouble(buf, out lay) || lay == 0)
            {
                ShowErrors(); return;
            }



            double laystake = stake;

            if (RBEquel.IsChecked.Value)
            {
                laystake = !State?Math.Round(back *stake / lay, 2) : lay < 2 ? Math.Round(back * stake / ((1 + commisions) * lay - commisions * 2), 2) : Math.Round(back * stake / lay, 2);
            }
            if (RBBack.IsChecked.Value)
            {
                laystake = !State?Math.Round(stake / (lay - 1), 2) : Math.Round((1 + commisions + commisions / 100) * stake, 2);
            }
            if (RBLay.IsChecked.Value)
            {
                laystake = !State?Math.Round(back *stake - stake, 2) : lay < 2 ? Math.Round(stake * (back - 1) / ((1 + commisions) * lay - (1 + commisions)), 2) : Math.Round(stake * (back - 1) / (lay - 1 + commisions), 2);
            }


            double comm = lay < 2 ? (lay - 1) * laystake * commisions : laystake * commisions;

            LabelBackPL.Content   = State ? Math.Round(stake * (back - 1) - (lay - 1) * laystake - comm, 2).ToString() : Math.Round(stake * (back - 1) - laystake, 2).ToString();
            LabelLayPL.Content    = State ? Math.Round(laystake - stake - laystake * commisions, 2).ToString() : Math.Round(laystake * (lay - 1) - stake, 2).ToString();
            LabelLayStake.Content = laystake.ToString();

            if (TextBoxAltStake.Text == "")
            {
                return;
            }
            double altlaystake = 1;

            buf = TextBoxAltStake.Text;
            if (buf == null || !TryToParse.ParseDouble(buf, out altlaystake) || stake == 0)
            {
                return;
            }

            double altcomm = lay < 2 ? (lay - 1) * altlaystake * commisions : altlaystake * commisions;

            LabelAltBackPL.Content = State ? Math.Round(stake * (back - 1) - (lay - 1) * altlaystake - altcomm, 2).ToString() : Math.Round(stake * (back - 1) - altlaystake, 2).ToString();
            LabelAltLayPL.Content  = State ? Math.Round(altlaystake - stake - altlaystake * commisions, 2).ToString() : Math.Round(altlaystake * (lay - 1) - stake, 2).ToString();
        }
Exemplo n.º 5
0
        private void Recalc()
        {
            string buf   = TextBoxStake.Text;
            double stake = 1;

            if (buf == "" || buf == null || !TryToParse.ParseDouble(buf, out stake) || stake == 0)
            {
                ShowErrors(); return;
            }

            double back1 = 1;

            buf = TextBoxBack1.Text;
            if (buf == "" || buf == null || !TryToParse.ParseDouble(buf, out back1) || back1 == 0)
            {
                ShowErrors(); return;
            }

            double back2 = 1;

            buf = TextBoxBack2.Text;
            if (buf == "" || buf == null || !TryToParse.ParseDouble(buf, out back2) || back2 == 0)
            {
                ShowErrors(); return;
            }

            double back3 = 1;

            buf = TextBoxBack3.Text;
            if (buf == "" || buf == null || !TryToParse.ParseDouble(buf, out back3) || back3 == 0)
            {
                ShowErrors(); return;
            }

            double backstake2 = stake;
            double backstake3 = stake;

            if (RBEquel.IsChecked.Value)
            {
                backstake2 = Math.Round(back1 * stake / back2, 2);
                backstake3 = Math.Round(back1 * stake / back3, 2);
            }
            if (RBBack1.IsChecked.Value)
            {
                double value = stake * back3 * (back1 - 1) / (back3 + back2);
                backstake2 = Math.Round(value, 2);
                backstake3 = Math.Round(value * back2 / back3, 2);
            }
            if (RBBack2.IsChecked.Value)
            {
                double value = stake * back1 / back3;
                backstake2 = Math.Round((stake + value) / (back2 - 1), 2);
                backstake3 = Math.Round(value, 2);
            }
            if (RBBack3.IsChecked.Value)
            {
                double value = stake * back1 / back2;
                backstake2 = Math.Round(value, 2);
                backstake3 = Math.Round((stake + value) / (back3 - 1), 2);
            }


            LabelBack1PL.Content = Math.Round(stake * (back1 - 1) - backstake2 - backstake3, 2).ToString();
            LabelBack2PL.Content = Math.Round(backstake2 * (back2 - 1) - stake - backstake3, 2).ToString();
            LabelBack3PL.Content = Math.Round(backstake3 * (back3 - 1) - stake - backstake2, 2).ToString();

            LabelBackStake1.Content = stake.ToString();
            LabelBackStake2.Content = backstake2.ToString();
            LabelBackStake3.Content = backstake3.ToString();

            if (TextBoxAltStake2.Text == "" && TextBoxAltStake3.Text == "")
            {
                return;
            }

            double altstake2 = 1;
            double altstake3 = 1;

            buf = TextBoxAltStake2.Text;
            if (buf == "" || buf == null || !TryToParse.ParseDouble(buf, out altstake2) || altstake2 == 0)
            {
                return;
            }

            buf = TextBoxAltStake3.Text;
            if (buf == "" || buf == null || !TryToParse.ParseDouble(buf, out altstake3) || altstake3 == 0)
            {
                return;
            }

            LabelAlt1PL.Content = Math.Round(stake * (back1 - 1) - altstake2 - altstake3, 2);
            LabelAlt2PL.Content = Math.Round(altstake2 * (back2 - 1) - stake - altstake3, 2);
            LabelAlt3PL.Content = Math.Round(altstake3 * (back3 - 1) - stake - altstake2, 2);
        }