public MainViewModel()
        {
            SourceDirectories    = new ObservableCollection <SourceDirectory>();
            StarColor            = new SolidColorBrush(Colors.White);
            ScrapedColor         = new SolidColorBrush(Colors.White);
            ToggleFavouriteColor = new SolidColorBrush(Colors.Black);

            _bookDomain   = new BookDomain();
            BookTiles     = new BookTiles();
            BookDetails   = new BookDetails();
            PdfViewer     = new PdfViewer();
            FilterOnTitle = true;
            //  var savedView = AppConfig.LoadSetting("SavedView");
            //switch (savedView)
            //{
            //    case "Tiles":
            //        BookView = BookTiles;
            //        break;

            //    case "Details":
            //        BookView = BookDetails;
            //        break;

            //    default:
            //        BookView = new BookTiles();
            //        break;
            //}
            BookView = BookTiles;
            ProgressService.RegisterSubscriber(this);

            var sortt = new List <string>
            {
                "Title [A-Z]",
                "Title [Z-A]",
                "Date Published [Newest]",
                "Date Published [Oldest]",
                "Date Added [Newest]",
                "Date Added [Oldest]"
            };

            SortList = new ObservableCollection <string>(sortt);
            RefreshAllBooks();
            RefreshPublishersAndAuthors();
            SelectedSort = "Title [A-Z]";
        }
Example #2
0
        public MainPageViewModel()
        {
            ShelfHeight = 0;
            Letters     = new ObservableCollection <Letter>();
            var zero = new Letter {
                Name = "0", LWidth = LetterWidth
            };

            var a = new Letter {
                Name = "A", LWidth = LetterWidth
            };
            var b = new Letter {
                Name = "B", LWidth = LetterWidth
            };
            var c = new Letter {
                Name = "C", LWidth = LetterWidth
            };
            var d = new Letter {
                Name = "D", LWidth = LetterWidth
            };
            var e = new Letter {
                Name = "E", LWidth = LetterWidth
            };
            var f = new Letter {
                Name = "F", LWidth = LetterWidth
            };
            var g = new Letter {
                Name = "G", LWidth = LetterWidth
            };
            var h = new Letter {
                Name = "H", LWidth = LetterWidth
            };
            var i = new Letter {
                Name = "I", LWidth = LetterWidth
            };
            var j = new Letter {
                Name = "J", LWidth = LetterWidth
            };
            var k = new Letter {
                Name = "K", LWidth = LetterWidth
            };
            var l = new Letter {
                Name = "L", LWidth = LetterWidth
            };
            var m = new Letter {
                Name = "M", LWidth = LetterWidth
            };
            var n = new Letter {
                Name = "N", LWidth = LetterWidth
            };
            var o = new Letter {
                Name = "O", LWidth = LetterWidth
            };
            var p = new Letter {
                Name = "P", LWidth = LetterWidth
            };
            var q = new Letter {
                Name = "Q", LWidth = LetterWidth
            };
            var r = new Letter {
                Name = "R", LWidth = LetterWidth
            };
            var s = new Letter {
                Name = "S", LWidth = LetterWidth
            };
            var t = new Letter {
                Name = "T", LWidth = LetterWidth
            };
            var u = new Letter {
                Name = "U", LWidth = LetterWidth
            };
            var v = new Letter {
                Name = "V", LWidth = LetterWidth
            };
            var w = new Letter {
                Name = "W", LWidth = LetterWidth
            };
            var x = new Letter {
                Name = "X", LWidth = LetterWidth
            };
            var y = new Letter {
                Name = "Y", LWidth = LetterWidth
            };
            var z = new Letter {
                Name = "Z", LWidth = LetterWidth
            };

            Letters.Add(zero);
            Letters.Add(a);
            Letters.Add(b);
            Letters.Add(c);
            Letters.Add(d);
            Letters.Add(e);
            Letters.Add(f);
            Letters.Add(g);
            Letters.Add(h);
            Letters.Add(i);
            Letters.Add(j);
            Letters.Add(k);
            Letters.Add(l);
            Letters.Add(m);
            Letters.Add(n);
            Letters.Add(o);
            Letters.Add(p);
            Letters.Add(q);
            Letters.Add(r);
            Letters.Add(s);
            Letters.Add(t);
            Letters.Add(u);
            Letters.Add(v);
            Letters.Add(w);
            Letters.Add(x);
            Letters.Add(y);
            Letters.Add(z);


            ProgressService.RegisterSubscriber(this);
            AllBooks = new List <Book>();


            AllBooks      = ShellViewModel.Books;
            FilteredBooks = new ObservableCollection <Book>(AllBooks);
            GetTags();
            UpdateShelfBooks();
            FilterCount = "Found " + FilteredBooks.Count + " results";


            Ratings = new List <int>();
            Ratings.Add(0);
            Ratings.Add(1);
            Ratings.Add(2);
            Ratings.Add(3);
            Ratings.Add(4);
            Ratings.Add(5);
            BooksScroll = ScrollMode.Enabled;
        }