public void UpdateCurrentInfo(INavigatorListEntry navigatorListEntry, int number)
        {
            OrderNumber = number;

            if (navigatorListEntry == null)
            {
                HasValue  = false;
                Name      = null;
                Size      = null;
                Hash      = null;
                _fileInfo = null;
                return;
            }

            var fi = new FileInfo(navigatorListEntry.Path);

            if (!fi.SpeedExists())
            {
                return;
            }

            HasValue  = true;
            Name      = fi.Name;
            Size      = fi.Length;
            Hash      = null;
            _fileInfo = fi;
        }
Exemplo n.º 2
0
        public async void UpdateCurrentTags(INavigatorListEntry listEntry)
        {
            if (listEntry?.DbId == null)
            {
                IsRateSetted = false;

                return;
            }

            var id = listEntry.DbId.Value;

            var tags = await Task.Run(() =>
            {
                return(ImoutoService.Use(imoutoService =>
                {
                    return imoutoService.GetImageTags(id);
                }));
            });

            _lastListEntryId = id;

            var tagVmsCollection = tags.Where(x => x.Tag.Type.Title != "LocalMeta")
                                   .Select(x => new BindedTagVM(x, listEntry.DbId))
                                   .ToList();

            CurrentTagsSources.Clear();

            var userTags = tagVmsCollection.Where(x => x.Model.Source == Source.User)
                           .ToList();

            if (userTags.Any())
            {
                CurrentTagsSources.Add(new TagSourceVM
                {
                    Title = "User",
                    Tags  = new ObservableCollection <BindedTagVM>(userTags)
                });
            }

            var parsedSources = tagVmsCollection.Select(x => x.Model.Source)
                                .Where(x => x != Source.User)
                                .Distinct();

            foreach (var parsedSource in parsedSources)
            {
                CurrentTagsSources.Add(new TagSourceVM
                {
                    Title = parsedSource.ToString(),
                    Tags  = new ObservableCollection <BindedTagVM>(tagVmsCollection.Where(x => x.Model.Source == parsedSource)
                                                                   .OrderBy(x => x.TypePriority)
                                                                   .ThenBy(x => x.Tag.Title))
                });
            }

            GetFavorite(tags);
            GetRate(tags);
            IsRateSetted = true;
        }