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