Exemplo n.º 1
0
        public async void Book_Clicked(object sender, EventArgs e)
        {
            BookPage myHomePage = new BookPage();

            NavigationPage.SetHasNavigationBar(myHomePage, true);
            await Navigation.PushModalAsync(myHomePage);
        }
Exemplo n.º 2
0
        public virtual IList <TermResult> GetBooksTermResults(List <string> bookGuidList,
                                                              TermCriteriaQueryCreator queryCreator)
        {
            using (var session = GetSession())
            {
                Book        bookAlias        = null;
                BookVersion bookVersionAlias = null;
                BookPage    bookPageAlias    = null;
                Term        termAlias        = null;
                TermResult  termResultAlias  = null;

                var result = session.QueryOver(() => bookAlias)
                             .JoinQueryOver(x => x.LastVersion, () => bookVersionAlias)
                             .JoinQueryOver(x => x.BookPages, () => bookPageAlias)
                             .JoinQueryOver(x => x.Terms, () => termAlias)
                             .SelectList(list => list
                                         .Select(() => bookAlias.Id).WithAlias(() => termResultAlias.BookId)
                                         .Select(() => bookPageAlias.Text).WithAlias(() => termResultAlias.PageName)
                                         .Select(() => bookPageAlias.XmlId).WithAlias(() => termResultAlias.PageXmlId))
                             .OrderBy(() => bookAlias.Id).Asc
                             .OrderBy(() => bookPageAlias.Position).Asc
                             .WhereRestrictionOn(() => bookAlias.Guid).IsInG(bookGuidList)
                             .And(queryCreator.GetCondition())
                             .TransformUsing(Transformers.AliasToBean <TermResult>())
                             .List <TermResult>();

                return(result);
            }
        }
Exemplo n.º 3
0
 public static PageParameters ResetPage(BookPage source, CornerOrigin origin)
 {
     return(new PageParameters(source.RenderSize)
     {
         Page0ShadowOpacity = 0.0, Page1ClippingFigure = new PathFigure(), Page1ReflectionStartPoint = new Point(0.0, 0.0), Page1ReflectionEndPoint = new Point(0.0, 0.0), Page1RotateAngle = 0.0, Page1RotateCenterX = 0.0, Page1RotateCenterY = 0.0, Page1TranslateX = 0.0, Page1TranslateY = 0.0, Page2ClippingFigure = new PathFigure(), Page0ShadowStartPoint = new Point(0.0, 0.0), Page0ShadowEndPoint = new Point(0.0, 0.0)
     });
 }
Exemplo n.º 4
0
        public virtual IList <string> GetTermsByBookType(string query, BookTypeEnum bookType, IList <long> bookIdList, int recordCount)
        {
            using (var session = GetSession())
            {
                Book        bookAlias        = null;
                BookVersion bookVersionAlias = null;
                Category    categoryAlias    = null;
                BookType    bookTypeAlias    = null;
                BookPage    pageAlias        = null;
                Term        termAlias        = null;

                var dbQuery = session.QueryOver(() => bookAlias)
                              .JoinQueryOver(x => x.LastVersion, () => bookVersionAlias)
                              .JoinQueryOver(x => x.Categories, () => categoryAlias)
                              .JoinQueryOver(x => categoryAlias.BookType, () => bookTypeAlias)
                              .JoinQueryOver(x => bookVersionAlias.BookPages, () => pageAlias)
                              .JoinQueryOver(x => pageAlias.Terms, () => termAlias)
                              .Select(Projections.Distinct(Projections.Property(() => termAlias.Text)))
                              .Where(x => bookTypeAlias.Type == bookType)
                              .AndRestrictionOn(() => termAlias.Text).IsInsensitiveLike(query);

                if (bookIdList != null)
                {
                    dbQuery.AndRestrictionOn(() => bookAlias.Id).IsInG(bookIdList);
                }

                return(dbQuery
                       .Take(recordCount)
                       .List <string>());
            }
        }
Exemplo n.º 5
0
    private IEnumerator SwitchGames(bool nextGame, BookPage page)
    {
        yield return(CameraSetTexture(printTexture));

        yield return(CameraSetTexture(updatedTexture));

        pageAnimator.SetFloat("FlipTime", flipTime);

        page.EnablePage();

        if (nextGame)
        {
            SetupToNextPage();
            pageAnimator.SetTrigger("GoNext");
        }
        else
        {
            SetupToReturnPage();
            pageAnimator.SetTrigger("GoPrev");
        }

        yield return(new WaitForSeconds(0));

        yield return(new WaitForSeconds(flipTime * pageAnimator.GetCurrentAnimatorStateInfo(0).length));

        page.StartPage();
    }
Exemplo n.º 6
0
        public virtual IList <TermCountResult> GetBooksTermResultsCount(List <string> bookGuidList,
                                                                        TermCriteriaQueryCreator queryCreator)
        {
            using (var session = GetSession())
            {
                Book            bookAlias        = null;
                BookVersion     bookVersionAlias = null;
                BookPage        bookPageAlias    = null;
                Term            termAlias        = null;
                TermCountResult termResultAlias  = null;

                var result = session.QueryOver(() => bookAlias)
                             .JoinQueryOver(x => x.LastVersion, () => bookVersionAlias)
                             .JoinQueryOver(x => x.BookPages, () => bookPageAlias)
                             .JoinQueryOver(x => x.Terms, () => termAlias)
                             .Select(Projections.ProjectionList()
                                     .Add(Projections.Group(() => bookAlias.Id).WithAlias(() => termResultAlias.BookId))
                                     .Add(
                                         Projections.CountDistinct(() => bookPageAlias.Id)
                                         .WithAlias(() => termResultAlias.PagesCount))
                                     )
                             .WhereRestrictionOn(() => bookAlias.Guid).IsInG(bookGuidList)
                             .And(queryCreator.GetCondition())
                             .TransformUsing(Transformers.AliasToBean <TermCountResult>())
                             .List <TermCountResult>();

                return(result);
            }
        }
Exemplo n.º 7
0
        public void BookEditing()
        {
            string expectedTitle      = "New Test Title";
            string expectedDate       = "10/20/2020";
            string expectedRating     = "5";
            string expectedPagesCount = "50";

            BookPage page = new BookPage(Browser);

            page.Open();

            page.OpenEditingModal();

            page.PopulateEditingModal(expectedTitle, expectedDate, expectedRating, expectedPagesCount);

            page.SubmitEditingModal();

            string actulaTitle      = page.FindLastRecordTitle();
            string actulaDate       = page.FindLastRecordDate();
            string actulaRating     = page.FindLastRecordRating();
            string actulaPagesCount = page.FindLastRecordPagesCount();

            Assert.AreEqual(expectedTitle, actulaTitle);
            Assert.AreEqual(expectedDate, actulaDate);
            Assert.AreEqual(expectedRating, actulaRating);
            Assert.AreEqual(expectedPagesCount, actulaPagesCount);
        }
Exemplo n.º 8
0
 public MoveBookPageDownTool(List <BookPage> bookPagesList, BookPage page)
 {
     this.bookPagesList   = bookPagesList;
     this.bookPage        = page;
     this.oldElementIndex = bookPagesList.IndexOf(bookPage);
     this.newElementIndex = oldElementIndex + 1;
 }
Exemplo n.º 9
0
        static void BuildChangelogBook(string dir)
        {
            Console.WriteLine("building book: Changelog");
            if (!FileExists(dir, "index.html"))
            {
                Console.WriteLine("please create index.html at /changelog");
                return;
            }

            var fileName = CombineDir(RootFolder, "Changelog.hhc");

            using (var fout = new StreamWriter(fileName, false, Encoding.UTF8))
            {
                // header
                fout.WriteLine(NewBook.Gen("\t", "Changelog", "changelog/index.html"));

                // pages
                var tab2 = "\t\t";
                var vers = Directory.GetFiles(dir, "*.???*.htm*")
                           .OrderByDescending(f => f);
                foreach (var fn in vers)
                {
                    var url   = fn.Replace(RootFolder, "");
                    var title = Titles[fn];
                    fout.WriteLine(BookPage.Gen(tab2, title, url));
                }

                //footer
                fout.WriteLine(EndBook.Gen("\t", "", ""));
            }
        }
        // IMPORTANT - This style selector is suitable for the BookPage model class only!
        public override Style SelectStyle(object item, DependencyObject container)
        {
            Style    selectedStyle;
            BookPage bookPage = item as BookPage;

            if (bookPage == null)
            {
                throw new InvalidOperationException("This style selector can be used with the BookPage model class only.");
            }

            switch (bookPage.Type)
            {
            case PageType.Soft:
            case PageType.Interactive:
                if (bookPage.Position == Kinemat.Models.Book.BookPagePosition.Left)
                {
                    selectedStyle = LeftBookPageContentStyle;
                }
                else
                {
                    selectedStyle = RightBookPageContentStyle;
                }
                break;

            //case PageType.FrontCover:
            //case PageType.BackCover:
            //    selectedStyle = CoverPageContentStyle;
            //    break;
            default:
                selectedStyle = base.SelectStyle(item, container);
                break;
            }

            return(selectedStyle);
        }
Exemplo n.º 11
0
 private void saveUIToList()
 {
     if (mHandlingEvent)
     {
         return;
     }
     mHandlingEvent = true;
     try
     {
         BookPage bookPage = null;
         if (listBoxPages.SelectedIndex == -1)
         {
             bookPage                  = new BookPage();
             bookPage.page_text        = "<new>";
             bookPage.book_page_def_id = 0;
             bookPage.page_number      = mPages.Count + 1;
             mPages.Add(bookPage);
             listBoxPages.Items.Add(bookPage.page_number);
             listBoxPages.SelectedIndex = listBoxPages.Items.Count - 1;
         }
         else
         {
             bookPage = mPages[listBoxPages.SelectedIndex];
         }
         listBoxPages.Items[listBoxPages.SelectedIndex] = bookPage.page_number;
         bookPage.page_text = txtPageText.Text;
     }
     catch (Exception ex)
     {
         Logger.Instance.log(ex);
         MessageBox.Show(ex.Message);
     }
     mHandlingEvent = false;
 }
Exemplo n.º 12
0
        /// <summary>
        /// Method that is responsible for loading a page of a book by id, by page number and format specified by the client
        /// </summary>
        /// <param name="id"></param>
        /// <param name="pageNumber"></param>
        /// <param name="contentType">Support content-type html|xml|plain</param>
        /// <returns></returns>
        public virtual HttpResponseMessage GetPage(int id, int pageNumber, string contentType)
        {
            BookPage bookPage = GetBookPage(id, pageNumber, contentType);

            var response = new HttpResponseMessage();

            string PageContent = (bookPage == null ? "Doesn't exist." : bookPage.Content);

            switch (contentType)
            {
            case "html":
                PageContent = "<h3>" + PageContent + "</h3>";
                break;

            case "xml":
                PageContent = "<Page><Content>" + PageContent + "</Content></Page>";
                break;

            case "plain":
                break;

            default:
                PageContent = "Unsupported format";
                break;
            }

            response.Content = new StringContent(PageContent);
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/" + contentType);

            return(response);
        }
Exemplo n.º 13
0
    public void EnablePage()
    {
        if (currentPage)
        {
            currentPage.DisablePage();
        }

        currentPage = this;

        transform.SetAsLastSibling();

        if (animatedPage)
        {
            txtBGCGC.transform.SetParent(BookManager.instance.sysContainer.transform);
            txtBGCGC.GetComponent <RectTransform>().anchoredPosition3D = Vector3.zero;
        }


        if (startView)
        {
            Vector3    targetPosition = startView.transform.position;
            Quaternion targetRotation = startView.transform.rotation;
            float      targetSize     = startView.ViewSize;

            cameraManager.PanToPosition(BookManager.instance.bookCamera, targetPosition, targetRotation, targetSize, 0, delegate { });
        }

        cgc.EnableCanvasGroup(true);

        doFadeOnText = true;
    }
Exemplo n.º 14
0
 public DynamicBookPage(DocumentFile activeDocument, BookPage bookPage, Site site)
     : base(null)
 {
     this.ActiveDocument = activeDocument;
     this.BookPage = bookPage;
     this.Site = site;
 }
Exemplo n.º 15
0
    public bool isValidPage(BookPage page)
    {
        bool isValid = false;

        ////TODO: implement
        //try
        //{
        //    if (page.getType() == BookPage.TYPE_RESOURCE)
        //    {
        //        BookPagePreviewPanel panel = new BookPagePreviewPanel(dControl, true);
        //        panel.setCurrentBookPage(page);
        //        isValid = !page.getUri().Equals("") && panel.isValid();
        //    }
        //    else if (page.getType() == BookPage.TYPE_URL)
        //    {
        //        //Check the URL exists and is accessible
        //        URL url = new URL(page.getUri());
        //        url.openStream().close();
        //        isValid = true;
        //    }
        //    else if (page.getType() == BookPage.TYPE_IMAGE)
        //    {
        //        if (page.getUri().length() > 0)
        //            isValid = true;
        //    }
        //}
        //catch (Exception e)
        //{
        //    isValid = false;
        //}
        return(isValid);
    }
Exemplo n.º 16
0
 public ChangeBookPageTypeTool(BookPage bookPage, int newType)
 {
     this.bookPage = bookPage;
     this.newType  = newType;
     this.oldType  = bookPage.getType();
     this.oldUri   = bookPage.getUri();
 }
Exemplo n.º 17
0
 public static double ComputeProgressRatio(BookPage source, Point p, CornerOrigin origin)
 {
     if ((origin != CornerOrigin.BottomLeft) && (origin != CornerOrigin.TopLeft))
     {
         return((source.RenderSize.Width - p.X) / source.RenderSize.Width);
     }
     return(p.X / source.RenderSize.Width);
 }
Exemplo n.º 18
0
        public override bool undoTool()
        {
            BookPage b = bookPagesList[newElementIndex];

            bookPagesList.RemoveAt(newElementIndex);
            bookPagesList.Insert(oldElementIndex, b);
            Controller.Instance.updatePanel();
            return(true);
        }
Exemplo n.º 19
0
 private static Image CreateBasicImage(Book book, BookPage page)
 {
     return(new Image()
     {
         Book = book,
         BookPage = page,
         ImageDescription = Guid.NewGuid().ToString()
     });
 }
Exemplo n.º 20
0
        /// <summary>
        /// Performs initialization tasks.
        /// </summary>
        /// <param name="parameter">Object parameter.</param>
        public override void Initialize(object parameter)
        {
            base.Initialize(parameter);

            // Set the book pages
            bookPages = new ObservableCollection <BookPage>((IEnumerable <BookPage>)parameter);

            // The active page is the front cover page.
            activePage = bookPages[0];
        }
Exemplo n.º 21
0
        public static ObservableCollection <UIElement> ToUIElementCollection(this BookPage bookPage)
        {
            ObservableCollection <UIElement> collection = new ObservableCollection <UIElement>();

            foreach (BookUI bookUI in bookPage.PageControls)
            {
                collection.Add(BookUIToUIElement(bookUI));
            }
            return(collection);
        }
Exemplo n.º 22
0
    public BookPage addPage()
    {
        BookPage newBookPage = new BookPage("", defaultType, defaultMargin, defaultScrollable);

        Controller.getInstance().addTool(new AddBookPageTool(bookPagesList, newBookPage, selectedPage));

        selectedPage = bookPagesList.IndexOf(newBookPage);

        return(newBookPage);
    }
Exemplo n.º 23
0
        public static int ComputeAnimationDuration(BookPage source, Point p, CornerOrigin origin)
        {
            double num  = ComputeProgressRatio(source, p, origin);
            int    num2 = Convert.ToInt32((double)(s_nANIMATION_DURATION * ((num / 2.0) + 0.5)));

            if (num2 <= 10)
            {
                num2 = 10;
            }
            return(num2);
        }
Exemplo n.º 24
0
    /**
     * Adds a page to the book with margin
     *
     * @param page
     *            New page (url) to be added
     */

    public void addPage(string uri, int type, int margin, int marginEnd, int marginTop, int marginBottom, bool scrollable)
    {
        BookPage page = new BookPage(uri, type, margin, marginEnd, marginTop, marginBottom, scrollable);

        pages.Add(page);
        // add the page to the structure that gather all elements with assets (for chapter importation)
        if (type != BookPage.TYPE_URL && uri != null && !uri.Equals(""))
        {
            AllElementsWithAssets.addAsset(page);
        }
    }
Exemplo n.º 25
0
    /**
     * Adds a page to the book
     *
     * @param page
     *            New page (url) to be added
     */

    public void addPage(string uri, int type)
    {
        BookPage page = new BookPage(uri, type);

        pages.Add(page);
        // add the page to the structure that gather all elements with assets (for chapter importation)
        if (uri != null && !uri.Equals(""))
        {
            AllElementsWithAssets.addAsset(page);
        }
    }
Exemplo n.º 26
0
    public BookPage changeCurrentPage(int page)
    {
        BookPage currentPage = null;

        if (page >= 0 && page < bookPagesList.Count)
        {
            currentPage       = bookPagesList[page];
            this.selectedPage = page;
        }
        return(currentPage);
    }
Exemplo n.º 27
0
 public override bool doTool()
 {
     if (oldElementIndex < bookPagesList.Count - 1)
     {
         BookPage b = bookPagesList[oldElementIndex];
         bookPagesList.RemoveAt(oldElementIndex);
         bookPagesList.Insert(newElementIndex, b);
         return(true);
     }
     return(false);
 }
Exemplo n.º 28
0
 public ChangeBookPageMarginsTool(BookPage bookPage, int newMargin, int newMarginTop, int newMarginBottom, int newMarginEnd)
 {
     this.bookPage        = bookPage;
     this.newMargin       = newMargin;
     this.newMarginTop    = newMarginTop;
     this.newMarginBottom = newMarginBottom;
     this.newMarginEnd    = newMarginEnd;
     this.oldMargin       = bookPage.getMargin();
     this.oldMarginTop    = bookPage.getMarginTop();
     this.oldMarginBottom = bookPage.getMarginBottom();
     this.oldMarginEnd    = bookPage.getMarginEnd();
 }
Exemplo n.º 29
0
        /// <summary>
        /// 依書本頁的連結,取得當中的書本資訊
        /// </summary>
        /// <param name="bookLinks"></param>
        /// <returns></returns>
        private async Task <List <Book> > GetBooks(List <Link> bookLinks, string categoryName)
        {
            var allBooks = new List <Book>();

            foreach (var bookLink in bookLinks)
            {
                var bookPage = new BookPage(bookLink, categoryName);
                allBooks.AddRange(await bookPage.GetBooks());
            }

            return(allBooks);
        }
Exemplo n.º 30
0
        private void SelectGameType(BookPage page)
        {
            if (page.KinectGame is SimonSaysGame)
            {
                CurrentGame = "SimonSaysGame";
            }

            if (page.KinectGame is OddOneOutGame)
            {
                CurrentGame = "OddOneOut";
            }
        }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            DataTemplate selectedDataTemplate;

            // Convert the item object to a BookPage object
            BookPage bookPage = item as BookPage;

            // If the BookPage object is null, then the original item was not a BookPage.
            // So we cannot handle it!!
            if (bookPage == null)
            {
                throw new ArgumentException();
            }

            switch (bookPage.Type)
            {
            case PageType.Blank:
                selectedDataTemplate = BlankPageTemplate;
                break;

            case PageType.Soft:
                selectedDataTemplate = SoftPageTemplate;
                break;

            case PageType.FrontCover:
                selectedDataTemplate = FrontCoverPageTemplate;
                break;

            case PageType.Interactive:
                selectedDataTemplate = InteractivePageTemplate;
                break;

            case PageType.BackCover:
                selectedDataTemplate = BackCoverPageTemplate;
                break;

            default:
                selectedDataTemplate = BackCoverPageTemplate;
                break;
            }

            return(selectedDataTemplate);
        }
Exemplo n.º 32
0
        public override void TouchDown(PointF p)
        {
            FloatingKeyboardHandler b = Source as FloatingKeyboardHandler;
            if (b == null) return;

            b.SetSelectedPages();
            selectedPage = findSelectedPage(b, new System.Windows.Point(p.X, p.Y));

            b.CheckSheets(selectedPage);

            if (selectedPage != null)
            {
                CornerOrigin? ISCorner = selectedPage.GetCorner(b, new System.Windows.Point(p.X, p.Y));
                if (ISCorner != null)
                {
                    //TouchFramework.MTSmoothContainer()

                    //selectedPage.GrabPage(b, new System.Windows.Point(p.X, p.Y));

                    if (ISCorner == WPFMitsuControls.CornerOrigin.TopRight)
                    {
                        b.AnimateToNextPage(true, 2000);
                    }
                    else if (ISCorner == WPFMitsuControls.CornerOrigin.BottomRight)
                    {
                        b.AnimateToNextPage(false, 2000);
                    }
                    else if (ISCorner == WPFMitsuControls.CornerOrigin.TopLeft)
                    {
                        b.AnimateToPreviousPage(true, 2000);
                    }
                    else if (ISCorner == WPFMitsuControls.CornerOrigin.BottomLeft)
                    {
                        b.AnimateToPreviousPage(false, 2000);
                    }

                    //b.ContainerObj.noScale = true;

                    //MTSmoothContainer containerobj = b.ContainerObj as MTSmoothContainer;
                    //b.ContainerObj.noScale = true;
                    //b.ContainerObj.noRotate = true;
                   // b.ContainerObj.noMove = true;

                }
            }

            base.TouchDown(p);
        }
Exemplo n.º 33
0
 /**
  * Adds a page to the book with margin
  *
  * @param page
  *            New page (url) to be added
  */
 public void addPage(string uri, int type, int margin, bool scrollable)
 {
     BookPage page = new BookPage(uri, type, margin, scrollable);
     pages.Add(page);
     // add the page to the structure that gather all elements with assets (for chapter importation)
     if (uri != null && !uri.Equals(""))
         AllElementsWithAssets.addAsset(page);
 }