markus / KCOM / Controls / Symbol.xaml.cs @ c73426a9
이력 | 보기 | 이력해설 | 다운로드 (41.7 KB)
1 | 53880c83 | ljiyeon | using IKCOM; |
---|---|---|---|
2 | using KCOM.Common; |
||
3 | 787a4489 | KangIngu | using KCOM.Events; |
4 | 5ce56a3a | KangIngu | using KCOMDataModel.Common; |
5 | using KCOMDataModel.DataModel; |
||
6 | 34c8d43a | ljiyeon | using MarkupToPDF.Common; |
7 | 53880c83 | ljiyeon | using Svg2Xaml; |
8 | 787a4489 | KangIngu | using System; |
9 | using System.Collections.Generic; |
||
10 | 53880c83 | ljiyeon | using System.ComponentModel; |
11 | 787a4489 | KangIngu | using System.Linq; |
12 | using System.Text; |
||
13 | using System.Windows; |
||
14 | using System.Windows.Controls; |
||
15 | using System.Windows.Data; |
||
16 | using System.Windows.Documents; |
||
17 | using System.Windows.Input; |
||
18 | using System.Windows.Media; |
||
19 | using System.Windows.Media.Imaging; |
||
20 | using System.Windows.Navigation; |
||
21 | using System.Windows.Shapes; |
||
22 | using Telerik.Windows.Controls; |
||
23 | 5ce56a3a | KangIngu | using Telerik.Windows.Controls.DragDrop; |
24 | 787a4489 | KangIngu | |
25 | namespace KCOM.Controls |
||
26 | { |
||
27 | public class Symbol_Custom |
||
28 | { |
||
29 | 5ce56a3a | KangIngu | public string ID { get; set; } |
30 | 787a4489 | KangIngu | public string Name { get; set; } |
31 | public string ImageUri { get; set; } |
||
32 | } |
||
33 | |||
34 | /// <summary> |
||
35 | /// Symbol.xaml에 대한 상호 작용 논리 |
||
36 | /// </summary> |
||
37 | public partial class Symbol : UserControl |
||
38 | { |
||
39 | AdornerFinal finalItem; |
||
40 | 5ce56a3a | KangIngu | bool IsMouseDown = false; |
41 | string moveItem_id = ""; |
||
42 | 787a4489 | KangIngu | public string filename { get; set; } |
43 | MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl(); |
||
44 | |||
45 | public Symbol() |
||
46 | { |
||
47 | InitializeComponent(); |
||
48 | 53880c83 | ljiyeon | |
49 | //RadDragAndDropManager.AddDragInfoHandler(lstSymbolPrivate, OnDragPrivateInfo); |
||
50 | //RadDragAndDropManager.AddDragQueryHandler(lstSymbolPrivate, OnDragPrivateQuery); |
||
51 | //RadDragAndDropManager.SetAllowDrag(lstSymbolPrivate, true); |
||
52 | 787a4489 | KangIngu | |
53 | DataBind(); |
||
54 | } |
||
55 | |||
56 | 5ce56a3a | KangIngu | private void OnDragPrivateInfo(object sender, DragDropEventArgs e) |
57 | { |
||
58 | } |
||
59 | |||
60 | private void OnDragPrivateQuery(object sender, DragDropQueryEventArgs e) |
||
61 | { |
||
62 | if (e.Options.Status == DragStatus.DragQuery) |
||
63 | { |
||
64 | //var draggedListBoxItem = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem; |
||
65 | //BitmapImage im = new BitmapImage(new Uri((draggedListBoxItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate).ImageUri)); |
||
66 | //ImageSource _source = im; |
||
67 | //Image img = new Image(); |
||
68 | //img.Source = _source; |
||
69 | |||
70 | //e.Options.Payload = im; |
||
71 | //var dragCue = new Image(); |
||
72 | //dragCue.Source = img.Source; |
||
73 | //dragCue.Width = 0; |
||
74 | //dragCue.Height = 0; |
||
75 | //e.Options.DragCue = dragCue; |
||
76 | |||
77 | |||
78 | //PayLoadAdorner = new AdornerFinal(); |
||
79 | //DeepView.ServiceDeepView_Symbol.SymbolPrivate tempDragableControl = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate; |
||
80 | //var xamldata = tempDragableControl.Data; |
||
81 | ////this.DeepLayer.markupParse(xamldata, this.DeepLayer._TempLayer, "복사된 데이터_이름으로 수정해야함"); |
||
82 | //PayLoadAdorner = this.DeepLayer.markupParseToAdorner(xamldata, this.DeepLayer._SelectLayer, ""); |
||
83 | //this.DeepLayer._SelectLayer.Children.Add(PayLoadAdorner); |
||
84 | } |
||
85 | |||
86 | e.QueryResult = true; |
||
87 | e.Handled = true; |
||
88 | } |
||
89 | |||
90 | 787a4489 | KangIngu | private void DataBind() |
91 | { |
||
92 | 5ce56a3a | KangIngu | //lstSymbolPrivate.ItemsSource = null; |
93 | //lstSymbolPublic.ItemsSource = null; |
||
94 | 787a4489 | KangIngu | |
95 | Symbol_Custom Custom = new Symbol_Custom(); |
||
96 | List<Symbol_Custom> Custom_List = new List<Symbol_Custom>(); |
||
97 | 6c781c0c | djkim | ServiceDeepView.ServiceDeepViewClient client = new ServiceDeepView.ServiceDeepViewClient(App._binding, App._EndPoint); |
98 | var symbol_Private = client.GetSymbolList(App.ViewInfo.UserID); |
||
99 | foreach (var item in symbol_Private) |
||
100 | 5ce56a3a | KangIngu | { |
101 | 6c781c0c | djkim | Custom.Name = item.NAME; |
102 | Custom.ImageUri = item.IMAGE_URL; |
||
103 | Custom.ID = item.ID; |
||
104 | Custom_List.Add(Custom); |
||
105 | 5ce56a3a | KangIngu | Custom = new Symbol_Custom(); |
106 | 6c781c0c | djkim | } |
107 | lstSymbolPrivate.ItemsSource = Custom_List; |
||
108 | 5ce56a3a | KangIngu | |
109 | 6c781c0c | djkim | Custom = new Symbol_Custom(); |
110 | Custom_List = new List<Symbol_Custom>(); |
||
111 | 5ce56a3a | KangIngu | |
112 | 6c781c0c | djkim | deptlist.ItemsSource = client.GetPublicSymbolDeptList(); |
113 | 5ce56a3a | KangIngu | |
114 | 6c781c0c | djkim | List<SYMBOL_PUBLIC> symbol_Public; |
115 | 5ce56a3a | KangIngu | |
116 | 53880c83 | ljiyeon | |
117 | 6c781c0c | djkim | if (deptlist.SelectedValue != null) |
118 | { |
||
119 | symbol_Public = client.GetPublicSymbolList(deptlist.SelectedValue.ToString()); |
||
120 | } |
||
121 | else |
||
122 | { |
||
123 | symbol_Public = client.GetPublicSymbolList(null); |
||
124 | 5ce56a3a | KangIngu | } |
125 | 6c781c0c | djkim | foreach (var item in symbol_Public) |
126 | { |
||
127 | Custom.Name = item.NAME; |
||
128 | Custom.ImageUri = item.IMAGE_URL; |
||
129 | Custom.ID = item.ID; |
||
130 | Custom_List.Add(Custom); |
||
131 | Custom = new Symbol_Custom(); |
||
132 | } |
||
133 | lstSymbolPublic.ItemsSource = Custom_List; |
||
134 | client.Close(); |
||
135 | 5ce56a3a | KangIngu | } |
136 | |||
137 | public PngBitmapEncoder symImage(string data) |
||
138 | { |
||
139 | |||
140 | Canvas _canvas = new Canvas(); |
||
141 | _canvas.Background = Brushes.White; |
||
142 | _canvas.Width = finalItem.BorderSize.Width; |
||
143 | _canvas.Height = finalItem.BorderSize.Height; |
||
144 | layer.markupParse(data, _canvas, "#FFFF0000", ""); |
||
145 | |||
146 | BitmapEncoder encoder = new PngBitmapEncoder(); |
||
147 | |||
148 | |||
149 | RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32); |
||
150 | |||
151 | DrawingVisual dv = new DrawingVisual(); |
||
152 | |||
153 | _canvas.Measure(new System.Windows.Size(finalItem.BorderSize.Width + 50, finalItem.BorderSize.Height + 50)); |
||
154 | //_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))); |
||
155 | _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))); |
||
156 | |||
157 | using (DrawingContext ctx = dv.RenderOpen()) |
||
158 | { |
||
159 | VisualBrush vb = new VisualBrush(_canvas); |
||
160 | //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))); |
||
161 | 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))); |
||
162 | } |
||
163 | |||
164 | try |
||
165 | { |
||
166 | renderBitmap.Render(dv); |
||
167 | |||
168 | GC.Collect(); |
||
169 | GC.WaitForPendingFinalizers(); |
||
170 | GC.Collect(); |
||
171 | //bitmap.Render(controlToConvert); |
||
172 | // encode png data |
||
173 | PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); |
||
174 | // puch rendered bitmap into it |
||
175 | pngEncoder.Interlace = PngInterlaceOption.Off; |
||
176 | pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap)); |
||
177 | return pngEncoder; |
||
178 | |||
179 | } |
||
180 | 53880c83 | ljiyeon | catch //(Exception ex) |
181 | 5ce56a3a | KangIngu | { |
182 | return null; |
||
183 | } |
||
184 | 787a4489 | KangIngu | |
185 | } |
||
186 | |||
187 | 5ce56a3a | KangIngu | public void DialogMessage_Alert(string content, string header) |
188 | { |
||
189 | var box = new TextBlock(); |
||
190 | box.MinWidth = 400; |
||
191 | box.FontSize = 11; |
||
192 | //box.FontSize = 12; |
||
193 | box.Text = content; |
||
194 | box.TextWrapping = System.Windows.TextWrapping.Wrap; |
||
195 | |||
196 | DialogParameters parameters = new DialogParameters() |
||
197 | { |
||
198 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
199 | 5ce56a3a | KangIngu | Content = box, |
200 | Header = header, |
||
201 | Theme = new VisualStudio2013Theme(), |
||
202 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
203 | }; |
||
204 | RadWindow.Alert(parameters); |
||
205 | } |
||
206 | |||
207 | #region Event |
||
208 | |||
209 | 498f0fc9 | ljiyeon | #region Private Symbol Add Event |
210 | 787a4489 | KangIngu | private void Create_Symbol(object sender, RoutedEventArgs e) |
211 | { |
||
212 | MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn(); |
||
213 | |||
214 | if (Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면 |
||
215 | { |
||
216 | DialogMessage_Alert("Please Select Controls", "Alert"); |
||
217 | } |
||
218 | else //선택된 것이 있으면 |
||
219 | { |
||
220 | string MarkupData = ""; |
||
221 | finalItem = new AdornerFinal(); |
||
222 | |||
223 | foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children) |
||
224 | { |
||
225 | if (item.GetType().Name == "AdornerFinal") |
||
226 | { |
||
227 | finalItem = (item as Controls.AdornerFinal); |
||
228 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
229 | { |
||
230 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
231 | { |
||
232 | markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
||
233 | MarkupData += markupReturn.ConvertData; |
||
234 | } |
||
235 | } |
||
236 | } |
||
237 | } |
||
238 | DialogParameters parameters = new DialogParameters() |
||
239 | { |
||
240 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
241 | 53880c83 | ljiyeon | Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args), |
242 | 787a4489 | KangIngu | DefaultPromptResultValue = "Custom State", |
243 | Content = "Name :", |
||
244 | Header = "Insert Custom Symbol Name", |
||
245 | Theme = new VisualStudio2013Theme(), |
||
246 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
247 | }; |
||
248 | RadWindow.Prompt(parameters); |
||
249 | } |
||
250 | |||
251 | } |
||
252 | 5ce56a3a | KangIngu | #endregion |
253 | 787a4489 | KangIngu | |
254 | 5ce56a3a | KangIngu | #region Symbol Add Close Event |
255 | 787a4489 | KangIngu | private void MarkupNamePromptClose(string data, WindowClosedEventArgs args) |
256 | { |
||
257 | c73426a9 | ljiyeon | try |
258 | 787a4489 | KangIngu | { |
259 | c73426a9 | ljiyeon | if (args.PromptResult != null) |
260 | 53880c83 | ljiyeon | { |
261 | c73426a9 | ljiyeon | if (args.DialogResult.Value) |
262 | { |
||
263 | PngBitmapEncoder _Encoder = symImage(data); |
||
264 | 787a4489 | KangIngu | |
265 | c73426a9 | ljiyeon | System.IO.MemoryStream fs = new System.IO.MemoryStream(); |
266 | _Encoder.Save(fs); |
||
267 | System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs); |
||
268 | 787a4489 | KangIngu | |
269 | c73426a9 | ljiyeon | byte[] Img_byte = fs.ToArray(); |
270 | 787a4489 | KangIngu | |
271 | c73426a9 | ljiyeon | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
272 | filename = fileUploader.Run(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte); |
||
273 | Check_Uri.UriCheck(filename); |
||
274 | if (RadTab.SelectedIndex == 0) |
||
275 | { |
||
276 | SymbolSave(args.PromptResult, filename, data); |
||
277 | } |
||
278 | else |
||
279 | { |
||
280 | SymbolSave_Public(args.PromptResult, filename, data, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
281 | } |
||
282 | 53880c83 | ljiyeon | |
283 | c73426a9 | ljiyeon | DataBind(); |
284 | 53880c83 | ljiyeon | } |
285 | 498f0fc9 | ljiyeon | } |
286 | 53880c83 | ljiyeon | } |
287 | c73426a9 | ljiyeon | catch(Exception ex) |
288 | { |
||
289 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert"); |
||
290 | } |
||
291 | 53880c83 | ljiyeon | } |
292 | #endregion |
||
293 | |||
294 | public void SymbolSave(string Name, string Url, string Data) |
||
295 | { |
||
296 | try |
||
297 | { |
||
298 | SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
||
299 | 498f0fc9 | ljiyeon | { |
300 | 53880c83 | ljiyeon | ID = Events.Save.shortGuid(), |
301 | MEMBER_USER_ID = App.ViewInfo.UserID, |
||
302 | NAME = Name, |
||
303 | IMAGE_URL = Url, |
||
304 | DATA = Data |
||
305 | }; |
||
306 | 5ce56a3a | KangIngu | |
307 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted; |
308 | Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
||
309 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
||
310 | } |
||
311 | catch (Exception) |
||
312 | { |
||
313 | throw; |
||
314 | 787a4489 | KangIngu | } |
315 | } |
||
316 | 53880c83 | ljiyeon | |
317 | public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
||
318 | { |
||
319 | try |
||
320 | { |
||
321 | SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
||
322 | { |
||
323 | ID = Events.Save.shortGuid(), |
||
324 | DEPARTMENT = Department, |
||
325 | NAME = Name, |
||
326 | IMAGE_URL = Url, |
||
327 | DATA = Data |
||
328 | }; |
||
329 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
||
330 | Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
||
331 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
||
332 | } |
||
333 | catch (Exception) |
||
334 | { |
||
335 | throw; |
||
336 | } |
||
337 | } |
||
338 | |||
339 | private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e) |
||
340 | { |
||
341 | Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
342 | DataBind(); |
||
343 | } |
||
344 | |||
345 | private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e) |
||
346 | { |
||
347 | Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
348 | DataBind(); |
||
349 | } |
||
350 | 787a4489 | KangIngu | |
351 | 498f0fc9 | ljiyeon | #region Private Symbol Delete Event |
352 | 5ce56a3a | KangIngu | private void Remove_Symbol(object sender, RoutedEventArgs e) |
353 | 787a4489 | KangIngu | { |
354 | 5ce56a3a | KangIngu | if (lstSymbolPrivate.SelectedItem == null) |
355 | { |
||
356 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
357 | return; |
||
358 | } |
||
359 | 6c781c0c | djkim | string delItem_ID = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
360 | 0f065e57 | ljiyeon | |
361 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted; |
362 | 0f065e57 | ljiyeon | Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1); |
363 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex); |
364 | 498f0fc9 | ljiyeon | } |
365 | #endregion |
||
366 | #region Public Symbol Delete Event |
||
367 | private void Remove_Symbol_Public(object sender, RoutedEventArgs e) |
||
368 | { |
||
369 | if (lstSymbolPublic.SelectedItem == null) |
||
370 | { |
||
371 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
372 | return; |
||
373 | } |
||
374 | string delItem_ID = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
||
375 | |||
376 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted; |
||
377 | Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1); |
||
378 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex); |
||
379 | 6c781c0c | djkim | } |
380 | 787a4489 | KangIngu | |
381 | 6c781c0c | djkim | private void BaseClient_DeleteSymbolCompleted(object sender, ServiceDeepView.DeleteSymbolCompletedEventArgs e) |
382 | { |
||
383 | 0f065e57 | ljiyeon | Logger.sendResLog("DeleteSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
384 | 6c781c0c | djkim | DataBind(); |
385 | 5ce56a3a | KangIngu | } |
386 | #endregion |
||
387 | 787a4489 | KangIngu | |
388 | 34c8d43a | ljiyeon | public Undo_data UndoData { get; set; } |
389 | 702abd98 | humkyung | /// <summary> |
390 | /// place symbol which has given id to original position which is created |
||
391 | /// </summary> |
||
392 | /// <date>2018.06.14</date> |
||
393 | /// <param name="id"></param> |
||
394 | private void PlaceSymbol(string id) |
||
395 | 5ce56a3a | KangIngu | { |
396 | 702abd98 | humkyung | string Data_ = ""; |
397 | 787a4489 | KangIngu | |
398 | 702abd98 | humkyung | try |
399 | 5ce56a3a | KangIngu | { |
400 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSymbolData: ", id + "," + RadTab.SelectedIndex, 1); |
401 | 6c781c0c | djkim | Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex); |
402 | 0f065e57 | ljiyeon | if (Data_ != null || Data_ != "") |
403 | { |
||
404 | Logger.sendResLog("GetSymbolData", "TRUE", 1); |
||
405 | } |
||
406 | else |
||
407 | { |
||
408 | Logger.sendResLog("GetSymbolData", "FALSE", 1); |
||
409 | } |
||
410 | 787a4489 | KangIngu | |
411 | 53880c83 | ljiyeon | //MARKUP_DATA_GROUP INSERT |
412 | MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
||
413 | { |
||
414 | SYMBOL_ID = id,//InnerItem.Symbol_ID |
||
415 | STATE = 0, |
||
416 | }; |
||
417 | long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO); |
||
418 | Logger.sendReqLog("AddMarkupDataGroup: ", "", 1); |
||
419 | |||
420 | 5ce56a3a | KangIngu | if (Data_.Contains("|DZ|")) |
421 | { |
||
422 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
423 | |||
424 | string[] delimiterChars = { "|DZ|" }; |
||
425 | string[] data = Data_.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
||
426 | |||
427 | 34c8d43a | ljiyeon | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
428 | UndoData = new Undo_data() |
||
429 | { |
||
430 | IsUndo = false, |
||
431 | Event = Event_Type.Create, |
||
432 | EventTime = DateTime.Now, |
||
433 | Markup_List = new List<Multi_Undo_data>() |
||
434 | }; |
||
435 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
436 | { |
||
437 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
438 | }); |
||
439 | |||
440 | foreach (string parse in data) |
||
441 | 5ce56a3a | KangIngu | { |
442 | if (parse != "") |
||
443 | { |
||
444 | System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER); |
||
445 | (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
||
446 | c8e9b3e4 | ljiyeon | (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = id; |
447 | 53880c83 | ljiyeon | (item as MarkupToPDF.Common.CommentUserInfo).GroupID = group_id; |
448 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
449 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
450 | 53880c83 | ljiyeon | |
451 | 5ce56a3a | KangIngu | adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
452 | 34c8d43a | ljiyeon | |
453 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
454 | |||
455 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
456 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
457 | 5ce56a3a | KangIngu | } |
458 | } |
||
459 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
460 | |||
461 | ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final); |
||
462 | } |
||
463 | 53880c83 | ljiyeon | else |
464 | { |
||
465 | PlaceImageSymbol(id, group_id); |
||
466 | } |
||
467 | } |
||
468 | catch (Exception ex) |
||
469 | { |
||
470 | this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
||
471 | } |
||
472 | } |
||
473 | |||
474 | private void PlaceImageSymbol(string id, long group_id) |
||
475 | { |
||
476 | |||
477 | //canvasZoommovingMouseDownPoint |
||
478 | string Data_ = ""; |
||
479 | |||
480 | try |
||
481 | { |
||
482 | Logger.sendReqLog("GetSymbolImageURL: ", id + "," + RadTab.SelectedIndex, 1); |
||
483 | Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, RadTab.SelectedIndex); |
||
484 | if (Data_ != null || Data_ != "") |
||
485 | { |
||
486 | Logger.sendResLog("GetSymbolImageURL", "TRUE", 1); |
||
487 | } |
||
488 | else |
||
489 | { |
||
490 | Logger.sendResLog("GetSymbolImageURL", "FALSE", 1); |
||
491 | } |
||
492 | |||
493 | //MARKUP_DATA_GROUP INSERT |
||
494 | MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
||
495 | { |
||
496 | SYMBOL_ID = id,//InnerItem.Symbol_ID |
||
497 | STATE = 0, |
||
498 | }; |
||
499 | //long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO); |
||
500 | //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1); |
||
501 | |||
502 | if (Data_ != null) |
||
503 | { |
||
504 | Image img = new Image(); |
||
505 | //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_)); |
||
506 | if (Data_.Contains(".svg")) |
||
507 | { |
||
508 | byte[] imageData = null; |
||
509 | DrawingImage image = null; |
||
510 | using (System.Net.WebClient web = new System.Net.WebClient()) |
||
511 | { |
||
512 | imageData = web.DownloadData(new Uri(Data_)); |
||
513 | System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
||
514 | image = SvgReader.Load(stream); |
||
515 | } |
||
516 | img.Source = image; |
||
517 | } |
||
518 | else |
||
519 | { |
||
520 | img.Source = new BitmapImage(new Uri(Data_)); |
||
521 | } |
||
522 | |||
523 | var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
||
524 | { |
||
525 | PointSet = new List<Point>(), |
||
526 | FilePath = Data_, |
||
527 | ImageData = img.Source, |
||
528 | StartPoint = new Point(0, 0), |
||
529 | EndPoint = new Point(img.Source.Width, img.Source.Height), |
||
530 | TopRightPoint = new Point(img.Source.Width, 0), |
||
531 | LeftBottomPoint = new Point(0, img.Source.Height) |
||
532 | }; |
||
533 | |||
534 | currentControl.PointSet = new List<Point> |
||
535 | { |
||
536 | currentControl.StartPoint, |
||
537 | currentControl.LeftBottomPoint, |
||
538 | currentControl.EndPoint, |
||
539 | currentControl.TopRightPoint, |
||
540 | }; |
||
541 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
542 | UndoData = new Undo_data() |
||
543 | { |
||
544 | IsUndo = false, |
||
545 | Event = Event_Type.Create, |
||
546 | EventTime = DateTime.Now, |
||
547 | Markup_List = new List<Multi_Undo_data>() |
||
548 | }; |
||
549 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
550 | { |
||
551 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
552 | }); |
||
553 | |||
554 | //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
555 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
556 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
557 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
558 | |||
559 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
560 | currentControl.CommentID = Events.Save.shortGuid(); |
||
561 | currentControl.SymbolID = id; |
||
562 | currentControl.GroupID = group_id; |
||
563 | currentControl.ApplyTemplate(); |
||
564 | currentControl.SetImage(); |
||
565 | |||
566 | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
567 | Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
568 | this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final); |
||
569 | |||
570 | // this.ParentOfType<MainWindow>().dzMainMenu.isLeftMouseButtonDownOnWindow = true; |
||
571 | // final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
572 | double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
||
573 | double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
574 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
575 | // move.control_Select(item, dragRect); |
||
576 | ApplyDragSelectionRect(); |
||
577 | this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = MouseHandlingMode.DragSymbol; |
||
578 | this.ParentOfType<MainWindow>().dzMainMenu.mouseButtonDown = MouseButton.Left; |
||
579 | this.ParentOfType<MainWindow>().dzMainMenu.symboldata(id, group_id, RadTab.SelectedIndex, Data_, img.Source); |
||
580 | |||
581 | } |
||
582 | 5ce56a3a | KangIngu | } |
583 | 702abd98 | humkyung | catch(Exception ex) |
584 | { |
||
585 | 53880c83 | ljiyeon | this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
586 | } |
||
587 | } |
||
588 | |||
589 | public Multi_Undo_data multi_Undo_Data; |
||
590 | private void ApplyDragSelectionRect() |
||
591 | { |
||
592 | move = new Move(); |
||
593 | multi_Undo_Data = new Multi_Undo_data(); |
||
594 | |||
595 | UndoData = new Undo_data() |
||
596 | { |
||
597 | IsUndo = false, |
||
598 | Event = Event_Type.Select, |
||
599 | EventTime = DateTime.Now, |
||
600 | Markup_List = new List<Multi_Undo_data>() |
||
601 | }; |
||
602 | |||
603 | this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Visibility = Visibility.Collapsed; |
||
604 | |||
605 | double x = Canvas.GetLeft(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder); |
||
606 | double y = Canvas.GetTop(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder); |
||
607 | double width = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Width; |
||
608 | double height = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Height; |
||
609 | Rect dragRect = new Rect(x, y, width, height); |
||
610 | Boolean Flag = false; |
||
611 | dragRect.Inflate(width / 10, height / 10); |
||
612 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
613 | var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList(); |
||
614 | |||
615 | dragRect = new Rect(x, y, width, height); |
||
616 | dragRect.Inflate(width / 10, height / 10); |
||
617 | |||
618 | //move.mousemode = MarkupToPDF.Controls.Common.MouseMode.Selecting; |
||
619 | //move. |
||
620 | foreach (var item in Items) |
||
621 | { |
||
622 | Flag = move.control_Select(item, dragRect); |
||
623 | |||
624 | if (Flag) |
||
625 | { |
||
626 | adornerSet.Add(item); |
||
627 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
||
628 | |||
629 | this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item); |
||
630 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
631 | multi_Undo_Data = new Multi_Undo_data(); |
||
632 | if (item.GroupID > 0) |
||
633 | { |
||
634 | |||
635 | } |
||
636 | } |
||
637 | } |
||
638 | if (adornerSet.Count > 0) |
||
639 | { |
||
640 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
641 | { |
||
642 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
643 | }); |
||
644 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
645 | |||
646 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
647 | this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final); |
||
648 | 702abd98 | humkyung | } |
649 | } |
||
650 | |||
651 | 53880c83 | ljiyeon | private Move move; |
652 | 702abd98 | humkyung | #region Symbol DoubleClick Event |
653 | private void Move_Symbol(object sender, MouseButtonEventArgs e) |
||
654 | { |
||
655 | 16d13764 | djkim | try |
656 | 702abd98 | humkyung | { |
657 | 16d13764 | djkim | Type type = e.OriginalSource.GetType(); |
658 | string id = string.Empty; |
||
659 | be31927d | djkim | Logger.sendResLog("Move_Symbol", type.Name, 0); |
660 | 16d13764 | djkim | if (type.Name == "Image") |
661 | { |
||
662 | id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID; |
||
663 | } |
||
664 | else if (type.Name == "Border") |
||
665 | { |
||
666 | id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID; |
||
667 | } |
||
668 | 53880c83 | ljiyeon | else if (type.Name == "TextBox") |
669 | be31927d | djkim | { |
670 | 53880c83 | ljiyeon | id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID; |
671 | be31927d | djkim | } |
672 | 16d13764 | djkim | |
673 | IsMouseDown = true; |
||
674 | 53880c83 | ljiyeon | |
675 | 16d13764 | djkim | if (e.ClickCount > 1) |
676 | { |
||
677 | this.PlaceSymbol(id); |
||
678 | } |
||
679 | 702abd98 | humkyung | } |
680 | 16d13764 | djkim | catch(Exception ex) |
681 | { |
||
682 | Logger.sendResLog("Move_Symbol", ex.Message, 0); |
||
683 | 53880c83 | ljiyeon | } |
684 | 5ce56a3a | KangIngu | } |
685 | #endregion |
||
686 | |||
687 | 498f0fc9 | ljiyeon | #region Private Symbol Rename Event |
688 | 5ce56a3a | KangIngu | private void Rename_Symbol(object sender, RoutedEventArgs e) |
689 | { |
||
690 | if (lstSymbolPrivate.SelectedItem == null) |
||
691 | 787a4489 | KangIngu | { |
692 | 5ce56a3a | KangIngu | DialogMessage_Alert("Please Select Symbol", "Alert"); |
693 | return; |
||
694 | 787a4489 | KangIngu | } |
695 | |||
696 | 5ce56a3a | KangIngu | DialogParameters parameters = new DialogParameters() |
697 | 787a4489 | KangIngu | { |
698 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
699 | 5ce56a3a | KangIngu | Closed = (obj, args) => this.MarkupReNamePromptClose("", args), |
700 | //DefaultPromptResultValue = "Custom State", |
||
701 | DefaultPromptResultValue = (lstSymbolPrivate.SelectedItem as Symbol_Custom).Name, |
||
702 | Content = "Name :", |
||
703 | Header = "Update Custom Symbol Name", |
||
704 | Theme = new VisualStudio2013Theme(), |
||
705 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
706 | }; |
||
707 | RadWindow.Prompt(parameters); |
||
708 | 787a4489 | KangIngu | |
709 | 5ce56a3a | KangIngu | } |
710 | #endregion |
||
711 | 787a4489 | KangIngu | |
712 | 498f0fc9 | ljiyeon | #region Public Symbol Rename Event |
713 | private void Rename_Symbol_Public(object sender, RoutedEventArgs e) |
||
714 | { |
||
715 | if (lstSymbolPublic.SelectedItem == null) |
||
716 | { |
||
717 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
718 | return; |
||
719 | } |
||
720 | |||
721 | DialogParameters parameters = new DialogParameters() |
||
722 | { |
||
723 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
724 | 498f0fc9 | ljiyeon | Closed = (obj, args) => this.MarkupReNamePromptClose("", args), |
725 | //DefaultPromptResultValue = "Custom State", |
||
726 | DefaultPromptResultValue = (lstSymbolPublic.SelectedItem as Symbol_Custom).Name, |
||
727 | Content = "Name :", |
||
728 | Header = "Update Custom Symbol Name", |
||
729 | Theme = new VisualStudio2013Theme(), |
||
730 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
731 | }; |
||
732 | RadWindow.Prompt(parameters); |
||
733 | |||
734 | } |
||
735 | #endregion |
||
736 | 5ce56a3a | KangIngu | #region Symbol Rename Close Event |
737 | private void MarkupReNamePromptClose(string data, WindowClosedEventArgs args) |
||
738 | { |
||
739 | if (args.DialogResult != null && args.DialogResult.Value) |
||
740 | { |
||
741 | 498f0fc9 | ljiyeon | if(RadTab.SelectedIndex == 0) |
742 | { |
||
743 | string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
||
744 | string _name = args.PromptResult; |
||
745 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
||
746 | Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
||
747 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex); |
||
748 | } |
||
749 | else |
||
750 | { |
||
751 | string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
||
752 | string _name = args.PromptResult; |
||
753 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
||
754 | Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
||
755 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex); |
||
756 | 53880c83 | ljiyeon | } |
757 | 787a4489 | KangIngu | } |
758 | 5ce56a3a | KangIngu | } |
759 | 6c781c0c | djkim | |
760 | private void BaseClient_RenameSymbolCompleted(object sender, ServiceDeepView.RenameSymbolCompletedEventArgs e) |
||
761 | { |
||
762 | 0f065e57 | ljiyeon | Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
763 | 6c781c0c | djkim | DataBind(); |
764 | } |
||
765 | 5ce56a3a | KangIngu | #endregion |
766 | |||
767 | #region Wheel Event |
||
768 | private void lstSymbolPrivate_PreviewMouseWheel(object sender, MouseWheelEventArgs e) |
||
769 | { |
||
770 | ScView.ScrollToVerticalOffset(ScView.ContentVerticalOffset - (e.Delta / 2)); |
||
771 | } |
||
772 | private void lstSymbolPublic_PreviewMouseWheel(object sender, MouseWheelEventArgs e) |
||
773 | { |
||
774 | ScView_Public.ScrollToVerticalOffset(ScView_Public.ContentVerticalOffset - (e.Delta / 2)); |
||
775 | } |
||
776 | #endregion |
||
777 | |||
778 | #region Tab Selection Event |
||
779 | private void RadTabControl_PreviewSelectionChanged(object sender, RadSelectionChangedEventArgs e) |
||
780 | { |
||
781 | foreach (var item in (e.OriginalSource as RadTabControl).Items) |
||
782 | 787a4489 | KangIngu | { |
783 | 5ce56a3a | KangIngu | (item as RadTabItem).FontWeight = FontWeights.Normal; |
784 | 787a4489 | KangIngu | } |
785 | 5ce56a3a | KangIngu | ((e.OriginalSource as RadTabControl).SelectedItem as RadTabItem).FontWeight = FontWeights.Bold; |
786 | } |
||
787 | #endregion |
||
788 | 787a4489 | KangIngu | |
789 | 5ce56a3a | KangIngu | #region Department Selection Event |
790 | private void deptlist_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||
791 | { |
||
792 | DataBind(); |
||
793 | 787a4489 | KangIngu | } |
794 | 5ce56a3a | KangIngu | #endregion |
795 | 787a4489 | KangIngu | |
796 | 5ce56a3a | KangIngu | #endregion |
797 | 29010418 | ljiyeon | |
798 | 5ce56a3a | KangIngu | private void lstSymbolPrivate_PreviewMouseUp(object sender, MouseButtonEventArgs e) |
799 | { |
||
800 | |||
801 | } |
||
802 | |||
803 | private void lstSymbolPrivate_MouseLeave(object sender, MouseEventArgs e) |
||
804 | { |
||
805 | |||
806 | } |
||
807 | |||
808 | private void lstSymbolPrivate_MouseDown(object sender, MouseButtonEventArgs e) |
||
809 | 787a4489 | KangIngu | { |
810 | |||
811 | } |
||
812 | 29010418 | ljiyeon | |
813 | 5ce56a3a | KangIngu | private void StackPanel_MouseLeave(object sender, MouseEventArgs e) |
814 | 787a4489 | KangIngu | { |
815 | 5ce56a3a | KangIngu | if(IsMouseDown && e.LeftButton == MouseButtonState.Pressed) |
816 | { |
||
817 | ViewerDataModel.Instance.SystemMain.dzMainMenu.Symbol_ID = moveItem_id; |
||
818 | } |
||
819 | else |
||
820 | { |
||
821 | IsMouseDown = false; |
||
822 | } |
||
823 | } |
||
824 | 787a4489 | KangIngu | |
825 | 5ce56a3a | KangIngu | private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e) |
826 | { |
||
827 | IsMouseDown = false; |
||
828 | 787a4489 | KangIngu | } |
829 | 702abd98 | humkyung | |
830 | /// <summary> |
||
831 | /// place symbol which user select |
||
832 | /// </summary> |
||
833 | /// <author>humkyung</author> |
||
834 | /// <date>2018.06.14</date> |
||
835 | /// <param name="sender"></param> |
||
836 | /// <param name="e"></param> |
||
837 | private void Place_Symbol(object sender, RoutedEventArgs e) |
||
838 | { |
||
839 | if (lstSymbolPrivate.SelectedItem == null) |
||
840 | { |
||
841 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
842 | return; |
||
843 | } |
||
844 | |||
845 | string id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
||
846 | this.PlaceSymbol(id); |
||
847 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
848 | 702abd98 | humkyung | } |
849 | ffcc8124 | ljiyeon | |
850 | private void Place_Symbol_Public(object sender, RoutedEventArgs e) |
||
851 | { |
||
852 | if (lstSymbolPublic.SelectedItem == null) |
||
853 | { |
||
854 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
855 | return; |
||
856 | } |
||
857 | |||
858 | string id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
||
859 | this.PlaceSymbol(id); |
||
860 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
861 | } |
||
862 | |||
863 | private void Image_Place_Register(object sender, RoutedEventArgs e) |
||
864 | { |
||
865 | SyncInit(); |
||
866 | ViewerDataModel.Instance.SystemMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl; |
||
867 | //캡쳐 하기 전에 코멘트 저장 |
||
868 | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0) |
||
869 | { |
||
870 | var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu; |
||
871 | menu.ReleaseAdorner(); |
||
872 | if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true) |
||
873 | { |
||
874 | (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu); |
||
875 | } |
||
876 | else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID) |
||
877 | { |
||
878 | |||
879 | } |
||
880 | else |
||
881 | { |
||
882 | (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu); |
||
883 | } |
||
884 | } |
||
885 | Application.Current.MainWindow.Focus(); |
||
886 | Common.ViewerDataModel.Instance.Capture_Opacity = 0.49; |
||
887 | (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture; |
||
888 | } |
||
889 | |||
890 | |||
891 | private void SyncInit() |
||
892 | { |
||
893 | try |
||
894 | { |
||
895 | if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden) |
||
896 | { |
||
897 | ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true; |
||
898 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
899 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
900 | ViewerDataModel.Instance.PageNumber = 0; |
||
901 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
902 | ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
903 | ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false; |
||
904 | ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false; |
||
905 | } |
||
906 | } |
||
907 | catch (Exception ex) |
||
908 | { |
||
909 | Logger.sendResLog("SyncInit", ex.Message, 0); |
||
910 | } |
||
911 | } |
||
912 | |||
913 | private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
||
914 | { |
||
915 | var block = sender as TextBox; |
||
916 | block.Focusable = true; |
||
917 | |||
918 | } |
||
919 | |||
920 | private void TextBlock_MouseEnter(object sender, MouseEventArgs e) |
||
921 | { |
||
922 | var block = sender as TextBox; |
||
923 | if (block != null) |
||
924 | { |
||
925 | //block.Text = "Enter"; |
||
926 | |||
927 | } |
||
928 | } |
||
929 | |||
930 | private void OnKeyDownHandler(object sender, KeyEventArgs e) |
||
931 | { |
||
932 | if (e.Key == Key.Return) |
||
933 | { |
||
934 | Type type = e.OriginalSource.GetType(); |
||
935 | string id = string.Empty; |
||
936 | Logger.sendResLog("Move_Symbol", type.Name, 0); |
||
937 | if (type.Name == "Image") |
||
938 | { |
||
939 | id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID; |
||
940 | } |
||
941 | else if (type.Name == "Border") |
||
942 | { |
||
943 | id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID; |
||
944 | } |
||
945 | else if (type.Name == "TextBox") |
||
946 | { |
||
947 | id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID; |
||
948 | } |
||
949 | |||
950 | //((System.Windows.Controls.TextBox)sender).Text; |
||
951 | |||
952 | if (RadTab.SelectedIndex == 0) |
||
953 | { |
||
954 | //string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
||
955 | string _name = ((System.Windows.Controls.TextBox)sender).Text; |
||
956 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
||
957 | Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1); |
||
958 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex); |
||
959 | } |
||
960 | else |
||
961 | { |
||
962 | //string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
||
963 | string _name = ((System.Windows.Controls.TextBox)sender).Text; |
||
964 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
||
965 | Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1); |
||
966 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex); |
||
967 | } |
||
968 | |||
969 | } |
||
970 | ffcc8124 | ljiyeon | } |
971 | 787a4489 | KangIngu | } |
972 | } |