1
|
using KCOM.Common;
|
2
|
using KCOM.Events;
|
3
|
using KCOMDataModel.Common;
|
4
|
using KCOMDataModel.DataModel;
|
5
|
using MarkupToPDF.Common;
|
6
|
using System;
|
7
|
using System.Collections.Generic;
|
8
|
using System.Linq;
|
9
|
using System.Text;
|
10
|
using System.Windows;
|
11
|
using System.Windows.Controls;
|
12
|
using System.Windows.Data;
|
13
|
using System.Windows.Documents;
|
14
|
using System.Windows.Input;
|
15
|
using System.Windows.Media;
|
16
|
using System.Windows.Media.Imaging;
|
17
|
using System.Windows.Navigation;
|
18
|
using System.Windows.Shapes;
|
19
|
using Telerik.Windows.Controls;
|
20
|
using Telerik.Windows.Controls.DragDrop;
|
21
|
|
22
|
namespace KCOM.Controls
|
23
|
{
|
24
|
public class Symbol_Custom
|
25
|
{
|
26
|
public string ID { get; set; }
|
27
|
public string Name { get; set; }
|
28
|
public string ImageUri { get; set; }
|
29
|
}
|
30
|
|
31
|
/// <summary>
|
32
|
/// Symbol.xaml에 대한 상호 작용 논리
|
33
|
/// </summary>
|
34
|
public partial class Symbol : UserControl
|
35
|
{
|
36
|
AdornerFinal finalItem;
|
37
|
bool IsMouseDown = false;
|
38
|
string moveItem_id = "";
|
39
|
public string filename { get; set; }
|
40
|
MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
|
41
|
|
42
|
public Symbol()
|
43
|
{
|
44
|
InitializeComponent();
|
45
|
|
46
|
RadDragAndDropManager.AddDragInfoHandler(lstSymbolPrivate, OnDragPrivateInfo);
|
47
|
RadDragAndDropManager.AddDragQueryHandler(lstSymbolPrivate, OnDragPrivateQuery);
|
48
|
RadDragAndDropManager.SetAllowDrag(lstSymbolPrivate, true);
|
49
|
|
50
|
DataBind();
|
51
|
}
|
52
|
|
53
|
private void OnDragPrivateInfo(object sender, DragDropEventArgs e)
|
54
|
{
|
55
|
}
|
56
|
|
57
|
private void OnDragPrivateQuery(object sender, DragDropQueryEventArgs e)
|
58
|
{
|
59
|
if (e.Options.Status == DragStatus.DragQuery)
|
60
|
{
|
61
|
//var draggedListBoxItem = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem;
|
62
|
//BitmapImage im = new BitmapImage(new Uri((draggedListBoxItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate).ImageUri));
|
63
|
//ImageSource _source = im;
|
64
|
//Image img = new Image();
|
65
|
//img.Source = _source;
|
66
|
|
67
|
//e.Options.Payload = im;
|
68
|
//var dragCue = new Image();
|
69
|
//dragCue.Source = img.Source;
|
70
|
//dragCue.Width = 0;
|
71
|
//dragCue.Height = 0;
|
72
|
//e.Options.DragCue = dragCue;
|
73
|
|
74
|
|
75
|
//PayLoadAdorner = new AdornerFinal();
|
76
|
//DeepView.ServiceDeepView_Symbol.SymbolPrivate tempDragableControl = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate;
|
77
|
//var xamldata = tempDragableControl.Data;
|
78
|
////this.DeepLayer.markupParse(xamldata, this.DeepLayer._TempLayer, "복사된 데이터_이름으로 수정해야함");
|
79
|
//PayLoadAdorner = this.DeepLayer.markupParseToAdorner(xamldata, this.DeepLayer._SelectLayer, "");
|
80
|
//this.DeepLayer._SelectLayer.Children.Add(PayLoadAdorner);
|
81
|
}
|
82
|
|
83
|
e.QueryResult = true;
|
84
|
e.Handled = true;
|
85
|
}
|
86
|
|
87
|
private void DataBind()
|
88
|
{
|
89
|
//lstSymbolPrivate.ItemsSource = null;
|
90
|
//lstSymbolPublic.ItemsSource = null;
|
91
|
|
92
|
Symbol_Custom Custom = new Symbol_Custom();
|
93
|
List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
|
94
|
ServiceDeepView.ServiceDeepViewClient client = new ServiceDeepView.ServiceDeepViewClient(App._binding, App._EndPoint);
|
95
|
var symbol_Private = client.GetSymbolList(App.ViewInfo.UserID);
|
96
|
foreach (var item in symbol_Private)
|
97
|
{
|
98
|
Custom.Name = item.NAME;
|
99
|
Custom.ImageUri = item.IMAGE_URL;
|
100
|
Custom.ID = item.ID;
|
101
|
Custom_List.Add(Custom);
|
102
|
Custom = new Symbol_Custom();
|
103
|
}
|
104
|
lstSymbolPrivate.ItemsSource = Custom_List;
|
105
|
|
106
|
Custom = new Symbol_Custom();
|
107
|
Custom_List = new List<Symbol_Custom>();
|
108
|
|
109
|
deptlist.ItemsSource = client.GetPublicSymbolDeptList();
|
110
|
|
111
|
List<SYMBOL_PUBLIC> symbol_Public;
|
112
|
|
113
|
|
114
|
if (deptlist.SelectedValue != null)
|
115
|
{
|
116
|
symbol_Public = client.GetPublicSymbolList(deptlist.SelectedValue.ToString());
|
117
|
}
|
118
|
else
|
119
|
{
|
120
|
symbol_Public = client.GetPublicSymbolList(null);
|
121
|
}
|
122
|
foreach (var item in symbol_Public)
|
123
|
{
|
124
|
Custom.Name = item.NAME;
|
125
|
Custom.ImageUri = item.IMAGE_URL;
|
126
|
Custom.ID = item.ID;
|
127
|
Custom_List.Add(Custom);
|
128
|
Custom = new Symbol_Custom();
|
129
|
}
|
130
|
lstSymbolPublic.ItemsSource = Custom_List;
|
131
|
client.Close();
|
132
|
}
|
133
|
|
134
|
public PngBitmapEncoder symImage(string data)
|
135
|
{
|
136
|
|
137
|
Canvas _canvas = new Canvas();
|
138
|
_canvas.Background = Brushes.White;
|
139
|
_canvas.Width = finalItem.BorderSize.Width;
|
140
|
_canvas.Height = finalItem.BorderSize.Height;
|
141
|
layer.markupParse(data, _canvas, "#FFFF0000", "");
|
142
|
|
143
|
BitmapEncoder encoder = new PngBitmapEncoder();
|
144
|
|
145
|
|
146
|
RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32);
|
147
|
|
148
|
DrawingVisual dv = new DrawingVisual();
|
149
|
|
150
|
_canvas.Measure(new System.Windows.Size(finalItem.BorderSize.Width + 50, finalItem.BorderSize.Height + 50));
|
151
|
//_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)));
|
152
|
_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)));
|
153
|
|
154
|
using (DrawingContext ctx = dv.RenderOpen())
|
155
|
{
|
156
|
VisualBrush vb = new VisualBrush(_canvas);
|
157
|
//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)));
|
158
|
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)));
|
159
|
}
|
160
|
|
161
|
try
|
162
|
{
|
163
|
renderBitmap.Render(dv);
|
164
|
|
165
|
GC.Collect();
|
166
|
GC.WaitForPendingFinalizers();
|
167
|
GC.Collect();
|
168
|
//bitmap.Render(controlToConvert);
|
169
|
// encode png data
|
170
|
PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
|
171
|
// puch rendered bitmap into it
|
172
|
pngEncoder.Interlace = PngInterlaceOption.Off;
|
173
|
pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
|
174
|
return pngEncoder;
|
175
|
|
176
|
}
|
177
|
catch (Exception ex)
|
178
|
{
|
179
|
return null;
|
180
|
}
|
181
|
|
182
|
}
|
183
|
|
184
|
public void DialogMessage_Alert(string content, string header)
|
185
|
{
|
186
|
var box = new TextBlock();
|
187
|
box.MinWidth = 400;
|
188
|
box.FontSize = 11;
|
189
|
//box.FontSize = 12;
|
190
|
box.Text = content;
|
191
|
box.TextWrapping = System.Windows.TextWrapping.Wrap;
|
192
|
|
193
|
DialogParameters parameters = new DialogParameters()
|
194
|
{
|
195
|
Owner = Application.Current.MainWindow,
|
196
|
Content = box,
|
197
|
Header = header,
|
198
|
Theme = new VisualStudio2013Theme(),
|
199
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
200
|
};
|
201
|
RadWindow.Alert(parameters);
|
202
|
}
|
203
|
|
204
|
#region Event
|
205
|
|
206
|
#region Private Symbol Add Event
|
207
|
private void Create_Symbol(object sender, RoutedEventArgs e)
|
208
|
{
|
209
|
MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
|
210
|
|
211
|
if (Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
|
212
|
{
|
213
|
DialogMessage_Alert("Please Select Controls", "Alert");
|
214
|
}
|
215
|
else //선택된 것이 있으면
|
216
|
{
|
217
|
string MarkupData = "";
|
218
|
finalItem = new AdornerFinal();
|
219
|
|
220
|
foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children)
|
221
|
{
|
222
|
if (item.GetType().Name == "AdornerFinal")
|
223
|
{
|
224
|
finalItem = (item as Controls.AdornerFinal);
|
225
|
foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
|
226
|
{
|
227
|
if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
|
228
|
{
|
229
|
markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
|
230
|
MarkupData += markupReturn.ConvertData;
|
231
|
}
|
232
|
}
|
233
|
}
|
234
|
}
|
235
|
DialogParameters parameters = new DialogParameters()
|
236
|
{
|
237
|
Owner = Application.Current.MainWindow,
|
238
|
Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
|
239
|
DefaultPromptResultValue = "Custom State",
|
240
|
Content = "Name :",
|
241
|
Header = "Insert Custom Symbol Name",
|
242
|
Theme = new VisualStudio2013Theme(),
|
243
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
244
|
};
|
245
|
RadWindow.Prompt(parameters);
|
246
|
}
|
247
|
|
248
|
}
|
249
|
#endregion
|
250
|
|
251
|
#region Symbol Add Close Event
|
252
|
private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
|
253
|
{
|
254
|
Save save = new Save();
|
255
|
|
256
|
if (args.DialogResult.Value)
|
257
|
{
|
258
|
PngBitmapEncoder _Encoder = symImage(data);
|
259
|
|
260
|
System.IO.MemoryStream fs = new System.IO.MemoryStream();
|
261
|
_Encoder.Save(fs);
|
262
|
System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
|
263
|
|
264
|
byte[] Img_byte = fs.ToArray();
|
265
|
|
266
|
kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
|
267
|
filename = fileUploader.Run(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
|
268
|
|
269
|
if(RadTab.SelectedIndex == 0)
|
270
|
{
|
271
|
save.SymbolSave(args.PromptResult, filename, data);
|
272
|
}
|
273
|
else
|
274
|
{
|
275
|
save.SymbolSave_Public(args.PromptResult, filename, data, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
|
276
|
}
|
277
|
|
278
|
DataBind();
|
279
|
}
|
280
|
}
|
281
|
#endregion
|
282
|
|
283
|
#region Private Symbol Delete Event
|
284
|
private void Remove_Symbol(object sender, RoutedEventArgs e)
|
285
|
{
|
286
|
if (lstSymbolPrivate.SelectedItem == null)
|
287
|
{
|
288
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
289
|
return;
|
290
|
}
|
291
|
string delItem_ID = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
|
292
|
|
293
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted;
|
294
|
Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1);
|
295
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex);
|
296
|
}
|
297
|
#endregion
|
298
|
#region Public Symbol Delete Event
|
299
|
private void Remove_Symbol_Public(object sender, RoutedEventArgs e)
|
300
|
{
|
301
|
if (lstSymbolPublic.SelectedItem == null)
|
302
|
{
|
303
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
304
|
return;
|
305
|
}
|
306
|
string delItem_ID = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
|
307
|
|
308
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted;
|
309
|
Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1);
|
310
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex);
|
311
|
}
|
312
|
|
313
|
private void BaseClient_DeleteSymbolCompleted(object sender, ServiceDeepView.DeleteSymbolCompletedEventArgs e)
|
314
|
{
|
315
|
Logger.sendResLog("DeleteSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
|
316
|
DataBind();
|
317
|
}
|
318
|
#endregion
|
319
|
|
320
|
public Undo_data UndoData { get; set; }
|
321
|
/// <summary>
|
322
|
/// place symbol which has given id to original position which is created
|
323
|
/// </summary>
|
324
|
/// <date>2018.06.14</date>
|
325
|
/// <param name="id"></param>
|
326
|
private void PlaceSymbol(string id)
|
327
|
{
|
328
|
string Data_ = "";
|
329
|
|
330
|
try
|
331
|
{
|
332
|
Logger.sendReqLog("GetSymbolData: ", id + "," + RadTab.SelectedIndex, 1);
|
333
|
Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex);
|
334
|
if (Data_ != null || Data_ != "")
|
335
|
{
|
336
|
Logger.sendResLog("GetSymbolData", "TRUE", 1);
|
337
|
}
|
338
|
else
|
339
|
{
|
340
|
Logger.sendResLog("GetSymbolData", "FALSE", 1);
|
341
|
}
|
342
|
|
343
|
if (Data_.Contains("|DZ|"))
|
344
|
{
|
345
|
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
|
346
|
|
347
|
string[] delimiterChars = { "|DZ|" };
|
348
|
string[] data = Data_.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
|
349
|
|
350
|
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
|
351
|
UndoData = new Undo_data()
|
352
|
{
|
353
|
IsUndo = false,
|
354
|
Event = Event_Type.Create,
|
355
|
EventTime = DateTime.Now,
|
356
|
Markup_List = new List<Multi_Undo_data>()
|
357
|
};
|
358
|
ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
|
359
|
{
|
360
|
ViewerDataModel.Instance.UndoDataList.Remove(i);
|
361
|
});
|
362
|
|
363
|
foreach (string parse in data)
|
364
|
{
|
365
|
if (parse != "")
|
366
|
{
|
367
|
System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
|
368
|
(item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
|
369
|
(item as MarkupToPDF.Common.CommentUserInfo).SymbolID = id;
|
370
|
ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
|
371
|
ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
|
372
|
|
373
|
adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
|
374
|
|
375
|
multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
|
376
|
|
377
|
UndoData.Markup_List.Add(multi_Undo_Data);
|
378
|
ViewerDataModel.Instance.UndoDataList.Add(UndoData);
|
379
|
}
|
380
|
}
|
381
|
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
|
382
|
|
383
|
ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
|
384
|
}
|
385
|
}
|
386
|
catch(Exception ex)
|
387
|
{
|
388
|
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
|
389
|
}
|
390
|
}
|
391
|
|
392
|
#region Symbol DoubleClick Event
|
393
|
private void Move_Symbol(object sender, MouseButtonEventArgs e)
|
394
|
{
|
395
|
try
|
396
|
{
|
397
|
Type type = e.OriginalSource.GetType();
|
398
|
string id = string.Empty;
|
399
|
if (type.Name == "Image")
|
400
|
{
|
401
|
id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID;
|
402
|
}
|
403
|
else if (type.Name == "Border")
|
404
|
{
|
405
|
id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID;
|
406
|
}
|
407
|
|
408
|
IsMouseDown = true;
|
409
|
if (e.ClickCount > 1)
|
410
|
{
|
411
|
this.PlaceSymbol(id);
|
412
|
}
|
413
|
}
|
414
|
catch(Exception ex)
|
415
|
{
|
416
|
Logger.sendResLog("Move_Symbol", ex.Message, 0);
|
417
|
}
|
418
|
}
|
419
|
#endregion
|
420
|
|
421
|
#region Private Symbol Rename Event
|
422
|
private void Rename_Symbol(object sender, RoutedEventArgs e)
|
423
|
{
|
424
|
if (lstSymbolPrivate.SelectedItem == null)
|
425
|
{
|
426
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
427
|
return;
|
428
|
}
|
429
|
|
430
|
DialogParameters parameters = new DialogParameters()
|
431
|
{
|
432
|
Owner = Application.Current.MainWindow,
|
433
|
Closed = (obj, args) => this.MarkupReNamePromptClose("", args),
|
434
|
//DefaultPromptResultValue = "Custom State",
|
435
|
DefaultPromptResultValue = (lstSymbolPrivate.SelectedItem as Symbol_Custom).Name,
|
436
|
Content = "Name :",
|
437
|
Header = "Update Custom Symbol Name",
|
438
|
Theme = new VisualStudio2013Theme(),
|
439
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
440
|
};
|
441
|
RadWindow.Prompt(parameters);
|
442
|
|
443
|
}
|
444
|
#endregion
|
445
|
|
446
|
#region Public Symbol Rename Event
|
447
|
private void Rename_Symbol_Public(object sender, RoutedEventArgs e)
|
448
|
{
|
449
|
if (lstSymbolPublic.SelectedItem == null)
|
450
|
{
|
451
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
452
|
return;
|
453
|
}
|
454
|
|
455
|
DialogParameters parameters = new DialogParameters()
|
456
|
{
|
457
|
Owner = Application.Current.MainWindow,
|
458
|
Closed = (obj, args) => this.MarkupReNamePromptClose("", args),
|
459
|
//DefaultPromptResultValue = "Custom State",
|
460
|
DefaultPromptResultValue = (lstSymbolPublic.SelectedItem as Symbol_Custom).Name,
|
461
|
Content = "Name :",
|
462
|
Header = "Update Custom Symbol Name",
|
463
|
Theme = new VisualStudio2013Theme(),
|
464
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
465
|
};
|
466
|
RadWindow.Prompt(parameters);
|
467
|
|
468
|
}
|
469
|
#endregion
|
470
|
#region Symbol Rename Close Event
|
471
|
private void MarkupReNamePromptClose(string data, WindowClosedEventArgs args)
|
472
|
{
|
473
|
if (args.DialogResult != null && args.DialogResult.Value)
|
474
|
{
|
475
|
if(RadTab.SelectedIndex == 0)
|
476
|
{
|
477
|
string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
|
478
|
string _name = args.PromptResult;
|
479
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
|
480
|
Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1);
|
481
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex);
|
482
|
}
|
483
|
else
|
484
|
{
|
485
|
string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
|
486
|
string _name = args.PromptResult;
|
487
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
|
488
|
Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1);
|
489
|
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex);
|
490
|
}
|
491
|
}
|
492
|
}
|
493
|
|
494
|
private void BaseClient_RenameSymbolCompleted(object sender, ServiceDeepView.RenameSymbolCompletedEventArgs e)
|
495
|
{
|
496
|
Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
|
497
|
DataBind();
|
498
|
}
|
499
|
#endregion
|
500
|
|
501
|
#region Wheel Event
|
502
|
private void lstSymbolPrivate_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
503
|
{
|
504
|
ScView.ScrollToVerticalOffset(ScView.ContentVerticalOffset - (e.Delta / 2));
|
505
|
}
|
506
|
private void lstSymbolPublic_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
507
|
{
|
508
|
ScView_Public.ScrollToVerticalOffset(ScView_Public.ContentVerticalOffset - (e.Delta / 2));
|
509
|
}
|
510
|
#endregion
|
511
|
|
512
|
#region Tab Selection Event
|
513
|
private void RadTabControl_PreviewSelectionChanged(object sender, RadSelectionChangedEventArgs e)
|
514
|
{
|
515
|
foreach (var item in (e.OriginalSource as RadTabControl).Items)
|
516
|
{
|
517
|
(item as RadTabItem).FontWeight = FontWeights.Normal;
|
518
|
}
|
519
|
((e.OriginalSource as RadTabControl).SelectedItem as RadTabItem).FontWeight = FontWeights.Bold;
|
520
|
}
|
521
|
#endregion
|
522
|
|
523
|
#region Department Selection Event
|
524
|
private void deptlist_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
525
|
{
|
526
|
DataBind();
|
527
|
}
|
528
|
#endregion
|
529
|
|
530
|
#endregion
|
531
|
|
532
|
private void lstSymbolPrivate_PreviewMouseUp(object sender, MouseButtonEventArgs e)
|
533
|
{
|
534
|
|
535
|
}
|
536
|
|
537
|
private void lstSymbolPrivate_MouseLeave(object sender, MouseEventArgs e)
|
538
|
{
|
539
|
|
540
|
}
|
541
|
|
542
|
private void lstSymbolPrivate_MouseDown(object sender, MouseButtonEventArgs e)
|
543
|
{
|
544
|
|
545
|
}
|
546
|
|
547
|
private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
|
548
|
{
|
549
|
if(IsMouseDown && e.LeftButton == MouseButtonState.Pressed)
|
550
|
{
|
551
|
ViewerDataModel.Instance.SystemMain.dzMainMenu.Symbol_ID = moveItem_id;
|
552
|
}
|
553
|
else
|
554
|
{
|
555
|
IsMouseDown = false;
|
556
|
}
|
557
|
}
|
558
|
|
559
|
private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e)
|
560
|
{
|
561
|
IsMouseDown = false;
|
562
|
}
|
563
|
|
564
|
/// <summary>
|
565
|
/// place symbol which user select
|
566
|
/// </summary>
|
567
|
/// <author>humkyung</author>
|
568
|
/// <date>2018.06.14</date>
|
569
|
/// <param name="sender"></param>
|
570
|
/// <param name="e"></param>
|
571
|
private void Place_Symbol(object sender, RoutedEventArgs e)
|
572
|
{
|
573
|
if (lstSymbolPrivate.SelectedItem == null)
|
574
|
{
|
575
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
576
|
return;
|
577
|
}
|
578
|
|
579
|
string id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
|
580
|
this.PlaceSymbol(id);
|
581
|
}
|
582
|
|
583
|
private void Place_Symbol_Public(object sender, RoutedEventArgs e)
|
584
|
{
|
585
|
if (lstSymbolPublic.SelectedItem == null)
|
586
|
{
|
587
|
DialogMessage_Alert("Please Select Symbol", "Alert");
|
588
|
return;
|
589
|
}
|
590
|
|
591
|
string id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
|
592
|
this.PlaceSymbol(id);
|
593
|
}
|
594
|
}
|
595
|
}
|