void SetBackgroundColor_Worker(object o)
{
if (o != null)
{
ImageSource img = (ImageSource)o;
double brightness = 0;
if (img != null)
{
BitmapImage bmpImg = img as BitmapImage;
if (bmpImg != null)
{
System.Drawing.Bitmap bmp = Functions.Images.BitmapImage2Bitmap(bmpImg);
if (bmp != null)
{
System.Drawing.Color color = Functions.Images.CalculateAverageColor(bmp);
brightness = color.GetBrightness();
}
}
}
this.Dispatcher.BeginInvoke(new Action<double>(LoadProfileImage_GUI), priority, new object[] { brightness });
}
}