Esempio n. 1
0
        public Task Refresh() => Task.Run(async() =>
        {
            _connectable.Clear();
            var models    = await _blobCache.GetAllObjects <ProviderModel>();
            var providers = models
                            .Where(model => model != null && _factories.ContainsKey(model.Type))
                            .Select(model => _factories[model.Type](model.Id));

            foreach (var provider in providers)
            {
                _connectable.AddOrUpdate(provider);
            }
        });
        public CurrentAccountTransactionsService(IEthereumHostProvider ethereumHostProvider, int updateIntervalMilliseconds = 2000)
        {
            updateInterval            = TimeSpan.FromMilliseconds(updateIntervalMilliseconds);
            this.ethereumHostProvider = ethereumHostProvider;
            this.ethereumHostProvider.SelectedAccountCallback.Subscribe(address =>
            {
                if (address != currentAccount)
                {
                    currentAccount = address;
                    _transactions.Clear();
                    //We should save ... reload
                }
            });

            timer = Observable.Timer(updateInterval, updateInterval, RxApp.MainThreadScheduler)
                    .Subscribe(async _ => await CheckReceiptsAsync());
        }
Esempio n. 3
0
        public async Task Refresh()
        {
            _connectable.Clear();
            var models = await _blobCache
                         .GetAllObjects <ProviderModel>()
                         .SubscribeOn(Scheduler.Default);

            var providers = models
                            .Where(model => model != null && _factories.ContainsKey(model.Type))
                            .Select(model => _factories[model.Type](model));

            _connectable.Edit(cache =>
            {
                foreach (var provider in providers)
                {
                    cache.AddOrUpdate(provider);
                }
            });
        }
Esempio n. 4
0
        private async Task OnReloadClicked(SourceCache <Neuron, int> cache)
        {
            this.Loading = true;

            await Helper.SetStatusOnComplete(async() =>
            {
                cache.Clear();
                var relatives = await this.neuronQueryService.GetNeurons(this.AvatarUrl);
                this.originService.Save(this.AvatarUrl);
                relatives.FillUIIds(null);
                cache.AddOrUpdate(relatives);
                this.InitRegion();
                return(true);
            },
                                             "Reload successful.",
                                             this.statusService
                                             );

            this.Loading = false;
        }
        public void Refresh_Click()
        {
            var list = new List <AuthorizedDevice>();

            var userlist = steamService.GetRememberUserList();
            var allList  = steamService.GetAuthorizedDeviceList();
            int count    = allList.Count - 1;

            foreach (var item in allList)
            {
                var temp = userlist.FirstOrDefault(x => x.SteamId3_Int == item.SteamId3_Int);
                item.SteamNickName = temp?.SteamNickName;
                item.ShowName      = item.SteamNickName + $"({item.SteamId64_Int})";
                item.AccountName   = temp?.AccountName;
                item.First         = item.Index == 0;
                item.End           = item.Index == count;
                list.Add(item);
            }
            _AuthorizedSourceList.Clear();
            _AuthorizedSourceList.AddOrUpdate(list);
            //_AuthorizedSourceList.Refresh();

            Refresh_Cash().ConfigureAwait(false);
        }
Esempio n. 6
0
        public NeuronGraphPaneViewModel(INeuronService neuronService = null)
        {
            this.neuronService = neuronService ?? Locator.Current.GetService <INeuronService>();

            bool DefaultPredicate(Node <NeuronDto, int> node) => node.IsRoot;

            var cache = new SourceCache <NeuronDto, int>(x => x.Id);

            this.AddCommand = ReactiveCommand.Create(() =>
                                                     this.neuronService.Add(cache, NeuronService.CreateNeuron("Root Neuron", ChildType.NotSet)));
            this.ReloadCommand = ReactiveCommand.Create(() => {
                cache.Clear();
                this.neuronService.Reload(cache);
            });
            this.cleanUp = cache.AsObservableCache().Connect()
                           .TransformToTree(child => child.ParentId, Observable.Return((Func <Node <NeuronDto, int>, bool>)DefaultPredicate))
                           .Transform(e =>
                                      e.Item.Type == ChildType.Postsynaptic ?
                                      (NeuronViewModelBase)(new PostsynapticViewModel(e.Item.Data, e, cache)) :
                                      (NeuronViewModelBase)(new PresynapticViewModel(e.Item.Data, e, cache)))
                           .Bind(out this.children)
                           .DisposeMany()
                           .Subscribe();
        }
        public NuGetPackageListViewModel(INavigationService navigationService, INuGetPackageService nugetPackageService)
        {
            _navigationService   = navigationService;
            _nugetPackageService = nugetPackageService;

            PackageDetails = ReactiveCommand.CreateFromTask <NuGetPackageViewModel>(ExecutePackageDetails);
            Refresh        = ReactiveCommand.CreateFromTask(ExecuteRefresh);

            Refresh.ThrownExceptions.Subscribe(exception => this.Log().Warn(exception));
            PackageDetails.ThrownExceptions.Subscribe(exception => this.Log().Warn(exception));

            var nugetChangeSet =
                _nugetCache
                .Connect()
                .RefCount();

            var sortChanged =
                this.WhenAnyValue(x => x.SelectedTag)
                .Where(x => !string.IsNullOrEmpty(x))
                .Select(selectedTag =>
                        SortExpressionComparer <NuGetPackageViewModel>
                        .Ascending(x => x.PackageMetadata.DownloadCount)
                        .ThenByAscending(x => x.PackageMetadata.Tags.Contains(selectedTag)));

            nugetChangeSet
            .Transform(x => new NuGetPackageViewModel(x))
            .Sort(sortChanged)
            .Bind(out _searchResults)
            .DisposeMany()
            .Subscribe()
            .DisposeWith(Disposal);

            _nugetCache
            .CountChanged
            .Select(count => count > 0)
            .ToProperty(this, x => x.HasItems, out _hasItems)
            .DisposeWith(Disposal);

            nugetChangeSet
            .Transform(x => x.Tags.Split(','))
            .RemoveKey()
            .TransformMany(x => x)
            .DistinctValues(x => x)
            .Bind(out _tags)
            .Subscribe()
            .DisposeWith(Disposal);

            Search =
                ReactiveCommand.CreateFromObservable <string, IEnumerable <IPackageSearchMetadata> >(SearchNuGetPackages);

            Search
            .Select(packageSearchMetadata => packageSearchMetadata)
            .Subscribe(packages =>
                       _nugetCache.EditDiff(packages, (first, second) => first.Identity.Id == second.Identity.Id))
            .DisposeWith(Disposal);

            this.WhenAnyValue(x => x.SearchText)
            .Where(x => !string.IsNullOrEmpty(x))
            .Throttle(TimeSpan.FromMilliseconds(750), RxApp.TaskpoolScheduler)
            .Select(term => term.Trim())
            .DistinctUntilChanged()
            .InvokeCommand(this, x => x.Search)
            .DisposeWith(Disposal);

            this.WhenAnyValue(x => x.SearchText)
            .Where(string.IsNullOrEmpty)
            .Subscribe(_ => _nugetCache.Clear())
            .DisposeWith(Disposal);

            this.WhenAnyObservable(x => x.Refresh.IsExecuting)
            .StartWith(false)
            .DistinctUntilChanged()
            .ToProperty(this, x => x.IsRefreshing, out _isRefreshing)
            .DisposeWith(Disposal);
        }
 /// <inheritdoc/>
 public void RemoveAll() => _sourceCache.Clear();
Esempio n. 9
0
 public void Clear() => _favouriteWeatherInfoModel.Clear();
Esempio n. 10
0
 public void TearDown()
 {
     _source.Clear();
 }
 public void Clear()
 {
     _cache.Clear();
 }
Esempio n. 12
0
 public void Clear()
 => source.Clear();
Esempio n. 13
0
 public void TearDown()
 {
     _cache.Clear();
 }
Esempio n. 14
0
 protected void Clear()
 {
     _sourceCache.Clear();
 }
Esempio n. 15
0
 /// <inheritdoc/>
 public void RemoveAll() => _store.Clear();