Esempio n. 1
0
        private async void BitmapSourceOption_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!canvas.ReadyToDraw)
            {
                return;                      // CreateResources hasn't been called yet.
            }
            if (currentBitmapSourceOption == NextBitmapSourceOption)
            {
                return;
            }
            currentBitmapSourceOption = NextBitmapSourceOption;

            //
            // If the window size changes during the execution of LoadBitmaps, the canvas control's
            // draw handler will be called. This may seem uncommon but is especially likely in
            // a debugging scenario. This bool keeps the draw handler from doing anything in
            // that case.
            //
            isRecreatingResources = true;

            await LoadBitmaps(canvas);

            isRecreatingResources = false;

            canvas.Invalidate();
        }
Esempio n. 2
0
        private async void BitmapSourceOption_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!canvas.ReadyToDraw)
            {
                return;                      // CreateResources hasn't been called yet.
            }
            if (currentBitmapSourceOption == NextBitmapSourceOption)
            {
                return;
            }
            currentBitmapSourceOption = NextBitmapSourceOption;

            await LoadBitmaps(canvas);

            canvas.Invalidate();
        }
        private async void BitmapSourceOption_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!canvas.ReadyToDraw) return; // CreateResources hasn't been called yet.

            if (currentBitmapSourceOption == NextBitmapSourceOption) return;
            currentBitmapSourceOption = NextBitmapSourceOption;

            //
            // If the window size changes during the execution of LoadBitmaps, the canvas control's 
            // draw handler will be called. This may seem uncommon but is especially likely in 
            // a debugging scenario. This bool keeps the draw handler from doing anything in
            // that case.
            //
            isRecreatingResources = true;

            await LoadBitmaps(canvas);

            isRecreatingResources = false;

            canvas.Invalidate();
        }
        private async void BitmapSourceOption_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!canvas.ReadyToDraw) return; // CreateResources hasn't been called yet.

            if (currentBitmapSourceOption == NextBitmapSourceOption) return;
            currentBitmapSourceOption = NextBitmapSourceOption;

            await LoadBitmaps(canvas);

            canvas.Invalidate();
        }