コード例 #1
0
        public void InvalidateArrange()
        {
            if (ShouldInterceptInvalidate)
            {
                return;
            }

            if (IsArrangeDirty)
            {
                return;                 // Already dirty
            }

            SetLayoutFlags(LayoutFlag.ArrangeDirty);

            if (FeatureConfiguration.UIElement.UseInvalidateArrangePath && !IsArrangeDirtyPathDisabled)
            {
                InvalidateParentArrangeDirtyPath();
            }
            else
            {
                (this.GetParent() as UIElement)?.InvalidateArrange();
                if (IsVisualTreeRoot)
                {
#if __SKIA__
                    XamlRoot.InvalidateArrange();
#else
                    Window.InvalidateArrange();
#endif
                }
            }
        }
コード例 #2
0
ファイル: BookManager.cs プロジェクト: kurema/BookViewerApp3
    public static async Task <IBook> GetBookFromFile(IStorageFile file, Windows.UI.Xaml.XamlRoot xamlRoot = null, bool skipPasswordEntryPdf = false)
    {
        var type = await GetBookTypeByStorageFile(file);

        if (type is null)
        {
            return(null);
        }
        return(await GetBookFromFile(file, (BookType)type, xamlRoot, skipPasswordEntryPdf));
    }
コード例 #3
0
        internal void InvalidateParentMeasureDirtyPath()
        {
            if (this.GetParent() is UIElement parent)             //TODO: Should this use VisualTree.GetParent as fallback? https://github.com/unoplatform/uno/issues/8978
            {
                parent.InvalidateMeasureDirtyPath();
            }
            else if (IsVisualTreeRoot)
            {
#if __SKIA__
                XamlRoot.InvalidateMeasure();
#else
                Window.InvalidateMeasure();
#endif
            }
        }
コード例 #4
0
        private void InvalidateParentArrangeDirtyPath()
        {
            if (this.GetParent() is UIElement parent)             //TODO: Should this use VisualTree.GetParent as fallback? https://github.com/unoplatform/uno/issues/8978
            {
                parent.InvalidateArrangeDirtyPath();
            }
            else             //TODO: Why not check IsVisualTreeRoot as in InvalidateParentMeasureDirtyPath?
            {
#if __SKIA__
                XamlRoot?.InvalidateArrange();
#else
                Window.InvalidateArrange();
#endif
            }
        }
コード例 #5
0
ファイル: BookManager.cs プロジェクト: kurema/BookViewerApp3
    public static async Task <IBook> GetBookFromFile(IStorageFile file, BookType type, Windows.UI.Xaml.XamlRoot xamlRoot = null, bool skipPasswordEntryPdf = false)
    {
        switch (type)
        {
        case BookType.Epub: goto Epub;

        case BookType.Zip: goto Zip;

        case BookType.Rar: goto SharpCompress;

        case BookType.SevenZip: goto SharpCompress;

        case BookType.Pdf: goto Pdf;
        }


        Pdf :;
        return(await GetBookPdf(await file.OpenReadAsync(), file.Name, xamlRoot, skipPasswordEntryPdf));

        Zip :;
        return(await GetBookZip((await file.OpenReadAsync()).AsStream()));

        SharpCompress :;
        return(await GetBookSharpCompress((await file.OpenReadAsync()).AsStream()));

        Epub :;
        {
            return(new BookEpub(file));
        }
    }
コード例 #6
0
ファイル: BookManager.cs プロジェクト: kurema/BookViewerApp3
    public static async Task <IBook> GetBookPdf(Windows.Storage.Streams.IRandomAccessStream stream, string fileName, Windows.UI.Xaml.XamlRoot xamlRoot = null, bool skipPasswordEntry = false)
    {
        var book = new PdfBook();

        try
        {
            await book.Load(stream, fileName, async (a) =>
            {
                if (skipPasswordEntry)
                {
                    throw new Exception("Password entry is skipped.");
                }
                var dialog = new Views.PasswordRequestContentDialog()
                {
                    XamlRoot = xamlRoot
                };
                Windows.UI.Xaml.Controls.ContentDialogResult result;
                try
                {
                    result = await dialog.ShowAsync();
                }
                catch
                {
                    throw;
                }
                if (result == Windows.UI.Xaml.Controls.ContentDialogResult.Primary)
                {
                    return(dialog.Password, dialog.Remember);
                }
                else
                {
                    throw new Exception();
                }
            });
        }
        catch { return(null); }
        if (book.PageCount <= 0)
        {
            return(null);
        }
        return(book);
    }