개정판 448c5399
Thumbnail download에서 오류 발생 수정
Change-Id: Iaa768613c35ba6a81ac3337d3e296942d3d6ea89
KCOM/Controls/Sample.xaml.cs | ||
---|---|---|
588 | 588 |
|
589 | 589 |
foreach (var page in items) |
590 | 590 |
{ |
591 |
System.Diagnostics.Debug.WriteLine("thumbnail download process " + page.PAGE_NUMBER); |
|
591 | 592 |
|
592 | 593 |
//} |
593 | 594 |
//ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page => |
... | ... | |
650 | 651 |
}); |
651 | 652 |
} |
652 | 653 |
} |
653 |
} |
|
654 | 654 |
|
655 |
if (ImgListbox.ItemsSource == null) |
|
656 |
{ |
|
657 |
ImgListbox.ItemsSource = this._thumbnailItems; |
|
655 |
if (ImgListbox.ItemsSource == null)
|
|
656 |
{
|
|
657 |
ImgListbox.ItemsSource = this._thumbnailItems;
|
|
658 | 658 |
|
659 |
//this.CurrentPage = this._thumbnailItems.FirstOrDefault(); |
|
659 |
//this.CurrentPage = this._thumbnailItems.FirstOrDefault();
|
|
660 | 660 |
|
661 |
//this._thumbnailItems.ToList().ForEach(data => |
|
662 |
//{ |
|
663 |
// data.Width = ImgListbox.ActualWidth; |
|
664 |
// data.Height = ImgListbox.ActualHeight; |
|
665 |
//}); |
|
661 |
//this._thumbnailItems.ToList().ForEach(data =>
|
|
662 |
//{
|
|
663 |
// data.Width = ImgListbox.ActualWidth;
|
|
664 |
// data.Height = ImgListbox.ActualHeight;
|
|
665 |
//});
|
|
666 | 666 |
|
667 |
if (ImgListbox.Items.Count > 0) |
|
668 |
{ |
|
669 |
int StartPageIdx = 1; |
|
670 |
|
|
671 |
if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1) |
|
667 |
if (ImgListbox.Items.Count > 0) |
|
672 | 668 |
{ |
673 |
ImgListbox.SelectedItem = ImgListbox.Items[0]; |
|
669 |
int StartPageIdx = 1; |
|
670 |
|
|
671 |
if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1) |
|
672 |
{ |
|
673 |
ImgListbox.SelectedItem = ImgListbox.Items[0]; |
|
674 |
} |
|
675 |
else |
|
676 |
{ |
|
677 |
ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx]; |
|
678 |
} |
|
674 | 679 |
} |
675 |
else |
|
680 |
|
|
681 |
if (ThumbInitialized != null) |
|
676 | 682 |
{ |
677 |
ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx];
|
|
683 |
ThumbInitialized(this, new EventArgs());
|
|
678 | 684 |
} |
679 | 685 |
} |
680 |
} |
|
681 |
else |
|
682 |
{ |
|
683 |
ImgListbox.UpdateLayout(); |
|
684 |
ImgListbox.ItemsSource = this._thumbnailItems; |
|
685 |
} |
|
686 |
else |
|
687 |
{ |
|
688 |
ImgListbox.UpdateLayout(); |
|
689 |
ImgListbox.ItemsSource = this._thumbnailItems; |
|
690 |
} |
|
686 | 691 |
|
687 |
if(ThumbInitialized != null) |
|
688 |
{ |
|
689 |
ThumbInitialized(this, new EventArgs()); |
|
690 | 692 |
} |
693 |
|
|
694 |
//if (ImgListbox.ItemsSource == null) |
|
695 |
//{ |
|
696 |
// ImgListbox.ItemsSource = this._thumbnailItems; |
|
697 |
|
|
698 |
// //this.CurrentPage = this._thumbnailItems.FirstOrDefault(); |
|
699 |
|
|
700 |
// //this._thumbnailItems.ToList().ForEach(data => |
|
701 |
// //{ |
|
702 |
// // data.Width = ImgListbox.ActualWidth; |
|
703 |
// // data.Height = ImgListbox.ActualHeight; |
|
704 |
// //}); |
|
705 |
|
|
706 |
// if (ImgListbox.Items.Count > 0) |
|
707 |
// { |
|
708 |
// int StartPageIdx = 1; |
|
709 |
|
|
710 |
// if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1) |
|
711 |
// { |
|
712 |
// ImgListbox.SelectedItem = ImgListbox.Items[0]; |
|
713 |
// } |
|
714 |
// else |
|
715 |
// { |
|
716 |
// ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx]; |
|
717 |
// } |
|
718 |
// } |
|
719 |
//} |
|
720 |
//else |
|
721 |
//{ |
|
722 |
// ImgListbox.UpdateLayout(); |
|
723 |
// ImgListbox.ItemsSource = this._thumbnailItems; |
|
724 |
//} |
|
725 |
|
|
726 |
//if(ThumbInitialized != null) |
|
727 |
//{ |
|
728 |
// ThumbInitialized(this, new EventArgs()); |
|
729 |
//} |
|
691 | 730 |
} |
692 | 731 |
|
693 | 732 |
private async void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
KCOM/MainWindow.xaml.cs | ||
---|---|---|
56 | 56 |
private void MainWindow_Activated(object sender, EventArgs e) |
57 | 57 |
{ |
58 | 58 |
this.Topmost = true; |
59 |
this.Topmost = false; |
|
59 | 60 |
} |
60 | 61 |
|
61 | 62 |
private void MainWindow_Unloaded(object sender, RoutedEventArgs e) |
KCOM/PageManager/PageStorage.cs | ||
---|---|---|
152 | 152 |
return result; |
153 | 153 |
} |
154 | 154 |
|
155 |
public void DownloadPagesAsync(int StartPageNo, int TalkCount = 5) |
|
155 |
public async void DownloadPagesAsync(int StartPageNo, int TalkCount = 5)
|
|
156 | 156 |
{ |
157 | 157 |
try |
158 | 158 |
{ |
... | ... | |
167 | 167 |
{ |
168 | 168 |
try |
169 | 169 |
{ |
170 |
DownloadPageAsync(i).RunAndForget();
|
|
171 |
|
|
170 |
await DownloadPageAsync(i);
|
|
171 |
System.Threading.Thread.Sleep(200); |
|
172 | 172 |
} |
173 | 173 |
catch (Exception ex) |
174 | 174 |
{ |
... | ... | |
228 | 228 |
Uri originalUri = new Uri(_BaseUri.Replace("{PageNo}", PageNo.ToString())); |
229 | 229 |
|
230 | 230 |
|
231 |
System.Net.WebClient client = new System.Net.WebClient(); |
|
231 |
using (System.Net.WebClient client = new System.Net.WebClient()) |
|
232 |
{ |
|
233 |
client.UseDefaultCredentials = true; |
|
234 |
System.Net.IWebProxy webProxy = client.Proxy; |
|
232 | 235 |
|
233 |
client.UseDefaultCredentials = true; |
|
234 |
System.Net.IWebProxy webProxy = client.Proxy; |
|
235 |
|
|
236 |
if (webProxy != null) |
|
237 |
{ |
|
238 |
// Use the default credentials of the logged on user. |
|
239 |
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; |
|
240 |
} |
|
241 |
|
|
242 |
client.DownloadFileCompleted += (snd, evt) => |
|
243 |
{ |
|
244 |
result = new PageItem |
|
245 |
{ |
|
246 |
PageNo = PageNo, |
|
247 |
OriginalUri = originalUri, |
|
248 |
LocalUri = new Uri(downloadFilePath, UriKind.Absolute), |
|
249 |
LocalFilePath = downloadFilePath |
|
250 |
}; |
|
251 |
|
|
252 |
lock (fileItems) |
|
236 |
if (webProxy != null) |
|
253 | 237 |
{ |
254 |
fileItems.Add(result); |
|
238 |
// Use the default credentials of the logged on user. |
|
239 |
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; |
|
255 | 240 |
} |
256 | 241 |
|
257 |
(snd as System.Net.WebClient).Dispose(); |
|
258 |
}; |
|
242 |
//client.DownloadFileCompleted += (snd, evt) => |
|
243 |
//{ |
|
244 |
|
|
259 | 245 |
|
260 |
System.Diagnostics.Debug.WriteLine("Download : " + downloadFilePath); |
|
246 |
// //(snd as System.Net.WebClient).Dispose(); |
|
247 |
//}; |
|
261 | 248 |
|
262 |
await client.DownloadFileTaskAsync(originalUri, downloadFilePath);
|
|
249 |
System.Diagnostics.Debug.WriteLine("Download : " + downloadFilePath);
|
|
263 | 250 |
|
251 |
await client.DownloadFileTaskAsync(originalUri, downloadFilePath); |
|
252 |
} |
|
253 |
|
|
254 |
result = new PageItem |
|
255 |
{ |
|
256 |
PageNo = PageNo, |
|
257 |
OriginalUri = originalUri, |
|
258 |
LocalUri = new Uri(downloadFilePath, UriKind.Absolute), |
|
259 |
LocalFilePath = downloadFilePath |
|
260 |
}; |
|
261 |
|
|
262 |
lock (fileItems) |
|
263 |
{ |
|
264 |
fileItems.Add(result); |
|
265 |
} |
|
264 | 266 |
//System.Diagnostics.Debug.WriteLine("Download : " + result.LocalFilePath); |
265 | 267 |
} |
266 | 268 |
} |
내보내기 Unified diff