프로젝트

일반

사용자정보

개정판 96bc6e8e

ID96bc6e8e3609f238126ed99864595538612bbbf2
상위 81908c01
하위 97eba451

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

PageStorage GetPageAsync에서 오류 발생시 무한 루프발생
- 방지하기 위한 IsReStart Flag 추가

Change-Id: I899961964f116524503be3fbdeefd5e9d5e7fc6c

차이점 보기:

KCOM/PageManager/PageStorage.cs
74 74

  
75 75
        }
76 76

  
77
        public async Task<BitmapFrame> GetPageAsync(int PageNo)
77
        public async Task<BitmapFrame> GetPageAsync(int PageNo,bool IsRestart =false)
78 78
        {
79 79
            try
80 80
            {
......
99 99
            }
100 100
            catch (Exception)
101 101
            {
102
                PageImage = await GetPageAsync(PageNo);
102
                if (!IsRestart)
103
                {
104
                    await Task.Delay(100);
105
                    PageImage = await GetPageAsync(PageNo,true);
106
                }
103 107
                //throw new Exception("GetPageAsync(string BasePageUri,int PageNo)", ex);
104 108
            }
105 109
            finally
......
181 185

  
182 186
                    string downloadFilePath = System.IO.Path.Combine(_localStorage, PageNo.ToString() + ".png");
183 187

  
184
                    result = new PageItem
185
                    {
186
                        PageNo = PageNo,
187
                        OriginalUri = new Uri(_BaseUri.Replace("{PageNo}", PageNo.ToString())),
188
                        LocalUri = new Uri(downloadFilePath, UriKind.Absolute),
189
                        LocalFilePath = downloadFilePath
190
                    };
188
                    Uri originalUri = new Uri(_BaseUri.Replace("{PageNo}", PageNo.ToString()));
189

  
191 190

  
192 191
                    System.Net.WebClient client = new System.Net.WebClient();
193 192

  
......
202 201

  
203 202
                    client.DownloadFileCompleted += (snd, evt) =>
204 203
                    {
204
                        result = new PageItem
205
                        {
206
                            PageNo = PageNo,
207
                            OriginalUri = originalUri,
208
                            LocalUri = new Uri(downloadFilePath, UriKind.Absolute),
209
                            LocalFilePath = downloadFilePath
210
                        };
211

  
205 212
                        fileItems.Add(result);
206 213
                    };
207 214

  
208
                    await client.DownloadFileTaskAsync(result.OriginalUri, downloadFilePath);
215
                    await client.DownloadFileTaskAsync(originalUri, downloadFilePath);
209 216

  
210 217
                    GC.Collect();
211 218
                    GC.WaitForPendingFinalizers();

내보내기 Unified diff

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