public UrlSettingViewModel(NethereumHostProvider ethereumHostProvider) { _ethereumHostProvider = ethereumHostProvider; var validUrlAndConnection = this.WhenAnyValue(x => x.Url) .Throttle(TimeSpan.FromSeconds(1), RxApp.MainThreadScheduler) .SelectMany(x => ValidateAndSetUrl(x)) .ObserveOn(RxApp.MainThreadScheduler).ToPropertyEx(this, x => x.ValidUrl); }
public AccountsViewModel(NethereumHostProvider nethereumHostProvider, AccountsService accountsService) { _accountsService = accountsService; _nethereumHostProvider = nethereumHostProvider; _accountsService.Accounts.Connect() .Transform(account => new AccountItemViewModel(account.Address, _nethereumHostProvider, accountsService) ) .AutoRefresh() .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _accounts) .DisposeMany() .Subscribe(); }
public AccountViewModel(NethereumHostProvider ethereumHostProvider) { _ethereumHostProvider = ethereumHostProvider; _ethereumHostProvider.SelectedAccountCallback.Subscribe(address => Address = address); var isValidAddress = this.WhenAnyValue(x => x.Address, (address) => Util.Utils.IsValidAddress(address)); var isValidRefreshBalance = Observable.CombineLatest(_ethereumHostProvider.EnabledCallBack, isValidAddress, (valid, enabled) => valid && enabled); isValidRefreshBalance.Where(x => x == true) .Subscribe(async _ => await RefreshBalanceAsync()); _refreshBalanceCommand = ReactiveCommand.CreateFromTask(RefreshBalanceAsync, isValidRefreshBalance); }
public AccountItemViewModel(string address, NethereumHostProvider ethereumHostProvider, AccountsService accountsService) { _ethereumHostProvider = ethereumHostProvider; _accountsService = accountsService; Address = address; var isValidAddress = this.WhenAnyValue(x => x.Address, (ad) => Util.Utils.IsValidAddress(ad)); var isValidRefreshBalance = Observable.CombineLatest(_ethereumHostProvider.EnabledCallBack, isValidAddress, (valid, enabled) => valid && enabled); isValidRefreshBalance.Where(x => x == true) .Subscribe(async _ => await RefreshBalanceAsync()); _refreshBalanceCommand = ReactiveCommand.CreateFromTask(RefreshBalanceAsync, isValidRefreshBalance); _selectCommand = ReactiveCommand.Create(() => _accountsService.SetSelectedAccount(Address)); }
// Avalonia configuration, don't remove; also used by visual designer. public static AppBuilder BuildAvaloniaApp() { var nethereumHostProvider = new NethereumHostProvider(); var currentAccountTransactionsService = new CurrentAccountTransactionsService(nethereumHostProvider); var accountsService = new AccountsService(nethereumHostProvider); Locator.CurrentMutable.RegisterConstant(accountsService); Locator.CurrentMutable.RegisterConstant(nethereumHostProvider); Locator.CurrentMutable.RegisterConstant(nethereumHostProvider, typeof(IEthereumHostProvider)); Locator.CurrentMutable.RegisterConstant(new ContractService(), typeof(IContractService)); Locator.CurrentMutable.RegisterConstant(currentAccountTransactionsService); Locator.CurrentMutable.Register(() => new SendTransactionUserControl(), typeof(IViewFor <SendTransactionViewModel>)); return(AppBuilder.Configure <App>() .UsePlatformDetect() .LogToTrace() .UseReactiveUI()); }
public AccountsService(NethereumHostProvider nethereumHostProvider) { this.nethereumHostProvider = nethereumHostProvider; }