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