Пример #1
0
        public override bool MovePrevious()
        {
            if (Any() == false)
            {
                return(false);
            }

            if (_book.IsFirst)
            {
                if (base.MovePrevious())
                {
                    _book = ViewModeSelector.Create(Value, ViewMode);
                    _book.MoveLast();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(_book.MovePrevious());
            }
        }
Пример #2
0
        public bool MoveAt(string path)
        {
            if (Any() == false)
            {
                return(false);
            }

            int counter = 0;

            foreach (var entry in Entries)
            {
                if (entry.Parent == path)
                {
                    Index = counter;
                }
                counter++;
            }

            _book = ViewModeSelector.Create(Value, ViewMode);
            return(true);
        }
Пример #3
0
        public BookShelf(string path) : base()
        {
            if (File.Exists(path))
            {
                Parent = Path.GetDirectoryName(path);
            }
            else
            {
                Parent = path;
            }

            int counter = 0;
            var entries = Storage.GetBookEntries(Parent);

            if (Any())
            {
                Index = 0;
            }
            foreach (var entry in entries)
            {
                Add(BookMaker.Create(entry));
                if (entry == Parent)
                {
                    Index = counter;
                }
                if (entry == path)
                {
                    Index = counter;
                }

                counter++;
            }

            if (Storage.IsPictureFile(path))
            {
                Value.MoveAt(path);
            }

            _book = ViewModeSelector.Create(Value, ViewMode);
        }