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