markus / KCOM / Controls / PrintControl.xaml.cs @ a9a82876
이력 | 보기 | 이력해설 | 다운로드 (44.7 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 |
_definePages.Back_Image = new ImageBrush(); |
469 |
//var defaultBitmapImage = new BitmapImage(new Uri(_DefaultTileUri + PageNo + ".png")); |
470 |
|
471 |
var pages = _definePages.DocumentInfo.DOCPAGE.Where(x => x.PAGE_NUMBER == PageNo); |
472 |
|
473 |
if(pages.Count() > 0) |
474 |
{ |
475 |
var currentPage = pages.First(); |
476 |
|
477 |
//var buffer = await new WebClient().DownloadDataTaskAsync(_DefaultTileUri + PageNo + ".png"); |
478 |
|
479 |
//var bitmap = new BitmapImage(); |
480 |
//using (var stream = new MemoryStream(buffer)) |
481 |
//{ |
482 |
//bitmap.BeginInit(); |
483 |
//bitmap.CacheOption = BitmapCacheOption.OnLoad; |
484 |
//bitmap.StreamSource = stream; |
485 |
//bitmap.EndInit(); |
486 |
|
487 |
|
488 |
var uri = await App.PageStorage.GetPageUriAsync(cts, currentPage.PAGE_NUMBER); |
489 |
//Image bitmap = new Image(); |
490 |
//bitmap.Stretch = Stretch.Fill; |
491 |
//bitmap.Source = bitmapframe; |
492 |
//bitmap.Width = Convert.ToDouble(currentPage.PAGE_WIDTH); |
493 |
//bitmap.Height = Convert.ToDouble(currentPage.PAGE_HEIGHT); |
494 |
|
495 |
//if (uri.Scheme == Uri.UriSchemeFile) |
496 |
//{ |
497 |
// var cloneUri = new Uri(System.IO.Path.Combine(System.IO.Path.GetTempPath(),System.IO.Path.GetRandomFileName()),UriKind.Absolute); |
498 |
// File.Copy(uri.LocalPath, cloneUri.LocalPath); |
499 |
|
500 |
// uri = cloneUri; |
501 |
//} |
502 |
|
503 |
printCanvas.Children.Clear(); |
504 |
printCanvas.Width = Convert.ToDouble(currentPage.PAGE_WIDTH); |
505 |
printCanvas.Height = Convert.ToDouble(currentPage.PAGE_HEIGHT); |
506 |
printCanvas.Background = new ImageBrush{ ImageSource = new BitmapImage(uri)}; |
507 |
printCanvas.SnapsToDevicePixels = false; |
508 |
printCanvas.UseLayoutRounding = false; |
509 |
printCanvas.CacheMode = new BitmapCache(50); |
510 |
RenderOptions.SetBitmapScalingMode(printCanvas, BitmapScalingMode.HighQuality); |
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 |
canvas.CacheMode = new BitmapCache(50); |
519 |
canvas.SnapsToDevicePixels = false; |
520 |
RenderOptions.SetBitmapScalingMode(canvas, BitmapScalingMode.HighQuality); |
521 |
//foreach (var info in gridViewMarkup.SelectedItems.Cast<IKCOM.MarkupInfoItem>()) |
522 |
//{ |
523 |
// load.User_Id = info.UserID; |
524 |
// load.document_id = _DocInfo.DOCUMENT_ID; |
525 |
// load.Page_No = PageNo; |
526 |
|
527 |
// if (chkOnlyRedColor.IsChecked == true) |
528 |
// { |
529 |
// load.DisplayColor = "#FFFF0000"; |
530 |
// } |
531 |
// else |
532 |
// { |
533 |
// load.DisplayColor = info.DisplayColor; |
534 |
// } |
535 |
|
536 |
// load.Markupinfoid = info.MarkupInfoID; |
537 |
// var IsLoad = await load.Markup_LoadAsync(canvas, 0); |
538 |
//} |
539 |
|
540 |
var tasks = gridViewMarkup.SelectedItems.Cast<IKCOM.MarkupInfoItem>() |
541 |
.Select(async info => |
542 |
{ |
543 |
Load load = new Load(); |
544 |
load.User_Id = info.UserID; |
545 |
load.document_id = _DocInfo.DOCUMENT_ID; |
546 |
load.Page_No = PageNo; |
547 |
load.DisplayColor = chkOnlyRedColor.IsChecked == true ? "#FFFF0000" : info.DisplayColor; |
548 |
load.Markupinfoid = info.MarkupInfoID; |
549 |
return await load.Markup_LoadAsync(canvas, 0); |
550 |
}); |
551 |
|
552 |
var results = await System.Threading.Tasks.Task.WhenAll(tasks); |
553 |
|
554 |
//printCanvas.Children.Add(canvas); |
555 |
|
556 |
printCanvas.Children.Add(canvas); |
557 |
|
558 |
//await Dispatcher.InvokeAsync(() => { |
559 |
// printCanvas.UpdateLayout(); |
560 |
//}); |
561 |
|
562 |
if (Flag) |
563 |
{ |
564 |
//MemoryStream ms = new MemoryStream(); |
565 |
//BmpBitmapEncoder bbe = new BmpBitmapEncoder(); |
566 |
//bbe.Frames.Add(BitmapFrame.Create(new Uri(_DefaultTileUri + PageNo + ".png"))); |
567 |
//bbe.Save(ms); |
568 |
|
569 |
//System.Drawing.Image.FromFile() |
570 |
//Printimg = System.Drawing.Image.FromStream(stream); |
571 |
//await System.Threading.Tasks.Task.Run(() => |
572 |
//{ |
573 |
await Dispatcher.InvokeAsync(() => |
574 |
{ |
575 |
Export export = new Export(); |
576 |
|
577 |
if (saveFile) |
578 |
{ |
579 |
var filepath = Path.Combine(TempImageDir, $"{PrintimgPath_List.Count() + 1}.png"); |
580 |
|
581 |
if (export.ExportingFile(printCanvas, printCanvas.Width, printCanvas.Height, filepath)) |
582 |
{ |
583 |
PrintimgPath_List.Add(PrintimgPath_List.Count() + 1, filepath); |
584 |
} |
585 |
else |
586 |
{ |
587 |
throw new Exception($"Export Image Save File Error :{filepath}"); |
588 |
} |
589 |
} |
590 |
else |
591 |
{ |
592 |
p_img = export.Exporting(PrintView, printCanvas.Width, printCanvas.Height); |
593 |
Printimg_List.Add(Printimg_List.Count() + 1, p_img); |
594 |
} |
595 |
|
596 |
},System.Windows.Threading.DispatcherPriority.SystemIdle); |
597 |
//}); |
598 |
} |
599 |
|
600 |
result = true; |
601 |
//} |
602 |
} |
603 |
} |
604 |
catch (Exception ex) |
605 |
{ |
606 |
//Logger.sendResLog("PrintControl.PageChanged", ex.Message, 0); |
607 |
} |
608 |
|
609 |
return result; |
610 |
//})); |
611 |
} |
612 |
|
613 |
|
614 |
public static MemoryStream ByteBufferFromImage(BitmapImage imageSource) |
615 |
{ |
616 |
var ms = new MemoryStream(); |
617 |
var pngEncoder = new PngBitmapEncoder(); |
618 |
pngEncoder.Frames.Add(BitmapFrame.Create(imageSource)); |
619 |
pngEncoder.Save(ms); |
620 |
|
621 |
return ms; |
622 |
} |
623 |
//Print 버튼 클릭 이벤트 |
624 |
#region Method - 명령 |
625 |
async void PrintMethod(object sender, RoutedEventArgs e) |
626 |
{ |
627 |
try |
628 |
{ |
629 |
var token = Common.ViewerDataModel.Instance.NewPagImageCancelToken(); |
630 |
|
631 |
if (this.printIndy.IsBusy == true) |
632 |
return; |
633 |
|
634 |
(this.Parent as RadWindow).CanClose = false; |
635 |
|
636 |
await this.Dispatcher.InvokeAsync(() => { |
637 |
this.printIndy.IsBusy = true; |
638 |
this.BusyContent = "Printing. . ."; |
639 |
}); |
640 |
|
641 |
|
642 |
_lstPrintPageNo = PrintPageCreate(); |
643 |
|
644 |
if (_lstPrintPageNo.Count == 0) |
645 |
{ |
646 |
RadWindow.Alert(new DialogParameters |
647 |
{ |
648 |
Owner = Application.Current.MainWindow, |
649 |
Theme = new VisualStudio2013Theme(), |
650 |
Header = "Info", |
651 |
Content = "Not specified the page." |
652 |
}); |
653 |
sliderPages.Value = 1; |
654 |
this.printIndy.IsBusy = false; |
655 |
return; |
656 |
} |
657 |
|
658 |
int cnt = 0; |
659 |
|
660 |
IsExportOrPrint = true; |
661 |
|
662 |
Printimg_List = new Dictionary<int, System.Drawing.Image>(); |
663 |
PrintimgPath_List = new Dictionary<int, string>(); |
664 |
TempImageDir = Path.Combine(Path.GetTempPath(), "Markus", Common.Commons.ShortGuid()); |
665 |
|
666 |
if (Directory.Exists(TempImageDir)) |
667 |
{ |
668 |
Directory.Delete(TempImageDir, true); |
669 |
} |
670 |
|
671 |
Directory.CreateDirectory(TempImageDir); |
672 |
|
673 |
foreach (int PageNo in _lstPrintPageNo) |
674 |
{ |
675 |
if (IsStop) |
676 |
break; |
677 |
|
678 |
cnt++; |
679 |
sliderPages.Value = PageNo; |
680 |
await PageChangeAsync(token,PageNo, true, true); |
681 |
//PageChanged(cnt, true); |
682 |
} |
683 |
PrintName = cbPrint.SelectedItem.ToString(); |
684 |
|
685 |
await this.Dispatcher.InvokeAsync(() => { |
686 |
if (cnt == _lstPrintPageNo.Count && !IsStop) |
687 |
{ |
688 |
Printing(); |
689 |
} |
690 |
}); |
691 |
|
692 |
IsExportOrPrint = false; |
693 |
} |
694 |
catch (Exception ex) |
695 |
{ |
696 |
//Logger.sendResLog("PrintMethod", ex.Message, 0); |
697 |
} |
698 |
finally |
699 |
{ |
700 |
if (IsStop) |
701 |
{ |
702 |
printIndy.IsBusy = false; |
703 |
IsStop = false; |
704 |
} |
705 |
(this.Parent as RadWindow).CanClose = true; |
706 |
} |
707 |
|
708 |
} |
709 |
|
710 |
//Export 버튼 클릭 이벤트 |
711 |
[System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptions] |
712 |
//[System.Security.Permissions.FileIOPermission(System.Security.Permissions.SecurityAction.LinkDemand)] |
713 |
async void ExportMethod(object sender, RoutedEventArgs e) |
714 |
{ |
715 |
try |
716 |
{ |
717 |
if (this.printIndy.IsBusy == true) |
718 |
return; |
719 |
|
720 |
var token = Common.ViewerDataModel.Instance.NewPagImageCancelToken(); |
721 |
|
722 |
(this.Parent as RadWindow).CanClose = false; |
723 |
|
724 |
this.printIndy.IsBusy = true; |
725 |
this.BusyContent = "Exporting. . ."; |
726 |
|
727 |
Export export = new Export(); |
728 |
_lstPrintPageNo = PrintPageCreate(); |
729 |
|
730 |
if (_lstPrintPageNo.Count == 0) |
731 |
{ |
732 |
sliderPages.Value = 1; |
733 |
this.printIndy.IsBusy = false; |
734 |
RadWindow.Alert(new DialogParameters |
735 |
{ |
736 |
Owner = Application.Current.MainWindow, |
737 |
Theme = new VisualStudio2013Theme(), |
738 |
Header = "Info", |
739 |
Content = "Not specified the page.", |
740 |
}); |
741 |
return; |
742 |
} |
743 |
|
744 |
//FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png"); |
745 |
|
746 |
switch (cbPrint.SelectedIndex) |
747 |
{ |
748 |
case (0): |
749 |
{ |
750 |
SaveDig.Filter = "PDF file format|*.pdf"; |
751 |
break; |
752 |
} |
753 |
case (1): |
754 |
{ |
755 |
SaveDig.Filter = "Image Files (*.jpg, *.Jpeg)|*.jpg;*.Jpeg"; |
756 |
break; |
757 |
} |
758 |
} |
759 |
|
760 |
SaveDig.Title = "Save an PDF File"; |
761 |
if(SaveDig.ShowDialog().Value) |
762 |
{ |
763 |
IsExportOrPrint = true; |
764 |
|
765 |
PrintimgPath_List = new Dictionary<int, string>(); |
766 |
TempImageDir = Path.Combine(Path.GetTempPath(), "Markus", Common.Commons.ShortGuid()); |
767 |
|
768 |
if (Directory.Exists(TempImageDir)) |
769 |
{ |
770 |
Directory.Delete(TempImageDir, true); |
771 |
} |
772 |
|
773 |
Directory.CreateDirectory(TempImageDir); |
774 |
|
775 |
foreach (int PageNo in _lstPrintPageNo) |
776 |
{ |
777 |
if (IsStop) |
778 |
break; |
779 |
|
780 |
await Dispatcher.InvokeAsync(() => |
781 |
{ |
782 |
sliderPages.Value = PageNo; |
783 |
}); |
784 |
|
785 |
await PageChangeAsync(token, PageNo, true, true); |
786 |
|
787 |
System.Diagnostics.Debug.WriteLine("Export Page : " + PageNo); |
788 |
} |
789 |
|
790 |
//using (FileStream fs = new FileStream(@"D:\Temp\Text.pdf", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None)) |
791 |
|
792 |
if (SaveDig.FileName != "") |
793 |
{ |
794 |
switch (cbPrint.SelectedIndex) |
795 |
{ |
796 |
case (0): |
797 |
{ |
798 |
FileStream fs = new FileStream(SaveDig.FileName, FileMode.Create, FileAccess.Write); |
799 |
|
800 |
Document doc = new Document(); |
801 |
try |
802 |
{ |
803 |
iTextSharp.text.Version.GetInstance(); |
804 |
} |
805 |
catch (System.NullReferenceException ex) |
806 |
{ |
807 |
|
808 |
} |
809 |
|
810 |
PdfWriter writer = PdfWriter.GetInstance(doc, fs); |
811 |
|
812 |
doc.Open(); |
813 |
|
814 |
float height = doc.PageSize.Height; |
815 |
float width = doc.PageSize.Width; |
816 |
|
817 |
foreach (var item in PrintimgPath_List) |
818 |
{ |
819 |
if (IsStop) |
820 |
break; |
821 |
|
822 |
System.Drawing.Image image = System.Drawing.Image.FromFile(item.Value); |
823 |
Export_img = iTextSharp.text.Image.GetInstance(image,System.Drawing.Imaging.ImageFormat.Jpeg); |
824 |
|
825 |
if (Export_img.Width > Export_img.Height) |
826 |
{ |
827 |
doc.SetPageSize(new Rectangle(height, width)); |
828 |
Export_img.ScaleToFit(height, width); |
829 |
} |
830 |
else |
831 |
{ |
832 |
doc.SetPageSize(new Rectangle(width, height)); |
833 |
Export_img.ScaleToFit(width, height); |
834 |
} |
835 |
|
836 |
Export_img.SetAbsolutePosition(0, 0); |
837 |
|
838 |
doc.NewPage(); |
839 |
doc.Add(Export_img); |
840 |
} |
841 |
doc.Close(); |
842 |
writer.Close(); |
843 |
break; |
844 |
} |
845 |
case (1): |
846 |
{ |
847 |
foreach (var item in PrintimgPath_List) |
848 |
{ |
849 |
if (IsStop) |
850 |
break; |
851 |
|
852 |
File.Copy(item.Value, SaveDig.FileName.Replace(".jpg", "_" + item.Key.ToString()) + ".jpg"); |
853 |
} |
854 |
break; |
855 |
} |
856 |
} |
857 |
} |
858 |
else |
859 |
{ |
860 |
sliderPages.Value = 1; |
861 |
this.printIndy.IsBusy = false; |
862 |
return; |
863 |
} |
864 |
|
865 |
await this.Dispatcher.InvokeAsync(() => |
866 |
{ |
867 |
sliderPages.Value = 1; |
868 |
printIndy.IsBusy = false; |
869 |
}); |
870 |
|
871 |
await PageChangeAsync(token,_StartPageNo, false); |
872 |
|
873 |
IsExportOrPrint = false; |
874 |
|
875 |
(Application.Current.MainWindow as MainWindow).dzMainMenu.DialogMessage_Alert("Success", "Alert"); |
876 |
}else |
877 |
{ |
878 |
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
879 |
{ |
880 |
sliderPages.Value = 1; |
881 |
printIndy.IsBusy = false; |
882 |
})); |
883 |
|
884 |
//(Application.Current.MainWindow as MainWindow).dzMainMenu.DialogMessage_Alert("Cancel", "Alert"); |
885 |
} |
886 |
} |
887 |
catch (Exception ex) |
888 |
{ |
889 |
sliderPages.Value = 1; |
890 |
printIndy.IsBusy = false; |
891 |
|
892 |
//Logger.sendResLog("Export Method", ex.Message, 0); |
893 |
//(Application.Current.MainWindow as MainWindow).dzMainMenu.DialogMessage_Alert("Alert", "관리자 확인이 필요합니다. 다시 시도해 주세요.\n"+ex.Message); |
894 |
} |
895 |
finally |
896 |
{ |
897 |
GC.Collect(); |
898 |
GC.WaitForPendingFinalizers(); |
899 |
GC.Collect(); |
900 |
IsStop = false; |
901 |
(this.Parent as RadWindow).CanClose = true; |
902 |
} |
903 |
} |
904 |
|
905 |
#endregion |
906 |
|
907 |
#region Method - 처리 |
908 |
void CheckCommentPages() |
909 |
{ |
910 |
List<MarkupPageItem> _pages = new List<MarkupPageItem>(); |
911 |
DoubleCollection _Ticks = new DoubleCollection(); |
912 |
|
913 |
|
914 |
if (GridCurrentPage.Visibility == System.Windows.Visibility.Visible) |
915 |
{ |
916 |
|
917 |
_pages = (from commPage in this._PageMarkupList |
918 |
where commPage.PageNumber == CurrentPageNo |
919 |
orderby commPage.PageNumber |
920 |
select commPage).ToList(); |
921 |
} |
922 |
else if (GridRangePages.Visibility == System.Windows.Visibility.Visible) |
923 |
{ |
924 |
stPageNo.Value = stPageNo.Value == null ? 1 : stPageNo.Value; |
925 |
edPageNo.Value = edPageNo.Value == null ? 1 : edPageNo.Value; |
926 |
|
927 |
int _stPage = (int)stPageNo.Value; |
928 |
int _edPage = (int)edPageNo.Value; |
929 |
|
930 |
_pages = (from commPage in this._PageMarkupList |
931 |
where commPage.PageNumber >= _stPage && commPage.PageNumber <= _edPage |
932 |
orderby commPage.PageNumber |
933 |
select commPage).ToList(); |
934 |
} |
935 |
else if (GridDefinePages.Visibility == System.Windows.Visibility.Visible) |
936 |
{ |
937 |
stPageNo.Value = stPageNo.Value == null ? 1 : stPageNo.Value; |
938 |
edPageNo.Value = edPageNo.Value == null ? 1 : edPageNo.Value; |
939 |
|
940 |
int _stPage = (int)stPageNo.Value; |
941 |
int _edPage = (int)edPageNo.Value; |
942 |
|
943 |
//Using DeepView.Common.RangeParser |
944 |
var lst = RangeParser.Parse(txtDefinedPages.Text, _stPage, _definePages.PagesCount); |
945 |
_pages = (from commPage in this._PageMarkupList |
946 |
from compareData in lst |
947 |
where commPage.PageNumber == compareData |
948 |
orderby commPage.PageNumber |
949 |
select commPage).ToList(); |
950 |
} |
951 |
else |
952 |
{ |
953 |
_pages = (from commPage in this._PageMarkupList |
954 |
orderby commPage.PageNumber |
955 |
select commPage).ToList(); |
956 |
} |
957 |
|
958 |
CommentPageList.ItemsSource = _pages.ToList(); |
959 |
} |
960 |
|
961 |
void SetLoadMakupList(int PageNo) |
962 |
{ |
963 |
_LoadMakupList.Clear(); |
964 |
var _markupList = _PageMarkupList.Where(page => page.PageNumber == PageNo); |
965 |
|
966 |
if (_markupList.Count() > 0) |
967 |
_LoadMakupList = _markupList.First().DisplayColorItems.ToList(); |
968 |
} |
969 |
|
970 |
#region 프린트 리스트 가져오기 |
971 |
public void GetPrint(bool flag) |
972 |
{ |
973 |
if (flag) |
974 |
{ |
975 |
foreach (string printer in PrinterSettings.InstalledPrinters) |
976 |
{ |
977 |
this.cbPrint.Items.Add(printer); |
978 |
} |
979 |
printDocument = new PrintDocument(); |
980 |
this.cbPrint.SelectedItem = printDocument.PrinterSettings.PrinterName; |
981 |
} |
982 |
else |
983 |
{ |
984 |
this.cbPrint.Items.Add("PDF"); |
985 |
this.cbPrint.Items.Add("IMAGE"); |
986 |
|
987 |
this.cbPrint.SelectedItem = "PDF"; |
988 |
} |
989 |
} |
990 |
#endregion |
991 |
|
992 |
#region 프린트 실행 |
993 |
public async void Printing() |
994 |
{ |
995 |
var token = Common.ViewerDataModel.Instance.NewPagImageCancelToken (); |
996 |
|
997 |
await PageChangeAsync(token,1, false); |
998 |
|
999 |
if (PrinterSettings.InstalledPrinters != null && PrinterSettings.InstalledPrinters.Count > 0) |
1000 |
{ |
1001 |
printDocument = new PrintDocument(); |
1002 |
printDocument.OriginAtMargins = true; |
1003 |
printDocument.BeginPrint += new System.Drawing.Printing.PrintEventHandler(printDocument_BeginPrint); |
1004 |
printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument_PrintPage); |
1005 |
printDocument.EndPrint += new System.Drawing.Printing.PrintEventHandler(printDocument_EndPrint); |
1006 |
} |
1007 |
else |
1008 |
printDocument = null; |
1009 |
|
1010 |
#region 인쇄 미리보기 테스트 |
1011 |
using (System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog()) |
1012 |
{ |
1013 |
printDocument.PrinterSettings.MinimumPage = 1; |
1014 |
printDocument.PrinterSettings.MaximumPage = _lstPrintPageNo.Count(); |
1015 |
printDocument.PrinterSettings.FromPage = 1; |
1016 |
printDocument.PrinterSettings.ToPage = _lstPrintPageNo.Count(); |
1017 |
printDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); |
1018 |
printDocument.PrinterSettings.PrinterName = PrintName; |
1019 |
dlg.Document = printDocument; |
1020 |
dlg.WindowState = System.Windows.Forms.FormWindowState.Maximized; |
1021 |
dlg.ShowDialog(); |
1022 |
} |
1023 |
#endregion |
1024 |
|
1025 |
#region 인쇄 |
1026 |
//printDocument.PrinterSettings.MinimumPage = 1; |
1027 |
//printDocument.PrinterSettings.MaximumPage = _lstPrintPageNo.Count(); |
1028 |
//printDocument.PrinterSettings.FromPage = 1; |
1029 |
//printDocument.PrinterSettings.ToPage = _lstPrintPageNo.Count(); |
1030 |
|
1031 |
//printDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); |
1032 |
//printDocument.PrinterSettings.PrinterName = PrintName; |
1033 |
|
1034 |
//printDocument.Print(); |
1035 |
#endregion |
1036 |
} |
1037 |
|
1038 |
private void printDocument_BeginPrint(object sender, PrintEventArgs e) |
1039 |
{ |
1040 |
//Printimg_List = new Dictionary<int, System.Drawing.Image>(); |
1041 |
// This demo only loads one page at a time, so no need to re-set the print page number |
1042 |
PrintDocument document = sender as PrintDocument; |
1043 |
currentPage = document.PrinterSettings.FromPage; |
1044 |
} |
1045 |
|
1046 |
private void printDocument_PrintPage(object sender, PrintPageEventArgs e) |
1047 |
{ |
1048 |
//e.Graphics.DrawImage(Printimg_List.Where(info => info.Key == currentPage).FirstOrDefault().Value, 0, 0); |
1049 |
|
1050 |
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
1051 |
{ |
1052 |
//p_img = Printimg_List.Where(data => data.Key == currentPage).FirstOrDefault().Value; |
1053 |
p_img = System.Drawing.Image.FromFile(PrintimgPath_List.Where(data => data.Key == currentPage).FirstOrDefault().Value); |
1054 |
|
1055 |
if (p_img.Width > p_img.Height) |
1056 |
{ |
1057 |
p_img.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone); |
1058 |
} |
1059 |
|
1060 |
//iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(p_img, System.Drawing.Imaging.ImageFormat.Jpeg); |
1061 |
System.Drawing.Image pic = p_img; |
1062 |
System.Drawing.Rectangle m = e.MarginBounds; |
1063 |
|
1064 |
//if ((double)pic.Width / (double)pic.Height > (double)m.Width / (double)m.Height) // image is wider |
1065 |
//{ |
1066 |
// m.Height = 1135;//(int)((double)pic.Height / (double)pic.Width * (double)m.Width) - 16; |
1067 |
//} |
1068 |
//else |
1069 |
//{ |
1070 |
// m.Width = 793;//(int)((double)pic.Width / (double)pic.Height * (double)m.Height) - 16; |
1071 |
//} |
1072 |
m.Width = (int)e.PageSettings.PrintableArea.Width; |
1073 |
m.Height = (int)e.PageSettings.PrintableArea.Height; |
1074 |
m.X = (int)e.PageSettings.HardMarginX; |
1075 |
m.Y = (int)e.PageSettings.HardMarginY; |
1076 |
|
1077 |
e.Graphics.DrawImage(pic, m); |
1078 |
//e.Graphics.DrawImage(p_img, e.MarginBounds); |
1079 |
//e.Graphics.DrawImage(p_img, 0, 0); |
1080 |
})); |
1081 |
|
1082 |
//다음 페이지 |
1083 |
currentPage++; |
1084 |
|
1085 |
////인쇄를 계속 할지 말지 확인 |
1086 |
if (currentPage <= printDocument.PrinterSettings.ToPage && !IsStop) |
1087 |
e.HasMorePages = true; |
1088 |
else |
1089 |
e.HasMorePages = false; |
1090 |
|
1091 |
} |
1092 |
|
1093 |
private void printDocument_EndPrint(object sender, PrintEventArgs e) |
1094 |
{ |
1095 |
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate |
1096 |
{ |
1097 |
//if (Directory.Exists(TempImageDir)) |
1098 |
// Directory.Delete(TempImageDir, true); |
1099 |
|
1100 |
sliderPages.Value = 1; |
1101 |
printIndy.IsBusy = false; |
1102 |
IsStop = false; |
1103 |
})); |
1104 |
} |
1105 |
#endregion |
1106 |
|
1107 |
#region Selected Pages Check |
1108 |
List<int> PrintPageCreate() |
1109 |
{ |
1110 |
List<int> Result = new List<int>(); |
1111 |
|
1112 |
if (GridCurrentPage.Visibility == System.Windows.Visibility.Visible || currentPagePrint) |
1113 |
{ |
1114 |
Result.Add(CurrentPageNo); |
1115 |
} |
1116 |
else if (GridRangePages.Visibility == System.Windows.Visibility.Visible) |
1117 |
{ |
1118 |
for (int i = Convert.ToInt32(stPageNo.Value); i <= Convert.ToInt32(edPageNo.Value); i++) |
1119 |
{ |
1120 |
Result.Add(i); |
1121 |
} |
1122 |
} |
1123 |
else if (GridDefinePages.Visibility == System.Windows.Visibility.Visible) |
1124 |
{ |
1125 |
int _stPage = (int)stPageNo.Value; |
1126 |
int _edPage = (int)edPageNo.Value; |
1127 |
|
1128 |
var lst = RangeParser.Parse(txtDefinedPages.Text, _stPage, _definePages.PagesCount); |
1129 |
Result.AddRange(lst); |
1130 |
} |
1131 |
else |
1132 |
{ |
1133 |
for (int i = 1; i <= _definePages.PagesCount; i++) |
1134 |
{ |
1135 |
Result.Add(i); |
1136 |
} |
1137 |
} |
1138 |
if (currentPagePrint) |
1139 |
{ |
1140 |
return Result; |
1141 |
} |
1142 |
|
1143 |
if (chkOnlyMarkup.IsChecked.Value) |
1144 |
{ |
1145 |
var _result = from result in Result |
1146 |
where _PageMarkupList.Where(page => page.PageNumber == result).Count() > 0 |
1147 |
select result; |
1148 |
Result = _result.ToList(); |
1149 |
} |
1150 |
return Result; |
1151 |
} |
1152 |
#endregion |
1153 |
|
1154 |
#endregion |
1155 |
|
1156 |
private void btPrintCancel_click(object sender, RoutedEventArgs e) |
1157 |
{ |
1158 |
IsStop = true; |
1159 |
} |
1160 |
} |
1161 |
} |