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