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