void CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            if (args.Reason == CanvasCreateResourcesReason.DpiChanged)
                return;

            args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #2
0
        void CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            if (args.Reason == CanvasCreateResourcesReason.DpiChanged)
            {
                return;
            }

            if (args.Reason == CanvasCreateResourcesReason.FirstTime)
            {
                bool spriteBatchSupported = false;

#if WINDOWS_UWP
                spriteBatchSupported = CanvasSpriteBatch.IsSupported(sender.Device);
#endif

                UseSpriteBatch = spriteBatchSupported;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("UseSpriteBatch"));
                }

                UseSpriteBatchCheckBox.Visibility = spriteBatchSupported ? Visibility.Visible : Visibility.Collapsed;
            }

            args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #3
0
        void myWidget_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            // Create any resources needed by the Draw event handler.

            // Asynchronous work can be tracked with TrackAsyncAction:
            args.TrackAsyncAction(myWidget_CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #4
0
        private void OnCreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(Task.Run(() =>
            {
                var animation = VideoAnimation.LoadFromFile(_source, false, true);
                if (animation == null)
                {
                    return;
                }

                _animation = animation;

                lock (_reusableLock)
                {
                    if (_reusableBuffer == null || _reusableBuffer.Length < _animation.PixelWidth * _animation.PixelHeight * 4)
                    {
                        _reusableBuffer = new byte[_animation.PixelWidth * _animation.PixelHeight * 4];
                    }
                }

                _bitmap = CanvasBitmap.CreateFromBytes(sender, _reusableBuffer, _animation.PixelWidth, _animation.PixelHeight, DirectXPixelFormat.R8G8B8A8UIntNormalized);
                _device = sender;

                // Invalidate to render the first frame
                if (!_subscribed)
                {
                    Invalidate();
                    _canvas?.Invalidate();
                }
            }).AsAsyncAction());
        }
Example #5
0
 private void Canvas_OnCreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(Task.Run(async() =>
     {
         _tileImage = await CanvasBitmap.LoadAsync(sender, "tile.png");
     }).AsAsyncAction());
 }
Example #6
0
        void canvas_CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            Log.i(this, "CreateResources started");

            //On losing device (the GPU one, not your cheap Windows Phone), resources gotta get reloaded
            if (args.Reason == CanvasCreateResourcesReason.NewDevice)
            {
                Log.i(this, "Hey, a new device!");
                //sender.Device.DeviceLost += Device_DeviceLost; //or maybe not
            }
            //If the reason is other, e.g. DPI change, we have to reload our textures too
            TextureSetLoader.DeleteInstance();

            //We create resources asynchronously
            Task createResourcesAsync = CreateResourcesAsync(sender);

            Log.i(this, "CreateResources starting parallel task for creating textures");
            args.TrackAsyncAction(createResourcesAsync.AsAsyncAction());

            //Failed attempt at syncing async
            //args.GetTrackedAction().AsTask().GetAwaiter().GetResult();
            //Log.i(this, "CreateResources parallel task has finished");

            Log.i(this, "CreateResources finished");
        }
Example #7
0
        private void OnCanvasAnimatedControlCreateResources(ICanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            var obstacles = GetObstacles();

            controller = new EcoSystemController(sender as CanvasAnimatedControl, new MapSize(60, 40), obstacles);
            controller.EpochStarted += OnEpochStarted;
            args.TrackAsyncAction(controller.InitializeAsync(args.Reason).AsAsyncAction());
        }
Example #8
0
        void CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            if (args.Reason == CanvasCreateResourcesReason.DpiChanged)
            {
                return;
            }

            args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #9
0
        void Canvas_CreateResources(CanvasVirtualControl sender, CanvasCreateResourcesEventArgs args)
        {
            // Don't bother reloading our shaders if it is only the DPI that changed.
            // That happens all the time due to ScrollViewer_ViewChanged adjusting canvas.DpiScale.
            if (args.Reason == CanvasCreateResourcesReason.DpiChanged)
                return;

            args.TrackAsyncAction(Canvas_CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #10
0
        void OnCreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            spriteBatchSupported = CanvasSpriteBatch.IsSupported(sender.Device);

            if (!spriteBatchSupported)
            {
                return;
            }

            args.TrackAsyncAction(LoadImages(sender.Device).AsAsyncAction());
        }
        void Canvas_CreateResources(CanvasVirtualControl sender, CanvasCreateResourcesEventArgs args)
        {
            // Don't bother reloading our shaders if it is only the DPI that changed.
            // That happens all the time due to ScrollViewer_ViewChanged adjusting canvas.DpiScale.
            if (args.Reason == CanvasCreateResourcesReason.DpiChanged)
            {
                return;
            }

            args.TrackAsyncAction(Canvas_CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #12
0
        private void RaiseCreateResources(CanvasVirtualControl sender, CanvasCreateResourcesEventArgs args)
        {
            if (args.Reason == CanvasCreateResourcesReason.DpiChanged)
            {
                return;
            }

            var task = OnCreateResources(_earlyCreateResources, _createResources, sender, args);

            args.TrackAsyncAction(task.AsAsyncAction());
        }
Example #13
0
 private void GameCanvasCreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(Task.Run(async() =>
     {
         backgroundImageLandscape    = await CanvasBitmap.LoadAsync(sender, new Uri("ms-appx:///Features/Game/Assets/WindowLandscape.png"));
         backgroundImagePortrait     = await CanvasBitmap.LoadAsync(sender, new Uri("ms-appx:///Features/Game/Assets/WindowPortrait.png"));
         backgroundTile              = await CanvasBitmap.LoadAsync(sender, new Uri("ms-appx:///Features/Game/Assets/Background.png"));
         backgroundTileBrush         = new CanvasImageBrush(sender, backgroundTile);
         backgroundTileBrush.ExtendX = backgroundTileBrush.ExtendY = CanvasEdgeBehavior.Wrap;
     }).AsAsyncAction());
 }
Example #14
0
 void canvas_CreateResources(ICanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
 {
     //Create all sprites and textures.
     args.TrackAsyncAction(Initialization.CreateGraphics(sender).AsAsyncAction());
     //Create all spritesheets
     Initialization.CreateSheets();
     //Create all tiles
     Initialization.CreateTiles();
     //Create the player object, however that's decided.
     Initialization.PreparePlayer();
 }
Example #15
0
        private void BackgroundCanvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(Task.Run(async () =>
            {
                // Load the background image and create an image brush from it
                this.backgroundImage = await CanvasBitmap.LoadAsync(sender, new Uri("ms-appx:///Background.jpg"));
                this.backgroundBrush = new CanvasImageBrush(sender, this.backgroundImage);

                // Set the brush's edge behaviour to wrap, so the image repeats if the drawn region is too big
                this.backgroundBrush.ExtendX = this.backgroundBrush.ExtendY = CanvasEdgeBehavior.Wrap;

                this.resourcesLoaded = true;
            }).AsAsyncAction());
        }
Example #16
0
        void CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            if (args.Reason == CanvasCreateResourcesReason.DpiChanged)
                return;

            bool spriteBatchSupported = false;
#if WINDOWS_UWP
            spriteBatchSupported = CanvasSpriteBatch.IsSupported(sender.Device);
#endif
            UseSpriteBatch = UseSpriteBatchCheckBox.IsChecked.GetValueOrDefault(false);
            UseSpriteBatchCheckBox.Visibility = spriteBatchSupported ? Visibility.Visible : Visibility.Collapsed;

            args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
        }
        private void BackgroundCanvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(Task.Run(async() =>
            {
                // Load the background image and create an image brush from it
                this.backgroundImage = await CanvasBitmap.LoadAsync(sender, new Uri("ms-appx:///Background.jpg"));
                this.backgroundBrush = new CanvasImageBrush(sender, this.backgroundImage);

                // Set the brush's edge behaviour to wrap, so the image repeats if the drawn region is too big
                this.backgroundBrush.ExtendX = this.backgroundBrush.ExtendY = CanvasEdgeBehavior.Wrap;

                this.resourcesLoaded = true;
            }).AsAsyncAction());
        }
Example #18
0
        void Canvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(LoadCanvasResources(sender).AsAsyncAction());

            imageBrush = new CanvasImageBrush(sender);

            imageSource         = new CanvasImageSource(sender, controlSize, controlSize);
            imageControl.Source = imageSource;

            virtualImageSource         = new CanvasVirtualImageSource(sender, controlSize, controlSize);
            virtualImageControl.Source = virtualImageSource.Source;

            swapChain = new CanvasSwapChain(sender, controlSize, controlSize);
            swapChainPanel.SwapChain = swapChain;
        }
        private void canvasControl_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            modeInstance = null;

            args.TrackAsyncAction(canvasControl_CreateResourcesAsync(sender).AsAsyncAction());

            var checks = CanvasBitmap.CreateFromColors(sender, new Color[] { Colors.Gray, Colors.Black, Colors.Black, Colors.Gray }, 2, 2);

            checkedFillPattern = new CanvasImageBrush(sender, checks)
            {
                ExtendX       = CanvasEdgeBehavior.Wrap,
                ExtendY       = CanvasEdgeBehavior.Wrap,
                Transform     = Matrix3x2.CreateScale(16),
                Interpolation = CanvasImageInterpolation.NearestNeighbor
            };
        }
Example #20
0
        void CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            if (args.Reason == CanvasCreateResourcesReason.DpiChanged)
            {
                return;
            }

            bool spriteBatchSupported = false;

#if WINDOWS_UWP
            spriteBatchSupported = CanvasSpriteBatch.IsSupported(sender.Device);
#endif
            UseSpriteBatch = UseSpriteBatchCheckBox.IsChecked.GetValueOrDefault(false);
            UseSpriteBatchCheckBox.Visibility = spriteBatchSupported ? Visibility.Visible : Visibility.Collapsed;

            args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #21
0
        private void BackgroundCanvas32_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(Task.Run(async() =>
            {
                // Load the background image and create an image brush from it
                backgroundImage32 = await CanvasBitmap.LoadAsync(sender, new Uri("ms-appx:///Assets/CheckboardPattern_3264.png"));
                backgroundBrush32 = new CanvasImageBrush(sender, backgroundImage32)
                {
                    Opacity = 0.3f
                };

                // Set the brush's edge behaviour to wrap, so the image repeats if the drawn region is too big
                backgroundBrush32.ExtendX = backgroundBrush32.ExtendY = CanvasEdgeBehavior.Wrap;

                //this.resourcesLoaded32 = true;
            }).AsAsyncAction());
        }
Example #22
0
        private void OnCreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(Task.Run(() =>
            {
                var animation = VideoAnimation.LoadFromFile(_source, false, true);
                if (animation == null)
                {
                    return;
                }

                _animation = animation;

                var colors = new byte[_animation.PixelWidth * _animation.PixelHeight * 4];

                _bitmap = CanvasBitmap.CreateFromBytes(sender, colors, _animation.PixelWidth, _animation.PixelHeight, Windows.Graphics.DirectX.DirectXPixelFormat.R8G8B8A8UIntNormalized);
                _device = sender;
            }).AsAsyncAction());
        }
Example #23
0
        void canvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            switch (args.Reason)
            {
            case CanvasCreateResourcesReason.FirstTime:
                // First time initialization: either restore suspended app state, load a
                // photo that was passed in from the shell, or bring up the file selector.
                if (launchArg is ApplicationExecutionState && (ApplicationExecutionState)launchArg == ApplicationExecutionState.Terminated)
                {
                    var restoreTask = RestoreSuspendedState(sender.Device);

                    args.TrackAsyncAction(restoreTask.AsAsyncAction());
                }
                else
                {
                    if (!TryLoadPhoto(launchArg as IReadOnlyList <IStorageItem>))
                    {
                        LoadButton_Click(null, null);
                    }
                }
                break;

            case CanvasCreateResourcesReason.NewDevice:
                // Recovering after a lost device (GPU reset).
                if (photo.SourceBitmap != null)
                {
                    photo.RecoverAfterDeviceLost(sender.Device);
                }

                cachedImage.RecoverAfterDeviceLost();
                break;

            case CanvasCreateResourcesReason.DpiChanged:
                // We mostly work in pixels rather than DIPs, so only need
                // minimal layout updates in response to DPI changes.
                if (photo.SourceBitmap != null)
                {
                    ZoomToFitPhoto();
                }
                break;
            }
        }
Example #24
0
        void CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            if (args.Reason == CanvasCreateResourcesReason.DpiChanged)
                return;

            if (args.Reason == CanvasCreateResourcesReason.FirstTime)
            {
                bool spriteBatchSupported = false;

#if WINDOWS_UWP
                spriteBatchSupported = CanvasSpriteBatch.IsSupported(sender.Device);
#endif

                UseSpriteBatch = spriteBatchSupported;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("UseSpriteBatch"));

                UseSpriteBatchCheckBox.Visibility = spriteBatchSupported ? Visibility.Visible : Visibility.Collapsed;
            }

            args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #25
0
 private void Logo_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(Task.Run(async() =>
     {
         try
         {
             // Load the background image and create an image brush from it
             //var asset = new Uri("ms-appx:///Assets/Square71x71Logo.scale-200.png");
             Uri asset = new Uri("ms-appx:///Assets/AppLogo.png");
             if (asset != null && asset is Uri)
             {
                 logoImage = await CanvasBitmap.LoadAsync(sender, asset);
             }
             else
             {
                 logoImage = null;
             }
         }
         catch (Exception ex)
         {
             ex.Message.T().ShowMessage("ERROR".T());
         }
     }).AsAsyncAction());
 }
Example #26
0
 virtual protected void Stage_CreateResources( CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args )
 {
     args.TrackAsyncAction( LoadTextures( sender ).AsAsyncAction() );
 }
Example #27
0
        private void Canvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            needsResourceRecreation = true;

            args.TrackAsyncAction(Canvas_CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #28
0
 private void canvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(RenderService.AwaitResources().AsAsyncAction());
 }
Example #29
0
 void AnimatedCanvas_CreateResources(ICanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(LoadAnimatedCanvasResources(sender).AsAsyncAction());
 }
        private void canvasControl_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            modeInstance = null;

            args.TrackAsyncAction(canvasControl_CreateResourcesAsync(sender).AsAsyncAction());

            var checks = CanvasBitmap.CreateFromColors(sender, new Color[] { Colors.Gray, Colors.Black, Colors.Black, Colors.Gray }, 2, 2);
            checkedFillPattern = new CanvasImageBrush(sender, checks)
            {
                ExtendX = CanvasEdgeBehavior.Wrap,
                ExtendY = CanvasEdgeBehavior.Wrap,
                Transform = Matrix3x2.CreateScale(16),
                Interpolation = CanvasImageInterpolation.NearestNeighbor
            };
        }
 private void canvasMain_CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
 }
 private void CanvasControl_OnCreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(snakeGame.CreateResources(sender, args).AsAsyncAction());
 }
 private void GameCanvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(CreateResourceAsync(sender).AsAsyncAction());
 }
Example #34
0
 private void OnGameCanvasCreateResources(ICanvasAnimatedControl canvasControl, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(CreateResourceAsync(canvasControl).AsAsyncAction());
 }
        private void canvas_CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(LoadSpriteSheet(sender.Device).AsAsyncAction());

            lvXCoordinate.SelectedIndex = 0;
            lvYCoordinate.SelectedIndex = 0;
            sldSpriteCount.Maximum      = _maxSpriteCount;

            var defaultGridLength = new GridLength(0);
            var debugRowHeight    = AnalyticsInfo.VersionInfo.DeviceFamily.ToLower().Contains("mobile")
                ? defaultGridLength
                : new GridLength(20);

            ViewModel.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "ShowDebug")
                {
                    Application.Current.DebugSettings.EnableFrameRateCounter = ViewModel.ShowDebug;
                    rowDebug.Height = ViewModel.ShowDebug
                        ? debugRowHeight
                        : defaultGridLength;
                }
            };

#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                ViewModel.ShowDebug = true;
            }
#endif

            _debugTextFormat = new CanvasTextFormat()
            {
                HorizontalAlignment = CanvasHorizontalAlignment.Right, VerticalAlignment = CanvasVerticalAlignment.Bottom
            };
            _debugTextColour           = Colors.Black;
            _spriteColour              = Color.FromArgb(60, 0, 0, 255);
            _spriteColourRunningSlowly = Color.FromArgb(60, 255, 0, 0);

            _fps        = 0;
            _fpsCounter = 0;
            _fpsTime    = TimeSpan.Zero;

            ViewModel.DeltaThetaInteger = 50;
            _theta = 0;

            ViewModel.SpriteCount = 315;
            _position             = new Vector2[_maxSpriteCount];

            _spriteBatchSupported = CanvasSpriteBatch.IsSupported(sender.Device);
            if (_spriteBatchSupported)
            {
                ViewModel.DrawModesAvailable.Add(DrawModes.SpriteBatch);

                _spriteRectNormal        = new Rect(0, 0, 10, 10);
                _spriteRectRunningSlowly = new Rect(10, 0, 10, 10);
            }

            ViewModel.aInteger = 100;
            ViewModel.bInteger = 1;
            ViewModel.cInteger = 100;

            ViewModel.mInteger = -100;
            ViewModel.nInteger = 29;
            ViewModel.oInteger = 74;
        }
Example #36
0
 private void Canvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(LoadBackgroundAsync(sender).AsAsyncAction());
 }
Example #37
0
        void canvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            switch (args.Reason)
            {
                case CanvasCreateResourcesReason.FirstTime:
                    // First time initialization: either restore suspended app state, load a
                    // photo that was passed in from the shell, or bring up the file selector.
                    if (launchArg is ApplicationExecutionState && (ApplicationExecutionState)launchArg == ApplicationExecutionState.Terminated)
                    {
                        var restoreTask = RestoreSuspendedState(sender.Device);

                        args.TrackAsyncAction(restoreTask.AsAsyncAction());
                    }
                    else
                    {
                        if (!TryLoadPhoto(launchArg as IReadOnlyList<IStorageItem>))
                        {
                            LoadButton_Click(null, null);
                        }
                    }
                    break;

                case CanvasCreateResourcesReason.NewDevice:
                    // Recovering after a lost device (GPU reset).
                    if (photo.SourceBitmap != null)
                    {
                        photo.RecoverAfterDeviceLost(sender.Device);
                    }

                    cachedImage.RecoverAfterDeviceLost();
                    break;

                case CanvasCreateResourcesReason.DpiChanged:
                    // We mostly work in pixels rather than DIPs, so only need
                    // minimal layout updates in response to DPI changes.
                    if (photo.SourceBitmap != null)
                    {
                        ZoomToFitPhoto();
                    }
                    break;
            }
        }
Example #38
0
 virtual protected void Stage_CreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
 {
     DeviceExist = true;
     args.TrackAsyncAction(LoadTextures(sender).AsAsyncAction());
 }
Example #39
0
        void Canvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            args.TrackAsyncAction(LoadCanvasResources(sender).AsAsyncAction());

            imageBrush = new CanvasImageBrush(sender);

            imageSource = new CanvasImageSource(sender, controlSize, controlSize);
            imageControl.Source = imageSource;

            virtualImageSource = new CanvasVirtualImageSource(sender, controlSize, controlSize);
            virtualImageControl.Source = virtualImageSource.Source;

            swapChain = new CanvasSwapChain(sender, controlSize, controlSize);
            swapChainPanel.SwapChain = swapChain;
        }
Example #40
0
        private void Canvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
        {
            needsResourceRecreation = true;

            args.TrackAsyncAction(Canvas_CreateResourcesAsync(sender).AsAsyncAction());
        }
Example #41
0
 void Canvas_CreateResources(CanvasControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(Canvas_CreateResourcesAsync(sender).AsAsyncAction());
 }
Example #42
0
 void AnimatedCanvas_CreateResources(ICanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(LoadAnimatedCanvasResources(sender).AsAsyncAction());
 }
 private void OnCreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(Canvas_CreateResourcesAsync(sender).AsAsyncAction());
 }
 private void OnCreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
 {
     if (args.Reason != CanvasCreateResourcesReason.DpiChanged)
         args.TrackAsyncAction(LoadSpritesAsync(sender).AsAsyncAction());
 }
 void DriveCanvas_CreateResourcesEvent(CanvasControl control, CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(DriveCanvas_CreateResourcesAsync(control).AsAsyncAction());
 }
Example #46
0
        void OnCreateResources(CanvasAnimatedControl sender, CanvasCreateResourcesEventArgs args)
        {
            spriteBatchSupported = CanvasSpriteBatch.IsSupported(sender.Device);

            if (!spriteBatchSupported)
                return;

            args.TrackAsyncAction(LoadImages(sender.Device).AsAsyncAction());
        }