Пример #1
0
        private void InitializeTextBoxes()
        {
            if (SManager == null)
            {
                return;
            }

            ExchangeSettings settings = SManager.CalculateExchangeSettings(Manager);

            if (settings == null || settings.Error)
            {
                return;
            }

            if (SManager.AssetPrimary.IsFixed)
            {
                #region Setup Primary

                if (!settings.Primary.IsAmountValid) //incorrect amoont outsoide of limmits
                {
                    string fromat = string.Format("<b>Warning ! </b> Primary value of {0} <b>{1}</b> is out of allowed range min {2}, max {3}"
                                                  , settings.Primary.Amount, settings.Primary.Asset.GetEnumName(), settings.Primary.MinAmount, settings.Primary.MaxAmount);
                    AlertsControlPrimary.ShowWarning(fromat);
                }

                if (UTbxAmountSecondary.Text.ParseDecimal(-1) != settings.Secondary.Amount)
                {
                    UTbxAmountSecondaryReset(true);
                }

                #endregion
            }
            else if (SManager.AssetSecondary.IsFixed)
            {
                #region Setup Secondary


                if (!settings.Secondary.IsAmountValid) //incorrect amoont outsoide of limmits
                {
                    string fromat = string.Format("<b>Warning ! </b>Secondary value of {0} <b>{1}</b> is out of allowed range min {2}, max {3}"
                                                  , settings.Secondary.Amount, settings.Secondary.Asset.GetEnumName(), settings.Secondary.MinAmount, settings.Secondary.MaxAmount);
                    AlertsControlSecondary.ShowWarning(fromat);
                }

                if (UTbxAmountPrimary.Text.ParseDecimal(-1) != settings.Primary.Amount)
                {
                    UTbxAmountPrimaryReset(true);
                }

                #endregion
            }

            this.InitializeTextBoxesColors();
        }
        /// <summary>
        /// Updates all controls form ExchangeControl, and triggers update from Fundings Control
        /// </summary>
        public void UpdateAll()
        {
            AlertsControlPrimary.HideAll();
            AlertsControlSecondary.HideAll();

            this.InitializeButtons();
            this.InitializeDropDowns();
            this.InitializeTextBoxes();


            UTbxAmountPrimaryReset(true);
            UTbxAmountSecondaryReset(true);

            this.UpdateAllPanells();

            SManager.FundingDeposit.UpdateAllCotrols  = true;
            SManager.FundingWithdraw.UpdateAllCotrols = true;
        }