/// <summary>
    /// Adds the periodic updater and subscribes the UserWalletManager events.
    /// </summary>
    protected virtual void OnEnable()
    {
        UserWalletManager.OnWalletLoadSuccessful   += OnWalletLoadSuccessful;
        UserWalletManager.OnWalletLoadUnsuccessful += OnWalletLoadUnsuccessful;

        periodicUpdateManager.AddPeriodicUpdater(this);
    }
 /// <summary>
 /// Checks if purpose was added as the most recent TradableAsset, and starts to update the values for the LockPRPSManager if so.
 /// </summary>
 /// <param name="tradableAsset"> The TradableAsset which was just added to the TradableAssetManager. </param>
 private void CheckIfPRPSAdded(TradableAsset tradableAsset)
 {
     if (tradableAsset.AssetAddress.EqualsIgnoreCase(prpsContract.ContractAddress))
     {
         periodicUpdateManager.AddPeriodicUpdater(this, true);
     }
 }
    /// <summary>
    /// Starts the EtherBalanceObserver.
    /// </summary>
    /// <param name="periodicUpdateManager"> The active PeriodicUpdateManager. </param>
    /// <param name="tradableAssetManager"> The active TradableAssetManager. </param>
    private void StartObserver(PeriodicUpdateManager periodicUpdateManager, TradableAssetManager tradableAssetManager)
    {
        etherAsset = tradableAssetManager.EtherAsset;
        etherAsset.OnAssetBalanceChanged += OnEtherBalanceChanged;

        periodicUpdateManager.AddPeriodicUpdater(this, true);
    }
Exemple #4
0
    /// <summary>
    /// Initializes the EthereumTransactionManager by initializing all collections and adding the proper methods to the events needed.
    /// </summary>
    /// <param name="disposableComponentManager"> The active DisposableComponentManager. </param>
    /// <param name="periodicUpdateManager"> The PeriodicUpdateManager to use when periodically checking for new transactions. </param>
    /// <param name="updateManager"> The UpdateManager to use when getting the transactions for each asset. </param>
    /// <param name="userWalletManager"> The active UserWalletManager. </param>
    /// <param name="apiService"> The active EtherscanApiService. </param>
    /// <param name="tradableAssetManager"> The active TradableAssetManager. </param>
    public EthereumTransactionManager(
        DisposableComponentManager disposableComponentManager,
        PeriodicUpdateManager periodicUpdateManager,
        UpdateManager updateManager,
        TradableAssetManager tradableAssetManager,
        UserWalletManager userWalletManager,
        EtherscanApiService apiService)
    {
        tradableAssetManager.OnTradableAssetAdded            += AddAssetToScrape;
        OptimizedScrollview.OnOptimizedScrollviewInitialized += optimizedScrollview =>
        {
            if (optimizedScrollview.scrollviewKey.Equals("asset_scrollview"))
            {
                scrollview = optimizedScrollview;
                scrollview.OnVisibleItemsChanged += OnVisibleAssetsChanged;

                periodicUpdateManager.AddPeriodicUpdater(this);
            }
        };

        this.tradableAssetManager = tradableAssetManager;
        this.userWalletManager    = userWalletManager;
        this.apiService           = apiService;

        disposableComponentManager.AddDisposable(this);
        updateManager.AddUpdater(this);
    }
Exemple #5
0
    /// <summary>
    /// Initializes the TradableAssetManager by adding required methods to events and adding this class to the PeriodicUpdateManager.
    /// </summary>
    /// <param name="tokenContractManager"> The active TokenContractManager. </param>
    /// <param name="periodicUpdateManager"> The PeriodicUpdateManager to use to run this class's periodic updates. </param>
    /// <param name="disposableComponentManager"> The active DisposableComponentManager. </param>
    public TradableAssetManager(TokenContractManager tokenContractManager, PeriodicUpdateManager periodicUpdateManager, DisposableComponentManager disposableComponentManager)
    {
        disposableComponentManager.AddDisposable(this);

        tokenContractManager.OnTokenAdded        += AddTradableAsset;
        tokenContractManager.OnTokenRemoved      += RemoveTradableAsset;
        UserWalletManager.OnWalletLoadSuccessful += () => periodicUpdateManager.AddPeriodicUpdater(this);
    }
        /// <summary>
        /// Adds all observables/listeners/updaters.
        /// </summary>
        private void AddListenersAndObservables()
        {
            periodicUpdateManager.AddPeriodicUpdater(this);

            gasLimitField.OnInputUpdated += CheckGasLimitField;
            gasPriceField.OnInputUpdated += CheckGasPriceField;
            advancedModeToggle.AddToggleListener(UpdateTransactionFeeVisuals);
        }
    public TradableAssetPriceManager(
        CoinMarketCapDataManager coinMarketCapDataManager,
        DubiExDataManager dubiexDataManager,
        CurrencyManager currencyManager,
        TradableAssetManager tradableAssetManager,
        TradableAssetButtonManager tradableAssetButtonManager,
        PeriodicUpdateManager periodicUpdateManager)
    {
        this.coinMarketCapDataManager = coinMarketCapDataManager;
        this.dubiexDataManager        = dubiexDataManager;
        this.tradableAssetManager     = tradableAssetManager;

        tradableAssetButtonManager.OnActiveButtonChanged += activeButton => UpdatePrice(activeButton.ButtonInfo);
        currencyManager.OnCurrencyChanged += ClearPrices;

        UserWalletManager.OnWalletLoadSuccessful += () => periodicUpdateManager.AddPeriodicUpdater(this);
    }
 /// <summary>
 /// Initializes the GasPriceObserver.
 /// </summary>
 /// <param name="periodicUpdateManager"> The active PeriodicUpdateManager. </param>
 public GasPriceObserver(PeriodicUpdateManager periodicUpdateManager)
 {
     ChooseWalletMenu.OnAppLoaded += () => periodicUpdateManager.AddPeriodicUpdater(this, true);
 }