public async Task <ObservableCollection <ApressBook> > GetFeaturedBooks()
        {
            //ApressBookServiceClient client = new ApressBookServiceClient();
            //var result = await client.GetFeaturedBooksAsync();
            //return result;

            ObservableCollection <ApressBook> featuredBooksCollection = new ObservableCollection <ApressBook>();

            ApressBook WPMigration = new ApressBook();

            WPMigration.ApressBookISBN          = "978-1-4302-3816-4";
            WPMigration.ApressBookName          = "Migrating to Windows Phone";
            WPMigration.ApressBookTechnology    = "Windows Phone";
            WPMigration.ApressBookAuthor        = "Jesse Liberty , Jeff Blankenburg";
            WPMigration.ApressBookDescription   = "This book offers everything you'll need to upgrade your existing programming knowledge and begin to develop applications for the Windows Phone.";
            WPMigration.ApressBookImageURI      = "/Assets/MigratingToWP.png";
            WPMigration.ApressBookPublishedDate = new DateTime(2011, 12, 28);
            WPMigration.ApressBookUserLevel     = "Intermediate";

            ApressBook WPRecipes = new ApressBook();

            WPRecipes.ApressBookISBN          = "978-1-4302-4137-9";
            WPRecipes.ApressBookName          = "Windows Phone Recipes";
            WPRecipes.ApressBookTechnology    = "Windows Phone";
            WPRecipes.ApressBookAuthor        = "Fabio Claudio Ferracchiati , Emanuele Garofalo";
            WPRecipes.ApressBookDescription   = "Are you interested in smartphone development? Windows Phone 7.5 (code-named Mango) is packed with new features and functionality that make it a .NET developer's dream. This book contains extensive code samples and detailed walkthroughs that will have you writing sophisticated apps in no time!";
            WPRecipes.ApressBookImageURI      = "/Assets/WPRecipes.png";
            WPRecipes.ApressBookPublishedDate = new DateTime(2011, 12, 14);
            WPRecipes.ApressBookUserLevel     = "Beginner to Intermediate";

            featuredBooksCollection.Add(WPMigration);
            featuredBooksCollection.Add(WPRecipes);

            return(featuredBooksCollection);
        }
        private async void pinButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.flipView.SelectedItem != null)
            {
                ApressBook selectedBook = (ApressBook)this.flipView.SelectedItem;

                this.BottomAppBar.IsSticky = true;

                string uniqueTileID            = selectedBook.ApressBookISBN;
                string shortTileName           = selectedBook.ApressBookName;
                string displayTileName         = selectedBook.ApressBookTechnology;
                string tileActivationArguments = uniqueTileID;
                Uri    logo = new Uri("ms-appx://" + selectedBook.ApressBookImageURI);

                SecondaryTile secondaryTile = new SecondaryTile(uniqueTileID, shortTileName, displayTileName, tileActivationArguments, TileOptions.ShowNameOnLogo, logo);
                secondaryTile.ForegroundText = ForegroundText.Light;
                secondaryTile.SmallLogo      = new Uri("ms-appx:///Assets/SmallLogo.png");

                FrameworkElement pinToStartButton = (FrameworkElement)pinButton;
                Windows.UI.Xaml.Media.GeneralTransform buttonTransform = pinToStartButton.TransformToVisual(null);
                Windows.Foundation.Point point = buttonTransform.TransformPoint(new Point());
                Windows.Foundation.Rect  rect  = new Rect(point, new Size(pinToStartButton.ActualWidth, pinToStartButton.ActualHeight));

                bool isPinned = await secondaryTile.RequestCreateForSelectionAsync(rect, Windows.UI.Popups.Placement.Above);

                this.BottomAppBar.IsSticky = false;
            }
        }
Пример #3
0
        public static ApressBook CreateApressBook(int ID, string apressBookISBN, string apressBookName, string apressBookTechnology, string apressBookAuthor, global::System.DateTime apressBookPublishedDate)
        {
            ApressBook apressBook = new ApressBook();

            apressBook.ID                      = ID;
            apressBook.ApressBookISBN          = apressBookISBN;
            apressBook.ApressBookName          = apressBookName;
            apressBook.ApressBookTechnology    = apressBookTechnology;
            apressBook.ApressBookAuthor        = apressBookAuthor;
            apressBook.ApressBookPublishedDate = apressBookPublishedDate;
            return(apressBook);
        }
        private void dataTransferManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
        {
            if (this.flipView.SelectedItem != null)
            {
                ApressBook selectedBook = (ApressBook)this.flipView.SelectedItem;

                // Set what to share.

                //string textToShare = "Currently Reading Book: Name: " + selectedBook.ApressBookName + " | Author: " + selectedBook.ApressBookAuthor + " | Published: " + selectedBook.DisplayablePublishDate + ".";
                //args.Request.Data.Properties.Title = "Apress Featured BookShare:";
                //args.Request.Data.SetText(textToShare);

                //args.Request.Data.Properties.Title = "Apress Featured BookShare:";
                //args.Request.Data.SetUri(new Uri("http://www.msn.com"));

                //args.Request.Data.Properties.Title = "Apress Featured BookShare:";
                //string someHTML = "<strong>Bold Text</strong> <em>Emphasized Text</em>";
                //args.Request.Data.SetHtmlFormat(HtmlFormatHelper.CreateHtmlFormat(someHTML));


                // DataRequestDeferral deferral = args.Request.GetDeferral();
                //try
                //{

                //    StorageFile storageFile = await localFolder.GetFileAsync("CustomSerializedFile.xml");
                //    List<IStorageItem> storageItems = new List<IStorageItem>();
                //    storageItems.Add(storageFile);

                //    args.Request.Data.Properties.Title = "Apress Featured BookShare:";
                //    args.Request.Data.SetStorageItems(storageItems);
                //}
                //finally
                //{
                //    deferral.Complete();
                //}


                //DataRequestDeferral deferral = args.Request.GetDeferral();
                //try
                //{
                //    StorageFile imageFile = await localFolder.GetFileAsync("Logo.png");

                //    args.Request.Data.Properties.Title = "Apress Featured BookShare:";
                //    args.Request.Data.SetBitmap(RandomAccessStreamReference.CreateFromFile(imageFile));
                //}
                //finally
                //{
                //    deferral.Complete();
                //}
            }
        }
Пример #5
0
        public static Book CreateBook(ApressBook apressBook)
        {
            if (apressBook == null)
            {
                return(null);
            }

            var title = apressBook.Ecommerce.Impressions.FirstOrDefault().Name;
            var url   = apressBook.Url;
            var price = new Price();

            price.Currency = (Currency)Enum.Parse(typeof(Currency), apressBook.Currency, true);
            price.Cost     = apressBook.BestPrice;

            var book = new Book(url, title, "Apress", "", "", price);

            return(book);
        }
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // Allow saved page state to override the initial item to display.
            if (pageState != null && pageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = pageState["SelectedItem"];
            }

            // Get the selected Book Item from Navigation parameter.
            ApressBook selectedBook = (ApressBook)((App)Application.Current).FeaturedBookListVM.FeaturedApressBooks.First(X => X.ApressBookISBN == navigationParameter);

            // Also fetch the corresponding Technology Group.
            GroupedApressBooks selectedGroup = (GroupedApressBooks)((App)Application.Current).FeaturedBookListVM.GroupedFeaturedApressBooks.First(X => X.ApressBookGroupName == selectedBook.ApressBookTechnology);

            this.DefaultViewModel["BookGroup"] = selectedGroup;
            this.DefaultViewModel["BookItems"] = selectedGroup.BookCollection;
            this.flipView.SelectedItem         = selectedBook;
        }
        public void LoadFlipViewDemoVM(FlipViewDemoViewModel flipViewDemoVM)
        {
            flipViewDemoVM.FeaturedWindowsPhoneApressBooks = new ObservableCollection <Models.ApressBook>();

            ApressBook WPMigration = new ApressBook();

            WPMigration.ApressBookISBN          = "978-1-4302-3816-4";
            WPMigration.ApressBookName          = "Migrating to Windows Phone";
            WPMigration.ApressBookAuthor        = "Jesse Liberty , Jeff Blankenburg";
            WPMigration.ApressBookDescription   = "This book offers everything you'll need to upgrade your existing programming knowledge and begin to develop applications for the Windows Phone.";
            WPMigration.ApressBookImageURI      = "/Assets/MigratingToWP.png";
            WPMigration.ApressBookPublishedDate = new DateTime(2011, 12, 28);
            WPMigration.ApressBookUserLevel     = "Intermediate";

            ApressBook WPRecipes = new ApressBook();

            WPRecipes.ApressBookISBN          = "978-1-4302-4137-9";
            WPRecipes.ApressBookName          = "Windows Phone Recipes";
            WPRecipes.ApressBookAuthor        = "Fabio Claudio Ferracchiati , Emanuele Garofalo";
            WPRecipes.ApressBookDescription   = "Are you interested in smartphone development? Windows Phone 7.5 (code-named Mango) is packed with new features and functionality that make it a .NET developer's dream. This book contains extensive code samples and detailed walkthroughs that will have you writing sophisticated apps in no time!";
            WPRecipes.ApressBookImageURI      = "/Assets/WPRecipes.png";
            WPRecipes.ApressBookPublishedDate = new DateTime(2011, 12, 14);
            WPRecipes.ApressBookUserLevel     = "Beginner to Intermediate";

            ApressBook WPAppDev = new ApressBook();

            WPAppDev.ApressBookISBN          = "978-1-4302-3936-9";
            WPAppDev.ApressBookName          = "Windows Phone App Development";
            WPAppDev.ApressBookAuthor        = "Rob Cameron";
            WPAppDev.ApressBookDescription   = "Pro Windows Phone 7 Development helps you unlock the potential of Microsoft's newest mobile platform and updates—NoDo and Mango—to develop visually rich, highly functional applications for the Windows Phone Marketplace.";
            WPAppDev.ApressBookImageURI      = "/Assets/WPAppDev.png";
            WPAppDev.ApressBookPublishedDate = new DateTime(2011, 12, 26);
            WPAppDev.ApressBookUserLevel     = "Intermediate to Advanced";

            flipViewDemoVM.FeaturedWindowsPhoneApressBooks.Add(WPMigration);
            flipViewDemoVM.FeaturedWindowsPhoneApressBooks.Add(WPRecipes);
            flipViewDemoVM.FeaturedWindowsPhoneApressBooks.Add(WPAppDev);
        }
Пример #8
0
        private Book GetBook()
        {
            ApressBook apressBook = null;

            try
            {
                var json = _htmlDocument
                           .DocumentNode
                           .Descendants("script")
                           .Where(y => y.InnerHtml.Contains("\n   dataLayer ="))
                           .FirstOrDefault().InnerText;

                json       = json.Remove(0, 17);
                json       = json.Remove(json.Length - 3, 2);
                apressBook = JsonConvert.DeserializeObject <ApressBook>(json);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error during book conversion from Apress service. \nError:\n" + ex.Message);
            }

            return(BookFactory.CreateBook(apressBook));
        }
        private async void searchPane_SuggestionsRequested(SearchPane sender, SearchPaneSuggestionsRequestedEventArgs args)
        {
            args.Request.SearchSuggestionCollection.AppendQuerySuggestions((from book in ((App)Application.Current).FeaturedBookListVM.FeaturedApressBooks
                                                                            where book.ApressBookName.ToLower().StartsWith(args.QueryText.ToLower())
                                                                            select book.ApressBookName).Take(5));

            IEnumerable <ApressBook> recommendedBooks = from book in ((App)Application.Current).FeaturedBookListVM.FeaturedApressBooks
                                                        where book.ApressBookName.Substring(0, 5).ToLower() == args.QueryText.ToLower()
                                                        select book;

            if (recommendedBooks.Count() > 0)
            {
                ApressBook firstRecommendedBook = null;
                foreach (ApressBook book in recommendedBooks)
                {
                    firstRecommendedBook = book;
                    break;
                }

                StorageFile imageToRead = await localFolder.GetFileAsync("MigratingToWP.png");

                args.Request.SearchSuggestionCollection.AppendResultSuggestion(firstRecommendedBook.ApressBookName, firstRecommendedBook.DisplayablePublishDate, firstRecommendedBook.ApressBookISBN, RandomAccessStreamReference.CreateFromFile(imageToRead), string.Empty);
            }
        }
Пример #10
0
 public void AddToApressBooks(ApressBook apressBook)
 {
     base.AddObject("ApressBooks", apressBook);
 }
        public void LoadFeaturedBooksDemoVM(FeaturedApressBookListViewModel featuredApressBookListVM)
        {
            featuredApressBookListVM.FeaturedApressBooks = new ObservableCollection <Models.ApressBook>();

            ApressBook WPMigration = new ApressBook();

            WPMigration.ApressBookISBN          = "978-1-4302-3816-4";
            WPMigration.ApressBookName          = "Migrating to Windows Phone";
            WPMigration.ApressBookTechnology    = "Windows Phone";
            WPMigration.ApressBookAuthor        = "Jesse Liberty , Jeff Blankenburg";
            WPMigration.ApressBookDescription   = "This book offers everything you'll need to upgrade your existing programming knowledge and begin to develop applications for the Windows Phone.";
            WPMigration.ApressBookImageURI      = "/Assets/MigratingToWP.png";
            WPMigration.ApressBookPublishedDate = new DateTime(2011, 12, 28);
            WPMigration.ApressBookUserLevel     = "Intermediate";

            ApressBook WPRecipes = new ApressBook();

            WPRecipes.ApressBookISBN          = "978-1-4302-4137-9";
            WPRecipes.ApressBookName          = "Windows Phone Recipes";
            WPRecipes.ApressBookTechnology    = "Windows Phone";
            WPRecipes.ApressBookAuthor        = "Fabio Claudio Ferracchiati , Emanuele Garofalo";
            WPRecipes.ApressBookDescription   = "Are you interested in smartphone development? Windows Phone 7.5 (code-named Mango) is packed with new features and functionality that make it a .NET developer's dream. This book contains extensive code samples and detailed walkthroughs that will have you writing sophisticated apps in no time!";
            WPRecipes.ApressBookImageURI      = "/Assets/WPRecipes.png";
            WPRecipes.ApressBookPublishedDate = new DateTime(2011, 12, 14);
            WPRecipes.ApressBookUserLevel     = "Beginner to Intermediate";

            ApressBook WPAppDev = new ApressBook();

            WPAppDev.ApressBookISBN          = "978-1-4302-3936-9";
            WPAppDev.ApressBookName          = "Windows Phone App Development";
            WPAppDev.ApressBookTechnology    = "Windows Phone";
            WPAppDev.ApressBookAuthor        = "Rob Cameron";
            WPAppDev.ApressBookDescription   = "Pro Windows Phone 7 Development helps you unlock the potential of Microsoft's newest mobile platform and updates—NoDo and Mango—to develop visually rich, highly functional applications for the Windows Phone Marketplace.";
            WPAppDev.ApressBookImageURI      = "/Assets/WPAppDev.png";
            WPAppDev.ApressBookPublishedDate = new DateTime(2011, 12, 26);
            WPAppDev.ApressBookUserLevel     = "Intermediate to Advanced";

            ApressBook AzurePlatform = new ApressBook();

            AzurePlatform.ApressBookISBN          = "978-1-4302-3563-7";
            AzurePlatform.ApressBookName          = "Windows Azure Platform";
            AzurePlatform.ApressBookTechnology    = "Windows Azure";
            AzurePlatform.ApressBookAuthor        = "Tejaswi Redkar , Tony Guidici";
            AzurePlatform.ApressBookDescription   = "Learn to architect and build cloud services using the Windows Azure platform. Best practices and techniques for using Windows Azure, SQL Azure and Windows Azure AppFabric are supported by a thorough overview of architectural concepts.";
            AzurePlatform.ApressBookImageURI      = "/Assets/AzurePlatform.png";
            AzurePlatform.ApressBookPublishedDate = new DateTime(2011, 12, 19);
            AzurePlatform.ApressBookUserLevel     = "Intermediate to Advanced";

            ApressBook SQLAzure = new ApressBook();

            SQLAzure.ApressBookISBN          = "978-1-4302-2961-2";
            SQLAzure.ApressBookName          = "Pro SQL Azure";
            SQLAzure.ApressBookTechnology    = "Windows Azure";
            SQLAzure.ApressBookAuthor        = "Scott Klein , Herve Roggero";
            SQLAzure.ApressBookDescription   = "Pro SQL Azure introduces you to Microsoft's cloud-based delivery of its enterprise-caliber, SQL Server database management system—showing you how to program and administer it in a variety of cloud computing scenarios.";
            SQLAzure.ApressBookImageURI      = "/Assets/SQLAzure.png";
            SQLAzure.ApressBookPublishedDate = new DateTime(2010, 10, 29);
            SQLAzure.ApressBookUserLevel     = "Intermediate to Advanced";

            ApressBook UltraFastASP = new ApressBook();

            UltraFastASP.ApressBookISBN          = "978-1-4302-4338-0";
            UltraFastASP.ApressBookName          = "Ultra-Fast ASP.NET 4.5";
            UltraFastASP.ApressBookTechnology    = "ASP.NET";
            UltraFastASP.ApressBookAuthor        = "Rick Kiessig";
            UltraFastASP.ApressBookDescription   = "Ultra-Fast ASP.NET 4.5 provides a practical guide to building extremely fast and scalable web sites using ASP.NET and SQL Server, with eminently usable advice and all of the detail you need to understand the recommendations.";
            UltraFastASP.ApressBookImageURI      = "/Assets/UltraFastASP.png";
            UltraFastASP.ApressBookPublishedDate = new DateTime(2012, 7, 25);
            UltraFastASP.ApressBookUserLevel     = "Intermediate to Advanced";

            ApressBook ASPWebAPI = new ApressBook();

            ASPWebAPI.ApressBookISBN          = "978-1-4302-4725-8";
            ASPWebAPI.ApressBookName          = "Pro ASP.NET Web API";
            ASPWebAPI.ApressBookTechnology    = "ASP.NET";
            ASPWebAPI.ApressBookAuthor        = "Tugberk Ugurlu , Alexander Zeitler";
            ASPWebAPI.ApressBookDescription   = "With the new ASP.NET Web API framework, HTTP has become a first-class citizen of .NET. Pro ASP.NET Web API shows you how to put this new technology into practice to build flexible, extensible web services that run seamlessly on a range of operating systems and devices.";
            ASPWebAPI.ApressBookImageURI      = "/Assets/ASPWebAPI.png";
            ASPWebAPI.ApressBookPublishedDate = new DateTime(2013, 3, 13);
            ASPWebAPI.ApressBookUserLevel     = "Intermediate to Advanced";

            featuredApressBookListVM.FeaturedApressBooks.Add(WPMigration);
            featuredApressBookListVM.FeaturedApressBooks.Add(WPRecipes);
            featuredApressBookListVM.FeaturedApressBooks.Add(WPAppDev);
            featuredApressBookListVM.FeaturedApressBooks.Add(AzurePlatform);
            featuredApressBookListVM.FeaturedApressBooks.Add(SQLAzure);
            featuredApressBookListVM.FeaturedApressBooks.Add(UltraFastASP);
            featuredApressBookListVM.FeaturedApressBooks.Add(ASPWebAPI);
        }