Пример #1
0
        public static ImageSource GetLottieFrame(string path, int frame, int width, int height, bool webp = true)
        {
            // Frame size affects disk cache, so we always use 256.
            var frameSize = new Windows.Graphics.SizeInt32 {
                Width = 256, Height = 256
            };

            var animation = LottieAnimation.LoadFromFile(path, frameSize, false, null);

            if (animation == null)
            {
                if (webp)
                {
                    return(GetWebPFrame(path, width));
                }

                return(null);
            }

            var bitmap = new WriteableBitmap(width, height);

            animation.RenderSync(bitmap, frame);
            animation.Dispose();

            return(bitmap);
        }
Пример #2
0
        private static async Task <ImageSource> GetLottieFrame(string path, int frame, int width, int height)
        {
            var dpi = WindowContext.Current.RasterizationScale;

            width  = (int)(width * dpi);
            height = (int)(height * dpi);

            var cache = $"{path}.{width}x{height}.png";

            if (System.IO.File.Exists(cache))
            {
                return(new BitmapImage(UriEx.ToLocal(cache)));
            }

            await Task.Run(() =>
            {
                var frameSize = new Windows.Graphics.SizeInt32 {
                    Width = width, Height = height
                };

                var animation = LottieAnimation.LoadFromFile(path, frameSize, false, null);
                if (animation != null)
                {
                    animation.RenderSync(cache, frame);
                    animation.Dispose();
                }
            });

            return(new BitmapImage(UriEx.ToLocal(cache)));
        }
Пример #3
0
        private void InitWindow()
        {
            IntPtr    hWnd      = WinRT.Interop.WindowNative.GetWindowHandle(this);
            WindowId  windowId  = Win32Interop.GetWindowIdFromWindow(hWnd);
            AppWindow appWindow = AppWindow.GetFromWindowId(windowId);
            var       size      = new Windows.Graphics.SizeInt32();

            size.Width  = 1280;
            size.Height = 960;
            appWindow.Resize(size);
            appWindow.SetIcon("icon.ico");
            this.Title = "LR(1)语义分析过程表";
        }
Пример #4
0
        private void InitWindow()
        {
            IntPtr    hWnd      = WinRT.Interop.WindowNative.GetWindowHandle(this);
            WindowId  windowId  = Win32Interop.GetWindowIdFromWindow(hWnd);
            AppWindow appWindow = AppWindow.GetFromWindowId(windowId);
            var       size      = new Windows.Graphics.SizeInt32();

            size.Width  = 710;
            size.Height = 850;
            appWindow.Resize(size);
            appWindow.SetIcon("icon.ico");
            this.Title   = "C--文法产生式";
            this.Closed += (o, e) =>
            {
                MainWebView.Close();
            };
            LoadedWebview();
        }
        public MainWindow()
        {
            this.InitializeComponent();
            IntPtr    hWnd      = WinRT.Interop.WindowNative.GetWindowHandle(this);
            WindowId  windowId  = Win32Interop.GetWindowIdFromWindow(hWnd);
            AppWindow appWindow = AppWindow.GetFromWindowId(windowId);
            var       size      = new Windows.Graphics.SizeInt32();

            size.Width  = 1280;
            size.Height = 960;
            appWindow.Resize(size);
            appWindow.SetIcon("icon.ico");

            this.Title          = "C--编译器";
            Lexcial.IsEnabled   = false;
            Syntactic.IsEnabled = false;
            Semantic.IsEnabled  = false;
            Mips.IsEnabled      = false;
            LoadedWebview();
            this.Closed += (o, e) =>
            {
                MainWebView.Close();
            };
        }