1
|
using IKCOM;
|
2
|
using KCOM.Common;
|
3
|
using KCOM.Events;
|
4
|
using KCOMDataModel.Common;
|
5
|
using KCOMDataModel.DataModel;
|
6
|
using MarkupToPDF.Common;
|
7
|
using MarkupToPDF.Controls.Parsing;
|
8
|
using System;
|
9
|
using System.Collections.Generic;
|
10
|
using System.ComponentModel;
|
11
|
using System.Linq;
|
12
|
using System.Text;
|
13
|
using System.Threading.Tasks;
|
14
|
using System.Windows;
|
15
|
using System.Windows.Controls;
|
16
|
using System.Windows.Data;
|
17
|
using System.Windows.Documents;
|
18
|
using System.Windows.Input;
|
19
|
using System.Windows.Media;
|
20
|
using System.Windows.Media.Imaging;
|
21
|
using System.Windows.Navigation;
|
22
|
using System.Windows.Shapes;
|
23
|
using Telerik.Windows.Controls;
|
24
|
using Telerik.Windows.Controls.DragDrop;
|
25
|
|
26
|
namespace KCOM.Controls
|
27
|
{
|
28
|
public class Symbol_Custom
|
29
|
{
|
30
|
public string ID { get; set; }
|
31
|
public string Name { get; set; }
|
32
|
public string ImageUri { get; set; }
|
33
|
}
|
34
|
|
35
|
/// <summary>
|
36
|
/// Symbol.xaml에 대한 상호 작용 논리
|
37
|
/// </summary>
|
38
|
public partial class Symbol : UserControl
|
39
|
{
|
40
|
AdornerFinal finalItem;
|
41
|
bool IsMouseDown = false;
|
42
|
string moveItem_id = "";
|
43
|
public string filename { get; set; }
|
44
|
bool _Initialize = false;
|
45
|
|
46
|
public Symbol()
|
47
|
{
|
48
|
//App.splashString(ISplashMessage.SYMBOL);
|
49
|
InitializeComponent();
|
50
|
|
51
|
//RadDragAndDropManager.AddDragInfoHandler(lstSymbolPrivate, OnDragPrivateInfo);
|
52
|
//RadDragAndDropManager.AddDragQueryHandler(lstSymbolPrivate, OnDragPrivateQuery);
|
53
|
//RadDragAndDropManager.SetAllowDrag(lstSymbolPrivate, true);
|
54
|
this.Loaded += Symbol_Loaded;
|
55
|
|
56
|
}
|
57
|
|
58
|
|
59
|
|
60
|
private async void Symbol_Loaded(object sender, RoutedEventArgs e)
|
61
|
{
|
62
|
if (!App.IsDesignMode)
|
63
|
{
|
64
|
if (!_Initialize)
|
65
|
{
|
66
|
_Initialize = true;
|
67
|
await DataBindAsync();
|
68
|
|
69
|
}
|
70
|
}
|
71
|
}
|
72
|
|
73
|
private void OnDragPrivateInfo(object sender, DragDropEventArgs e)
|
74
|
{
|
75
|
}
|
76
|
|
77
|
private void OnDragPrivateQuery(object sender, DragDropQueryEventArgs e)
|
78
|
{
|
79
|
if (e.Options.Status == DragStatus.DragQuery)
|
80
|
{
|
81
|
//var draggedListBoxItem = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem;
|
82
|
//BitmapImage im = new BitmapImage(new Uri((draggedListBoxItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate).ImageUri));
|
83
|
//ImageSource _source = im;
|
84
|
//Image img = new Image();
|
85
|
//img.Source = _source;
|
86
|
|
87
|
//e.Options.Payload = im;
|
88
|
//var dragCue = new Image();
|
89
|
//dragCue.Source = img.Source;
|
90
|
//dragCue.Width = 0;
|
91
|
//dragCue.Height = 0;
|
92
|
//e.Options.DragCue = dragCue;
|
93
|
|
94
|
|
95
|
//PayLoadAdorner = new AdornerFinal();
|
96
|
//DeepView.ServiceDeepView_Symbol.SymbolPrivate tempDragableControl = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate;
|
97
|
//var xamldata = tempDragableControl.Data;
|
98
|
////this.DeepLayer.markupParse(xamldata, this.DeepLayer._TempLayer, "복사된 데이터_이름으로 수정해야함");
|
99
|
//PayLoadAdorner = this.DeepLayer.markupParseToAdorner(xamldata, this.DeepLayer._SelectLayer, "");
|
100
|
//this.DeepLayer._SelectLayer.Children.Add(PayLoadAdorner);
|
101
|
}
|
102
|
|
103
|
e.QueryResult = true;
|
104
|
e.Handled = true;
|
105
|
}
|
106
|
|
107
|
private async Task DataBindAsync()
|
108
|
{
|
109
|
//lstSymbolPrivate.ItemsSource = null;
|
110
|
//lstSymbolPublic.ItemsSource = null;
|
111
|
|
112
|
Symbol_Custom Custom = new Symbol_Custom();
|
113
|
List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
|
114
|
|
115
|
try
|
116
|
{
|
117
|
|
118
|
var symbol_Private = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetSymbolListAsync(App.ViewInfo.UserID);
|
119
|
|
120
|
foreach (var item in symbol_Private)
|
121
|
{
|
122
|
Custom.Name = item.NAME;
|
123
|
Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL.Replace("//","/").Replace(":/", "://"), App.isExternal);
|
124
|
Custom.ID = item.ID;
|
125
|
Custom_List.Add(Custom);
|
126
|
Custom = new Symbol_Custom();
|
127
|
}
|
128
|
lstSymbolPrivate.ItemsSource = Custom_List;
|
129
|
}
|
130
|
catch (Exception ex)
|
131
|
{
|
132
|
System.Diagnostics.Debug.WriteLine(ex.ToString());
|
133
|
}
|
134
|
|
135
|
Custom = new Symbol_Custom();
|
136
|
Custom_List = new List<Symbol_Custom>();
|
137
|
|
138
|
deptlist.ItemsSource = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolDeptListAsync();
|
139
|
|
140
|
List<SYMBOL_PUBLIC> symbol_Public;
|
141
|
|
142
|
|
143
|
if (deptlist.SelectedValue != null)
|
144
|
{
|
145
|
symbol_Public = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolListAsync(deptlist.SelectedValue.ToString());
|
146
|
}
|
147
|
else
|
148
|
{
|
149
|
symbol_Public = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolListAsync(null);
|
150
|
}
|
151
|
|
152
|
if (symbol_Public != null)
|
153
|
{
|
154
|
foreach (var item in symbol_Public)
|
155
|
{
|
156
|
Custom.Name = item.NAME;
|
157
|
Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL.Replace("//", "/").Replace(":/", "://"), App.isExternal);
|
158
|
Custom.ID = item.ID;
|
159
|
Custom_List.Add(Custom);
|
160
|
Custom = new Symbol_Custom();
|
161
|
}
|
162
|
|
163
|
lstSymbolPublic.ItemsSource = Custom_List;
|
164
|
}
|
165
|
}
|
166
|
|
167
|
public async Task<PngBitmapEncoder> symImageAsync_old(string data,double PageAngle)
|
168
|
{
|
169
|
|
170
|
Canvas _canvas = new Canvas();
|
171
|
_canvas.Background = Brushes.White;
|
172
|
_canvas.Width = finalItem.BorderSize.Width;
|
173
|
_canvas.Height = finalItem.BorderSize.Height;
|
174
|
await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas, PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken(),
|
175
|
STAMP_Contents: App.SystemInfo.STAMP_CONTENTS);
|
176
|
|
177
|
BitmapEncoder encoder = new PngBitmapEncoder();
|
178
|
|
179
|
|
180
|
RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32);
|
181
|
|
182
|
DrawingVisual dv = new DrawingVisual();
|
183
|
|
184
|
_canvas.Measure(new System.Windows.Size(finalItem.BorderSize.Width + 50, finalItem.BorderSize.Height + 50));
|
185
|
//_canvas.Arrange(new Rect(new System.Windows.Point { X = -finalItem.BorderSize.X - 50, Y = -finalItem.BorderSize.Y - 50 }, new Point(finalItem.BorderSize.Width + 20, finalItem.BorderSize.Height + 20)));
|
186
|
_canvas.Arrange(new Rect(new System.Windows.Point { X = -finalItem.BorderSize.X - 20, Y = -finalItem.BorderSize.Y - 20 }, new Point(finalItem.BorderSize.Width + 20, finalItem.BorderSize.Height + 20)));
|
187
|
|
188
|
using (DrawingContext ctx = dv.RenderOpen())
|
189
|
{
|
190
|
VisualBrush vb = new VisualBrush(_canvas);
|
191
|
//ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -finalItem.BorderSize.X - 20, Y = -finalItem.BorderSize.Y - 20 }, new Point(finalItem.BorderSize.Width + 20, finalItem.BorderSize.Height + 20)));
|
192
|
ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -finalItem.BorderSize.X, Y = -finalItem.BorderSize.Y }, new Point(finalItem.BorderSize.Width + 20, finalItem.BorderSize.Height + 20)));
|
193
|
}
|
194
|
|
195
|
try
|
196
|
{
|
197
|
renderBitmap.Render(dv);
|
198
|
|
199
|
GC.Collect();
|
200
|
GC.WaitForPendingFinalizers();
|
201
|
GC.Collect();
|
202
|
//bitmap.Render(controlToConvert);
|
203
|
// encode png data
|
204
|
PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
|
205
|
// puch rendered bitmap into it
|
206
|
pngEncoder.Interlace = PngInterlaceOption.Off;
|
207
|
pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
|
208
|
return pngEncoder;
|
209
|
|
210
|
}
|
211
|
catch //(Exception ex)
|
212
|
{
|
213
|
return null;
|
214
|
}
|
215
|
|
216
|
}
|
217
|
|
218
|
public async Task<PngBitmapEncoder> symImageAsync(string data, double PageAngle)
|
219
|
{
|
220
|
|
221
|
Canvas _canvas = new Canvas();
|
222
|
_canvas.Background = Brushes.White;
|
223
|
|
224
|
List<Rect> rects = new List<Rect>();
|
225
|
|
226
|
finalItem.Members.ForEach(member =>
|
227
|
{
|
228
|
if(member?.DrawingData is MarkupToPDF.ICommentRect comment)
|
229
|
{
|
230
|
rects.Add(comment.GetCommentRect());
|
231
|
}
|
232
|
});
|
233
|
|
234
|
var rect = MathHelper.CombineRects(rects);
|
235
|
|
236
|
_canvas.Width = rect.Width;
|
237
|
_canvas.Height = rect.Height;
|
238
|
|
239
|
await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas, PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken(),
|
240
|
STAMP_Contents: App.SystemInfo.STAMP_CONTENTS);
|
241
|
|
242
|
BitmapEncoder encoder = new PngBitmapEncoder();
|
243
|
RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)rect.Width, (int)rect.Height, 96d, 96d, PixelFormats.Pbgra32);
|
244
|
|
245
|
DrawingVisual dv = new DrawingVisual();
|
246
|
//Window window = new Window();
|
247
|
//window.Content = _canvas;
|
248
|
//var result = window.ShowDialog();
|
249
|
//if(result.GetValueOrDefault())
|
250
|
//{
|
251
|
|
252
|
//}
|
253
|
|
254
|
_canvas.Measure(rect.Size);
|
255
|
_canvas.Arrange(new Rect(new System.Windows.Point { X = -rect.X + 35, Y = -rect.Y + 35 }, new Point(rect.Width + 35, rect.Height + 35)));
|
256
|
|
257
|
using (DrawingContext ctx = dv.RenderOpen())
|
258
|
{
|
259
|
VisualBrush vb = new VisualBrush(_canvas);
|
260
|
ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -rect.X, Y = -rect.Y }, new Point(rect.Width, rect.Height)));
|
261
|
}
|
262
|
Window window2 = new Window();
|
263
|
window2.Content = _canvas;
|
264
|
var result2 = window2.ShowDialog();
|
265
|
if (result2.GetValueOrDefault())
|
266
|
{
|
267
|
|
268
|
}
|
269
|
try
|
270
|
{
|
271
|
renderBitmap.Render(dv);
|
272
|
|
273
|
GC.Collect();
|
274
|
GC.WaitForPendingFinalizers();
|
275
|
GC.Collect();
|
276
|
//bitmap.Render(controlToConvert);
|
277
|
// encode png data
|
278
|
PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
|
279
|
// puch rendered bitmap into it
|
280
|
pngEncoder.Interlace = PngInterlaceOption.Off;
|
281
|
pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
|
282
|
return pngEncoder;
|
283
|
|
284
|
}
|
285
|
catch //(Exception ex)
|
286
|
{
|
287
|
return null;
|
288
|
}
|
289
|
|
290
|
}
|
291
|
|
292
|
public void DialogMessage_Alert(string content, string header)
|
293
|
{
|
294
|
App.splashScreen.Close();
|
295
|
|
296
|
DialogParameters parameters = new DialogParameters()
|
297
|
{
|
298
|
Owner = Application.Current.MainWindow,
|
299
|
Content = new TextBlock()
|
300
|
{
|
301
|
MinWidth = 400,
|
302
|
FontSize = 11,
|
303
|
Text = content,
|
304
|
TextWrapping = System.Windows.TextWrapping.Wrap
|
305
|
},
|
306
|
Header = header,
|
307
|
Theme = new VisualStudio2013Theme(),
|
308
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
309
|
};
|
310
|
RadWindow.Alert(parameters);
|
311
|
}
|
312
|
|
313
|
#region Event
|
314
|
|
315
|
#region Private Symbol Add Event
|
316
|
private void Create_Symbol(object sender, RoutedEventArgs e)
|
317
|
{
|
318
|
MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
|
319
|
|
320
|
if (Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
|
321
|
{
|
322
|
DialogMessage_Alert("Please Select Controls", "Alert");
|
323
|
}
|
324
|
else //선택된 것이 있으면
|
325
|
{
|
326
|
string MarkupData = "";
|
327
|
finalItem = new AdornerFinal();
|
328
|
|
329
|
foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children)
|
330
|
{
|
331
|
if (item.GetType().Name == "AdornerFinal")
|
332
|
{
|
333
|
finalItem = (item as Controls.AdornerFinal);
|
334
|
foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
|
335
|
{
|
336
|
if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
|
337
|
{
|
338
|
markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
|
339
|
MarkupData += markupReturn.ConvertData;
|
340
|
}
|
341
|
}
|
342
|
}
|
343
|
}
|
344
|
DialogParameters parameters = new DialogParameters()
|
345
|
{
|
346
|
Owner = Application.Current.MainWindow,
|
347
|
Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
|
348
|
DefaultPromptResultValue = "Custom State",
|
349
|
Content = "Name :",
|
350
|
Header = "Insert Custom Symbol Name",
|
351
|
Theme = new VisualStudio2013Theme(),
|
352
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
353
|
};
|
354
|
RadWindow.Prompt(parameters);
|
355
|
}
|
356
|
|
357
|
}
|
358
|
#endregion
|
359
|
|
360
|
#region Symbol Add Close Event
|
361
|
private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
|
362
|
{
|
363
|
try
|
364
|
{
|
365
|
if (args.PromptResult != null)
|
366
|
{
|
367
|
if (args.DialogResult.Value)
|
368
|
{
|
369
|
PngBitmapEncoder _Encoder = null;
|
370
|
|
371
|
if (finalItem.Members.Any(x=> x.DrawingData is MarkupToPDF.ICommentRect comment))
|
372
|
{
|
373
|
_Encoder = await symImageAsync(data, ViewerDataModel.Instance.MarkupAngle);
|
374
|
}
|
375
|
else
|
376
|
{
|
377
|
_Encoder = await symImageAsync_old(data, ViewerDataModel.Instance.MarkupAngle);
|
378
|
}
|
379
|
|
380
|
System.IO.MemoryStream fs = new System.IO.MemoryStream();
|
381
|
_Encoder.Save(fs);
|
382
|
System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
|
383
|
|
384
|
byte[] Img_byte = fs.ToArray();
|
385
|
|
386
|
kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
|
387
|
filename = fileUploader.RunSymbol(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
|
388
|
Check_Uri.UriCheck(filename);
|
389
|
if (RadTab.SelectedIndex == 0)
|
390
|
{
|
391
|
SymbolSave(args.PromptResult, filename, data);
|
392
|
}
|
393
|
else
|
394
|
{
|
395
|
SymbolSave_Public(args.PromptResult, filename, data, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
|
396
|
}
|
397
|
|
398
|
await DataBindAsync();
|
399
|
}
|
400
|
}
|
401
|
}
|
402
|
catch(Exception ex)
|
403
|
{
|
404
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
|
405
|
}
|
406
|
}
|
407
|
#endregion
|
408
|
|
409
|
public void SymbolSave(string Name, string Url, string Data)
|
410
|
{
|
411
|
try
|
412
|
{
|
413
|
SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
|
414
|
{
|
415
|
ID = Commons.shortGuid(),
|
416
|
MEMBER_USER_ID = App.ViewInfo.UserID,
|
417
|
NAME = Name,
|
418
|
IMAGE_URL = Url,
|
419
|
DATA = Data
|
420
|
};
|
421
|
|
422
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
|
423
|
//Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
|
424
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
|
425
|
}
|
426
|
catch (Exception)
|
427
|
{
|
428
|
throw;
|
429
|
}
|
430
|
}
|
431
|
|
432
|
public void SymbolSave_Public(string Name, string Url, string Data, string Department)
|
433
|
{
|
434
|
try
|
435
|
{
|
436
|
SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
|
437
|
{
|
438
|
ID = Commons.shortGuid(),
|
439
|
DEPARTMENT = Department,
|
440
|
NAME = Name,
|
441
|
IMAGE_URL = Url,
|
442
|
DATA = Data
|
443
|
};
|
444
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
|
445
|
//Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
|
446
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
|
447
|
}
|
448
|
catch (Exception)
|
449
|
{
|
450
|
throw;
|
451
|
}
|
452
|
}
|
453
|
|
454
|
private async void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
|
455
|
{
|
456
|
//Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
|
457
|
await DataBindAsync();
|
458
|
}
|
459
|
|
460
|
private async void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
|
461
|
{
|
462
|
//Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
|
463
|
await DataBindAsync();
|
464
|
}
|
465
|
|
466
|
#region Private Symbol Delete Event
|
467
|
private void Remove_Symbol(object sender, RoutedEventArgs e)
|
468
|
{
|
469
|
if (lstSymbolPrivate.SelectedItem == null)
|
470
|
{
|
471
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
472
|
return;
|
473
|
}
|
474
|
string delItem_ID = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
|
475
|
|
476
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted;
|
477
|
//Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1);
|
478
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex);
|
479
|
}
|
480
|
#endregion
|
481
|
#region Public Symbol Delete Event
|
482
|
private void Remove_Symbol_Public(object sender, RoutedEventArgs e)
|
483
|
{
|
484
|
if (lstSymbolPublic.SelectedItem == null)
|
485
|
{
|
486
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
487
|
return;
|
488
|
}
|
489
|
string delItem_ID = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
|
490
|
|
491
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted;
|
492
|
//Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1);
|
493
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex);
|
494
|
}
|
495
|
|
496
|
private async void BaseClient_DeleteSymbolCompleted(object sender, ServiceDeepView.DeleteSymbolCompletedEventArgs e)
|
497
|
{
|
498
|
//Logger.sendResLog("DeleteSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
|
499
|
await DataBindAsync();
|
500
|
}
|
501
|
#endregion
|
502
|
|
503
|
public UndoDataGroup UndoDataGroup { get; set; }
|
504
|
/// <summary>
|
505
|
/// place symbol which has given id to original position which is created
|
506
|
/// </summary>
|
507
|
/// <date>2018.06.14</date>
|
508
|
/// <param name="id"></param>
|
509
|
private async void PlaceSymbol(string id,Point CurrentMousePoint)
|
510
|
{
|
511
|
string Data_ = "";
|
512
|
|
513
|
var systemMain = Common.ViewerDataModel.Instance.SystemMain;
|
514
|
var mainMenu = systemMain.dzMainMenu;
|
515
|
|
516
|
SelectionSet.Instance.UnSelect(mainMenu); /// unselect alreay selected items
|
517
|
|
518
|
try
|
519
|
{
|
520
|
//Logger.sendReqLog("GetSymbolData: ", id + "," + RadTab.SelectedIndex, 1);
|
521
|
Data_ = mainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex);
|
522
|
|
523
|
if (Data_ != null || Data_ != "")
|
524
|
{
|
525
|
//Logger.sendResLog("GetSymbolData", "TRUE", 1);
|
526
|
}
|
527
|
else
|
528
|
{
|
529
|
//Logger.sendResLog("GetSymbolData", "FALSE", 1);
|
530
|
}
|
531
|
|
532
|
//MARKUP_DATA_GROUP INSERT
|
533
|
//MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
|
534
|
//{
|
535
|
// SYMBOL_ID = id,//InnerItem.Symbol_ID
|
536
|
// STATE = 0,
|
537
|
//};
|
538
|
//long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
|
539
|
////Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
|
540
|
|
541
|
if (Data_.Contains("|DZ|"))
|
542
|
{
|
543
|
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
|
544
|
|
545
|
string[] delimiterChars = { "|DZ|" };
|
546
|
string[] data = Data_.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
|
547
|
|
548
|
UndoData multi_UndoData = new UndoData();
|
549
|
UndoDataGroup = new UndoDataGroup()
|
550
|
{
|
551
|
IsUndo = false,
|
552
|
Event = EventType.Create,
|
553
|
EventTime = DateTime.Now,
|
554
|
MarkupDataColl = new List<UndoData>()
|
555
|
};
|
556
|
ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
|
557
|
{
|
558
|
ViewerDataModel.Instance.UndoDataList.Remove(i);
|
559
|
});
|
560
|
|
561
|
foreach (string parse in data)
|
562
|
{
|
563
|
if (parse != "")
|
564
|
{
|
565
|
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,
|
566
|
STAMP_Contents: App.SystemInfo.STAMP_CONTENTS);
|
567
|
(item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
|
568
|
(item as MarkupToPDF.Common.CommentUserInfo).SymbolID = id;
|
569
|
//(item as MarkupToPDF.Common.CommentUserInfo).GroupID = group_id;
|
570
|
|
571
|
ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
|
572
|
ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
|
573
|
|
574
|
adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
|
575
|
|
576
|
multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
|
577
|
|
578
|
UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
|
579
|
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
|
580
|
}
|
581
|
}
|
582
|
|
583
|
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
|
584
|
|
585
|
// 마우스 클릭된 페이지 위치
|
586
|
|
587
|
var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
|
588
|
var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
|
589
|
var angle = Common.ViewerDataModel.Instance.MarkupAngle;
|
590
|
|
591
|
Point pagePoint = new Point(pageWidth/2, pageHeight/2);
|
592
|
|
593
|
var rotatePoint = Rotate(mainMenu.CanvasDrawingMouseDownPoint,pagePoint,angle);
|
594
|
|
595
|
var diff = Point.Subtract(rotatePoint, final.Centeroid);
|
596
|
final.TranslateItems(diff.X, diff.Y);
|
597
|
|
598
|
mainMenu.SelectLayer.Children.Add(final);
|
599
|
//var finalPosition = new Point(Canvas.GetLeft(final), Canvas.GetTop(final));
|
600
|
//Rect rect = new Rect(finalPosition, Point.Add(finalPosition,new Vector(final.Width,final.Height)));
|
601
|
|
602
|
//SelectionSet.Instance.SelectItemByRect(final.getAdornerSize(), mainMenu);
|
603
|
|
604
|
}
|
605
|
else
|
606
|
{
|
607
|
PlaceImageSymbol(id, 0);
|
608
|
}
|
609
|
}
|
610
|
catch (Exception ex)
|
611
|
{
|
612
|
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
|
613
|
}
|
614
|
}
|
615
|
|
616
|
|
617
|
//출처: https://icodebroker.tistory.com/3189 [ICODEBROKER]
|
618
|
public Point Rotate(Point sourcePoint, Point centerPoint, double rotateAngle)
|
619
|
{
|
620
|
Point targetPoint = new Point();
|
621
|
|
622
|
double radian = rotateAngle / 180 * Math.PI;
|
623
|
|
624
|
targetPoint.X = Math.Cos(radian) * (sourcePoint.X - centerPoint.X) - Math.Sin(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.X;
|
625
|
targetPoint.Y = Math.Sin(radian) * (sourcePoint.X - centerPoint.X) + Math.Cos(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.Y;
|
626
|
|
627
|
return targetPoint;
|
628
|
}
|
629
|
|
630
|
|
631
|
|
632
|
private void PlaceImageSymbol(string id, long group_id)
|
633
|
{
|
634
|
|
635
|
//canvasZoommovingMouseDownPoint
|
636
|
string Data_ = "";
|
637
|
|
638
|
try
|
639
|
{
|
640
|
//Logger.sendReqLog("GetSymbolImageURL: ", id + "," + RadTab.SelectedIndex, 1);
|
641
|
Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, RadTab.SelectedIndex);
|
642
|
if (Data_ != null || Data_ != "")
|
643
|
{
|
644
|
//Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
|
645
|
}
|
646
|
else
|
647
|
{
|
648
|
//Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
|
649
|
}
|
650
|
|
651
|
//MARKUP_DATA_GROUP INSERT
|
652
|
//MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
|
653
|
//{
|
654
|
// SYMBOL_ID = id,//InnerItem.Symbol_ID
|
655
|
// STATE = 0,
|
656
|
//};
|
657
|
//long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
|
658
|
////Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
|
659
|
|
660
|
if (Data_ != null)
|
661
|
{
|
662
|
Image img = new Image();
|
663
|
//img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
|
664
|
if (Data_.Contains(".svg"))
|
665
|
{
|
666
|
SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(Data_);
|
667
|
img.Source = (DrawingImage)svgImage.ProvideValue(null);
|
668
|
}
|
669
|
else
|
670
|
{
|
671
|
img.Source = new BitmapImage(new Uri(Data_));
|
672
|
}
|
673
|
|
674
|
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
|
675
|
{
|
676
|
PointSet = new List<Point>(),
|
677
|
FilePath = Data_,
|
678
|
ImageData = img.Source,
|
679
|
StartPoint = new Point(0, 0),
|
680
|
EndPoint = new Point(img.Source.Width, img.Source.Height),
|
681
|
TopRightPoint = new Point(img.Source.Width, 0),
|
682
|
LeftBottomPoint = new Point(0, img.Source.Height)
|
683
|
};
|
684
|
|
685
|
currentControl.PointSet = new List<Point>
|
686
|
{
|
687
|
currentControl.StartPoint,
|
688
|
currentControl.LeftBottomPoint,
|
689
|
currentControl.EndPoint,
|
690
|
currentControl.TopRightPoint,
|
691
|
};
|
692
|
UndoData multi_UndoData = new UndoData();
|
693
|
UndoDataGroup = new UndoDataGroup()
|
694
|
{
|
695
|
IsUndo = false,
|
696
|
Event = EventType.Create,
|
697
|
EventTime = DateTime.Now,
|
698
|
MarkupDataColl = new List<UndoData>()
|
699
|
};
|
700
|
ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
|
701
|
{
|
702
|
ViewerDataModel.Instance.UndoDataList.Remove(i);
|
703
|
});
|
704
|
|
705
|
//multi_UndoData = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
706
|
multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
707
|
UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
|
708
|
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
|
709
|
|
710
|
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
711
|
currentControl.CommentID = Commons.shortGuid();
|
712
|
currentControl.SymbolID = id;
|
713
|
currentControl.GroupID = group_id;
|
714
|
currentControl.ApplyTemplate();
|
715
|
currentControl.SetImage();
|
716
|
|
717
|
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
718
|
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
719
|
this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
|
720
|
|
721
|
/*
|
722
|
// this.ParentOfType<MainWindow>().dzMainMenu.isLeftMouseButtonDownOnWindow = true;
|
723
|
// final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
|
724
|
double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
|
725
|
double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
|
726
|
final.TranslateItems(realPointX, realPointY);
|
727
|
// move.control_Select(item, dragRect);
|
728
|
ApplyDragSelectionRect();
|
729
|
//this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = MouseHandlingMode.DragSymbol;
|
730
|
///this.ParentOfType<MainWindow>().dzMainMenu.mouseButtonDown = MouseButton.Left;
|
731
|
//this.ParentOfType<MainWindow>().dzMainMenu.symboldata(id, group_id, RadTab.SelectedIndex, Data_, img.Source);*/
|
732
|
|
733
|
}
|
734
|
}
|
735
|
catch(Exception ex)
|
736
|
{
|
737
|
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
|
738
|
}
|
739
|
}
|
740
|
|
741
|
public UndoData multi_UndoData;
|
742
|
private void ApplyDragSelectionRect()
|
743
|
{
|
744
|
multi_UndoData = new UndoData();
|
745
|
|
746
|
UndoDataGroup = new UndoDataGroup()
|
747
|
{
|
748
|
IsUndo = false,
|
749
|
Event = EventType.Operation,
|
750
|
EventTime = DateTime.Now,
|
751
|
MarkupDataColl = new List<UndoData>()
|
752
|
};
|
753
|
|
754
|
this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Visibility = Visibility.Collapsed;
|
755
|
|
756
|
double x = Canvas.GetLeft(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder);
|
757
|
double y = Canvas.GetTop(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder);
|
758
|
double width = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Width;
|
759
|
double height = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Height;
|
760
|
Rect dragRect = new Rect(x, y, width, height);
|
761
|
Boolean Flag = false;
|
762
|
dragRect.Inflate(width / 10, height / 10);
|
763
|
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
|
764
|
var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
|
765
|
|
766
|
dragRect = new Rect(x, y, width, height);
|
767
|
dragRect.Inflate(width / 10, height / 10);
|
768
|
|
769
|
//move.mousemode = MarkupToPDF.Controls.Common.MouseMode.Selecting;
|
770
|
//move.
|
771
|
foreach (var item in Items)
|
772
|
{
|
773
|
Flag = SelectionSet.Instance.SelectControl(item, dragRect);
|
774
|
|
775
|
if (Flag)
|
776
|
{
|
777
|
adornerSet.Add(item);
|
778
|
ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
|
779
|
|
780
|
this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item);
|
781
|
UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
|
782
|
multi_UndoData = new UndoData();
|
783
|
if (item.GroupID > 0)
|
784
|
{
|
785
|
|
786
|
}
|
787
|
}
|
788
|
}
|
789
|
if (adornerSet.Count > 0)
|
790
|
{
|
791
|
ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
|
792
|
{
|
793
|
ViewerDataModel.Instance.UndoDataList.Remove(i);
|
794
|
});
|
795
|
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
|
796
|
|
797
|
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
|
798
|
this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
|
799
|
}
|
800
|
}
|
801
|
|
802
|
///private Move move;
|
803
|
#region Symbol DoubleClick Event
|
804
|
private void Move_Symbol(object sender, MouseButtonEventArgs e)
|
805
|
{
|
806
|
try
|
807
|
{
|
808
|
Type type = e.OriginalSource.GetType();
|
809
|
string id = string.Empty;
|
810
|
//Logger.sendResLog("Move_Symbol", type.Name, 0);
|
811
|
if (type.Name == "Image")
|
812
|
{
|
813
|
id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID;
|
814
|
}
|
815
|
else if (type.Name == "Border")
|
816
|
{
|
817
|
id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID;
|
818
|
}
|
819
|
else if (type.Name == "TextBox")
|
820
|
{
|
821
|
id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID;
|
822
|
}
|
823
|
|
824
|
IsMouseDown = true;
|
825
|
|
826
|
if (e.ClickCount > 1)
|
827
|
{
|
828
|
this.PlaceSymbol(id,ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint);
|
829
|
}
|
830
|
}
|
831
|
catch(Exception ex)
|
832
|
{
|
833
|
//Logger.sendResLog("Move_Symbol", ex.Message, 0);
|
834
|
}
|
835
|
}
|
836
|
#endregion
|
837
|
|
838
|
#region Private Symbol Rename Event
|
839
|
private void Rename_Symbol(object sender, RoutedEventArgs e)
|
840
|
{
|
841
|
if (lstSymbolPrivate.SelectedItem == null)
|
842
|
{
|
843
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
844
|
return;
|
845
|
}
|
846
|
|
847
|
DialogParameters parameters = new DialogParameters()
|
848
|
{
|
849
|
Owner = Application.Current.MainWindow,
|
850
|
Closed = (obj, args) => this.MarkupReNamePromptClose("", args),
|
851
|
//DefaultPromptResultValue = "Custom State",
|
852
|
DefaultPromptResultValue = (lstSymbolPrivate.SelectedItem as Symbol_Custom).Name,
|
853
|
Content = "Name :",
|
854
|
Header = "Update Custom Symbol Name",
|
855
|
Theme = new VisualStudio2013Theme(),
|
856
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
857
|
};
|
858
|
RadWindow.Prompt(parameters);
|
859
|
|
860
|
}
|
861
|
#endregion
|
862
|
|
863
|
#region Public Symbol Rename Event
|
864
|
private void Rename_Symbol_Public(object sender, RoutedEventArgs e)
|
865
|
{
|
866
|
if (lstSymbolPublic.SelectedItem == null)
|
867
|
{
|
868
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
869
|
return;
|
870
|
}
|
871
|
|
872
|
DialogParameters parameters = new DialogParameters()
|
873
|
{
|
874
|
Owner = Application.Current.MainWindow,
|
875
|
Closed = (obj, args) => this.MarkupReNamePromptClose("", args),
|
876
|
//DefaultPromptResultValue = "Custom State",
|
877
|
DefaultPromptResultValue = (lstSymbolPublic.SelectedItem as Symbol_Custom).Name,
|
878
|
Content = "Name :",
|
879
|
Header = "Update Custom Symbol Name",
|
880
|
Theme = new VisualStudio2013Theme(),
|
881
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
882
|
};
|
883
|
RadWindow.Prompt(parameters);
|
884
|
|
885
|
}
|
886
|
#endregion
|
887
|
#region Symbol Rename Close Event
|
888
|
private void MarkupReNamePromptClose(string data, WindowClosedEventArgs args)
|
889
|
{
|
890
|
if (args.DialogResult != null && args.DialogResult.Value)
|
891
|
{
|
892
|
if(RadTab.SelectedIndex == 0)
|
893
|
{
|
894
|
string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
|
895
|
string _name = args.PromptResult;
|
896
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
|
897
|
//Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1);
|
898
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex);
|
899
|
}
|
900
|
else
|
901
|
{
|
902
|
string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
|
903
|
string _name = args.PromptResult;
|
904
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
|
905
|
//Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1);
|
906
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex);
|
907
|
}
|
908
|
}
|
909
|
}
|
910
|
|
911
|
private async void BaseClient_RenameSymbolCompleted(object sender, ServiceDeepView.RenameSymbolCompletedEventArgs e)
|
912
|
{
|
913
|
//Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
|
914
|
await DataBindAsync();
|
915
|
}
|
916
|
#endregion
|
917
|
|
918
|
#region Wheel Event
|
919
|
private void lstSymbolPrivate_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
920
|
{
|
921
|
ScView.ScrollToVerticalOffset(ScView.ContentVerticalOffset - (e.Delta / 2));
|
922
|
}
|
923
|
private void lstSymbolPublic_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
924
|
{
|
925
|
ScView_Public.ScrollToVerticalOffset(ScView_Public.ContentVerticalOffset - (e.Delta / 2));
|
926
|
}
|
927
|
#endregion
|
928
|
|
929
|
#region Tab Selection Event
|
930
|
private void RadTabControl_PreviewSelectionChanged(object sender, RadSelectionChangedEventArgs e)
|
931
|
{
|
932
|
foreach (var item in (e.OriginalSource as RadTabControl).Items)
|
933
|
{
|
934
|
(item as RadTabItem).FontWeight = FontWeights.Normal;
|
935
|
}
|
936
|
((e.OriginalSource as RadTabControl).SelectedItem as RadTabItem).FontWeight = FontWeights.Bold;
|
937
|
}
|
938
|
#endregion
|
939
|
|
940
|
#region Department Selection Event
|
941
|
private async void deptlist_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
942
|
{
|
943
|
await DataBindAsync();
|
944
|
}
|
945
|
#endregion
|
946
|
|
947
|
#endregion
|
948
|
|
949
|
private void lstSymbolPrivate_PreviewMouseUp(object sender, MouseButtonEventArgs e)
|
950
|
{
|
951
|
|
952
|
}
|
953
|
|
954
|
private void lstSymbolPrivate_MouseLeave(object sender, MouseEventArgs e)
|
955
|
{
|
956
|
|
957
|
}
|
958
|
|
959
|
private void lstSymbolPrivate_MouseDown(object sender, MouseButtonEventArgs e)
|
960
|
{
|
961
|
|
962
|
}
|
963
|
|
964
|
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
965
|
{
|
966
|
if(IsMouseDown && e.LeftButton == MouseButtonState.Pressed)
|
967
|
{
|
968
|
ViewerDataModel.Instance.SystemMain.dzMainMenu.Symbol_ID = moveItem_id;
|
969
|
}
|
970
|
else
|
971
|
{
|
972
|
IsMouseDown = false;
|
973
|
}
|
974
|
}
|
975
|
|
976
|
private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e)
|
977
|
{
|
978
|
IsMouseDown = false;
|
979
|
}
|
980
|
|
981
|
/// <summary>
|
982
|
/// place symbol which user select
|
983
|
/// </summary>
|
984
|
/// <author>humkyung</author>
|
985
|
/// <date>2018.06.14</date>
|
986
|
/// <param name="sender"></param>
|
987
|
/// <param name="e"></param>
|
988
|
private void Place_Symbol(object sender, RoutedEventArgs e)
|
989
|
{
|
990
|
if (lstSymbolPrivate.SelectedItem == null)
|
991
|
{
|
992
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
993
|
return;
|
994
|
}
|
995
|
|
996
|
string id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
|
997
|
this.PlaceSymbol(id, ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint);
|
998
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
|
999
|
}
|
1000
|
|
1001
|
private void Place_Symbol_Public(object sender, RoutedEventArgs e)
|
1002
|
{
|
1003
|
if (lstSymbolPublic.SelectedItem == null)
|
1004
|
{
|
1005
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
1006
|
return;
|
1007
|
}
|
1008
|
|
1009
|
string id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
|
1010
|
this.PlaceSymbol(id, ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint);
|
1011
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
|
1012
|
}
|
1013
|
|
1014
|
private void Image_Place_Register(object sender, RoutedEventArgs e)
|
1015
|
{
|
1016
|
SyncInit();
|
1017
|
ViewerDataModel.Instance.SystemMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
|
1018
|
//캡쳐 하기 전에 코멘트 저장
|
1019
|
if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
|
1020
|
{
|
1021
|
var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
|
1022
|
SelectionSet.Instance.UnSelect(menu);
|
1023
|
if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
|
1024
|
{
|
1025
|
(Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
|
1026
|
}
|
1027
|
else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
|
1028
|
{
|
1029
|
|
1030
|
}
|
1031
|
else
|
1032
|
{
|
1033
|
(Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
|
1034
|
}
|
1035
|
}
|
1036
|
Application.Current.MainWindow.Focus();
|
1037
|
Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
|
1038
|
(Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
|
1039
|
}
|
1040
|
|
1041
|
|
1042
|
private void SyncInit()
|
1043
|
{
|
1044
|
try
|
1045
|
{
|
1046
|
if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
|
1047
|
{
|
1048
|
ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
|
1049
|
ViewerDataModel.Instance.PageBalanceMode = false;
|
1050
|
ViewerDataModel.Instance.PageBalanceNumber = 0;
|
1051
|
ViewerDataModel.Instance.SyncPageNumber = 0;
|
1052
|
ViewerDataModel.Instance.MarkupControls_Sync.Clear();
|
1053
|
ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
|
1054
|
ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
|
1055
|
ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
|
1056
|
}
|
1057
|
}
|
1058
|
catch (Exception ex)
|
1059
|
{
|
1060
|
//Logger.sendResLog("SyncInit", ex.Message, 0);
|
1061
|
}
|
1062
|
}
|
1063
|
|
1064
|
private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
1065
|
{
|
1066
|
var block = sender as TextBox;
|
1067
|
block.Focusable = true;
|
1068
|
|
1069
|
}
|
1070
|
|
1071
|
private void TextBlock_MouseEnter(object sender, MouseEventArgs e)
|
1072
|
{
|
1073
|
var block = sender as TextBox;
|
1074
|
if (block != null)
|
1075
|
{
|
1076
|
//block.Text = "Enter";
|
1077
|
|
1078
|
}
|
1079
|
}
|
1080
|
|
1081
|
private void OnKeyDownHandler(object sender, KeyEventArgs e)
|
1082
|
{
|
1083
|
if (e.Key == Key.Return)
|
1084
|
{
|
1085
|
Type type = e.OriginalSource.GetType();
|
1086
|
string id = string.Empty;
|
1087
|
//Logger.sendResLog("Move_Symbol", type.Name, 0);
|
1088
|
if (type.Name == "Image")
|
1089
|
{
|
1090
|
id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID;
|
1091
|
}
|
1092
|
else if (type.Name == "Border")
|
1093
|
{
|
1094
|
id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID;
|
1095
|
}
|
1096
|
else if (type.Name == "TextBox")
|
1097
|
{
|
1098
|
id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID;
|
1099
|
}
|
1100
|
|
1101
|
//((System.Windows.Controls.TextBox)sender).Text;
|
1102
|
|
1103
|
if (RadTab.SelectedIndex == 0)
|
1104
|
{
|
1105
|
//string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
|
1106
|
string _name = ((System.Windows.Controls.TextBox)sender).Text;
|
1107
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
|
1108
|
//Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1);
|
1109
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex);
|
1110
|
}
|
1111
|
else
|
1112
|
{
|
1113
|
//string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
|
1114
|
string _name = ((System.Windows.Controls.TextBox)sender).Text;
|
1115
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
|
1116
|
//Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1);
|
1117
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex);
|
1118
|
}
|
1119
|
|
1120
|
}
|
1121
|
}
|
1122
|
|
1123
|
}
|
1124
|
}
|