示例#1
0
 public static ImageSource GetImageSource(Uri uri, Dispatcher dispatcher)
 {
     if (uri == null) return null;
     BitmapImage bi = null;
     BackgroundHelper.DoWithDispatcher(dispatcher, () =>
     {
         try
         {
             bi = new BitmapImage(uri);
         }
         catch
         {
             bi = new BitmapImage(new Uri("/Images/LoadingError.png", UriKind.Relative));
         }
     });
     return bi;
 }
示例#2
0
        public static ImageSource GetImageSource(Uri uri, Dispatcher dispatcher)
        {
            if (uri == null)
            {
                return(null);
            }
            BitmapImage bi = null;

            BackgroundHelper.DoWithDispatcher(dispatcher, () =>
            {
                try
                {
                    bi = new BitmapImage(uri);
                }
                catch
                {
                    bi = null;
                }
            });
            return(bi);
        }
示例#3
0
        public static ImageSource GetImageSource(Stream stream, Dispatcher dispatcher)
        {
            if (stream == null) return null;
            BitmapImage bi = null;

            BackgroundHelper.DoWithDispatcher(dispatcher, () =>
            {
                try
                {
                    bi = new BitmapImage();
                    bi.BeginInit();
                    bi.StreamSource = stream;
                    bi.EndInit();
                }
                catch
                {
                    bi = new BitmapImage(new Uri("/Images/LoadingError.png", UriKind.Relative));
                }

            });
            return bi;
        }
示例#4
0
        public static ImageSource GetImageSource(Stream stream, Dispatcher dispatcher)
        {
            if (stream == null)
            {
                return(null);
            }
            BitmapImage bi = null;

            BackgroundHelper.DoWithDispatcher(dispatcher, () =>
            {
                try
                {
                    bi = new BitmapImage();
                    bi.BeginInit();
                    bi.StreamSource = stream;
                    bi.EndInit();
                }
                catch
                {
                    bi = null;
                }
            });
            return(bi);
        }