Boa noite a todos!
Estou fazendo uma aplicação em Silverlight 4 para fazer uploads de imagens.
Ela está funcionando perfeitamente, envia as imagens tudo certinho, mas eu estava querendo implementar a aplicação com umas thumbnails das imagens a ser upadas.
Funciona perfeitamente com imagens de até 1mb acima disso retorna o seguinte erro: Falha catastrófica (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)).
A forma que estou fazendo o processo de gerar as thumbnails é o seguinte:
private void button_browser_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog dig = new OpenFileDialog();
dig.Multiselect = true;
bool ? test = dig.ShowDialog();
if (test != null && test == true)
{
indexTotal = dig.Files.Count();
int x = 5;
int y = 5;
int i = 0;
BitmapImage bi;
Image img;
foreach (FileInfo f in dig.Files)
{
files.Add(i, f);
input_browser.Text += f.Name + ";";
i++;
bi = new BitmapImage();
bi.SetSource(f.OpenRead());
img = new Image()
{
Source = bi,
MaxWidth = 100,
MaxHeight = 100,
Stretch = Stretch.Uniform,
VerticalAlignment = System.Windows.VerticalAlignment.Top,
HorizontalAlignment = System.Windows.HorizontalAlignment.Left,
Margin = new Thickness(x, y, 0, 0)
};
preview.Children.Add(img);
preview.Children.Add(new ProgressBar()
{
Width = 100,
Height = 15,
VerticalAlignment = System.Windows.VerticalAlignment.Top,
HorizontalAlignment = System.Windows.HorizontalAlignment.Left,
Margin = new Thickness(x, y + 100, 0, 0)
});
y = (i + 1) % 5 == 0 ? y + 120 : y;
x = (i + 1) % 5 == 0 ? 5 : x + 120;
}
uploadFile();
}
}
Eu acredito que uma forma de tudo ocorrer sem nenhum problema seria se tivesse uma forma de eu saber se a imagem foi carregada para assim eu passar para a proxima, porque se eu tentar carregar apenas uma imagem ela carrega pela metade e não retorna
nenhum erro, mas se eu tentar carregar mais de uma imagem acontece esse erro.
Desde já eu agradeço!
Agredecido pela ajuda sempre! Qualquer opnião é valida desde que tenha fundamento! http://darksp.myvnc.com