프로젝트

일반

사용자정보

개정판 448c5399

ID448c5399cf649bbf082f9ac8cf2a3fd01eaa060b
상위 d97dbc7f
하위 604465bd, 5b372dc6

김태성이(가) 약 5년 전에 추가함

Thumbnail download에서 오류 발생 수정

Change-Id: Iaa768613c35ba6a81ac3337d3e296942d3d6ea89

차이점 보기:

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

클립보드 이미지 추가 (최대 크기: 500 MB)