markus / KCOM / Controls / Symbol.xaml.cs @ be31927d
이력 | 보기 | 이력해설 | 다운로드 (24.2 KB)
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 |
Logger.sendResLog("Move_Symbol", type.Name, 0); |
400 |
if (type.Name == "Image") |
401 |
{ |
402 |
id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID; |
403 |
} |
404 |
else if (type.Name == "Border") |
405 |
{ |
406 |
id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID; |
407 |
} |
408 |
else if (type.Name == "TextBlock") |
409 |
{ |
410 |
id = ((e.OriginalSource as TextBlock).DataContext as Symbol_Custom).ID; |
411 |
} |
412 |
|
413 |
IsMouseDown = true; |
414 |
if (e.ClickCount > 1) |
415 |
{ |
416 |
this.PlaceSymbol(id); |
417 |
} |
418 |
} |
419 |
catch(Exception ex) |
420 |
{ |
421 |
Logger.sendResLog("Move_Symbol", ex.Message, 0); |
422 |
} |
423 |
} |
424 |
#endregion |
425 |
|
426 |
#region Private Symbol Rename Event |
427 |
private void Rename_Symbol(object sender, RoutedEventArgs e) |
428 |
{ |
429 |
if (lstSymbolPrivate.SelectedItem == null) |
430 |
{ |
431 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
432 |
return; |
433 |
} |
434 |
|
435 |
DialogParameters parameters = new DialogParameters() |
436 |
{ |
437 |
Owner = Application.Current.MainWindow, |
438 |
Closed = (obj, args) => this.MarkupReNamePromptClose("", args), |
439 |
//DefaultPromptResultValue = "Custom State", |
440 |
DefaultPromptResultValue = (lstSymbolPrivate.SelectedItem as Symbol_Custom).Name, |
441 |
Content = "Name :", |
442 |
Header = "Update Custom Symbol Name", |
443 |
Theme = new VisualStudio2013Theme(), |
444 |
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
445 |
}; |
446 |
RadWindow.Prompt(parameters); |
447 |
|
448 |
} |
449 |
#endregion |
450 |
|
451 |
#region Public Symbol Rename Event |
452 |
private void Rename_Symbol_Public(object sender, RoutedEventArgs e) |
453 |
{ |
454 |
if (lstSymbolPublic.SelectedItem == null) |
455 |
{ |
456 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
457 |
return; |
458 |
} |
459 |
|
460 |
DialogParameters parameters = new DialogParameters() |
461 |
{ |
462 |
Owner = Application.Current.MainWindow, |
463 |
Closed = (obj, args) => this.MarkupReNamePromptClose("", args), |
464 |
//DefaultPromptResultValue = "Custom State", |
465 |
DefaultPromptResultValue = (lstSymbolPublic.SelectedItem as Symbol_Custom).Name, |
466 |
Content = "Name :", |
467 |
Header = "Update Custom Symbol Name", |
468 |
Theme = new VisualStudio2013Theme(), |
469 |
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
470 |
}; |
471 |
RadWindow.Prompt(parameters); |
472 |
|
473 |
} |
474 |
#endregion |
475 |
#region Symbol Rename Close Event |
476 |
private void MarkupReNamePromptClose(string data, WindowClosedEventArgs args) |
477 |
{ |
478 |
if (args.DialogResult != null && args.DialogResult.Value) |
479 |
{ |
480 |
if(RadTab.SelectedIndex == 0) |
481 |
{ |
482 |
string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
483 |
string _name = args.PromptResult; |
484 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
485 |
Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
486 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex); |
487 |
} |
488 |
else |
489 |
{ |
490 |
string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
491 |
string _name = args.PromptResult; |
492 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
493 |
Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
494 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex); |
495 |
} |
496 |
} |
497 |
} |
498 |
|
499 |
private void BaseClient_RenameSymbolCompleted(object sender, ServiceDeepView.RenameSymbolCompletedEventArgs e) |
500 |
{ |
501 |
Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
502 |
DataBind(); |
503 |
} |
504 |
#endregion |
505 |
|
506 |
#region Wheel Event |
507 |
private void lstSymbolPrivate_PreviewMouseWheel(object sender, MouseWheelEventArgs e) |
508 |
{ |
509 |
ScView.ScrollToVerticalOffset(ScView.ContentVerticalOffset - (e.Delta / 2)); |
510 |
} |
511 |
private void lstSymbolPublic_PreviewMouseWheel(object sender, MouseWheelEventArgs e) |
512 |
{ |
513 |
ScView_Public.ScrollToVerticalOffset(ScView_Public.ContentVerticalOffset - (e.Delta / 2)); |
514 |
} |
515 |
#endregion |
516 |
|
517 |
#region Tab Selection Event |
518 |
private void RadTabControl_PreviewSelectionChanged(object sender, RadSelectionChangedEventArgs e) |
519 |
{ |
520 |
foreach (var item in (e.OriginalSource as RadTabControl).Items) |
521 |
{ |
522 |
(item as RadTabItem).FontWeight = FontWeights.Normal; |
523 |
} |
524 |
((e.OriginalSource as RadTabControl).SelectedItem as RadTabItem).FontWeight = FontWeights.Bold; |
525 |
} |
526 |
#endregion |
527 |
|
528 |
#region Department Selection Event |
529 |
private void deptlist_SelectionChanged(object sender, SelectionChangedEventArgs e) |
530 |
{ |
531 |
DataBind(); |
532 |
} |
533 |
#endregion |
534 |
|
535 |
#endregion |
536 |
|
537 |
private void lstSymbolPrivate_PreviewMouseUp(object sender, MouseButtonEventArgs e) |
538 |
{ |
539 |
|
540 |
} |
541 |
|
542 |
private void lstSymbolPrivate_MouseLeave(object sender, MouseEventArgs e) |
543 |
{ |
544 |
|
545 |
} |
546 |
|
547 |
private void lstSymbolPrivate_MouseDown(object sender, MouseButtonEventArgs e) |
548 |
{ |
549 |
|
550 |
} |
551 |
|
552 |
private void StackPanel_MouseLeave(object sender, MouseEventArgs e) |
553 |
{ |
554 |
if(IsMouseDown && e.LeftButton == MouseButtonState.Pressed) |
555 |
{ |
556 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.Symbol_ID = moveItem_id; |
557 |
} |
558 |
else |
559 |
{ |
560 |
IsMouseDown = false; |
561 |
} |
562 |
} |
563 |
|
564 |
private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e) |
565 |
{ |
566 |
IsMouseDown = false; |
567 |
} |
568 |
|
569 |
/// <summary> |
570 |
/// place symbol which user select |
571 |
/// </summary> |
572 |
/// <author>humkyung</author> |
573 |
/// <date>2018.06.14</date> |
574 |
/// <param name="sender"></param> |
575 |
/// <param name="e"></param> |
576 |
private void Place_Symbol(object sender, RoutedEventArgs e) |
577 |
{ |
578 |
if (lstSymbolPrivate.SelectedItem == null) |
579 |
{ |
580 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
581 |
return; |
582 |
} |
583 |
|
584 |
string id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
585 |
this.PlaceSymbol(id); |
586 |
} |
587 |
|
588 |
private void Place_Symbol_Public(object sender, RoutedEventArgs e) |
589 |
{ |
590 |
if (lstSymbolPublic.SelectedItem == null) |
591 |
{ |
592 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
593 |
return; |
594 |
} |
595 |
|
596 |
string id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
597 |
this.PlaceSymbol(id); |
598 |
} |
599 |
} |
600 |
} |