markus / KCOM / Controls / PrintControl.xaml.cs @ a1cc6e1f
이력 | 보기 | 이력해설 | 다운로드 (44.2 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Windows; |
5 |
using System.Windows.Controls; |
6 |
using System.Windows.Media; |
7 |
using Telerik.Windows.Controls; |
8 |
using System.Collections.ObjectModel; |
9 |
using System.Drawing.Printing; |
10 |
using System.Windows.Media.Imaging; |
11 |
using KCOMDataModel.DataModel; |
12 |
using Microsoft.Win32; |
13 |
using System.IO; |
14 |
using System.Timers; |
15 |
//using IKCOM.Common; |
16 |
using KCOM.Event; |
17 |
using iTextSharp; |
18 |
using iTextSharp.text; |
19 |
//using Leadtools.Windows.Controls; |
20 |
using IKCOM; |
21 |
using iTextSharp.text.pdf; |
22 |
using System.Net; |
23 |
using Image = System.Windows.Controls.Image; |
24 |
using System.ComponentModel; |
25 |
|
26 |
namespace KCOM.Control |
27 |
{ |
28 |
public class DefinedPages |
29 |
{ |
30 |
public DOCINFO DocumentInfo { get; set; } |
31 |
|
32 |
public int PagesCount { get; set; } |
33 |
public string vpSlip { get; set; } |
34 |
public string vpTitle { get; set; } |
35 |
public string fileUrl { get; set; } |
36 |
public ImageBrush Back_Image { get; set; } |
37 |
|
38 |
public double CurrentValue { get; set; } |
39 |
|
40 |
string _DefinedPagesStrings; |
41 |
/// <summary> |
42 |
/// 사용자 정의 페이지를 입력시 오류를 방지하기 위해 적용 |
43 |
/// </summary> |
44 |
public string DefinedPagesStrings |
45 |
{ |
46 |
get { return _DefinedPagesStrings; } |
47 |
set |
48 |
{ |
49 |
if (string.IsNullOrWhiteSpace(value)) return; |
50 |
|
51 |
var _definedPages = value.Replace('-', ',').Split(','); |
52 |
List<char> _NotEx = new List<char>(); |
53 |
|
54 |
foreach (var item in _definedPages) |
55 |
{ |
56 |
bool _isNum = true; |
57 |
|
58 |
foreach (var chr in item) |
59 |
{ |
60 |
if (!char.IsNumber(chr)) |
61 |
{ |
62 |
_NotEx.Add(chr); |
63 |
_isNum = false; |
64 |
} |
65 |
} |
66 |
|
67 |
if (_isNum) |
68 |
{ |
69 |
if (Convert.ToInt32(item) > PagesCount) |
70 |
throw new Exception(string.Format("Max Page Number is '{0}'!!.", PagesCount)); |
71 |
} |
72 |
} |
73 |
|
74 |
if (_NotEx.Count() > 0) |
75 |
{ |
76 |
string _notString = ""; |
77 |
_NotEx.ForEach(s => _notString += s.ToString()); |
78 |
throw new Exception(string.Format("'{0}' Can not be added.", _notString)); |
79 |
} |
80 |
|
81 |
|
82 |
try |
83 |
{ |
84 |
|
85 |
string _notString2 = ""; |
86 |
_NotEx.ForEach(s => _notString2 += s.ToString()); |
87 |
_DefinedPagesStrings = value; |
88 |
} |
89 |
catch (Exception) |
90 |
{ |
91 |
throw new Exception(string.Format("Can not be added.")); |
92 |
} |
93 |
|
94 |
} |
95 |
} |
96 |
} |
97 |
|
98 |
/// <summary> |
99 |
/// Interaction logic for Print.xaml |
100 |
/// </summary> |
101 |
public partial class PrintControl : UserControl |
102 |
{ |
103 |
#region Data |
104 |
|
105 |
string ProjectNo = null; //프로젝트 넘버 |
106 |
string _DefaultTileUri = null; //기본 타일 경로 |
107 |
int _StartPageNo; //시작페이지 |
108 |
DOCINFO _DocInfo; //문서 정보 |
109 |
//DocInfo _DocInfo; //문서 정보 |
110 |
bool currentPagePrint = false; //현재 페이지 수 |
111 |
int PageCount { get; set; } //총 페이지수 |
112 |
DefinedPages _definePages = null; //인쇄 설정 범위 지정 |
113 |
public bool IsPrint { get; set; } |
114 |
|
115 |
PrintDocument printDocument = new PrintDocument(); //프린터도큐먼트 생성 |
116 |
|
117 |
//LayerControl LayerControl = null; // 레이어 컨트롤 |
118 |
ObservableCollection<IKCOM.MarkupInfoItem> _markupInfo = new ObservableCollection<IKCOM.MarkupInfoItem>(); //마크업 정보 |
119 |
List<MarkupPageItem> _PageMarkupList = new List<MarkupPageItem>(); |
120 |
List<SetColorMarkupItem> _LoadMakupList = new List<SetColorMarkupItem>(); |
121 |
List<int> _lstPrintPageNo = new List<int>(); |
122 |
|
123 |
System.Windows.Threading.DispatcherTimer tm = new System.Windows.Threading.DispatcherTimer(); |
124 |
bool _initializeComponentFinished; //이벤트 |
125 |
bool _IsDagSlider = false; //드래그 상태인가 |
126 |
bool IsExportOrPrint = false; |
127 |
bool IsStop = false; |
128 |
|
129 |
List<DisplayColorInfo> colorList = new List<DisplayColorInfo>(); |
130 |
DefinedPages DocumentInfo { get; set; } //문서정보 정의 |
131 |
//PdfSharp.Pdf.PdfDocument document { get; set; } // pdfsharp 인데 아직 왜 넣었는지 모름 |
132 |
delegate void PrintEventHandler(); //프린트 핸들러 |
133 |
SaveFileDialog SaveDig = new SaveFileDialog(); //파일 세이브 다이얼로그 |
134 |
//SaveFileDialog SaveFile { get; set; } //저장할 때 사용 |
135 |
|
136 |
//RasterImageViewer _viewer; //이미지 뷰어 |
137 |
//System.Windows.Controls.Image backimg; //백그라운드 이미지 |
138 |
System.Drawing.Image Printimg; //프린트 이미지 |
139 |
System.Drawing.Image p_img; //프린트 이미지 |
140 |
iTextSharp.text.Image Export_img; |
141 |
Dictionary<int, System.Drawing.Image> Printimg_List; //프린트 이미지 |
142 |
Dictionary<int, string> PrintimgPath_List; //프린트 이미지 파일 경로 |
143 |
string TempImageDir = null; |
144 |
|
145 |
//RasterCodecs codecs; |
146 |
int currentPage; |
147 |
public string PrintName; |
148 |
public string Type; |
149 |
|
150 |
public System.Timers.Timer timm = new System.Timers.Timer(); |
151 |
|
152 |
|
153 |
#endregion |
154 |
|
155 |
#region Static Property Defines |
156 |
|
157 |
public static readonly DependencyProperty BusyContentProperty = |
158 |
DependencyProperty.RegisterAttached("BusyContent", typeof(string), typeof(PrintControl), |
159 |
new PropertyMetadata(new PropertyChangedCallback(BusyContentPropertyChanged))); |
160 |
#endregion |
161 |
|
162 |
#region Property |
163 |
public string BusyContent |
164 |
{ |
165 |
get { return (string)GetValue(BusyContentProperty); } |
166 |
set { SetValue(BusyContentProperty, value); } |
167 |
} |
168 |
#endregion |
169 |
|
170 |
#region PropertyChangeMethod |
171 |
private static void BusyContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
172 |
{ |
173 |
} |
174 |
|
175 |
public static readonly DependencyProperty CurrentPageNoProperty = |
176 |
DependencyProperty.Register("CurrentPageNo", typeof(int), typeof(PrintControl), |
177 |
new PropertyMetadata(new PropertyChangedCallback(CurrentPageNoPropertyChanged))); |
178 |
#endregion |
179 |
|
180 |
#region Property |
181 |
public int CurrentPageNo |
182 |
{ |
183 |
get { return (int)GetValue(CurrentPageNoProperty); } |
184 |
set { SetValue(CurrentPageNoProperty, value); } |
185 |
} |
186 |
#endregion |
187 |
|
188 |
#region PropertyChangeMethod |
189 |
private static void CurrentPageNoPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
190 |
{ |
191 |
var printPage = (PrintControl)d; |
192 |
var newValue = (int)e.NewValue; |
193 |
|
194 |
printPage.sliderPages.Value = newValue; |
195 |
printPage.SetLoadMakupList(newValue); |
196 |
|
197 |
} |
198 |
#endregion |
199 |
|
200 |
#region 생성자 |
201 |
|
202 |
public PrintControl(string TileSourceUri, string ProjectNo, DOCINFO DocInfo, List<IKCOM.MarkupInfoItem> markupInfo, int CurrentPageNo, string slip, string title, string fileurl, bool isPrint) |
203 |
{ |
204 |
InitializeComponent(); |
205 |
|
206 |
this.Unloaded += (snd, evt) => |
207 |
{ |
208 |
try |
209 |
{ |
210 |
if (Directory.Exists(TempImageDir)) |
211 |
Directory.Delete(TempImageDir, true); |
212 |
} |
213 |
catch (Exception) |
214 |
{ |
215 |
} |
216 |
}; |
217 |
|
218 |
this.IsEnabled = true; |
219 |
|
220 |
//Layer Control을 통째로 가져와야 하는건가 |
221 |
this._DocInfo = DocInfo; |
222 |
this._DefaultTileUri = TileSourceUri; |
223 |
this.ProjectNo = ProjectNo; |
224 |
this._StartPageNo = CurrentPageNo; |
225 |
|
226 |
markupInfo.ForEach(info => this._markupInfo.Add(info)); |
227 |
|
228 |
foreach (var info in _markupInfo) |
229 |
{ |
230 |
if (info.Consolidate == 1) |
231 |
{ |
232 |
info.UserName = "Consolidation"; |
233 |
} |
234 |
info.MarkupList.ForEach(makup => |
235 |
{ |
236 |
var _pageMarkup = _PageMarkupList.Where(item => item.PageNumber == makup.PageNumber); |
237 |
var _SetMarkupItem = new SetColorMarkupItem { markupID = makup.ID, DisplayColor = info.DisplayColor }; |
238 |
|
239 |
if (_pageMarkup.Count() > 0) |
240 |
_pageMarkup.First().DisplayColorItems.Add(_SetMarkupItem); |
241 |
else |
242 |
_PageMarkupList.Add(new MarkupPageItem |
243 |
{ |
244 |
PageNumber = makup.PageNumber, |
245 |
DisplayColorItems = new List<SetColorMarkupItem> { _SetMarkupItem } |
246 |
}); |
247 |
}); |
248 |
|
249 |
colorList.Add(new DisplayColorInfo |
250 |
{ |
251 |
UserID = info.UserID, |
252 |
DisplayColor = info.DisplayColor, |
253 |
Department = info.Depatment, |
254 |
UserName = info.UserName, |
255 |
}); |
256 |
} |
257 |
|
258 |
gridViewMarkup.ItemsSource = this._markupInfo; |
259 |
SetLoadMakupList(this._StartPageNo); |
260 |
if (_LoadMakupList.Count() == 0) |
261 |
chkOnlyMarkup.IsChecked = false; |
262 |
|
263 |
this.CurrentPageNo = _StartPageNo; |
264 |
|
265 |
_definePages = new DefinedPages { DefinedPagesStrings = "", DocumentInfo = this._DocInfo |
266 |
, PagesCount = Convert.ToInt32(this._DocInfo.PAGE_COUNT), vpSlip = slip, vpTitle = title, fileUrl = fileurl }; |
267 |
|
268 |
DocumentInfo = _definePages; |
269 |
this.DataContext = _definePages; |
270 |
|
271 |
CheckCommentPages(); |
272 |
|
273 |
//초기화면 Comment Check된 상태로 보여주기 |
274 |
foreach (var item in _markupInfo) |
275 |
{ |
276 |
gridViewMarkup.SelectedItems.Add(item); |
277 |
} |
278 |
|
279 |
PageChangeAsync(Common.ViewerDataModel.Instance.NewPagImageCancelToken(), _StartPageNo,false).ConfigureAwait(true); |
280 |
|
281 |
sliderPages.Maximum = Convert.ToDouble(this._DocInfo.PAGE_COUNT); |
282 |
this.stPageNo.Maximum = Convert.ToDouble(this._DocInfo.PAGE_COUNT); |
283 |
this.edPageNo.Maximum = Convert.ToDouble(this._DocInfo.PAGE_COUNT); |
284 |
this.IsPrint = isPrint; |
285 |
|
286 |
if (!IsPrint) |
287 |
{ |
288 |
GetPrint(false); |
289 |
btnWholeExport.Visibility = Visibility.Visible; |
290 |
btnWholePrint.Visibility = Visibility.Collapsed; |
291 |
Selected_Print.Header = "Export Type"; |
292 |
} |
293 |
else |
294 |
{ |
295 |
//PrintList 가져오기 |
296 |
GetPrint(true); |
297 |
btnWholePrint.Visibility = Visibility.Visible; |
298 |
btnWholeExport.Visibility = Visibility.Collapsed; |
299 |
} |
300 |
|
301 |
_initializeComponentFinished = true; |
302 |
|
303 |
//timm.Interval = 10; |
304 |
//timm.Elapsed += new System.Timers.ElapsedEventHandler(_Timer_Elapsed); |
305 |
//timm.Enabled = true; |
306 |
} |
307 |
|
308 |
#endregion |
309 |
|
310 |
#region Control Event |
311 |
private async void sliderPages_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) |
312 |
{ |
313 |
if (_initializeComponentFinished) |
314 |
{ |
315 |
if (!_IsDagSlider) |
316 |
{ |
317 |
this.CurrentPageNo = (int)this.sliderPages.Value; |
318 |
|
319 |
if (!IsExportOrPrint) |
320 |
{ |
321 |
await PageChangeAsync(Common.ViewerDataModel.Instance.NewPagImageCancelToken(), this.CurrentPageNo, false); |
322 |
} |
323 |
//await App.PageStorage.GetPageUriAsync(this.CurrentPageNo); |
324 |
|
325 |
if (_ButtonName == "Current") |
326 |
{ |
327 |
stPageNo.Value = CurrentPageNo; |
328 |
edPageNo.Value = CurrentPageNo; |
329 |
} |
330 |
|
331 |
//CheckCommentPages(); |
332 |
} |
333 |
} |
334 |
} |
335 |
|
336 |
private async void sliderPages_DragCompleted(object sender, RadDragCompletedEventArgs e) |
337 |
{ |
338 |
_IsDagSlider = false; |
339 |
this.CurrentPageNo = (int)this.sliderPages.Value; |
340 |
if (_initializeComponentFinished) |
341 |
{ |
342 |
|
343 |
} |
344 |
} |
345 |
|
346 |
private void sliderPages_DragStarted(object sender, RadDragStartedEventArgs e) |
347 |
{ |
348 |
_IsDagSlider = true; |
349 |
} |
350 |
|
351 |
private void chkOnlyMarkup_Checked(object sender, RoutedEventArgs e) |
352 |
{ |
353 |
if (_initializeComponentFinished) //GridRangePages |
354 |
{ |
355 |
CheckCommentPages(); |
356 |
} |
357 |
} |
358 |
|
359 |
private void chkOnlyRedColor_Checked(object sender, RoutedEventArgs e) |
360 |
{ |
361 |
if (_initializeComponentFinished) //GridRangePages |
362 |
{ |
363 |
CheckCommentPages(); |
364 |
} |
365 |
} |
366 |
|
367 |
|
368 |
string _ButtonName; |
369 |
private void PageSelect_Checked(object sender, RoutedEventArgs e) |
370 |
{ |
371 |
if (!_initializeComponentFinished) return; |
372 |
|
373 |
_ButtonName = (sender as RadRadioButton).Tag.ToString(); |
374 |
CommentPageList.ItemsSource = null; |
375 |
|
376 |
switch (_ButtonName) |
377 |
{ |
378 |
case "Current": |
379 |
stPageNo.Value = CurrentPageNo; |
380 |
edPageNo.Value = CurrentPageNo; |
381 |
|
382 |
GridCurrentPage.Visibility = Visibility.Visible; |
383 |
GridDefinePages.Visibility = Visibility.Collapsed; |
384 |
GridRangePages.Visibility = Visibility.Collapsed; |
385 |
GridAllPages.Visibility = Visibility.Collapsed; |
386 |
|
387 |
break; |
388 |
case "RangePrint": |
389 |
GridCurrentPage.Visibility = Visibility.Collapsed; |
390 |
GridDefinePages.Visibility = Visibility.Visible; |
391 |
GridRangePages.Visibility = Visibility.Collapsed; |
392 |
GridAllPages.Visibility = Visibility.Collapsed; |
393 |
break; |
394 |
case "UserDefined": |
395 |
GridCurrentPage.Visibility = Visibility.Collapsed; |
396 |
GridDefinePages.Visibility = Visibility.Collapsed; |
397 |
GridRangePages.Visibility = Visibility.Visible; |
398 |
GridAllPages.Visibility = Visibility.Collapsed; |
399 |
break; |
400 |
case "AllPrint": |
401 |
stPageNo.Value = 1; |
402 |
edPageNo.Value = Convert.ToDouble(_DocInfo.PAGE_COUNT); |
403 |
GridCurrentPage.Visibility = Visibility.Collapsed; |
404 |
GridDefinePages.Visibility = Visibility.Collapsed; |
405 |
GridRangePages.Visibility = Visibility.Collapsed; |
406 |
GridAllPages.Visibility = Visibility.Visible; |
407 |
break; |
408 |
} |
409 |
|
410 |
CheckCommentPages(); |
411 |
} |
412 |
|
413 |
private void PageNo_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e) |
414 |
{ |
415 |
if (_initializeComponentFinished) //GridRangePages |
416 |
{ |
417 |
if (stPageNo.Value > edPageNo.Value) |
418 |
{ |
419 |
if (sender.Equals(stPageNo)) |
420 |
edPageNo.Value = stPageNo.Value; |
421 |
else |
422 |
stPageNo.Value = edPageNo.Value; |
423 |
} |
424 |
|
425 |
//뷰어잠시제외(강인구) |
426 |
//this.LayoutRoot.Dispatcher.BeginInvoke(delegate() |
427 |
//{ |
428 |
CheckCommentPages(); |
429 |
//}); |
430 |
} |
431 |
} |
432 |
|
433 |
private void txtDefinedPages_TextChanged(object sender, TextChangedEventArgs e) |
434 |
{ |
435 |
CheckCommentPages(); |
436 |
} |
437 |
|
438 |
private void btnClearDefinedPages_Click(object sender, RoutedEventArgs e) |
439 |
{ |
440 |
txtDefinedPages.Text = ""; |
441 |
} |
442 |
|
443 |
private void CommentPageList_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) |
444 |
{ |
445 |
if (_initializeComponentFinished) |
446 |
if (CommentPageList.SelectedItem != null) |
447 |
this.CurrentPageNo = (CommentPageList.SelectedItem as MarkupPageItem).PageNumber; |
448 |
} |
449 |
|
450 |
private async void gridViewMarkup_SelectionChanged(object sender, SelectionChangeEventArgs e) |
451 |
{ |
452 |
if (_initializeComponentFinished) |
453 |
{ |
454 |
await PageChangeAsync(Common.ViewerDataModel.Instance.NewPagImageCancelToken(),this.CurrentPageNo, false); |
455 |
} |
456 |
} |
457 |
|
458 |
#endregion |
459 |
|
460 |
public async System.Threading.Tasks.Task<bool> PageChangeAsync(System.Threading.CancellationToken cts, int PageNo,bool saveFile, bool Flag = false) |
461 |
{ |
462 |
System.Diagnostics.Debug.WriteLine("PageChangeAsync " + PageNo); |
463 |
bool result = false; |
464 |
//Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
465 |
//{ |
466 |
try |
467 |
{ |
468 |
Load load = new Load(); |
469 |
|
470 |
_definePages.Back_Image = new ImageBrush(); |
471 |
//var defaultBitmapImage = new BitmapImage(new Uri(_DefaultTileUri + PageNo + ".png")); |
472 |
|
473 |
var pages = _definePages.DocumentInfo.DOCPAGE.Where(x => x.PAGE_NUMBER == PageNo); |
474 |
|
475 |
if(pages.Count() > 0) |
476 |
{ |
477 |
var currentPage = pages.First(); |
478 |
|
479 |
//var buffer = await new WebClient().DownloadDataTaskAsync(_DefaultTileUri + PageNo + ".png"); |
480 |
|
481 |
//var bitmap = new BitmapImage(); |
482 |
//using (var stream = new MemoryStream(buffer)) |
483 |
//{ |
484 |
//bitmap.BeginInit(); |
485 |
//bitmap.CacheOption = BitmapCacheOption.OnLoad; |
486 |
//bitmap.StreamSource = stream; |
487 |
//bitmap.EndInit(); |
488 |
|
489 |
|
490 |
var uri = await App.PageStorage.GetPageUriAsync(cts, currentPage.PAGE_NUMBER); |
491 |
//Image bitmap = new Image(); |
492 |
//bitmap.Stretch = Stretch.Fill; |
493 |
//bitmap.Source = bitmapframe; |
494 |
//bitmap.Width = Convert.ToDouble(currentPage.PAGE_WIDTH); |
495 |
//bitmap.Height = Convert.ToDouble(currentPage.PAGE_HEIGHT); |
496 |
|
497 |
//if (uri.Scheme == Uri.UriSchemeFile) |
498 |
//{ |
499 |
// var cloneUri = new Uri(System.IO.Path.Combine(System.IO.Path.GetTempPath(),System.IO.Path.GetRandomFileName()),UriKind.Absolute); |
500 |
// File.Copy(uri.LocalPath, cloneUri.LocalPath); |
501 |
|
502 |
// uri = cloneUri; |
503 |
//} |
504 |
|
505 |
printCanvas.Children.Clear(); |
506 |
printCanvas.Width = Convert.ToDouble(currentPage.PAGE_WIDTH); |
507 |
printCanvas.Height = Convert.ToDouble(currentPage.PAGE_HEIGHT); |
508 |
|
509 |
printCanvas.Background = new ImageBrush{ ImageSource = new BitmapImage(uri)}; |
510 |
|
511 |
//printCanvas.RenderTransformOrigin = new Point(0.5, 0.5); |
512 |
//printCanvas.RenderTransform = new RotateTransform(currentPage.PAGE_ANGLE); |
513 |
//ImageBrush background = new ImageBrush(bitmap); |
514 |
//printCanvas.Background = background; |
515 |
//printCanvas.Background = new SolidColorBrush(Colors.Transparent); |
516 |
|
517 |
Canvas canvas = new Canvas(); |
518 |
|
519 |
//foreach (var info in gridViewMarkup.SelectedItems.Cast<IKCOM.MarkupInfoItem>()) |
520 |
//{ |
521 |
// load.User_Id = info.UserID; |
522 |
// load.document_id = _DocInfo.DOCUMENT_ID; |
523 |
// load.Page_No = PageNo; |
524 |
|
525 |
// if (chkOnlyRedColor.IsChecked == true) |
526 |
// { |
527 |
// load.DisplayColor = "#FFFF0000"; |
528 |
// } |
529 |
// else |
530 |
// { |
531 |
// load.DisplayColor = info.DisplayColor; |
532 |
// } |
533 |
|
534 |
// load.Markupinfoid = info.MarkupInfoID; |
535 |
// var IsLoad = await load.Markup_LoadAsync(canvas, 0); |
536 |
//} |
537 |
|
538 |
var tasks = gridViewMarkup.SelectedItems.Cast<IKCOM.MarkupInfoItem>() |
539 |
.Select(async info => |
540 |
{ |
541 |
load.User_Id = info.UserID; |
542 |
load.document_id = _DocInfo.DOCUMENT_ID; |
543 |
load.Page_No = PageNo; |
544 |
load.DisplayColor = chkOnlyRedColor.IsChecked == true ? "#FFFF0000" : info.DisplayColor; |
545 |
load.Markupinfoid = info.MarkupInfoID; |
546 |
return await load.Markup_LoadAsync(canvas, 0); |
547 |
}); |
548 |
|
549 |
var results = await System.Threading.Tasks.Task.WhenAll(tasks); |
550 |
|
551 |
//printCanvas.Children.Add(canvas); |
552 |
|
553 |
printCanvas.Children.Add(canvas); |
554 |
|
555 |
//await Dispatcher.InvokeAsync(() => { |
556 |
// printCanvas.UpdateLayout(); |
557 |
//}); |
558 |
|
559 |
if (Flag) |
560 |
{ |
561 |
//MemoryStream ms = new MemoryStream(); |
562 |
//BmpBitmapEncoder bbe = new BmpBitmapEncoder(); |
563 |
//bbe.Frames.Add(BitmapFrame.Create(new Uri(_DefaultTileUri + PageNo + ".png"))); |
564 |
//bbe.Save(ms); |
565 |
|
566 |
//System.Drawing.Image.FromFile() |
567 |
//Printimg = System.Drawing.Image.FromStream(stream); |
568 |
//await System.Threading.Tasks.Task.Run(() => |
569 |
//{ |
570 |
await Dispatcher.InvokeAsync(() => |
571 |
{ |
572 |
Export export = new Export(); |
573 |
|
574 |
if (saveFile) |
575 |
{ |
576 |
var filepath = Path.Combine(TempImageDir, $"{PrintimgPath_List.Count() + 1}.png"); |
577 |
|
578 |
if (export.ExportingFile(PrintView, printCanvas.Width, printCanvas.Height, filepath)) |
579 |
{ |
580 |
PrintimgPath_List.Add(PrintimgPath_List.Count() + 1, filepath); |
581 |
} |
582 |
else |
583 |
{ |
584 |
throw new Exception($"Export Image Save File Error :{filepath}"); |
585 |
} |
586 |
} |
587 |
else |
588 |
{ |
589 |
p_img = export.Exporting(PrintView, printCanvas.Width, printCanvas.Height); |
590 |
Printimg_List.Add(Printimg_List.Count() + 1, p_img); |
591 |
} |
592 |
|
593 |
},System.Windows.Threading.DispatcherPriority.SystemIdle); |
594 |
//}); |
595 |
} |
596 |
|
597 |
result = true; |
598 |
//} |
599 |
} |
600 |
} |
601 |
catch (Exception ex) |
602 |
{ |
603 |
//Logger.sendResLog("PrintControl.PageChanged", ex.Message, 0); |
604 |
} |
605 |
|
606 |
return result; |
607 |
//})); |
608 |
} |
609 |
|
610 |
|
611 |
public static MemoryStream ByteBufferFromImage(BitmapImage imageSource) |
612 |
{ |
613 |
var ms = new MemoryStream(); |
614 |
var pngEncoder = new PngBitmapEncoder(); |
615 |
pngEncoder.Frames.Add(BitmapFrame.Create(imageSource)); |
616 |
pngEncoder.Save(ms); |
617 |
|
618 |
return ms; |
619 |
} |
620 |
//Print 버튼 클릭 이벤트 |
621 |
#region Method - 명령 |
622 |
async void PrintMethod(object sender, RoutedEventArgs e) |
623 |
{ |
624 |
try |
625 |
{ |
626 |
var token = Common.ViewerDataModel.Instance.NewPagImageCancelToken(); |
627 |
|
628 |
if (this.printIndy.IsBusy == true) |
629 |
return; |
630 |
|
631 |
(this.Parent as RadWindow).CanClose = false; |
632 |
|
633 |
await this.Dispatcher.InvokeAsync(() => { |
634 |
this.printIndy.IsBusy = true; |
635 |
this.BusyContent = "Printing. . ."; |
636 |
}); |
637 |
|
638 |
|
639 |
_lstPrintPageNo = PrintPageCreate(); |
640 |
|
641 |
if (_lstPrintPageNo.Count == 0) |
642 |
{ |
643 |
RadWindow.Alert(new DialogParameters |
644 |
{ |
645 |
Owner = Application.Current.MainWindow, |
646 |
Theme = new VisualStudio2013Theme(), |
647 |
Header = "Info", |
648 |
Content = "Not specified the page." |
649 |
}); |
650 |
sliderPages.Value = 1; |
651 |
this.printIndy.IsBusy = false; |
652 |
return; |
653 |
} |
654 |
|
655 |
int cnt = 0; |
656 |
|
657 |
IsExportOrPrint = true; |
658 |
|
659 |
Printimg_List = new Dictionary<int, System.Drawing.Image>(); |
660 |
PrintimgPath_List = new Dictionary<int, string>(); |
661 |
TempImageDir = Path.Combine(Path.GetTempPath(), "Markus", Common.Commons.ShortGuid()); |
662 |
|
663 |
if (Directory.Exists(TempImageDir)) |
664 |
{ |
665 |
Directory.Delete(TempImageDir, true); |
666 |
} |
667 |
|
668 |
Directory.CreateDirectory(TempImageDir); |
669 |
|
670 |
foreach (int PageNo in _lstPrintPageNo) |
671 |
{ |
672 |
if (IsStop) |
673 |
break; |
674 |
|
675 |
cnt++; |
676 |
sliderPages.Value = PageNo; |
677 |
await PageChangeAsync(token,PageNo, true, true); |
678 |
//PageChanged(cnt, true); |
679 |
} |
680 |
PrintName = cbPrint.SelectedItem.ToString(); |
681 |
|
682 |
await this.Dispatcher.InvokeAsync(() => { |
683 |
if (cnt == _lstPrintPageNo.Count && !IsStop) |
684 |
{ |
685 |
Printing(); |
686 |
} |
687 |
}); |
688 |
|
689 |
IsExportOrPrint = false; |
690 |
} |
691 |
catch (Exception ex) |
692 |
{ |
693 |
//Logger.sendResLog("PrintMethod", ex.Message, 0); |
694 |
} |
695 |
finally |
696 |
{ |
697 |
if (IsStop) |
698 |
{ |
699 |
printIndy.IsBusy = false; |
700 |
IsStop = false; |
701 |
} |
702 |
(this.Parent as RadWindow).CanClose = true; |
703 |
} |
704 |
|
705 |
} |
706 |
|
707 |
//Export 버튼 클릭 이벤트 |
708 |
[System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptions] |
709 |
//[System.Security.Permissions.FileIOPermission(System.Security.Permissions.SecurityAction.LinkDemand)] |
710 |
async void ExportMethod(object sender, RoutedEventArgs e) |
711 |
{ |
712 |
try |
713 |
{ |
714 |
if (this.printIndy.IsBusy == true) |
715 |
return; |
716 |
|
717 |
var token = Common.ViewerDataModel.Instance.NewPagImageCancelToken(); |
718 |
|
719 |
(this.Parent as RadWindow).CanClose = false; |
720 |
|
721 |
this.printIndy.IsBusy = true; |
722 |
this.BusyContent = "Exporting. . ."; |
723 |
|
724 |
Export export = new Export(); |
725 |
_lstPrintPageNo = PrintPageCreate(); |
726 |
|
727 |
if (_lstPrintPageNo.Count == 0) |
728 |
{ |
729 |
sliderPages.Value = 1; |
730 |
this.printIndy.IsBusy = false; |
731 |
RadWindow.Alert(new DialogParameters |
732 |
{ |
733 |
Owner = Application.Current.MainWindow, |
734 |
Theme = new VisualStudio2013Theme(), |
735 |
Header = "Info", |
736 |
Content = "Not specified the page.", |
737 |
}); |
738 |
return; |
739 |
} |
740 |
|
741 |
//FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png"); |
742 |
|
743 |
switch (cbPrint.SelectedIndex) |
744 |
{ |
745 |
case (0): |
746 |
{ |
747 |
SaveDig.Filter = "PDF file format|*.pdf"; |
748 |
break; |
749 |
} |
750 |
case (1): |
751 |
{ |
752 |
SaveDig.Filter = "Image Files (*.jpg, *.Jpeg)|*.jpg;*.Jpeg"; |
753 |
break; |
754 |
} |
755 |
} |
756 |
|
757 |
SaveDig.Title = "Save an PDF File"; |
758 |
if(SaveDig.ShowDialog().Value) |
759 |
{ |
760 |
IsExportOrPrint = true; |
761 |
|
762 |
PrintimgPath_List = new Dictionary<int, string>(); |
763 |
TempImageDir = Path.Combine(Path.GetTempPath(), "Markus", Common.Commons.ShortGuid()); |
764 |
|
765 |
if (Directory.Exists(TempImageDir)) |
766 |
{ |
767 |
Directory.Delete(TempImageDir, true); |
768 |
} |
769 |
|
770 |
Directory.CreateDirectory(TempImageDir); |
771 |
|
772 |
foreach (int PageNo in _lstPrintPageNo) |
773 |
{ |
774 |
if (IsStop) |
775 |
break; |
776 |
|
777 |
await Dispatcher.InvokeAsync(() => |
778 |
{ |
779 |
sliderPages.Value = PageNo; |
780 |
}); |
781 |
|
782 |
await PageChangeAsync(token, PageNo, true, true); |
783 |
|
784 |
System.Diagnostics.Debug.WriteLine("Export Page : " + PageNo); |
785 |
} |
786 |
|
787 |
//using (FileStream fs = new FileStream(@"D:\Temp\Text.pdf", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None)) |
788 |
|
789 |
if (SaveDig.FileName != "") |
790 |
{ |
791 |
switch (cbPrint.SelectedIndex) |
792 |
{ |
793 |
case (0): |
794 |
{ |
795 |
FileStream fs = new FileStream(SaveDig.FileName, FileMode.Create, FileAccess.Write); |
796 |
|
797 |
Document doc = new Document(); |
798 |
try |
799 |
{ |
800 |
iTextSharp.text.Version.GetInstance(); |
801 |
} |
802 |
catch (System.NullReferenceException ex) |
803 |
{ |
804 |
|
805 |
} |
806 |
|
807 |
PdfWriter writer = PdfWriter.GetInstance(doc, fs); |
808 |
|
809 |
doc.Open(); |
810 |
|
811 |
float height = doc.PageSize.Height; |
812 |
float width = doc.PageSize.Width; |
813 |
|
814 |
foreach (var item in PrintimgPath_List) |
815 |
{ |
816 |
if (IsStop) |
817 |
break; |
818 |
|
819 |
System.Drawing.Image image = System.Drawing.Image.FromFile(item.Value); |
820 |
Export_img = iTextSharp.text.Image.GetInstance(image,System.Drawing.Imaging.ImageFormat.Jpeg); |
821 |
|
822 |
if (Export_img.Width > Export_img.Height) |
823 |
{ |
824 |
doc.SetPageSize(new Rectangle(height, width)); |
825 |
Export_img.ScaleToFit(height, width); |
826 |
} |
827 |
else |
828 |
{ |
829 |
doc.SetPageSize(new Rectangle(width, height)); |
830 |
Export_img.ScaleToFit(width, height); |
831 |
} |
832 |
|
833 |
Export_img.SetAbsolutePosition(0, 0); |
834 |
|
835 |
doc.NewPage(); |
836 |
doc.Add(Export_img); |
837 |
} |
838 |
doc.Close(); |
839 |
writer.Close(); |
840 |
break; |
841 |
} |
842 |
case (1): |
843 |
{ |
844 |
foreach (var item in PrintimgPath_List) |
845 |
{ |
846 |
if (IsStop) |
847 |
break; |
848 |
|
849 |
File.Copy(item.Value, SaveDig.FileName.Replace(".jpg", "_" + item.Key.ToString()) + ".jpg"); |
850 |
} |
851 |
break; |
852 |
} |
853 |
} |
854 |
} |
855 |
else |
856 |
{ |
857 |
sliderPages.Value = 1; |
858 |
this.printIndy.IsBusy = false; |
859 |
return; |
860 |
} |
861 |
|
862 |
await this.Dispatcher.InvokeAsync(() => |
863 |
{ |
864 |
sliderPages.Value = 1; |
865 |
printIndy.IsBusy = false; |
866 |
}); |
867 |
|
868 |
await PageChangeAsync(token,_StartPageNo, false); |
869 |
|
870 |
IsExportOrPrint = false; |
871 |
|
872 |
(Application.Current.MainWindow as MainWindow).dzMainMenu.DialogMessage_Alert("Success", "Alert"); |
873 |
}else |
874 |
{ |
875 |
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
876 |
{ |
877 |
sliderPages.Value = 1; |
878 |
printIndy.IsBusy = false; |
879 |
})); |
880 |
|
881 |
//(Application.Current.MainWindow as MainWindow).dzMainMenu.DialogMessage_Alert("Cancel", "Alert"); |
882 |
} |
883 |
} |
884 |
catch (Exception ex) |
885 |
{ |
886 |
sliderPages.Value = 1; |
887 |
printIndy.IsBusy = false; |
888 |
|
889 |
//Logger.sendResLog("Export Method", ex.Message, 0); |
890 |
//(Application.Current.MainWindow as MainWindow).dzMainMenu.DialogMessage_Alert("Alert", "관리자 확인이 필요합니다. 다시 시도해 주세요.\n"+ex.Message); |
891 |
} |
892 |
finally |
893 |
{ |
894 |
GC.Collect(); |
895 |
GC.WaitForPendingFinalizers(); |
896 |
GC.Collect(); |
897 |
IsStop = false; |
898 |
(this.Parent as RadWindow).CanClose = true; |
899 |
} |
900 |
} |
901 |
|
902 |
#endregion |
903 |
|
904 |
#region Method - 처리 |
905 |
void CheckCommentPages() |
906 |
{ |
907 |
List<MarkupPageItem> _pages = new List<MarkupPageItem>(); |
908 |
DoubleCollection _Ticks = new DoubleCollection(); |
909 |
|
910 |
|
911 |
if (GridCurrentPage.Visibility == System.Windows.Visibility.Visible) |
912 |
{ |
913 |
|
914 |
_pages = (from commPage in this._PageMarkupList |
915 |
where commPage.PageNumber == CurrentPageNo |
916 |
orderby commPage.PageNumber |
917 |
select commPage).ToList(); |
918 |
} |
919 |
else if (GridRangePages.Visibility == System.Windows.Visibility.Visible) |
920 |
{ |
921 |
stPageNo.Value = stPageNo.Value == null ? 1 : stPageNo.Value; |
922 |
edPageNo.Value = edPageNo.Value == null ? 1 : edPageNo.Value; |
923 |
|
924 |
int _stPage = (int)stPageNo.Value; |
925 |
int _edPage = (int)edPageNo.Value; |
926 |
|
927 |
_pages = (from commPage in this._PageMarkupList |
928 |
where commPage.PageNumber >= _stPage && commPage.PageNumber <= _edPage |
929 |
orderby commPage.PageNumber |
930 |
select commPage).ToList(); |
931 |
} |
932 |
else if (GridDefinePages.Visibility == System.Windows.Visibility.Visible) |
933 |
{ |
934 |
stPageNo.Value = stPageNo.Value == null ? 1 : stPageNo.Value; |
935 |
edPageNo.Value = edPageNo.Value == null ? 1 : edPageNo.Value; |
936 |
|
937 |
int _stPage = (int)stPageNo.Value; |
938 |
int _edPage = (int)edPageNo.Value; |
939 |
|
940 |
//Using DeepView.Common.RangeParser |
941 |
var lst = RangeParser.Parse(txtDefinedPages.Text, _stPage, _definePages.PagesCount); |
942 |
_pages = (from commPage in this._PageMarkupList |
943 |
from compareData in lst |
944 |
where commPage.PageNumber == compareData |
945 |
orderby commPage.PageNumber |
946 |
select commPage).ToList(); |
947 |
} |
948 |
else |
949 |
{ |
950 |
_pages = (from commPage in this._PageMarkupList |
951 |
orderby commPage.PageNumber |
952 |
select commPage).ToList(); |
953 |
} |
954 |
|
955 |
CommentPageList.ItemsSource = _pages.ToList(); |
956 |
} |
957 |
|
958 |
void SetLoadMakupList(int PageNo) |
959 |
{ |
960 |
_LoadMakupList.Clear(); |
961 |
var _markupList = _PageMarkupList.Where(page => page.PageNumber == PageNo); |
962 |
|
963 |
if (_markupList.Count() > 0) |
964 |
_LoadMakupList = _markupList.First().DisplayColorItems.ToList(); |
965 |
} |
966 |
|
967 |
#region 프린트 리스트 가져오기 |
968 |
public void GetPrint(bool flag) |
969 |
{ |
970 |
if (flag) |
971 |
{ |
972 |
foreach (string printer in PrinterSettings.InstalledPrinters) |
973 |
{ |
974 |
this.cbPrint.Items.Add(printer); |
975 |
} |
976 |
printDocument = new PrintDocument(); |
977 |
this.cbPrint.SelectedItem = printDocument.PrinterSettings.PrinterName; |
978 |
} |
979 |
else |
980 |
{ |
981 |
this.cbPrint.Items.Add("PDF"); |
982 |
this.cbPrint.Items.Add("IMAGE"); |
983 |
|
984 |
this.cbPrint.SelectedItem = "PDF"; |
985 |
} |
986 |
} |
987 |
#endregion |
988 |
|
989 |
#region 프린트 실행 |
990 |
public async void Printing() |
991 |
{ |
992 |
var token = Common.ViewerDataModel.Instance.NewPagImageCancelToken (); |
993 |
|
994 |
await PageChangeAsync(token,1, false); |
995 |
|
996 |
if (PrinterSettings.InstalledPrinters != null && PrinterSettings.InstalledPrinters.Count > 0) |
997 |
{ |
998 |
printDocument = new PrintDocument(); |
999 |
printDocument.OriginAtMargins = true; |
1000 |
printDocument.BeginPrint += new System.Drawing.Printing.PrintEventHandler(printDocument_BeginPrint); |
1001 |
printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument_PrintPage); |
1002 |
printDocument.EndPrint += new System.Drawing.Printing.PrintEventHandler(printDocument_EndPrint); |
1003 |
} |
1004 |
else |
1005 |
printDocument = null; |
1006 |
|
1007 |
#region 인쇄 미리보기 테스트 |
1008 |
using (System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog()) |
1009 |
{ |
1010 |
printDocument.PrinterSettings.MinimumPage = 1; |
1011 |
printDocument.PrinterSettings.MaximumPage = _lstPrintPageNo.Count(); |
1012 |
printDocument.PrinterSettings.FromPage = 1; |
1013 |
printDocument.PrinterSettings.ToPage = _lstPrintPageNo.Count(); |
1014 |
printDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); |
1015 |
printDocument.PrinterSettings.PrinterName = PrintName; |
1016 |
dlg.Document = printDocument; |
1017 |
dlg.WindowState = System.Windows.Forms.FormWindowState.Maximized; |
1018 |
dlg.ShowDialog(); |
1019 |
} |
1020 |
#endregion |
1021 |
|
1022 |
#region 인쇄 |
1023 |
//printDocument.PrinterSettings.MinimumPage = 1; |
1024 |
//printDocument.PrinterSettings.MaximumPage = _lstPrintPageNo.Count(); |
1025 |
//printDocument.PrinterSettings.FromPage = 1; |
1026 |
//printDocument.PrinterSettings.ToPage = _lstPrintPageNo.Count(); |
1027 |
|
1028 |
//printDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); |
1029 |
//printDocument.PrinterSettings.PrinterName = PrintName; |
1030 |
|
1031 |
//printDocument.Print(); |
1032 |
#endregion |
1033 |
} |
1034 |
|
1035 |
private void printDocument_BeginPrint(object sender, PrintEventArgs e) |
1036 |
{ |
1037 |
//Printimg_List = new Dictionary<int, System.Drawing.Image>(); |
1038 |
// This demo only loads one page at a time, so no need to re-set the print page number |
1039 |
PrintDocument document = sender as PrintDocument; |
1040 |
currentPage = document.PrinterSettings.FromPage; |
1041 |
} |
1042 |
|
1043 |
private void printDocument_PrintPage(object sender, PrintPageEventArgs e) |
1044 |
{ |
1045 |
//e.Graphics.DrawImage(Printimg_List.Where(info => info.Key == currentPage).FirstOrDefault().Value, 0, 0); |
1046 |
|
1047 |
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
1048 |
{ |
1049 |
//p_img = Printimg_List.Where(data => data.Key == currentPage).FirstOrDefault().Value; |
1050 |
p_img = System.Drawing.Image.FromFile(PrintimgPath_List.Where(data => data.Key == currentPage).FirstOrDefault().Value); |
1051 |
|
1052 |
if (p_img.Width > p_img.Height) |
1053 |
{ |
1054 |
p_img.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone); |
1055 |
} |
1056 |
|
1057 |
//iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(p_img, System.Drawing.Imaging.ImageFormat.Jpeg); |
1058 |
System.Drawing.Image pic = p_img; |
1059 |
System.Drawing.Rectangle m = e.MarginBounds; |
1060 |
|
1061 |
//if ((double)pic.Width / (double)pic.Height > (double)m.Width / (double)m.Height) // image is wider |
1062 |
//{ |
1063 |
// m.Height = 1135;//(int)((double)pic.Height / (double)pic.Width * (double)m.Width) - 16; |
1064 |
//} |
1065 |
//else |
1066 |
//{ |
1067 |
// m.Width = 793;//(int)((double)pic.Width / (double)pic.Height * (double)m.Height) - 16; |
1068 |
//} |
1069 |
m.Width = (int)e.PageSettings.PrintableArea.Width; |
1070 |
m.Height = (int)e.PageSettings.PrintableArea.Height; |
1071 |
m.X = (int)e.PageSettings.HardMarginX; |
1072 |
m.Y = (int)e.PageSettings.HardMarginY; |
1073 |
|
1074 |
e.Graphics.DrawImage(pic, m); |
1075 |
//e.Graphics.DrawImage(p_img, e.MarginBounds); |
1076 |
//e.Graphics.DrawImage(p_img, 0, 0); |
1077 |
})); |
1078 |
|
1079 |
//다음 페이지 |
1080 |
currentPage++; |
1081 |
|
1082 |
////인쇄를 계속 할지 말지 확인 |
1083 |
if (currentPage <= printDocument.PrinterSettings.ToPage && !IsStop) |
1084 |
e.HasMorePages = true; |
1085 |
else |
1086 |
e.HasMorePages = false; |
1087 |
|
1088 |
} |
1089 |
|
1090 |
private void printDocument_EndPrint(object sender, PrintEventArgs e) |
1091 |
{ |
1092 |
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
1093 |
{ |
1094 |
//if (Directory.Exists(TempImageDir)) |
1095 |
// Directory.Delete(TempImageDir, true); |
1096 |
|
1097 |
sliderPages.Value = 1; |
1098 |
printIndy.IsBusy = false; |
1099 |
IsStop = false; |
1100 |
})); |
1101 |
} |
1102 |
#endregion |
1103 |
|
1104 |
#region Selected Pages Check |
1105 |
List<int> PrintPageCreate() |
1106 |
{ |
1107 |
List<int> Result = new List<int>(); |
1108 |
|
1109 |
if (GridCurrentPage.Visibility == System.Windows.Visibility.Visible || currentPagePrint) |
1110 |
{ |
1111 |
Result.Add(CurrentPageNo); |
1112 |
} |
1113 |
else if (GridRangePages.Visibility == System.Windows.Visibility.Visible) |
1114 |
{ |
1115 |
for (int i = Convert.ToInt32(stPageNo.Value); i <= Convert.ToInt32(edPageNo.Value); i++) |
1116 |
{ |
1117 |
Result.Add(i); |
1118 |
} |
1119 |
} |
1120 |
else if (GridDefinePages.Visibility == System.Windows.Visibility.Visible) |
1121 |
{ |
1122 |
int _stPage = (int)stPageNo.Value; |
1123 |
int _edPage = (int)edPageNo.Value; |
1124 |
|
1125 |
var lst = RangeParser.Parse(txtDefinedPages.Text, _stPage, _definePages.PagesCount); |
1126 |
Result.AddRange(lst); |
1127 |
} |
1128 |
else |
1129 |
{ |
1130 |
for (int i = 1; i <= _definePages.PagesCount; i++) |
1131 |
{ |
1132 |
Result.Add(i); |
1133 |
} |
1134 |
} |
1135 |
if (currentPagePrint) |
1136 |
{ |
1137 |
return Result; |
1138 |
} |
1139 |
|
1140 |
if (chkOnlyMarkup.IsChecked.Value) |
1141 |
{ |
1142 |
var _result = from result in Result |
1143 |
where _PageMarkupList.Where(page => page.PageNumber == result).Count() > 0 |
1144 |
select result; |
1145 |
Result = _result.ToList(); |
1146 |
} |
1147 |
return Result; |
1148 |
} |
1149 |
#endregion |
1150 |
|
1151 |
#endregion |
1152 |
|
1153 |
private void btPrintCancel_click(object sender, RoutedEventArgs e) |
1154 |
{ |
1155 |
IsStop = true; |
1156 |
} |
1157 |
} |
1158 |
} |