QnA
|
사용언어 (칠해주세요) => (C#,VB) |
|
사용툴 (VS) : VS2010 |
|
운영체제 (OS) : Windows 7 |
제가 ScatterView를 이용해서 인터넷에 이미지URL로 폴더안에 이미지 저장하고 폴더안에 있는 이미지들을 나타내주려고 하거든요.
그래서 xaml에는
<s:ScatterView x:Name="scatterView">
<s:ScatterView.ItemTemplate>
<DataTemplate>
<Grid Background="Transparent">
<Image Source="{Binding}" TouchDown="Image_TouchDown">
</Image>
</Grid>
</DataTemplate>
</s:ScatterView.ItemTemplate>
</s:ScatterView>
해주고
파일 저장은
string file = @"C:\Users\GuenYoung\Downloads\image\" + name + ".jpg";
System.Net.WebClient cln = new System.Net.WebClient();
cln.DownloadFile(url, file);
폴더에 있는 이미지를 표기하는 것은
scatterView.ItemsSource = Directory.GetFiles(@"C:\Users\GuenYoung\Downloads\image", "*.jpg");
로 해주거든요.
그리고 새로운 이미지를 불러올때는 폴더안에 이미지를 모두 지우고
DirectoryInfo dirinfo = new DirectoryInfo(@"C:\Users\GuenYoung\Downloads\image");
if (dirinfo.Exists)
dirinfo.Delete(true);
그리고 새로운 폴더를 만들어 주고
if (Directory.Exists(@"C:\Users\GuenYoung\Downloads\image") == false)
Directory.CreateDirectory(@"C:\Users\GuenYoung\Downloads\image");
다시 폴더에 저장해서 이미지를 불러오려고 하는데
"파일은 다른 프로세스에서 사용 중이므로 프로세스에서 액세스할 수 없습니다."라고 뜨네요.,
제생각에는 scatterView에 이미지들이 표기되어 있어서 사용 중이라고 뜨는 것같은데
그래서 삭제하기 전에 scatterView.Items.Clear();해줬는데
"ItemsSource를 사용하는 동안에는 작업을 수행할 수 없습니다. 대신 ItemsControl.ItemsSource가 있는 요소에 액세스하여 수정합니다."라고 에러가 뜨네요...
제생각에는 폴더안에 이미지를 삭제하기 전에 scatterView에 있는 이미지들을 초기화해줘야 할것같은데..
어떻게 해야할까요??
댓글
댓글 리스트-
작성자100전무패 작성자 본인 여부 작성자 작성시간 13.06.11 자문자답이네요..ㅎ
<Grid Background="Transparent">
<Image TouchDown="Image_TouchDown">
<Image.Source>
<BitmapImage UriSource="{Binding}" CacheOption="OnLoad"/>
</Image.Source>
</Image>
</Grid>
하니깐 괜찮아지네요. -
작성자망고 작성시간 13.06.11 금방 해결하셔서 다행이네요.
-
답댓글 작성자100전무패 작성자 본인 여부 작성자 작성시간 13.06.11 어제부터 계속 이래서 오늘까지 고민하다가 과장님께 여쩌보니깐 바로 해결.. 좋긴하지만 멘붕..ㅎㅎ
-
작성자카키104 작성시간 13.06.12 고생하셨네요