개정판 f5f788c2
issue #0000 저장기능 수정
Change-Id: Iea19dc20c703cb1e07d3d5a2034d419eda6fa5b6
KCOM/Common/TempFile.cs | ||
---|---|---|
413 | 413 |
} |
414 | 414 |
|
415 | 415 |
//Control |
416 |
item = await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, tempLoadData[k].ConvertData, Common.ViewerDataModel.Instance.MarkupControls_USER,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "", tempLoadData[k].MarkupInfoID, tempLoadData[k].CommentID);
|
|
416 |
item = await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, tempLoadData[k].ConvertData, Common.ViewerDataModel.Instance.MarkupControls_USER,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "", tempLoadData[k].MarkupInfoID, tempLoadData[k].CommentID);
|
|
417 | 417 |
|
418 | 418 |
UndoData = new Undo_data() |
419 | 419 |
{ |
KCOM/Common/ViewerDataModel.cs | ||
---|---|---|
26 | 26 |
public class ViewerDataModel : INotifyPropertyChanged |
27 | 27 |
{ |
28 | 28 |
|
29 |
System.Threading.CancellationTokenSource TokenSource; |
|
29 |
System.Threading.CancellationTokenSource PageImageTokenSource; |
|
30 |
System.Threading.CancellationTokenSource MarkupTokenSource; |
|
30 | 31 |
|
31 |
public System.Threading.CancellationToken CancellationToken()
|
|
32 |
public System.Threading.CancellationToken? PagImageCancelToken()
|
|
32 | 33 |
{ |
33 |
return TokenSource.Token;
|
|
34 |
return PageImageTokenSource?.Token;
|
|
34 | 35 |
} |
35 | 36 |
|
36 |
public System.Threading.CancellationToken NewCancellationToken()
|
|
37 |
public void PagImageCancelDispose()
|
|
37 | 38 |
{ |
38 |
if (TokenSource != null) |
|
39 |
if (PageImageTokenSource != null) |
|
40 |
{ |
|
41 |
PageImageTokenSource.Dispose(); |
|
42 |
PageImageTokenSource = null; |
|
43 |
} |
|
44 |
} |
|
45 |
|
|
46 |
public System.Threading.CancellationToken NewPagImageCancelToken() |
|
47 |
{ |
|
48 |
if (PageImageTokenSource != null) |
|
49 |
{ |
|
50 |
System.Diagnostics.Debug.WriteLine("cancel Token"); |
|
51 |
PageImageTokenSource.Cancel(true); |
|
52 |
|
|
53 |
while (!PageImageTokenSource.IsCancellationRequested) |
|
54 |
{ |
|
55 |
// Do some work, or just wait |
|
56 |
System.Threading.Thread.Sleep(50); |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
PageImageTokenSource = new System.Threading.CancellationTokenSource(); |
|
61 |
|
|
62 |
return PageImageTokenSource.Token; |
|
63 |
} |
|
64 |
|
|
65 |
public System.Threading.CancellationToken MarkupCancelToken() |
|
66 |
{ |
|
67 |
return MarkupTokenSource.Token; |
|
68 |
} |
|
69 |
|
|
70 |
public void MarkupCancelDispose() |
|
71 |
{ |
|
72 |
if (MarkupTokenSource != null) |
|
73 |
{ |
|
74 |
MarkupTokenSource.Dispose(); |
|
75 |
MarkupTokenSource = null; |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
public System.Threading.CancellationToken NewMarkupCancelToken() |
|
80 |
{ |
|
81 |
if (MarkupTokenSource != null) |
|
39 | 82 |
{ |
40 | 83 |
System.Diagnostics.Debug.WriteLine("cancel Token"); |
41 |
TokenSource.Cancel(true); |
|
84 |
MarkupTokenSource.Cancel(true);
|
|
42 | 85 |
|
43 |
while (!TokenSource.IsCancellationRequested) |
|
86 |
while (!MarkupTokenSource.IsCancellationRequested)
|
|
44 | 87 |
{ |
45 | 88 |
// Do some work, or just wait |
46 | 89 |
System.Threading.Thread.Sleep(50); |
47 | 90 |
} |
48 | 91 |
} |
49 | 92 |
|
50 |
TokenSource = new System.Threading.CancellationTokenSource(); |
|
93 |
MarkupTokenSource = new System.Threading.CancellationTokenSource();
|
|
51 | 94 |
|
52 |
return TokenSource.Token; |
|
95 |
return MarkupTokenSource.Token;
|
|
53 | 96 |
} |
54 | 97 |
|
55 | 98 |
|
KCOM/Controls/PrintControl.xaml.cs | ||
---|---|---|
244 | 244 |
gridViewMarkup.SelectedItems.Add(item); |
245 | 245 |
} |
246 | 246 |
|
247 |
PageChangeAsync(Common.ViewerDataModel.Instance.NewCancellationToken(), _StartPageNo,false).ConfigureAwait(true);
|
|
247 |
PageChangeAsync(Common.ViewerDataModel.Instance.NewPagImageCancelToken(), _StartPageNo,false).ConfigureAwait(true);
|
|
248 | 248 |
|
249 | 249 |
sliderPages.Maximum = Convert.ToDouble(this._DocInfo.PAGE_COUNT); |
250 | 250 |
this.stPageNo.Maximum = Convert.ToDouble(this._DocInfo.PAGE_COUNT); |
... | ... | |
286 | 286 |
|
287 | 287 |
if (!IsExportOrPrint) |
288 | 288 |
{ |
289 |
await PageChangeAsync(Common.ViewerDataModel.Instance.NewCancellationToken(), this.CurrentPageNo, false);
|
|
289 |
await PageChangeAsync(Common.ViewerDataModel.Instance.NewPagImageCancelToken(), this.CurrentPageNo, false);
|
|
290 | 290 |
} |
291 | 291 |
//await App.PageStorage.GetPageUriAsync(this.CurrentPageNo); |
292 | 292 |
|
... | ... | |
409 | 409 |
{ |
410 | 410 |
if (_initializeComponentFinished) |
411 | 411 |
{ |
412 |
await PageChangeAsync(Common.ViewerDataModel.Instance.NewCancellationToken(),this.CurrentPageNo, false);
|
|
412 |
await PageChangeAsync(Common.ViewerDataModel.Instance.NewPagImageCancelToken(),this.CurrentPageNo, false);
|
|
413 | 413 |
} |
414 | 414 |
} |
415 | 415 |
|
... | ... | |
553 | 553 |
{ |
554 | 554 |
try |
555 | 555 |
{ |
556 |
var token = Common.ViewerDataModel.Instance.NewCancellationToken();
|
|
556 |
var token = Common.ViewerDataModel.Instance.NewPagImageCancelToken();
|
|
557 | 557 |
|
558 | 558 |
if (this.printIndy.IsBusy == true) |
559 | 559 |
return; |
... | ... | |
636 | 636 |
if (this.printIndy.IsBusy == true) |
637 | 637 |
return; |
638 | 638 |
|
639 |
var token = Common.ViewerDataModel.Instance.NewCancellationToken();
|
|
639 |
var token = Common.ViewerDataModel.Instance.NewPagImageCancelToken();
|
|
640 | 640 |
|
641 | 641 |
(this.Parent as RadWindow).CanClose = false; |
642 | 642 |
|
... | ... | |
904 | 904 |
#region 프린트 실행 |
905 | 905 |
public async void Printing() |
906 | 906 |
{ |
907 |
var token = Common.ViewerDataModel.Instance.NewCancellationToken();
|
|
907 |
var token = Common.ViewerDataModel.Instance.NewPagImageCancelToken ();
|
|
908 | 908 |
|
909 | 909 |
await PageChangeAsync(token,1, false); |
910 | 910 |
|
KCOM/Controls/Sample.xaml | ||
---|---|---|
555 | 555 |
x:Name="ImgListbox" |
556 | 556 |
Grid.Row="2" |
557 | 557 |
Margin="1" |
558 |
telerik:StyleManager.Theme="office2016"
|
|
558 |
telerik:StyleManager.Theme="Office2016"
|
|
559 | 559 |
Background="{DynamicResource KCOMColor_AlternativeBrush}" |
560 | 560 |
BorderBrush="#FFC2C2C2" |
561 | 561 |
BorderThickness="0" |
KCOM/Controls/Sample.xaml.cs | ||
---|---|---|
781 | 781 |
|
782 | 782 |
GotoPage(selectItem.PageNumber); |
783 | 783 |
|
784 |
var result = await MarkupParser.GetBaseControlAsync(selectItem.Data, ViewerDataModel.Instance.CancellationToken());
|
|
784 |
var result = await MarkupParser.GetBaseControlAsync(selectItem.Data, ViewerDataModel.Instance.NewMarkupCancelToken());
|
|
785 | 785 |
|
786 | 786 |
Rect rect = new Rect(new Point(result.StartPoint.X - 100, result.StartPoint.Y - 100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100)); |
787 | 787 |
this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect); |
... | ... | |
854 | 854 |
MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall; |
855 | 855 |
GotoPage(Convert.ToInt32(gaza.PageNumber)); |
856 | 856 |
|
857 |
var data = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(gaza.Data.ToString(),ViewerDataModel.Instance.CancellationToken()); //언패킹작업
|
|
857 |
var data = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(gaza.Data.ToString(),ViewerDataModel.Instance.NewMarkupCancelToken()); //언패킹작업
|
|
858 | 858 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString())) |
859 | 859 |
{ |
860 | 860 |
case MarkupToPDF.Controls.Common.ControlType.TextControl: |
... | ... | |
1369 | 1369 |
} |
1370 | 1370 |
foreach (var item in list) |
1371 | 1371 |
{ |
1372 |
var data = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(item.Data.ToString(), ViewerDataModel.Instance.CancellationToken());
|
|
1372 |
var data = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(item.Data.ToString(), ViewerDataModel.Instance.NewMarkupCancelToken());
|
|
1373 | 1373 |
|
1374 | 1374 |
switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString())) |
1375 | 1375 |
{ |
KCOM/Controls/Symbol.xaml.cs | ||
---|---|---|
172 | 172 |
_canvas.Background = Brushes.White; |
173 | 173 |
_canvas.Width = finalItem.BorderSize.Width; |
174 | 174 |
_canvas.Height = finalItem.BorderSize.Height; |
175 |
await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas, PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.CancellationToken());
|
|
175 |
await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas, PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken());
|
|
176 | 176 |
|
177 | 177 |
BitmapEncoder encoder = new PngBitmapEncoder(); |
178 | 178 |
|
... | ... | |
479 | 479 |
{ |
480 | 480 |
if (parse != "") |
481 | 481 |
{ |
482 |
System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty);
|
|
482 |
System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty);
|
|
483 | 483 |
(item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid(); |
484 | 484 |
(item as MarkupToPDF.Common.CommentUserInfo).SymbolID = id; |
485 | 485 |
//(item as MarkupToPDF.Common.CommentUserInfo).GroupID = group_id; |
KCOM/Events/Implementation/TopMenuEvent.cs | ||
---|---|---|
2796 | 2796 |
data = new string[instance.Count]; |
2797 | 2797 |
foreach (var markup in instance) |
2798 | 2798 |
{ |
2799 |
data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.CancellationToken());
|
|
2799 |
data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.NewMarkupCancelToken());
|
|
2800 | 2800 |
} |
2801 | 2801 |
} |
2802 | 2802 |
} |
... | ... | |
3084 | 3084 |
{ |
3085 | 3085 |
if (parse != "") |
3086 | 3086 |
{ |
3087 |
System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress,ViewerDataModel.Instance.CancellationToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty);
|
|
3087 |
System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress,ViewerDataModel.Instance.NewMarkupCancelToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty);
|
|
3088 | 3088 |
(item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid(); |
3089 | 3089 |
|
3090 | 3090 |
ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
KCOM/Events/Load.cs | ||
---|---|---|
63 | 63 |
|
64 | 64 |
foreach (string data in markupdata) |
65 | 65 |
{ |
66 |
result = await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, printCanvas, pageAngle, DisplayColor, "",Common.ViewerDataModel.Instance.CancellationToken());
|
|
66 |
result = await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, printCanvas, pageAngle, DisplayColor, "",Common.ViewerDataModel.Instance.NewMarkupCancelToken());
|
|
67 | 67 |
|
68 | 68 |
if(!result) |
69 | 69 |
{ |
KCOM/Events/PasteCommand.cs | ||
---|---|---|
90 | 90 |
string[] data2 = new string[2]; |
91 | 91 |
data2 = parse.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
92 | 92 |
|
93 |
System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, data2[0], ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, "#FFFF0000", string.Empty);
|
|
93 |
System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, data2[0], ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, "#FFFF0000", string.Empty);
|
|
94 | 94 |
(item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid(); |
95 | 95 |
if (data2.Length >= 2) |
96 | 96 |
{ |
KCOM/KCOM.csproj | ||
---|---|---|
1443 | 1443 |
<ItemGroup> |
1444 | 1444 |
<Resource Include="Resources\Images\MenuImage_New\tips.png" /> |
1445 | 1445 |
</ItemGroup> |
1446 |
<ItemGroup> |
|
1447 |
<Resource Include="Resources\Images\ExtImage\blank.png" /> |
|
1448 |
</ItemGroup> |
|
1446 | 1449 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
1447 | 1450 |
<Target Name="PostBuildMacros"> |
1448 | 1451 |
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> |
KCOM/PageManager/PageStorage.cs | ||
---|---|---|
3 | 3 |
using System.Collections.Generic; |
4 | 4 |
using System.ComponentModel; |
5 | 5 |
using System.Linq; |
6 |
using System.Net; |
|
6 | 7 |
using System.Text; |
7 | 8 |
using System.Threading.Tasks; |
8 | 9 |
using System.Windows.Media.Imaging; |
... | ... | |
35 | 36 |
try |
36 | 37 |
{ |
37 | 38 |
backgroundWorker = new BackgroundWorker { WorkerSupportsCancellation = true, WorkerReportsProgress = true }; |
39 |
|
|
38 | 40 |
backgroundWorker.DoWork += BackgroundWorker_DoWork; |
39 | 41 |
backgroundWorker.ProgressChanged += BackgroundWorker_ProgressChanged; |
40 |
|
|
42 |
|
|
41 | 43 |
_fileExt = fileExt; |
42 | 44 |
_BaseUri = BaseUri; |
43 | 45 |
LocalStorage = localStoragePath; |
... | ... | |
64 | 66 |
|
65 | 67 |
while (WorkItems.Count > 0) |
66 | 68 |
{ |
69 |
if (backgroundWorker.CancellationPending) |
|
70 |
{ |
|
71 |
e.Cancel = true; |
|
72 |
return; |
|
73 |
} |
|
74 |
|
|
67 | 75 |
if (!IsBusy) |
68 | 76 |
{ |
69 | 77 |
int item = -1; |
... | ... | |
71 | 79 |
{ |
72 | 80 |
|
73 | 81 |
if (WorkItems.TryFrist(true, out item)) |
74 |
{ |
|
82 |
{
|
|
75 | 83 |
var result = await DownloadPageAsync(item, null); |
76 | 84 |
|
77 | 85 |
if (!result.IsDownLoad) |
... | ... | |
195 | 203 |
{ |
196 | 204 |
result = pageItem.LocalUri; |
197 | 205 |
|
198 |
if(PageNo + _TakeCount < _TotalPages) |
|
199 |
{ |
|
200 |
int takecount = 5; |
|
206 |
//if(PageNo + _TakeCount < _TotalPages)
|
|
207 |
//{
|
|
208 |
// int takecount = 5;
|
|
201 | 209 |
|
202 |
if (_TotalPages < PageNo + takecount) |
|
203 |
{ |
|
204 |
takecount = takecount - (PageNo + takecount - _TotalPages) - 1; |
|
205 |
} |
|
210 |
// if (_TotalPages < PageNo + takecount)
|
|
211 |
// {
|
|
212 |
// takecount = takecount - (PageNo + takecount - _TotalPages) - 1;
|
|
213 |
// }
|
|
206 | 214 |
|
207 |
DownloadWorkAsync(PageNo + 1, takecount); |
|
208 |
} |
|
215 |
// DownloadWorkAsync(PageNo + 1, takecount);
|
|
216 |
//}
|
|
209 | 217 |
//int takecount = _TakeCount; |
210 | 218 |
|
211 | 219 |
//if (_TotalPages < PageNo + takecount) |
... | ... | |
272 | 280 |
} |
273 | 281 |
else |
274 | 282 |
{ |
275 |
|
|
276 |
|
|
277 | 283 |
if (!System.IO.Directory.Exists(LocalStorage)) |
278 | 284 |
{ |
279 | 285 |
System.IO.Directory.CreateDirectory(LocalStorage); |
... | ... | |
294 | 300 |
LocalFilePath = downloadFilePath |
295 | 301 |
}; |
296 | 302 |
|
297 |
using (System.Net.WebClient client = new System.Net.WebClient())
|
|
298 |
{ |
|
299 |
System.Diagnostics.Debug.WriteLine("download start " + downloadFilePath);
|
|
300 |
client.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
|
|
301 |
client.Headers.Add("Cache-Control", "no-cache");
|
|
302 |
client.UseDefaultCredentials = true;
|
|
303 |
System.Net.IWebProxy webProxy = client.Proxy;
|
|
303 |
System.Net.WebClient client = new System.Net.WebClient();
|
|
304 |
|
|
305 |
System.Diagnostics.Debug.WriteLine("download start " + downloadFilePath); |
|
306 |
client.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); |
|
307 |
client.Headers.Add("Cache-Control", "no-cache"); |
|
308 |
client.UseDefaultCredentials = true; |
|
309 |
System.Net.IWebProxy webProxy = client.Proxy; |
|
304 | 310 |
|
305 |
if (webProxy != null) |
|
306 |
{ |
|
307 |
// Use the default credentials of the logged on user. |
|
308 |
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; |
|
309 |
} |
|
310 |
|
|
311 |
//client.DownloadFileCompleted += (snd, evt) => |
|
312 |
//{ |
|
313 |
|
|
314 |
|
|
315 |
// //(snd as System.Net.WebClient).Dispose(); |
|
316 |
//}; |
|
311 |
if (webProxy != null) |
|
312 |
{ |
|
313 |
// Use the default credentials of the logged on user. |
|
314 |
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; |
|
315 |
} |
|
317 | 316 |
|
318 |
if (cts != null) |
|
317 |
AsyncCompletedEventHandler downloadFileCompleteHandler = (snd, evt) => |
|
318 |
{ |
|
319 |
if (!evt.Cancelled) |
|
319 | 320 |
{ |
320 |
cts.Value.Register(() => |
|
321 |
{ |
|
322 |
client.CancelAsync(); |
|
323 |
Console.WriteLine("Request cancelled!"); |
|
324 |
result = null; |
|
325 |
}); |
|
321 |
result.IsDownLoad = true; |
|
326 | 322 |
|
327 |
client.DownloadProgressChanged += (snd, ect) =>
|
|
323 |
if (fileItems.Where(x => x.PageNo == PageNo).Count() == 0)
|
|
328 | 324 |
{ |
329 |
IsBusy = client.IsBusy; |
|
330 |
|
|
331 |
//if(cts.Value.IsCancellationRequested) |
|
332 |
//{ |
|
333 |
// System.Diagnostics.Debug.WriteLine("download cancel " + downloadFilePath); |
|
334 |
// client.CancelAsync(); |
|
335 |
// client.Dispose(); |
|
336 |
//} |
|
337 |
}; |
|
325 |
fileItems.Add(result); |
|
326 |
} |
|
327 |
System.Diagnostics.Debug.WriteLine("Download completed finish : " + downloadFilePath); |
|
328 |
PageLoadCompleted?.Invoke(this, new PageLoadCompletedEventArgs(result)); |
|
338 | 329 |
} |
339 |
|
|
340 |
client.DownloadFileCompleted += (snd, evt) => |
|
330 |
else |
|
341 | 331 |
{ |
342 |
if (!evt.Cancelled) |
|
343 |
{ |
|
344 |
result.IsDownLoad = true; |
|
332 |
//client.DownloadFileCompleted -= downloadFileCompleteHandler; |
|
333 |
//client.DownloadProgressChanged -= downloadProgressHandler; |
|
345 | 334 |
|
346 |
if (fileItems.Where(x => x.PageNo == PageNo).Count() == 0) |
|
347 |
{ |
|
348 |
fileItems.Add(result); |
|
349 |
} |
|
335 |
client.Dispose(); |
|
336 |
client = null; |
|
337 |
System.IO.File.Delete(downloadFilePath); |
|
350 | 338 |
|
351 |
System.Diagnostics.Debug.WriteLine("Download completed finish : " + downloadFilePath); |
|
339 |
Console.WriteLine("Request cancelled!"); |
|
340 |
result = null; |
|
341 |
System.Diagnostics.Debug.WriteLine("Download completed cancelled : " + downloadFilePath); |
|
342 |
} |
|
352 | 343 |
|
353 |
PageLoadCompleted?.Invoke(this, new PageLoadCompletedEventArgs(result)); |
|
344 |
#if !DOWNLOAD_TEST |
|
345 |
KCOM.Common.ViewerDataModel.Instance.PagImageCancelDispose(); |
|
346 |
#endif |
|
347 |
}; |
|
354 | 348 |
|
355 |
client.Dispose(); |
|
356 |
} |
|
357 |
else |
|
358 |
{ |
|
359 |
System.Diagnostics.Debug.WriteLine("Download completed cancelled : " + downloadFilePath); |
|
360 | 349 |
|
361 |
client.Dispose(); |
|
362 |
System.IO.File.Delete(downloadFilePath); |
|
363 |
} |
|
350 |
if (cts != null) |
|
351 |
{ |
|
352 |
DownloadProgressChangedEventHandler downloadProgressHandler = (snd, ect) => |
|
353 |
{ |
|
354 |
IsBusy = client.IsBusy; |
|
364 | 355 |
}; |
365 | 356 |
|
366 |
await client.DownloadFileTaskAsync(originalUri, downloadFilePath); |
|
357 |
cts.Value.Register(() => |
|
358 |
{ |
|
359 |
client.CancelAsync(); |
|
360 |
}); |
|
367 | 361 |
|
362 |
client.DownloadProgressChanged += downloadProgressHandler; |
|
368 | 363 |
} |
369 | 364 |
|
370 |
//} |
|
371 |
//System.Diagnostics.Debug.WriteLine("Download : " + result.LocalFilePath); |
|
365 |
client.DownloadFileCompleted += downloadFileCompleteHandler; |
|
366 |
|
|
367 |
await client.DownloadFileTaskAsync(originalUri, downloadFilePath); |
|
368 |
|
|
372 | 369 |
} |
373 | 370 |
} |
371 |
catch (WebException ex) when (ex.Status == WebExceptionStatus.RequestCanceled) |
|
372 |
{ |
|
373 |
Console.WriteLine("Cancelled"); |
|
374 |
} |
|
374 | 375 |
catch (Exception ex) |
375 | 376 |
{ |
376 | 377 |
throw new Exception("DownloadPageAsync : ", ex); |
... | ... | |
383 | 384 |
return result; |
384 | 385 |
} |
385 | 386 |
|
387 |
private void downloadFileCompleteHandler(object sender, AsyncCompletedEventArgs e) |
|
388 |
{ |
|
389 |
throw new NotImplementedException(); |
|
390 |
} |
|
391 |
|
|
386 | 392 |
public void Clear() |
387 | 393 |
{ |
388 | 394 |
try |
KCOM/Services/BaseServices.cs | ||
---|---|---|
584 | 584 |
|
585 | 585 |
foreach (var markupitem in pageItems) |
586 | 586 |
{ |
587 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID);
|
|
587 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID);
|
|
588 | 588 |
} |
589 | 589 |
} |
590 | 590 |
} |
... | ... | |
689 | 689 |
|
690 | 690 |
foreach (var markup in instance) |
691 | 691 |
{ |
692 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "",
|
|
692 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "",
|
|
693 | 693 |
item.MarkupInfoID, markup.ID,STAMP_Contents:App.SystemInfo.STAMP_CONTENTS); |
694 | 694 |
} |
695 | 695 |
} |
... | ... | |
709 | 709 |
var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
710 | 710 |
foreach (var markup in instance) |
711 | 711 |
{ |
712 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "",
|
|
712 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "",
|
|
713 | 713 |
item.MarkupInfoID, markup.ID); |
714 | 714 |
} |
715 | 715 |
} |
... | ... | |
1025 | 1025 |
|
1026 | 1026 |
foreach (var markupitem in markupItems) |
1027 | 1027 |
{ |
1028 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "",
|
|
1028 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "",
|
|
1029 | 1029 |
item.MarkupInfoID, markupitem.ID); |
1030 | 1030 |
} |
1031 | 1031 |
} |
... | ... | |
1035 | 1035 |
|
1036 | 1036 |
foreach (var markupitem in markupItems) |
1037 | 1037 |
{ |
1038 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID);
|
|
1038 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID);
|
|
1039 | 1039 |
} |
1040 | 1040 |
} |
1041 | 1041 |
} |
KCOM/Views/MainMenu.xaml.cs | ||
---|---|---|
117 | 117 |
{ |
118 | 118 |
#region 프로퍼티 |
119 | 119 |
|
120 |
private BitmapFrame tempPageImage =null; |
|
121 |
|
|
120 | 122 |
public CommentUserInfo currentControl { get; set; } |
121 | 123 |
public ControlType controlType { get; set; } |
122 | 124 |
private Move move = new Move(); |
... | ... | |
244 | 246 |
//App.splashString(ISplashMessage.MAINMENU_0); |
245 | 247 |
InitializeComponent(); |
246 | 248 |
|
249 |
tempPageImage = BitmapFrame.Create(new Uri(@"pack://application:,,,/KCOM;component/Resources/Images/ExtImage/blank.png"), BitmapCreateOptions.None, BitmapCacheOption.OnLoad); |
|
247 | 250 |
//List<testItem> testItems = new List<testItem> |
248 | 251 |
//{ |
249 | 252 |
// new testItem{Title = "test1"}, |
... | ... | |
677 | 680 |
/// <param name="e"></param> |
678 | 681 |
private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e) |
679 | 682 |
{ |
680 |
//await Task.Delay(10); |
|
681 |
|
|
682 |
// 마크업 로드 |
|
683 |
//await this.Dispatcher.InvokeAsync(()=>MarkupLoad(e.PageNumber)); |
|
683 |
// await PageLoadAsync(e.CurrentPage,e.PageNumber); |
|
684 |
//} |
|
684 | 685 |
|
685 |
ViewerDataModel.Instance.PageAngle = e.CurrentPage.PAGE_ANGLE; |
|
686 |
//private async Task PageLoadAsync(DOCPAGE page, int PageNo) |
|
687 |
//{ |
|
688 |
DOCPAGE page = e.CurrentPage; |
|
689 |
int PageNo = e.PageNumber; |
|
686 | 690 |
|
687 |
var token = ViewerDataModel.Instance.NewCancellationToken(); |
|
688 |
|
|
689 |
await MarkupLoadAsync(e.PageNumber, ViewerDataModel.Instance.PageAngle, token); |
|
691 |
ViewerDataModel.Instance.PageAngle = page.PAGE_ANGLE; |
|
690 | 692 |
|
691 | 693 |
// 페이지 이미지 변경 |
692 |
await PageChangingAsync(e.CurrentPage, e.PageNumber, token); |
|
694 |
|
|
695 |
|
|
696 |
/// 컨트롤을 새로 생성한다. |
|
697 |
Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
|
698 |
Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
|
699 |
|
|
700 |
ViewerDataModel.Instance.ImageViewPath = tempPageImage; |
|
701 |
ViewerDataModel.Instance.ImageViewWidth = 1; |
|
702 |
ViewerDataModel.Instance.ImageViewHeight = 1; |
|
703 |
|
|
704 |
await PageChangingAsync(page, PageNo, ViewerDataModel.Instance.NewPagImageCancelToken()); |
|
705 |
|
|
706 |
await MarkupLoadAsync(PageNo, ViewerDataModel.Instance.PageAngle, ViewerDataModel.Instance.NewMarkupCancelToken()); |
|
707 |
|
|
708 |
//var pagechangeTask = PageChangingAsync(page, page.PAGE_NUMBER, ViewerDataModel.Instance.NewPagImageCancelToken()); |
|
709 |
|
|
710 |
//var markupLoadTask = MarkupLoadAsync(page.PAGE_NUMBER, ViewerDataModel.Instance.PageAngle, ViewerDataModel.Instance.NewMarkupCancelToken()); |
|
711 |
|
|
712 |
//await Task.WhenAll(pagechangeTask, markupLoadTask); |
|
693 | 713 |
} |
694 | 714 |
|
695 | 715 |
private async Task PageChangingAsync(DOCPAGE currentPage, int changePageNumber,CancellationToken token) |
... | ... | |
719 | 739 |
var contentScale = zoomAndPanControl.ContentScale; |
720 | 740 |
|
721 | 741 |
#region 페이지 이미지 로딩 수정 |
742 |
|
|
722 | 743 |
|
723 | 744 |
ViewerDataModel.Instance.ImageViewPath = await App.PageStorage.GetPageImageAsync(token,changePageNumber); |
724 | 745 |
|
746 |
if(token.IsCancellationRequested) |
|
747 |
{ |
|
748 |
return; |
|
749 |
} |
|
750 |
|
|
725 | 751 |
ScaleImage(pageWidth, pageHeight); |
726 | 752 |
|
727 | 753 |
ViewerDataModel.Instance.ImageViewWidth = pageWidth; |
... | ... | |
1156 | 1182 |
|
1157 | 1183 |
foreach (var markupitem in markupitems) |
1158 | 1184 |
{ |
1159 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,PageAngle, item.DisplayColor, "", item.MarkupInfoID);
|
|
1185 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,PageAngle, item.DisplayColor, "", item.MarkupInfoID);
|
|
1160 | 1186 |
|
1161 | 1187 |
if (cts.IsCancellationRequested) |
1162 | 1188 |
{ |
... | ... | |
4695 | 4721 |
|
4696 | 4722 |
if (isSave) |
4697 | 4723 |
{ |
4698 |
var token = ViewerDataModel.Instance.NewCancellationToken();
|
|
4724 |
var token = ViewerDataModel.Instance.NewMarkupCancelToken();
|
|
4699 | 4725 |
|
4700 | 4726 |
await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token); |
4701 | 4727 |
|
... | ... | |
4725 | 4751 |
|
4726 | 4752 |
if (isSave) |
4727 | 4753 |
{ |
4728 |
var token = ViewerDataModel.Instance.NewCancellationToken();
|
|
4754 |
var token = ViewerDataModel.Instance.NewMarkupCancelToken();
|
|
4729 | 4755 |
await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token); |
4730 | 4756 |
|
4731 | 4757 |
List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>(); |
... | ... | |
5054 | 5080 |
var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList(); |
5055 | 5081 |
foreach (var markupitem in markupitems) |
5056 | 5082 |
{ |
5057 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,0, item.DisplayColor, "", item.MarkupInfoID);
|
|
5083 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,0, item.DisplayColor, "", item.MarkupInfoID);
|
|
5058 | 5084 |
} |
5059 | 5085 |
} |
5060 | 5086 |
|
... | ... | |
5714 | 5740 |
_canvas.Background = Brushes.White; |
5715 | 5741 |
_canvas.Width = adorner_.BorderSize.Width; |
5716 | 5742 |
_canvas.Height = adorner_.BorderSize.Height; |
5717 |
await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.CancellationToken());
|
|
5743 |
await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken());
|
|
5718 | 5744 |
|
5719 | 5745 |
BitmapEncoder encoder = new PngBitmapEncoder(); |
5720 | 5746 |
|
... | ... | |
6008 | 6034 |
{ |
6009 | 6035 |
if (item.PageNumber == pageNavigator.CurrentPage.PageNumber) |
6010 | 6036 |
{ |
6011 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.CancellationToken(), App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "",
|
|
6037 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "",
|
|
6012 | 6038 |
items.MarkupInfoID, Commons.shortGuid()); |
6013 | 6039 |
} |
6014 | 6040 |
} |
내보내기 Unified diff