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