markus / KCOM / Controls / Symbol.xaml.cs @ 7fa95b67
이력 | 보기 | 이력해설 | 다운로드 (45.6 KB)
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 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
424 |
} |
425 |
catch (Exception) |
426 |
{ |
427 |
throw; |
428 |
} |
429 |
} |
430 |
|
431 |
public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
432 |
{ |
433 |
try |
434 |
{ |
435 |
SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
436 |
{ |
437 |
ID = Commons.ShortGuid(), |
438 |
DEPARTMENT = Department, |
439 |
NAME = Name, |
440 |
IMAGE_URL = Url, |
441 |
DATA = Data |
442 |
}; |
443 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
444 |
//Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
445 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
446 |
} |
447 |
catch (Exception) |
448 |
{ |
449 |
throw; |
450 |
} |
451 |
} |
452 |
|
453 |
private async void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e) |
454 |
{ |
455 |
await DataBindAsync(); |
456 |
} |
457 |
|
458 |
private async void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e) |
459 |
{ |
460 |
await DataBindAsync(); |
461 |
} |
462 |
|
463 |
#region Private Symbol Delete Event |
464 |
private void Remove_Symbol(object sender, RoutedEventArgs e) |
465 |
{ |
466 |
if (lstSymbolPrivate.SelectedItem == null) |
467 |
{ |
468 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
469 |
return; |
470 |
} |
471 |
string delItem_ID = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
472 |
|
473 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted; |
474 |
//Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1); |
475 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex); |
476 |
} |
477 |
#endregion |
478 |
#region Public Symbol Delete Event |
479 |
private void Remove_Symbol_Public(object sender, RoutedEventArgs e) |
480 |
{ |
481 |
if (lstSymbolPublic.SelectedItem == null) |
482 |
{ |
483 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
484 |
return; |
485 |
} |
486 |
string delItem_ID = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
487 |
|
488 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted; |
489 |
//Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1); |
490 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex); |
491 |
} |
492 |
|
493 |
private async void BaseClient_DeleteSymbolCompleted(object sender, ServiceDeepView.DeleteSymbolCompletedEventArgs e) |
494 |
{ |
495 |
//Logger.sendResLog("DeleteSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
496 |
await DataBindAsync(); |
497 |
} |
498 |
#endregion |
499 |
|
500 |
public UndoDataGroup UndoDataGroup { get; set; } |
501 |
|
502 |
/// <summary> |
503 |
/// place symbol which has given id to original position which is created |
504 |
/// </summary> |
505 |
/// <date>2018.06.14</date> |
506 |
/// <param name="id"></param> |
507 |
private async Task PlaceSymbol(string id, Point CurrentMousePoint) |
508 |
{ |
509 |
var systemMain = Common.ViewerDataModel.Instance.SystemMain; |
510 |
var mainMenu = systemMain.dzMainMenu; |
511 |
|
512 |
SelectionSet.Instance.UnSelect(mainMenu); /// unselect alreay selected items |
513 |
|
514 |
try |
515 |
{ |
516 |
string Data_ = mainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex); |
517 |
if (!string.IsNullOrEmpty(Data_) && Data_.Contains("|DZ|")) |
518 |
{ |
519 |
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
520 |
|
521 |
string[] delimiterChars = { "|DZ|" }; |
522 |
string[] data = Data_.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
523 |
|
524 |
UndoDataGroup = new UndoDataGroup() |
525 |
{ |
526 |
IsUndo = false, |
527 |
Event = EventType.Create, |
528 |
EventTime = DateTime.Now, |
529 |
MarkupDataColl = new List<UndoData>() |
530 |
}; |
531 |
ViewerDataModel.Instance.UndoDataList.Where(x => x.IsUndo).ToList().ForEach(i => |
532 |
{ |
533 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
534 |
}); |
535 |
|
536 |
foreach (string parse in data) |
537 |
{ |
538 |
if (!string.IsNullOrEmpty(parse)) |
539 |
{ |
540 |
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, |
541 |
STAMP_Contents: App.SystemInfo.STAMP_CONTENTS); |
542 |
(item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.ShortGuid(); |
543 |
(item as MarkupToPDF.Common.CommentUserInfo).SymbolID = id; |
544 |
|
545 |
adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
546 |
|
547 |
var multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
548 |
UndoDataGroup.MarkupDataColl.Add(multi_UndoData); |
549 |
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup); |
550 |
} |
551 |
} |
552 |
|
553 |
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
554 |
|
555 |
// 마우스 클릭된 페이지 위치 |
556 |
|
557 |
var pageWidth = ViewerDataModel.Instance.ImageViewWidth; |
558 |
var pageHeight = ViewerDataModel.Instance.ImageViewHeight; |
559 |
var angle = Common.ViewerDataModel.Instance.MarkupAngle; |
560 |
|
561 |
Point pagePoint = new Point(pageWidth/2, pageHeight/2); |
562 |
|
563 |
var rotatePoint = Rotate(mainMenu.CanvasDrawingMouseDownPoint,pagePoint,angle); |
564 |
|
565 |
var diff = Point.Subtract(rotatePoint, final.Centeroid); |
566 |
final.TranslateItems(diff.X, diff.Y); |
567 |
|
568 |
mainMenu.SelectLayer.Children.Add(final); |
569 |
|
570 |
//var finalPosition = new Point(Canvas.GetLeft(final), Canvas.GetTop(final)); |
571 |
//Rect rect = new Rect(finalPosition, Point.Add(finalPosition,new Vector(final.Width,final.Height))); |
572 |
|
573 |
//SelectionSet.Instance.SelectItemByRect(final.getAdornerSize(), mainMenu); |
574 |
|
575 |
} |
576 |
else |
577 |
{ |
578 |
await PlaceImageSymbol(id, 0); |
579 |
} |
580 |
} |
581 |
catch (Exception ex) |
582 |
{ |
583 |
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
584 |
} |
585 |
} |
586 |
|
587 |
|
588 |
//출처: https://icodebroker.tistory.com/3189 [ICODEBROKER] |
589 |
public Point Rotate(Point sourcePoint, Point centerPoint, double rotateAngle) |
590 |
{ |
591 |
Point targetPoint = new Point(); |
592 |
|
593 |
double radian = rotateAngle / 180 * Math.PI; |
594 |
|
595 |
targetPoint.X = Math.Cos(radian) * (sourcePoint.X - centerPoint.X) - Math.Sin(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.X; |
596 |
targetPoint.Y = Math.Sin(radian) * (sourcePoint.X - centerPoint.X) + Math.Cos(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.Y; |
597 |
|
598 |
return targetPoint; |
599 |
} |
600 |
|
601 |
/// <summary> |
602 |
/// 이미지 심볼을 배치한다. |
603 |
/// </summary> |
604 |
/// <param name="id"></param> |
605 |
/// <param name="group_id"></param> |
606 |
private async Task PlaceImageSymbol(string id, long group_id) |
607 |
{ |
608 |
try |
609 |
{ |
610 |
string FilePath = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, RadTab.SelectedIndex); |
611 |
if (!string.IsNullOrEmpty(FilePath)) |
612 |
{ |
613 |
bool exists = await Commons.DoesFileExist(FilePath); |
614 |
if (!exists) |
615 |
{ |
616 |
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert($"{FilePath} doesn't exist", "Warning"); |
617 |
return; |
618 |
} |
619 |
|
620 |
Image img = new Image(); |
621 |
if (FilePath.Contains(".svg")) |
622 |
{ |
623 |
SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(FilePath); |
624 |
img.Source = (DrawingImage)svgImage.ProvideValue(null); |
625 |
} |
626 |
else |
627 |
{ |
628 |
img.Source = new BitmapImage(new Uri(FilePath)); |
629 |
} |
630 |
|
631 |
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
632 |
{ |
633 |
PointSet = new List<Point>(), |
634 |
FilePath = FilePath, |
635 |
ImageData = img.Source, |
636 |
StartPoint = new Point(0, 0), |
637 |
EndPoint = new Point(img.Source.Width, img.Source.Height), |
638 |
TopRightPoint = new Point(img.Source.Width, 0), |
639 |
LeftBottomPoint = new Point(0, img.Source.Height) |
640 |
}; |
641 |
|
642 |
currentControl.PointSet = new List<Point> |
643 |
{ |
644 |
currentControl.StartPoint, |
645 |
currentControl.LeftBottomPoint, |
646 |
currentControl.EndPoint, |
647 |
currentControl.TopRightPoint, |
648 |
}; |
649 |
UndoDataGroup = new UndoDataGroup() |
650 |
{ |
651 |
IsUndo = false, |
652 |
Event = EventType.Create, |
653 |
EventTime = DateTime.Now, |
654 |
MarkupDataColl = new List<UndoData>() |
655 |
}; |
656 |
ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo).ToList().ForEach(i => |
657 |
{ |
658 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
659 |
}); |
660 |
|
661 |
var multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
662 |
UndoDataGroup.MarkupDataColl.Add(multi_UndoData); |
663 |
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup); |
664 |
|
665 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
666 |
currentControl.CommentID = Commons.ShortGuid(); |
667 |
currentControl.SymbolID = id; |
668 |
currentControl.GroupID = group_id; |
669 |
currentControl.ApplyTemplate(); |
670 |
currentControl.SetImage(); |
671 |
|
672 |
///ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
673 |
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
674 |
this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final); |
675 |
|
676 |
#region 마우스 위치에 배치 |
677 |
/* |
678 |
// this.ParentOfType<MainWindow>().dzMainMenu.isLeftMouseButtonDownOnWindow = true; |
679 |
// final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
680 |
double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
681 |
double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
682 |
final.TranslateItems(realPointX, realPointY); |
683 |
// move.control_Select(item, dragRect); |
684 |
ApplyDragSelectionRect(); |
685 |
//this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = MouseHandlingMode.DragSymbol; |
686 |
///this.ParentOfType<MainWindow>().dzMainMenu.mouseButtonDown = MouseButton.Left; |
687 |
//this.ParentOfType<MainWindow>().dzMainMenu.symboldata(id, group_id, RadTab.SelectedIndex, Data_, img.Source);*/ |
688 |
#endregion |
689 |
} |
690 |
} |
691 |
catch(Exception ex) |
692 |
{ |
693 |
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
694 |
} |
695 |
} |
696 |
|
697 |
/// <summary> |
698 |
/// |
699 |
/// </summary> |
700 |
private void ApplyDragSelectionRect() |
701 |
{ |
702 |
var multi_UndoData = new UndoData(); |
703 |
|
704 |
UndoDataGroup = new UndoDataGroup() |
705 |
{ |
706 |
IsUndo = false, |
707 |
Event = EventType.Operation, |
708 |
EventTime = DateTime.Now, |
709 |
MarkupDataColl = new List<UndoData>() |
710 |
}; |
711 |
|
712 |
this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Visibility = Visibility.Collapsed; |
713 |
|
714 |
double x = Canvas.GetLeft(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder); |
715 |
double y = Canvas.GetTop(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder); |
716 |
double width = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Width; |
717 |
double height = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Height; |
718 |
Rect dragRect = new Rect(x, y, width, height); |
719 |
Boolean Flag = false; |
720 |
dragRect.Inflate(width / 10, height / 10); |
721 |
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
722 |
var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList(); |
723 |
|
724 |
dragRect = new Rect(x, y, width, height); |
725 |
dragRect.Inflate(width / 10, height / 10); |
726 |
|
727 |
//move.mousemode = MarkupToPDF.Controls.Common.MouseMode.Selecting; |
728 |
//move. |
729 |
foreach (var item in Items) |
730 |
{ |
731 |
Flag = SelectionSet.Instance.SelectControl(item, dragRect); |
732 |
|
733 |
if (Flag) |
734 |
{ |
735 |
adornerSet.Add(item); |
736 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
737 |
|
738 |
this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item); |
739 |
UndoDataGroup.MarkupDataColl.Add(multi_UndoData); |
740 |
multi_UndoData = new UndoData(); |
741 |
if (item.GroupID > 0) |
742 |
{ |
743 |
|
744 |
} |
745 |
} |
746 |
} |
747 |
if (adornerSet.Count > 0) |
748 |
{ |
749 |
ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
750 |
{ |
751 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
752 |
}); |
753 |
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup); |
754 |
|
755 |
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
756 |
this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final); |
757 |
} |
758 |
} |
759 |
|
760 |
///private Move move; |
761 |
#region Symbol DoubleClick Event |
762 |
private void Move_Symbol(object sender, MouseButtonEventArgs e) |
763 |
{ |
764 |
try |
765 |
{ |
766 |
Type type = e.OriginalSource.GetType(); |
767 |
string id = string.Empty; |
768 |
//Logger.sendResLog("Move_Symbol", type.Name, 0); |
769 |
if (type.Name == "Image") |
770 |
{ |
771 |
id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID; |
772 |
} |
773 |
else if (type.Name == "Border") |
774 |
{ |
775 |
id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID; |
776 |
} |
777 |
else if (type.Name == "TextBox") |
778 |
{ |
779 |
id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID; |
780 |
} |
781 |
|
782 |
IsMouseDown = true; |
783 |
|
784 |
if (e.ClickCount > 1) |
785 |
{ |
786 |
this.PlaceSymbol(id,ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint); |
787 |
} |
788 |
} |
789 |
catch(Exception ex) |
790 |
{ |
791 |
//Logger.sendResLog("Move_Symbol", ex.Message, 0); |
792 |
} |
793 |
} |
794 |
#endregion |
795 |
|
796 |
#region Private Symbol Rename Event |
797 |
private void Rename_Symbol(object sender, RoutedEventArgs e) |
798 |
{ |
799 |
if (lstSymbolPrivate.SelectedItem == null) |
800 |
{ |
801 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
802 |
return; |
803 |
} |
804 |
|
805 |
DialogParameters parameters = new DialogParameters() |
806 |
{ |
807 |
Owner = Application.Current.MainWindow, |
808 |
Closed = (obj, args) => this.MarkupReNamePromptClose("", args), |
809 |
//DefaultPromptResultValue = "Custom State", |
810 |
DefaultPromptResultValue = (lstSymbolPrivate.SelectedItem as Symbol_Custom).Name, |
811 |
Content = "Name :", |
812 |
Header = "Update Custom Symbol Name", |
813 |
Theme = new VisualStudio2013Theme(), |
814 |
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
815 |
}; |
816 |
RadWindow.Prompt(parameters); |
817 |
|
818 |
} |
819 |
#endregion |
820 |
|
821 |
#region Public Symbol Rename Event |
822 |
private void Rename_Symbol_Public(object sender, RoutedEventArgs e) |
823 |
{ |
824 |
if (lstSymbolPublic.SelectedItem == null) |
825 |
{ |
826 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
827 |
return; |
828 |
} |
829 |
|
830 |
DialogParameters parameters = new DialogParameters() |
831 |
{ |
832 |
Owner = Application.Current.MainWindow, |
833 |
Closed = (obj, args) => this.MarkupReNamePromptClose("", args), |
834 |
//DefaultPromptResultValue = "Custom State", |
835 |
DefaultPromptResultValue = (lstSymbolPublic.SelectedItem as Symbol_Custom).Name, |
836 |
Content = "Name :", |
837 |
Header = "Update Custom Symbol Name", |
838 |
Theme = new VisualStudio2013Theme(), |
839 |
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
840 |
}; |
841 |
RadWindow.Prompt(parameters); |
842 |
|
843 |
} |
844 |
#endregion |
845 |
#region Symbol Rename Close Event |
846 |
private void MarkupReNamePromptClose(string data, WindowClosedEventArgs args) |
847 |
{ |
848 |
if (args.DialogResult != null && args.DialogResult.Value) |
849 |
{ |
850 |
if(RadTab.SelectedIndex == 0) |
851 |
{ |
852 |
string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
853 |
string _name = args.PromptResult; |
854 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
855 |
//Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
856 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex); |
857 |
} |
858 |
else |
859 |
{ |
860 |
string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
861 |
string _name = args.PromptResult; |
862 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
863 |
//Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
864 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex); |
865 |
} |
866 |
} |
867 |
} |
868 |
|
869 |
private async void BaseClient_RenameSymbolCompleted(object sender, ServiceDeepView.RenameSymbolCompletedEventArgs e) |
870 |
{ |
871 |
//Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
872 |
await DataBindAsync(); |
873 |
} |
874 |
#endregion |
875 |
|
876 |
#region Wheel Event |
877 |
private void lstSymbolPrivate_PreviewMouseWheel(object sender, MouseWheelEventArgs e) |
878 |
{ |
879 |
ScView.ScrollToVerticalOffset(ScView.ContentVerticalOffset - (e.Delta / 2)); |
880 |
} |
881 |
private void lstSymbolPublic_PreviewMouseWheel(object sender, MouseWheelEventArgs e) |
882 |
{ |
883 |
ScView_Public.ScrollToVerticalOffset(ScView_Public.ContentVerticalOffset - (e.Delta / 2)); |
884 |
} |
885 |
#endregion |
886 |
|
887 |
#region Tab Selection Event |
888 |
private void RadTabControl_PreviewSelectionChanged(object sender, RadSelectionChangedEventArgs e) |
889 |
{ |
890 |
foreach (var item in (e.OriginalSource as RadTabControl).Items) |
891 |
{ |
892 |
(item as RadTabItem).FontWeight = FontWeights.Normal; |
893 |
} |
894 |
((e.OriginalSource as RadTabControl).SelectedItem as RadTabItem).FontWeight = FontWeights.Bold; |
895 |
} |
896 |
#endregion |
897 |
|
898 |
#region Department Selection Event |
899 |
private async void deptlist_SelectionChanged(object sender, SelectionChangedEventArgs e) |
900 |
{ |
901 |
await DataBindAsync(); |
902 |
} |
903 |
#endregion |
904 |
|
905 |
#endregion |
906 |
|
907 |
private void lstSymbolPrivate_PreviewMouseUp(object sender, MouseButtonEventArgs e) |
908 |
{ |
909 |
|
910 |
} |
911 |
|
912 |
private void lstSymbolPrivate_MouseLeave(object sender, MouseEventArgs e) |
913 |
{ |
914 |
|
915 |
} |
916 |
|
917 |
private void lstSymbolPrivate_MouseDown(object sender, MouseButtonEventArgs e) |
918 |
{ |
919 |
|
920 |
} |
921 |
|
922 |
private void StackPanel_MouseLeave(object sender, MouseEventArgs e) |
923 |
{ |
924 |
if(IsMouseDown && e.LeftButton == MouseButtonState.Pressed) |
925 |
{ |
926 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.Symbol_ID = moveItem_id; |
927 |
} |
928 |
else |
929 |
{ |
930 |
IsMouseDown = false; |
931 |
} |
932 |
} |
933 |
|
934 |
private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e) |
935 |
{ |
936 |
IsMouseDown = false; |
937 |
} |
938 |
|
939 |
/// <summary> |
940 |
/// place symbol which user select |
941 |
/// </summary> |
942 |
/// <author>humkyung</author> |
943 |
/// <date>2018.06.14</date> |
944 |
/// <param name="sender"></param> |
945 |
/// <param name="e"></param> |
946 |
private void Place_Symbol(object sender, RoutedEventArgs e) |
947 |
{ |
948 |
if (lstSymbolPrivate.SelectedItem == null) |
949 |
{ |
950 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
951 |
return; |
952 |
} |
953 |
|
954 |
string id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
955 |
this.PlaceSymbol(id, ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint); |
956 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
957 |
} |
958 |
|
959 |
private void Place_Symbol_Public(object sender, RoutedEventArgs e) |
960 |
{ |
961 |
if (lstSymbolPublic.SelectedItem == null) |
962 |
{ |
963 |
DialogMessage_Alert("Please Select Symbol", "Alert"); |
964 |
return; |
965 |
} |
966 |
|
967 |
string id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
968 |
this.PlaceSymbol(id, ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint); |
969 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
970 |
} |
971 |
|
972 |
private void Image_Place_Register(object sender, RoutedEventArgs e) |
973 |
{ |
974 |
SyncInit(); |
975 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl; |
976 |
//캡쳐 하기 전에 코멘트 저장 |
977 |
if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0) |
978 |
{ |
979 |
var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu; |
980 |
SelectionSet.Instance.UnSelect(menu); |
981 |
if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true) |
982 |
{ |
983 |
(Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null); |
984 |
} |
985 |
else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID) |
986 |
{ |
987 |
|
988 |
} |
989 |
else |
990 |
{ |
991 |
(Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null); |
992 |
} |
993 |
} |
994 |
Application.Current.MainWindow.Focus(); |
995 |
Common.ViewerDataModel.Instance.Capture_Opacity = 0.49; |
996 |
(Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture; |
997 |
} |
998 |
|
999 |
|
1000 |
private void SyncInit() |
1001 |
{ |
1002 |
try |
1003 |
{ |
1004 |
if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden) |
1005 |
{ |
1006 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true; |
1007 |
ViewerDataModel.Instance.PageBalanceMode = false; |
1008 |
ViewerDataModel.Instance.PageBalanceNumber = 0; |
1009 |
ViewerDataModel.Instance.SyncPageNumber = 0; |
1010 |
ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
1011 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
1012 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false; |
1013 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false; |
1014 |
} |
1015 |
} |
1016 |
catch (Exception ex) |
1017 |
{ |
1018 |
//Logger.sendResLog("SyncInit", ex.Message, 0); |
1019 |
} |
1020 |
} |
1021 |
|
1022 |
private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
1023 |
{ |
1024 |
var block = sender as TextBox; |
1025 |
block.Focusable = true; |
1026 |
|
1027 |
} |
1028 |
|
1029 |
private void TextBlock_MouseEnter(object sender, MouseEventArgs e) |
1030 |
{ |
1031 |
var block = sender as TextBox; |
1032 |
if (block != null) |
1033 |
{ |
1034 |
//block.Text = "Enter"; |
1035 |
|
1036 |
} |
1037 |
} |
1038 |
|
1039 |
private void OnKeyDownHandler(object sender, KeyEventArgs e) |
1040 |
{ |
1041 |
if (e.Key == Key.Return) |
1042 |
{ |
1043 |
Type type = e.OriginalSource.GetType(); |
1044 |
string id = string.Empty; |
1045 |
//Logger.sendResLog("Move_Symbol", type.Name, 0); |
1046 |
if (type.Name == "Image") |
1047 |
{ |
1048 |
id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID; |
1049 |
} |
1050 |
else if (type.Name == "Border") |
1051 |
{ |
1052 |
id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID; |
1053 |
} |
1054 |
else if (type.Name == "TextBox") |
1055 |
{ |
1056 |
id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID; |
1057 |
} |
1058 |
|
1059 |
//((System.Windows.Controls.TextBox)sender).Text; |
1060 |
|
1061 |
if (RadTab.SelectedIndex == 0) |
1062 |
{ |
1063 |
//string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
1064 |
string _name = ((System.Windows.Controls.TextBox)sender).Text; |
1065 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
1066 |
//Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1); |
1067 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex); |
1068 |
} |
1069 |
else |
1070 |
{ |
1071 |
//string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
1072 |
string _name = ((System.Windows.Controls.TextBox)sender).Text; |
1073 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
1074 |
//Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1); |
1075 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex); |
1076 |
} |
1077 |
|
1078 |
} |
1079 |
} |
1080 |
|
1081 |
} |
1082 |
} |