Пример #1
0
        private void ddlCoinFraction_SelectedValueChanged(object sender, EventArgs e)
        {
            if (inhibitFractionChange)
            {
                return;
            }

            // when the ddlCoinFraction dropdown selection is changed, rebase the value of txtSendAmount to follow along

            // first, check that the textbox contains an intelligible Decimal. if not, no reprocessing happens
            decimal currentBoxValue;

            if (decimal.TryParse(txtSendAmount.Text, out currentBoxValue))
            {
                // ok there's a proper number in the box
                decimal wholeCoinEquivalent = currentFraction.toWholeCoin(currentBoxValue);
                currentFraction = (coinFraction)ddlCoinFraction.SelectedItem;

                //decimal newBoxValue = currentFraction.toFraction(wholeCoinEquivalent);
                //txtSendAmount.Text = string.Format("{0:0,0.#,############}", newBoxValue);

                txtSendAmount.Text = currentFraction.formatFractionNumberOnly(wholeCoinEquivalent);
            }
            else
            {
                // not a parseable decimal, so we don't care
                currentFraction = (coinFraction)ddlCoinFraction.SelectedItem;
            }

            // finally, refresh the Labels DDL so that values there are shown in the same Fraction setting
            reloadLabels();

            // and refresh the "add tx fee" checkbox for the same reason
            updateFeeAddCheckbox();
        }
Пример #2
0
        private void setupFractions()
        {
            fractions = new List <coinFraction>();

            currentFraction = new coinFraction("", "", 1);

            fractions.Add(currentFraction);
            fractions.Add(new coinFraction("(1/1000)", "m", 1000));
            fractions.Add(new coinFraction("(1/Million)", "u", 1000000));
        }