Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            OpacityEffect loOpacityEffect = new OpacityEffect(this);

            loOpacityEffect.RunAsync();

            // Set the maximum number of requests to the thread pool that can be active concurrently equal to the number of available cores
            // All requests above that number remain queued until thread pool threads become available
            ThreadPool.SetMaxThreads(Environment.ProcessorCount, Environment.ProcessorCount * 2);

            // Specify the image file name
            //psImageFileName = @"C:\MYPHOTOS\DSC01470.JPG";
            psImageFileName = @"C:\MYPHOTOS\DSC01566.JPG";

            // Initialize the safe counter
            piThumbnailsShown = 0;
            piTotalThumbnails = (int)((piEndingBrightness - piBeginningBrightness) / piBrightnessStep);
            double liBrightnessAdjustment = piBeginningBrightness;

            while (liBrightnessAdjustment <= piEndingBrightness)
            {
                QueueBrightnessThumbnail(liBrightnessAdjustment);
                liBrightnessAdjustment += piBrightnessStep;
                liBrightnessAdjustment  = Math.Round(liBrightnessAdjustment, 3);
            }
        }
        private void ThreadProc(object poThreadParameter)
        {
            // An instance of OpacityEffect is passed in poThreadParameter
            OpacityEffect loOpacityEffect = (OpacityEffect)poThreadParameter;

            // Call the RunEffect method for the instance
            loOpacityEffect.RunEffect();
        }