프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Controls / AdornerFinal.xaml.cs @ a9a82876

이력 | 보기 | 이력해설 | 다운로드 (73.8 KB)

1
using KCOM.Common;
2
using KCOM.Events;
3
using MarkupToPDF.Common;
4
using MarkupToPDF.Controls.Cad;
5
using MarkupToPDF.Controls.Common;
6
using MarkupToPDF.Controls.Etc;
7
using MarkupToPDF.Controls.Line;
8
using MarkupToPDF.Controls.Parsing;
9
using MarkupToPDF.Controls.Polygon;
10
using MarkupToPDF.Controls.Shape;
11
using MarkupToPDF.Controls.Text;
12
using System;
13
using System.Collections.Generic;
14
using System.Diagnostics;
15
using System.Linq;
16
using System.Text;
17
using System.Threading.Tasks;
18
using System.Windows;
19
using System.Windows.Controls;
20
using System.Windows.Controls.Primitives;
21
using System.Windows.Input;
22
using System.Windows.Media;
23
using Telerik.Windows.Controls;
24

    
25
namespace KCOM.Controls
26
{
27
    public class MyThumb : Thumb
28
    {
29
        public const int ZIndex = int.MaxValue;
30

    
31
        public MyThumb()
32
        {
33
            this.Opacity = 0.6;
34
            this.MouseEnter += MyThumb_MouseEnter;
35
            this.MouseLeave += MyThumb_MouseLeave;
36
        }
37

    
38
        public void Translate(double dx, double dy, double angle)
39
        {
40
            var ratotePoint = MathHelper.RotatePoint(new Point(dx, dy), new Point(), angle);
41

    
42
            Canvas.SetLeft(this, Canvas.GetLeft(this) + ratotePoint.X);
43
            Canvas.SetTop(this, Canvas.GetTop(this) + ratotePoint.Y);
44
        }
45

    
46

    
47
        /// <summary>
48
        /// </summary>
49
        /// <param name="sender"></param>
50
        /// <param name="e"></param>
51
        private void MyThumb_MouseLeave(object sender, MouseEventArgs e)
52
        {
53
            this.Opacity = 0.6;
54
        }
55

    
56
        /// <summary>
57
        /// 
58
        /// </summary>
59
        /// <param name="sender"></param>
60
        /// <param name="e"></param>
61
        private void MyThumb_MouseEnter(object sender, MouseEventArgs e)
62
        {
63
            this.Opacity = 1.0;
64
        }
65
    }
66

    
67
    /// <summary>
68
    /// Interaction logic for AdornerFinal.xaml
69
    /// </summary>
70
    public class AdornerMember
71
    {
72
        public UIElement DrawingData { get; set; }
73
        public ControlType Drawingtype { get; set; }
74
        public double DrawingAngle { get; set; }
75
        public List<MyThumb> ThumbList { get; set; }
76
        public string Symbol_ID { get; set; }
77

    
78
        /// <summary>
79
        /// update thumb
80
        /// </summary>
81
        public void UpdateThumb()
82
        {
83
            var path = this.DrawingData as IPath;
84
            for (int i = 0; i < path.PointSet.Count; ++i)
85
            {
86
                Canvas.SetLeft(this.ThumbList[i], path.PointSet[i].X);
87
                Canvas.SetTop(this.ThumbList[i], path.PointSet[i].Y);
88
            }
89

    
90
            if (this.DrawingData is ArrowTextControl ArrowTextCtrl)
91
            {
92
                if (!ArrowTextCtrl.isTrans) //trans가 True인경우
93
                {
94
                    List<Point> ps = new List<Point>();
95

    
96
                    var temp = this.DrawingData as ArrowTextControl;
97
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
98
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
99
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
100
                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
101

    
102
                    if (temp.isFixed)
103
                    {
104
                        var endP = MathSet.getNearPoint(ps, temp.MidPoint);
105
                        var testP = endP;
106
                        if (ps[0] == endP) //상단
107
                        {
108
                            testP = new Point(endP.X, endP.Y - 50);
109
                        }
110
                        else if (ps[1] == endP) //하단
111
                        {
112
                            testP = new Point(endP.X, endP.Y + 50);
113
                        }
114
                        else if (ps[2] == endP) //좌단
115
                        {
116
                            testP = new Point(endP.X - 50, endP.Y);
117
                        }
118
                        else if (ps[3] == endP) //우단
119
                        {
120
                            testP = new Point(endP.X + 50, endP.Y);
121
                        }
122
                        Canvas.SetLeft(this.ThumbList[1], testP.X);
123
                        Canvas.SetTop(this.ThumbList[1], testP.Y);
124
                    }
125
                    else
126
                    {
127
                        var endP = MathSet.getNearPoint(ps, temp.MidPoint);
128
                        var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
129
                        Canvas.SetLeft(this.ThumbList[1], tempP.X);
130
                        Canvas.SetTop(this.ThumbList[1], tempP.Y);
131
                    }
132
                }
133
            }
134
        }
135

    
136
        /// <summary>
137
        /// rotate members about given position and angle
138
        /// </summary>
139
        /// <param name="at"></param>
140
        /// <param name="angle">in degree</param>
141
        public void RotateAbout(Point at, double angle)
142
        {
143
            for (int i = 0; i < (this.DrawingData as IPath).PointSet.Count; i++)
144
            {
145
                (this.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(at, (this.DrawingData as IPath).PointSet[i], angle);
146
            }
147
            (this.DrawingData as CommentUserInfo).UpdateControl();
148

    
149
            this.UpdateThumb();
150
        }
151
    }
152

    
153
    public partial class AdornerFinal : UserControl
154
    {
155
        #region 공용 인스턴스
156
        public List<AdornerMember> Members { get; } = new List<AdornerMember>();
157
        public Dictionary<Thumb, DragData> _dragData = new Dictionary<Thumb, DragData>();
158

    
159
        private List<double> AlignedAngles {get;} = new List<double>() { 0, 30, 45, 60, 90, 120, 135, 150, 180, 210, 225, 240, 270, 300, 315, 330, 360 };
160

    
161
        /// <summary>
162
        /// 회전 시작할때의 각도
163
        /// </summary>
164

    
165
        private double angleValue;
166
        public double AngleValue { get => angleValue;
167
            set
168
            {
169
                if(angleValue != value)
170
                {
171
                    angleValue = value;
172
                }
173
            }
174
        }
175

    
176
        /// <summary>
177
        /// Axis Lock을 적용하지 않는 실제 회전 각도
178
        /// </summary>
179
        private double _ActualAngle { get; set; }
180

    
181
        public bool IsTextAngle = false;
182
        public Rect BorderSize { get; set; }
183
        public bool TextCompensation = false;
184
        public bool isDragging { get; set; }
185
        public Thumb DraggerThumb { get; set; }
186
        public RadDropDownButton dropData;
187
        public RadCalendar dropCalendar;
188
        public Thumb mainDragThumb { get; set; }
189

    
190
        private bool disposed;
191

    
192
        public Point reSizePoint { get; set; }
193
        private Point RotatedPoint { get; set; } /// 2018.05.09 added by humkyung
194
        private Point MouseDownPoint = new Point();
195
        private Point CurrentMousePoint = new Point();
196
        #endregion
197
        #region 생성자
198
        private void RadDropDownButton_Loaded(object sender, RoutedEventArgs e)
199
        {
200
            dropData = sender as RadDropDownButton;
201
        }
202

    
203
        private void Date_Calendar_Loaded(object sender, RoutedEventArgs e)
204
        {
205
            dropCalendar = sender as RadCalendar;
206
            dropCalendar.SelectionChanged += (sen, ea) =>
207
            {
208
                dropData.IsOpen = false;
209
                if ((this.Members[0]).DrawingData.GetType().Name == "DateControl")
210
                {
211
                    DateControl data = (this.Members[0]).DrawingData as DateControl;
212
                    data.Text = dropCalendar.SelectedDate.Value.ToShortDateString();
213
                }
214
            };
215
        }
216

    
217
        public AdornerFinal()
218
        {
219
            InitializeComponent();
220
            BorderSize = new Rect();
221
            _dragData.Add(rotateTop, new DragData() { CursorAngle = 0, DragType = DragType.Rotate, RotateIsLeft = true, RotateIsTop = true });
222
        }
223

    
224
        public AdornerFinal(CommentUserInfo objectData) : this()
225
        {
226
            InitializeComponent();
227
            objectData.IsHitTestVisible = false;
228

    
229
            if (objectData is ArrowTextControl ArrTextCtrl)
230
            {
231
                ArrTextCtrl.Base_TextBox.Focusable = true;
232
            }
233

    
234
            try
235
            {
236
                objectData.Index = ViewerDataModel.Instance.MarkupControls_USER.IndexOf(objectData);
237
                ViewerDataModel.Instance.MarkupControls_USER.Remove(objectData);
238
                this.ContainerContent.Children.Add(objectData);
239
            }
240
            catch (Exception ex)
241
            {
242
                throw new InvalidOperationException(ex.Message);
243
            }
244

    
245
            SetAdornerMember(objectData);
246
            this.Focus();
247
        }
248

    
249
        public AdornerFinal(List<CommentUserInfo> comments) : this()
250
        {
251
            InitializeComponent();
252
            RemoveMultipleFromCanvas(comments);
253
            foreach (var item in comments)
254
            {
255
                if (item is ArrowTextControl ArrTextCtrl)
256
                {
257
                    ArrTextCtrl.Base_TextBox.Focusable = true;
258
                }
259
                try
260
                {
261
                    item.Index = ViewerDataModel.Instance.MarkupControls_USER.IndexOf(item);
262
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);                  
263
                    this.ContainerContent.Children.Add(item);
264
                }
265
                catch (Exception ex)
266
                {
267
                    throw new InvalidOperationException(ex.Message);
268
                }
269
                finally
270
                {
271
                }
272
            }
273

    
274
            this.SetAdornerMembers(comments);
275
            this.Focus();
276
        }
277

    
278
        private void RemoveMultipleFromCanvas(IEnumerable<UIElement> elements)
279
        {
280
            if (elements == null)
281
            {
282
                return;
283
            }
284

    
285
            try
286
            {
287
                var elementList = elements.ToList();
288

    
289
                foreach (var element in elementList)
290
                {
291
                    var parent = VisualTreeHelper.GetParent(element);
292
                   if(parent != null && ((System.Windows.FrameworkElement)parent) != null && ((System.Windows.FrameworkElement)parent).Parent != null)
293
                    {
294
                        if (parent is Canvas canvas)
295
                        {
296
                            canvas.Children.Remove(element);
297
                        }
298
                    }                   
299
                }
300
            }
301
            catch (InvalidOperationException ex)
302
            {
303
                // 컬렉션 수정 중 예외 처리
304
                Console.WriteLine($"Exception removing elements: {ex.Message}");
305
            }
306
        }
307

    
308
        ~AdornerFinal()
309
        {
310
            this.Dispose(false);
311
        }
312

    
313
        public void Dispose()
314
        {
315
            this.Dispose(true);
316
            GC.SuppressFinalize(this);
317
        }
318

    
319
        protected virtual void Dispose(bool disposing)
320
        {
321
            if (this.disposed) return;
322
            if (disposing)
323
            {
324
                foreach (var member in this.Members)
325
                {
326
                    if(!Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member.DrawingData))
327
                        Common.ViewerDataModel.Instance.MarkupControls_USER.Add(member.DrawingData as CommentUserInfo);
328
                }
329
                // IDisposable 인터페이스를 구현하는 멤버들을 여기서 정리합니다.
330
            }
331
            // .NET Framework에 의하여 관리되지 않는 외부 리소스들을 여기서 정리합니다.
332
            this.disposed = true;
333
        }
334

    
335
        void DragThumb_Loaded(object sender, RoutedEventArgs e)
336
        {
337
            mainDragThumb = DragThumb;
338
        }
339

    
340
        public Point Centeroid
341
        {
342
            get
343
            {
344
                List<Point> pts = new List<Point>();
345

    
346
                #region 센터 포인트 구하기 (그룹핑)
347
                foreach (var item in this.Members)
348
                {
349
                    if (item.DrawingData.GetType().Name == "TextControl")
350
                    {
351
                        if (AngleValue == 0)
352
                        {
353
                            AngleValue = (item.DrawingData as TextControl).CommentAngle;
354
                        }
355
                        double X = Canvas.GetLeft((item.DrawingData as TextControl));
356
                        double Y = Canvas.GetTop((item.DrawingData as TextControl));
357
                        pts.Add(new Point(X, Y));
358
                    }
359
                    else
360
                    {
361
                        pts.AddRange((item.DrawingData as IPath).PointSet);
362
                    }
363
                }
364
                #endregion
365

    
366
                return MathSet.FindCentroid(pts);
367
            }
368
        }
369

    
370
        #endregion
371
        #region 메서드
372
        public Rect getAdornerSize()
373
        {
374
            return BorderSize;
375
        }
376

    
377
        private void TextControlLostFocus(object sender,RoutedEventArgs e)
378
        {
379
            TextCompensation = false;
380
            BorderUpdate();
381

    
382
            if (sender is TextBox TextBox)
383
            {
384
                if (string.IsNullOrEmpty(TextBox.Text)) //보류
385
                {
386
                    this.ContainerContent.Children.Remove((sender as TextBox).Parent as MarkupToPDF.Common.CommentUserInfo);
387
                    this.Visibility = Visibility.Collapsed;
388
                }
389
            }
390
        }
391

    
392
        private void TextControlPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
393
        {
394
            if (sender is TextControl)
395
            {
396
                TextCompensation = true;
397
                BorderUpdate();
398
            }
399
        }
400

    
401
        private void TextControlSelectionChanged(object sender, RoutedEventArgs e)
402
        {
403
            BorderUpdate();
404
        }
405

    
406
        /// <summary>
407
        /// UIElement를 종류에 맞게 등록시킴
408
        /// </summary>
409
        /// <param name="member">UIElement 타입으로 BaseLayer에 있는 것들이 들어옵니다.</param>
410
        public void SetAdornerMember(MarkupToPDF.Common.CommentUserInfo member)
411
        {
412
            switch (member.GetType().Name)
413
            {
414
                #region 컨트롤 조건
415
                case "LineControl":
416
                case "PolygonControl":
417
                case "ArrowControl":
418
                case "ArcControl":
419
                case "ArrowArcControl":
420
                case "ArrowControl_Multi":
421
                case "RectangleControl":
422
                case "TriControl":
423
                case "CircleControl":
424
                case "CloudControl":
425
                case "RectCloudControl":
426
                case "InkControl":
427
                case "InsideWhiteControl":
428
                case "OverlapWhiteControl":
429
                case "ClipWhiteControl":
430
                case "CoordinateControl":
431
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
432
                    _ActualAngle = AngleValue = member.CommentAngle;
433
                    break;
434
                case "ArrowTextControl":
435
                    this.Members.Add(new AdornerMember
436
                    {
437
                        DrawingData = member,
438
                        Drawingtype = ControlType.ArrowTextControl,
439
                        ThumbList = new List<MyThumb>(),
440
                        Symbol_ID = member.SymbolID
441
                    });
442
                    (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
443
                    _ActualAngle = AngleValue = (member as ArrowTextControl).CommentAngle;
444

    
445
                    ((ArrowTextControl)member).Base_TextBox.LostFocus += TextControlLostFocus;
446
                    break;
447
                case "ImgControl":
448
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID});
449
                    _ActualAngle = AngleValue = (member as ImgControl).CommentAngle;
450
                    break;
451
                case "DateControl":
452
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
453
                    _ActualAngle = AngleValue = (member as DateControl).CommentAngle;
454
                    break;
455
                case "SignControl":
456
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
457
                    _ActualAngle = AngleValue = (member as SignControl).CommentAngle;
458
                    break;
459
                case "SymControl":
460
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
461
                    _ActualAngle = AngleValue = (member as SymControl).CommentAngle;
462
                    break;
463
                case "SymControlN":
464
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = member.ControlType, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
465
                    _ActualAngle = AngleValue = (member as SymControlN).CommentAngle;
466
                    break;
467
                case "TextControl":
468
                    this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
469
                    RectangleGeometry Data = new RectangleGeometry
470
                    {
471
                        Rect = new Rect()
472
                        {
473
                            X = Canvas.GetLeft((member as TextControl)),
474
                            Y = Canvas.GetTop((member as TextControl)),
475
                            Width = (member as TextControl).Base_TextBlock.ActualWidth / 2,
476
                            Height = (member as TextControl).Base_TextBlock.ActualHeight / 2,
477
                        }
478
                    };
479
                    Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
480
                    Point middle = MathSet.getMiddlePoint((member as TextControl).StartPoint, endPointV);
481

    
482

    
483
                    DragThumb.RenderTransformOrigin = new Point(0.0, 0.0);
484
                    DragThumb.RenderTransform = new RotateTransform()
485
                    {
486
                        Angle = (member as TextControl).CommentAngle,
487
                    };
488

    
489
                    AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0);
490
                    AdornerBorder.RenderTransform = new RotateTransform()
491
                    {
492
                        Angle = (member as TextControl).CommentAngle,
493
                    };
494

    
495
                    ((TextControl)member).PropertyChanged += TextControlPropertyChanged;
496
                    ((TextControl)member).Base_TextBox.LostFocus += TextControlLostFocus;
497
                    break;
498
                default:
499
                    break;
500
                    #endregion
501
            }
502

    
503
            if (member.GetType().Name == "TextControl")
504
            {
505
                TextControl content = ((TextControl)member);
506
                content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content));
507
                content.EndPoint = content.StartPoint;
508
            }
509
            else
510
            {
511
                RegistryPoint(member);
512
            }
513
            BorderUpdate();
514

    
515
            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member))
516
                Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member);
517
        }
518

    
519
        public void SetAdornerMembers(List<CommentUserInfo> members)
520
        {
521
            foreach (var member in members)
522
            {
523
                switch (member.GetType().Name)
524
                {
525
                    #region 컨트롤 조건
526
                    case "LineControl":
527
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.SingleLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
528
                        break;
529
                    case "ImgControl":
530
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ImgControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
531
                        break;
532
                    case "ArrowControl":
533
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
534
                        break;
535
                    case "PolygonControl":
536
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
537
                        break;
538
                    case "ArrowTextControl":
539
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowTextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
540
                        (member as ArrowTextControl).Base_TextBox.IsHitTestVisible = false;
541
                        break;
542
                    case "ArcControl":
543
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
544
                        break;
545
                    case "ArrowArcControl":
546
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArcArrow, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
547
                        break;
548
                    case "DateControl":
549
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Date, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
550
                        break;
551
                    case "ArrowControl_Multi":
552
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ArrowMultiLine, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
553
                        break;
554
                    case "RectangleControl":
555
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Rectangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
556
                        break;
557
                    case "TriControl":
558
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Triangle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
559
                        break;
560
                    case "CircleControl":
561
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Circle, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
562
                        break;
563
                    case "CloudControl":
564
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.PolygonCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
565
                        break;
566
                    case "RectCloudControl":
567
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.RectCloud, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
568
                        break;
569
                    case "SignControl":
570
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Sign, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
571
                        break;
572
                    case "SymControl":
573
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Symbol, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
574
                        break;
575
                    case "SymControlN":
576
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Stamp, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
577
                        break;
578
                    case "InkControl":
579
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Ink, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
580
                        break;
581
                    case "TextControl":
582
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.TextControl, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
583

    
584
                        (member as TextControl).PropertyChanged += TextControlPropertyChanged;
585
                        (member as TextControl).Base_TextBox.SelectionChanged += TextControlSelectionChanged;
586

    
587
                        //Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a =>
588
                        //{
589
                        //    BorderUpdate();
590
                        //});
591
                        //Observable.FromEventPattern(((TextControl)member), "PropertyChanged").Subscribe(a =>
592
                        //{
593
                        //    BorderUpdate();
594
                        //    try
595
                        //    {
596
                        //        ((TextControl)member).Base_TextBlock.TextDecorations = ((TextControl)member).UnderLine; 
597
                        //    }
598
                        //    catch (Exception)
599
                        //    {
600

    
601
                        //    }
602

    
603
                        //});
604
                        //Observable.FromEventPattern(((TextControl)member).Base_TextBox, "SelectionChanged").Subscribe(a =>
605
                        //{
606
                        //    BorderUpdate();
607
                        //});
608
                        break;
609
                    case "InsideWhiteControl":
610
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.InsideWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
611
                        break;
612
                    case "OverlapWhiteControl":
613
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.OverlapWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
614
                        break;
615
                    case "ClipWhiteControl":
616
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.ClipWhite, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
617
                        break;
618
                    case "CoordinateControl":
619
                        this.Members.Add(new AdornerMember { DrawingData = member, Drawingtype = ControlType.Coordinate, ThumbList = new List<MyThumb>(), Symbol_ID = member.SymbolID });
620
                        break;
621
                    default:
622
                        break;
623
                        #endregion
624
                }
625
                if (member.GetType().Name == "TextControl")
626
                {
627
                    TextControl content = ((TextControl)member);
628
                    content.StartPoint = new Point(Canvas.GetLeft(content), Canvas.GetTop(content));
629
                    content.EndPoint = content.StartPoint;
630
                }
631
                else
632
                {
633
                    RegistryPoint(member, members.Count);
634
                }
635

    
636
                if (Common.ViewerDataModel.Instance.MarkupControls_USER.Contains(member))
637
                    Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(member); /// remove commment from mycontrols
638
            }
639

    
640
            BorderUpdate();
641
        }
642

    
643

    
644
        /// <summary>
645
        /// Border 를 갱신
646
        /// </summary>
647
        public void BorderUpdate()
648
        {
649
            AdornerBorder.MinWidth = 10;
650
            AdornerBorder.MinHeight = 10;
651

    
652
            double minX = double.MaxValue;
653
            double minY = double.MaxValue;
654
            double maxX = double.MinValue;
655
            double maxY = double.MinValue; 
656
            double lineSize = 0;
657
            double marginSize = 0;
658
            if (this.Members.Count == 1)
659
            {
660
                if (this.Members[0].DrawingData.GetType().Name == "TextControl")
661
                {
662
                    if ((this.Members[0].DrawingData as TextControl).CommentAngle != 0)
663
                    {
664
                        trRotate.Angle = (this.Members[0].DrawingData as TextControl).CommentAngle;
665
                        trRotateThumb.Angle = (this.Members[0].DrawingData as TextControl).CommentAngle;
666
                    }
667
                    else
668
                    {
669
                        trRotate.Angle = 0;
670
                        trRotateThumb.Angle = 0;
671
                    }
672
                }
673
            }
674

    
675
            foreach (var item in this.Members)
676
            {
677
                UIElement currentControl = item.DrawingData;
678
                
679
                Point startP = (currentControl as IPath).StartPoint;
680
                Point endP = (currentControl as IPath).EndPoint;
681

    
682
                // ViewerDataModel.Instance.Angle = MathSet.returnAngle(startP, ref endP, ViewerDataModel.Instance.IsPressShift);
683

    
684
                // 컨트롤의 angle변환시 상단 anglecontrol에 출력
685
                ViewerDataModel.Instance.MarkupAngle = (currentControl as CommentUserInfo).CommentAngle;
686

    
687
                if (item.DrawingData.GetType().Name == "TextControl")
688
                {
689
                    double textControlWidth;
690
                    double textControlHeight;
691
                             
692
                    if (((currentControl as TextControl).Base_TextBox.ActualWidth) == 0)
693
                    {
694
                        textControlWidth = ((currentControl as TextControl).Base_TextBlock.ActualWidth);
695
                        textControlHeight = ((currentControl as TextControl).Base_TextBlock.ActualHeight);
696
                    }
697
                    else
698
                    {
699
                        textControlWidth = ((currentControl as TextControl).Base_TextBox.ActualWidth);
700
                        textControlHeight = ((currentControl as TextControl).Base_TextBox.ActualHeight);
701
                    }
702
                    
703
                    if ((currentControl as TextControl).EndPoint.X < minX)
704
                    {
705
                        minX = (currentControl as TextControl).EndPoint.X;
706
                    }
707

    
708
                    if ((currentControl as TextControl).EndPoint.Y < minY)
709
                    {
710
                        minY = (currentControl as TextControl).EndPoint.Y;
711
                    }
712

    
713
                    if (textControlWidth + (currentControl as TextControl).EndPoint.X > maxX)
714
                    {
715
                        maxX = textControlWidth + (currentControl as TextControl).EndPoint.X;
716
                    }
717

    
718
                    if (textControlHeight + (currentControl as TextControl).EndPoint.Y > maxY)
719
                    {
720
                        maxY = textControlHeight + (currentControl as TextControl).EndPoint.Y;
721
                    }
722
                    if ((currentControl as TextControl).ControlType_No == 2)
723
                        marginSize = (((currentControl as TextControl).Base_TextPath).ActualHeight - ((currentControl as TextControl).Base_Border).ActualHeight) / 2 + (((dynamic)currentControl).LineSize.Left / 2) + (currentControl as TextControl).ArcLength - 30;
724
                    if ((currentControl as TextControl).ControlType_No == 1)
725
                        marginSize = ((dynamic)currentControl).LineSize.Left;
726
                }
727
                else if ((currentControl as IViewBox) != null)
728
                {
729
                    IViewBox instance = currentControl as IViewBox;
730
                    List<Point> am = (currentControl as IPath).PointSet;
731
                    
732
                    if (am.Count() > 0)
733
                    {
734
                        List<double> xSet = am.Select(p => p.X).ToList();
735
                        List<double> ySet = am.Select(p => p.Y).ToList();
736
                        if (xSet.Min() < minX) minX = xSet.Min();
737
                        if (ySet.Min() < minY) minY = ySet.Min();
738
                        if (xSet.Max() > maxX) maxX = xSet.Max();
739
                        if (ySet.Max() > maxY) maxY = ySet.Max();
740
                    }
741
                }
742
                else if ((currentControl as IPath).PathData == null)
743
                {
744
                    Rect rt = new Rect
745
                    {
746
                        X = (currentControl as IPath).StartPoint.X,
747
                        Y = (currentControl as IPath).StartPoint.Y,
748
                        Width = Math.Max((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X) - Math.Min((currentControl as IPath).EndPoint.X, (currentControl as IPath).StartPoint.X),
749
                        Height = Math.Max((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y) - Math.Min((currentControl as IPath).EndPoint.Y, (currentControl as IPath).StartPoint.Y),
750
                    };
751
                    if (rt.Left < minX) minX = rt.Left;
752
                    if (rt.Top < minY) minY = rt.Top;
753
                    if (rt.Right > maxX) maxX = rt.Right;
754
                    if (rt.Bottom > maxY) maxY = rt.Bottom;
755
                }
756
                else if ((currentControl as IPath) == null)
757
                {
758
                    Rect rt = new Rect
759
                    {
760
                        X = (currentControl as IPath).StartPoint.X,
761
                        Y = (currentControl as IPath).StartPoint.Y,
762
                        Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X,
763
                        Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y
764
                    };
765
                    if (rt.Left < minX) minX = rt.Left;
766
                    if (rt.Top < minY) minY = rt.Top;
767
                    if (rt.Right > maxX) maxX = rt.Right;
768
                    if (rt.Bottom > maxY) maxY = rt.Bottom;
769
                }
770
                else if (currentControl is CircleControl CircleCtrl)
771
                {
772
                    List<Point> am = CircleCtrl.PointSet;
773
                    lineSize = CircleCtrl.LineSize;
774

    
775
                    List<double> xSet = am.Select(p => p.X).ToList();
776
                    List<double> ySet = am.Select(p => p.Y).ToList();
777
                    if (xSet.Min() < minX) minX = xSet.Min();
778
                    if (ySet.Min() < minY) minY = ySet.Min();
779
                    if (xSet.Max() > maxX) maxX = xSet.Max();
780
                    if (ySet.Max() > maxY) maxY = ySet.Max();
781
                }
782
                else 
783
                {
784
                    lineSize = ((dynamic)currentControl).LineSize;
785
                    if ((currentControl as IPath).PathData.Bounds.Left < minX) minX = (currentControl as IPath).PathData.Bounds.Left;
786
                    if ((currentControl as IPath).PathData.Bounds.Top < minY) minY = (currentControl as IPath).PathData.Bounds.Top;
787
                    if ((currentControl as IPath).PathData.Bounds.Right > maxX) maxX = (currentControl as IPath).PathData.Bounds.Right;
788
                    if ((currentControl as IPath).PathData.Bounds.Bottom > maxY) maxY = (currentControl as IPath).PathData.Bounds.Bottom;
789
                }
790
            }
791

    
792
            if (maxX <= minX || maxY <= minY) return;
793
            Rect ac = new Rect(minX , minY, maxX - minX, maxY - minY);
794
            bool addWidthSize = false;
795
            bool addHeightSize = false;
796
            if (ac.Width <= 10)
797
            {
798
                ac.Width += 10;
799
                addWidthSize = true;
800
            }
801
            if (ac.Height <= 10)
802
            {
803
                ac.Height += 10;
804
                addHeightSize = true;
805
            }
806
            BorderSize = ac;
807
            //lineSize : Thickness 굵기에 따라서 adoner 수정 
808
            ac.Width += lineSize;
809
            ac.Height += lineSize;
810
            AdornerBorder.MinWidth = 10;
811
            AdornerBorder.MinHeight = 10;
812
            AdornerBorder.Width = ac.Width;
813
            AdornerBorder.Height = ac.Height;
814
            minX -= lineSize / 2;
815
            minY -= lineSize / 2;
816
            Canvas.SetLeft(AdornerBorder, minX);
817
            Canvas.SetTop(AdornerBorder, minY);
818

    
819
            DragThumb.Width = ac.Width;
820
            DragThumb.Height = ac.Height;
821
            rotateTop.Margin = new Thickness(rotateTop.Margin.Left, -30 - marginSize, rotateTop.Margin.Right, rotateTop.Margin.Bottom);
822
            DragThumb.MinWidth = 10;
823
            DragThumb.MinHeight = 10;
824
            if (addWidthSize)
825
            {
826
                Canvas.SetLeft(DragThumb, minX - 5);
827
            }
828
            else
829
            {
830
                Canvas.SetLeft(DragThumb, minX);
831
            }
832

    
833
            if (addHeightSize)
834
            {
835
                Canvas.SetTop(DragThumb, minY - 5);
836
            }
837
            else
838
            {
839
                Canvas.SetTop(DragThumb, minY);
840
            }
841
        }
842

    
843
        /// <summary>
844
        /// UIElement 해제
845
        /// </summary>
846
        public void UnRegister()
847
        {
848
            foreach (var item in this.ContainerContent.Children)
849
            {
850
                if (item is MarkupToPDF.Common.CommentUserInfo)
851
                {
852
                    (item as MarkupToPDF.Common.CommentUserInfo).IsHitTestVisible = true;
853
                }
854
            }
855
            this.ContainerContent.Children.Clear();
856
        }
857

    
858
        /// <summary>
859
        /// 각 포인트들을 등록합니다.
860
        /// </summary>
861
        /// <param name="pointset">Drawing Point</param>
862
        public void RegistryPoint(CommentUserInfo member, int cnt = 1)
863
        {
864
            int count = 0;
865
            List<Point> pts = (member as IPath).PointSet;
866
            if (member.GetType().Name == "InkControl")
867
            {
868
                pts.Clear();
869
                pts.Add(new Point((member as IPath).PathData.Bounds.X, (member as IPath).PathData.Bounds.Y));
870
                pts.Add(new Point((member as IPath).PathData.Bounds.Left, (member as IPath).PathData.Bounds.Bottom));
871
                pts.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Bottom));
872
                pts.Add(new Point((member as IPath).PathData.Bounds.Right, (member as IPath).PathData.Bounds.Top));
873
            }
874
            ControlType markT = this.Members.First(p => p.DrawingData == member).Drawingtype;
875

    
876
            for (int i = 0; i < pts.Count; i++)
877
            {
878
                MyThumb tm = new MyThumb
879
                {
880
                    Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"],
881
                };
882

    
883
                this.Members[this.Members.Count - 1].ThumbList.Add(tm);
884

    
885
                if ((markT == ControlType.ArcLine && pts[i] == (member as ArcControl).MidPoint) || (markT == ControlType.ArcArrow && pts[i] == (member as ArrowArcControl).MiddlePoint))
886
                {
887
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"];
888
                }
889
                if (member.GetType().Name == "ArrowTextControl" && i == 1)
890
                {
891
                    //if (this.Members.Count()<=1)
892
                    //{
893
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbArcControlStyle"];
894
                    List<Point> ps = new List<Point>();
895

    
896
                    if ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl != null)
897
                    {
898
                        var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl;
899

    
900
                        switch (Math.Abs(temp.CommentAngle).ToString())
901
                        {
902
                            case "90":
903
                                {
904
                                    ps.Clear();
905
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
906
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간
907
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽
908

    
909
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간
910
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단
911

    
912
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단
913
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단
914

    
915
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간
916
                                }
917
                                break;
918
                            case "270":
919
                                {
920
                                    ps.Clear();
921
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽
922
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간
923
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽
924

    
925
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간
926
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단
927

    
928
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단
929
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단
930

    
931
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간
932
                                }
933
                                break;
934
                            default:
935
                                {
936
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단
937
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단
938
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단
939
                                    ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2));  //우단
940
                                }
941
                                break;
942
                        }
943

    
944
                        ArrowTextControl instance = (member as ArrowTextControl);
945
                        if (instance.isTrans)
946
                        {
947
                            //var endP = MathSet.getNearPoint(ps, temp.MidPoint);
948
                            //var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP);
949
                            //list[count] = tempP;
950
                            pts[count] = temp.MidPoint;
951
                        }
952
                        else
953
                        {
954
                            if (temp.isFixed)
955
                            {
956
                                var endP = MathSet.getNearPoint(ps, temp.MidPoint);
957
                                var testP = endP;
958
                                if (ps[0] == endP) //상단
959
                                {
960
                                    testP = new Point(endP.X, endP.Y - 50);
961
                                }
962
                                else if (ps[1] == endP) //하단
963
                                {
964
                                    testP = new Point(endP.X, endP.Y + 50);
965
                                }
966
                                else if (ps[2] == endP) //좌단
967
                                {
968
                                    testP = new Point(endP.X - 50, endP.Y);
969
                                }
970
                                else if (ps[3] == endP) //우단
971
                                {
972
                                    testP = new Point(endP.X + 50, endP.Y);
973
                                }
974
                                pts[count] = testP;
975
                            }
976
                            else
977
                            {
978
                                var endP = MathSet.getNearPoint(ps, instance.MidPoint);
979
                                pts[count] = MathSet.getMiddlePoint(instance.StartPoint, endP);
980
                            }
981
                        }
982
                    }
983
                }
984

    
985
                /// ArrowTextControl text box 화면 출력
986
                if (member.GetType().Name == "ArrowTextControl" && pts[i] == pts.Last())
987
                {
988
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"];
989
                    tm.Width = (member as ArrowTextControl).BoxWidth;
990
                    tm.Height = (member as ArrowTextControl).BoxHeight;
991
                    var angle = (member as ArrowTextControl).PageAngle;
992
                    if (Math.Abs(angle).ToString() == "90")
993
                    {
994
                        tm.RenderTransformOrigin = new Point(0, 0);
995
                        tm.RenderTransform = new RotateTransform { Angle = 270 };
996
                    }
997
                    else if (Math.Abs(angle).ToString() == "270")
998
                    {
999
                        tm.RenderTransformOrigin = new Point(0, 0);
1000
                        tm.RenderTransform = new RotateTransform { Angle = 90 };
1001
                    }
1002
                    else
1003
                    {
1004
                        tm.RenderTransformOrigin = new Point(0.5, 0.5);
1005
                        tm.RenderTransform = new RotateTransform()
1006
                        {
1007
                            Angle = angle
1008
                        };
1009
                    }
1010
                }
1011
                
1012
                if (member.GetType().Name == "CloudControl")
1013
                {
1014
                    if (i == pts.Count() - 1)
1015
                    {
1016
                        tm.Visibility = System.Windows.Visibility.Collapsed;
1017
                    }
1018
                }
1019
                if (member.GetType().Name == "PolygonControl")
1020
                {
1021
                    if (i == pts.Count() - 1)
1022
                    {
1023
                        if ((member as PolygonControl).ControlType == ControlType.ChainLine)
1024
                        {
1025

    
1026
                        }
1027
                        else
1028
                        {
1029
                            tm.Visibility = System.Windows.Visibility.Collapsed;
1030
                        }
1031
                    }
1032
                    if ((member as PolygonControl).ControlType == ControlType.Ink)
1033
                    {
1034
                        tm.Visibility = System.Windows.Visibility.Collapsed;
1035
                    }
1036
                }
1037
                
1038
                this.ContainerContent.Children.Add(tm);
1039
                Canvas.SetLeft(tm, pts[count].X);
1040
                Canvas.SetTop(tm, pts[count].Y);
1041
                if (member.GetType().Name == "ArrowTextControl" && pts[i] == (member as ArrowTextControl).MidPoint)
1042
                {
1043
                    Canvas.SetZIndex(tm, MyThumb.ZIndex);
1044
                    tm.DragDelta += MidPoint_DragDelta;
1045
                }
1046
                else
1047
                {
1048
                    tm.DragDelta += ResizeTm_DragDelta;
1049
                    Canvas.SetZIndex(tm, MyThumb.ZIndex);
1050
                }
1051

    
1052
                tm.DragStarted += new DragStartedEventHandler(tm_DragStarted);
1053
                tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted);
1054
                
1055
                tm.MouseMove += new MouseEventHandler(resize_MouseMove);
1056
                count++;
1057
            }
1058
        }
1059

    
1060
        private void MidPoint_DragDelta(object sender, DragDeltaEventArgs e)
1061
        {
1062
            MyThumb thumb = sender as MyThumb;
1063
            double newHorizontalChange = e.HorizontalChange;
1064
            double newVerticalChange = e.VerticalChange;
1065

    
1066
            var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), 0);// commentInfo.VisualPageAngle);
1067

    
1068
            var direction = VisualHelper.GetPointDirection(newpoint, ViewerDataModel.Instance.PageAngle);
1069

    
1070
            System.Diagnostics.Debug.WriteLine("뱡향 : " + direction.ToString());
1071

    
1072
            AdornerMember control = CurrentAdornerMember(thumb);
1073
            var commentInfo = (control.DrawingData) as CommentUserInfo;
1074

    
1075
            if (commentInfo is ArrowTextControl)
1076
            {
1077
                Point getThumbPoint = GetPosition(thumb);
1078

    
1079
                var arrowText = commentInfo as ArrowTextControl;
1080

    
1081
                //var midPoint = MathSet.getMiddlePoint(arrowText.StartPoint, arrowText.EndPoint);
1082
                //arrowText.MidPoint = newpoint;
1083
                thumb.Translate(newpoint.X, newpoint.Y, this.AngleValue);
1084
          
1085
                commentInfo.OnMoveCtrlPoint(getThumbPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift);
1086

    
1087
                control.UpdateThumb();
1088

    
1089
                System.Diagnostics.Debug.WriteLine($"text {Canvas.GetLeft(arrowText.Base_TextBox)},{Canvas.GetTop(arrowText.Base_TextBox)}");
1090

    
1091
                System.Diagnostics.Debug.WriteLine($"Page Angle : {ViewerDataModel.Instance.PageAngle} GetPoint : {getThumbPoint.X},{getThumbPoint.Y}  Change Value : {newpoint.X},{newpoint.Y}");
1092
            }
1093
        }
1094
        
1095

    
1096
        /// <summary>
1097
        /// 제어점을 조정하여 크기를 수정한다.
1098
        /// </summary>
1099
        /// <param name="sender"></param>
1100
        /// <param name="e"></param>
1101
        private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e)
1102
        {
1103
            if (sender.GetType() != typeof(MyThumb)) return;
1104

    
1105
            MyThumb thumb = sender as MyThumb;
1106

    
1107
            if (this.Members.Count > 1) return;
1108

    
1109
            System.Diagnostics.Debug.WriteLine($"Value {e.HorizontalChange},{e.VerticalChange}");
1110

    
1111
            double newHorizontalChange = e.HorizontalChange;
1112
            double newVerticalChange = e.VerticalChange;
1113

    
1114
            Point setPoint = GetPosition(thumb);
1115

    
1116
            AdornerMember control = CurrentAdornerMember(thumb);
1117
            var commentInfo = (control.DrawingData) as CommentUserInfo;
1118

    
1119
            double ratatePointAngle = 0;
1120

    
1121
            if (commentInfo is ArrowTextControl textControl)
1122
            {
1123
                if (textControl.EndPoint == MathSet.getNearPoint(textControl.PointSet, setPoint))
1124
                {
1125
                    textControl.CommentAngle = 0;
1126
                    this.AngleValue = 0;
1127
                    ratatePointAngle = commentInfo.VisualPageAngle;
1128
                }
1129
                else
1130
                {
1131
                    ///textControl.OnMoveCtrlPoint(setPoint, newHorizontalChange, newVerticalChange, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressCtrl);
1132
                    this.AngleValue = textControl.CommentAngle;
1133
                    commentInfo.CommentAngle = this.AngleValue;
1134
                }
1135
            }
1136
            System.Diagnostics.Debug.WriteLine("## Angle : " + this.AngleValue + " ##");
1137
            thumb.Translate(newHorizontalChange, newVerticalChange, this.AngleValue);
1138

    
1139
            // 페이지회전에 따른 화살표텍스트 박스의 이동 수정
1140

    
1141
            var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), ratatePointAngle);// commentInfo.VisualPageAngle);
1142
            commentInfo.OnMoveCtrlPoint(setPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift);
1143
            control.UpdateThumb();
1144
            this.BorderUpdate();
1145
        }
1146

    
1147
        private AdornerMember CurrentAdornerMember(MyThumb thumb)
1148
        {
1149
            AdornerMember result = null;
1150

    
1151
            try
1152
            {
1153
                result = (from userThumb in this.Members
1154
                            where userThumb.ThumbList.Contains(thumb)
1155
                            select userThumb).FirstOrDefault();
1156
            }
1157
            catch (Exception ex)
1158
            {
1159
                App.FileLogger.Error(ex);
1160
            }
1161

    
1162
            return result;
1163
        }
1164

    
1165
        private static Point GetPosition(Thumb thumb)
1166
        {
1167
            return new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb));
1168
        }
1169

    
1170
        #endregion
1171
        #region 이벤트
1172

    
1173
        void tm_DragCompleted(object sender, DragCompletedEventArgs e)
1174
        {
1175
            this.isDragging = false;
1176
            DraggerThumb = null;
1177

    
1178
            var comments = (from drawing in this.Members
1179
                            select drawing.DrawingData as CommentUserInfo).ToList();
1180
            ViewerDataModel.Instance.IsMarkupUpdate = true;
1181
        }
1182

    
1183
        /// <summary>
1184
        /// start drag
1185
        /// </summary>
1186
        /// <param name="sender"></param>
1187
        /// <param name="e"></param>
1188
        void tm_DragStarted(object sender, DragStartedEventArgs e)
1189
        {
1190
            this.DraggerThumb = sender as Thumb;
1191
            this.isDragging = true;
1192

    
1193
            if (ViewerDataModel.Instance.UndoDataList == null)
1194
            {
1195
                return;
1196
            }
1197

    
1198
            var comments = (from drawing in this.Members
1199
                            select drawing.DrawingData as CommentUserInfo).ToList();
1200

    
1201
            UndoCommand.Instance.Push(EventType.Operation, comments);
1202
        }
1203

    
1204
        private void rotate_MouseMove(object sender, MouseEventArgs e)
1205
        {
1206
            if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
1207
            {
1208
                if (LastRotateVerticalValue < e.GetPosition(this).X)
1209
                    IsTextAngle = true;
1210
                else
1211
                    IsTextAngle = false;
1212
                LastRotateVerticalValue = e.GetPosition(this).X;
1213
            }
1214
            else
1215
            {
1216
                if (e.GetPosition(this).X > LastRotateHorizontalValue)
1217
                {
1218
                    RotateFlag = true;
1219
                }
1220
                else
1221
                {
1222
                    RotateFlag = false;
1223
                }
1224
                LastRotateHorizontalValue = e.GetPosition(this).X;
1225
            }
1226
        }
1227

    
1228
        /// <summary>
1229
        /// 선택한 항목들 이동 시작
1230
        /// </summary>
1231
        /// <param name="sender"></param>
1232
        /// <param name="e"></param>
1233
        private void drag_DragStarted(object sender, DragStartedEventArgs e)
1234
        {
1235
            /// save mouse down and current mouse point
1236
            this.MouseDownPoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender));
1237
            this.CurrentMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender));
1238
            /// up to here
1239

    
1240
            if (ViewerDataModel.Instance.UndoDataList == null)
1241
            {
1242
                return;
1243
            }
1244

    
1245
            var comments = (from drawing in this.Members
1246
                            select drawing.DrawingData as CommentUserInfo).ToList();
1247

    
1248
            UndoCommand.Instance.Push(EventType.Operation, comments);
1249
        }
1250

    
1251
        /// <summary>
1252
        /// 선택한 항목들 이동 종료
1253
        /// </summary>
1254
        /// <param name="sender"></param>
1255
        /// <param name="e"></param>
1256
        private void drag_DragCompleted(object sender, DragCompletedEventArgs e)
1257
        {
1258
            DragThumb.Cursor = new Cursor(App.DefaultArrowCursorStream);
1259

    
1260
            var comments = (from drawing in this.Members
1261
                            select drawing.DrawingData as CommentUserInfo).ToList();
1262
        }
1263

    
1264
        /// <summary>
1265
        /// 선택한 항목들 이동
1266
        /// </summary>
1267
        /// <param name="sender"></param>
1268
        /// <param name="e"></param>
1269
        private void DragThumb_DragDelta(object sender, DragDeltaEventArgs e)
1270
        {
1271
            double scale = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ContentScale;
1272

    
1273
            var newMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender));
1274
         
1275
            var horzChange = (newMousePoint.X - this.CurrentMousePoint.X) / scale;/// Math.Round(tmp.X - this.CurrentMousePoint.X) / scale;
1276
            var vertChange = (newMousePoint.Y - this.CurrentMousePoint.Y) / scale;///Math.Round(tmp.Y - this.CurrentMousePoint.Y) / scale;
1277

    
1278
            try
1279
            {
1280
                DragThumb.Cursor = Cursors.SizeAll;
1281
                System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}");
1282
                System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}");
1283

    
1284

    
1285
                var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect();
1286

    
1287
                mainRect = MathHelper.RotateRect(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect(), new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle);
1288

    
1289
                var rect = (this.ContainerContent.FindChildByType<CommentUserInfo>() as CommentUserInfo).ItemRect; //this.AdornerBorder.Bounds(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel);
1290

    
1291
                var rotationRect = MathHelper.RotateRect(rect, new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle);
1292
                
1293
                var moveDirection = mainRect.Movement(rotationRect);
1294

    
1295
                System.Diagnostics.Debug.WriteLine($"horzChange: {horzChange} , vertChange:{vertChange}");
1296

    
1297
                this.TranslateItems(horzChange, vertChange);
1298
            }
1299
            finally
1300
            {
1301
                /// update CurrentMousePoint
1302
                this.CurrentMousePoint = newMousePoint;
1303
            }
1304
        }
1305

    
1306
        /// <summary>
1307
        /// translate all members
1308
        /// </summary>
1309
        /// <param name="e"></param>
1310
        public void TranslateItems(double dx, double dy)
1311
        {
1312
            Dispatcher.BeginInvoke((Action)(() =>
1313
            {
1314
                foreach (var item in this.Members)
1315
                {
1316
                    this.TranslateItem(dx, dy, item);
1317
                }
1318

    
1319
                this.BorderUpdate();
1320
            }));
1321
        }
1322

    
1323
        /// <summary>
1324
        /// translate a item
1325
        /// </summary>
1326
        /// <param name="e"></param>
1327
        /// <param name="item"></param>
1328
        private void TranslateItem(double dx, double dy, AdornerMember item)
1329
        {
1330
            /// rotate point with page rotation
1331
            var rotation = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle;
1332
            Point delta = MathSet.RotateAbout(new Point(0, 0), new Point(dx, dy), -rotation);
1333
            /// up to here
1334
            (item.DrawingData as CommentUserInfo).OnTranslate(delta.X, delta.Y);
1335

    
1336
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
1337
                        MarkupParser.MarkupToString((item.DrawingData as CommentUserInfo), App.ViewInfo.UserID), EventType.Operation, null, null);            
1338

    
1339
            item.UpdateThumb();
1340
        }
1341

    
1342
        private void resize_MouseMove(object sender, MouseEventArgs e)
1343
        {
1344
            //reSizePoint = e.GetPosition(this);
1345
        }
1346

    
1347
        /// <summary>
1348
        /// 회전
1349
        /// </summary>
1350
        /// <param name="sender"></param>
1351
        /// <param name="e"></param>
1352
        public void rotate_DragDelta(object sender, DragDeltaEventArgs e)
1353
        {
1354
            MoveRotate(e);
1355
        }
1356

    
1357
        double LastRotateHorizontalValue = 0;
1358
        double LastRotateVerticalValue = 0;
1359
        bool RotateFlag = false;
1360

    
1361
        /// <summary>
1362
        /// <history>humkyung 2018.05.09 upgrade rotate shape peformance</history>
1363
        /// </summary>
1364
        /// <param name="e"></param>
1365
        public void MoveRotate(DragDeltaEventArgs e)
1366
        {
1367
            Point CenterPoint = this.Centeroid;
1368
            Point pt = Mouse.GetPosition(this);
1369

    
1370
            #region X축 기준으로 회전 각도를 구한다.
1371
            Vector AxisX = new Vector(RotatedPoint.X - CenterPoint.X, RotatedPoint.Y - CenterPoint.Y);
1372
            AxisX.Normalize();
1373
            Vector AxisY = new Vector(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y);
1374
            AxisY.Normalize();
1375
            double dDeltaAngle = Vector.AngleBetween(AxisX, AxisY);
1376
            #endregion
1377

    
1378
            _ActualAngle += dDeltaAngle;
1379
            if (_ActualAngle > 360) _ActualAngle -= 360;
1380
            if (_ActualAngle < 0) _ActualAngle += 360;
1381
            #region AxisLock이 설정되어 있는 경우 Angle을 특정 값으로 정렬한다.
1382
            if (ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift)
1383
            {
1384
                double tmp = AlignedAngles.OrderBy(x => Math.Abs(_ActualAngle - x)).First();
1385
                dDeltaAngle = tmp - AngleValue;
1386
                AngleValue = tmp;
1387
            }
1388
            else
1389
            {
1390
                AngleValue = _ActualAngle;
1391
            }
1392
            #endregion
1393

    
1394
            /// save rotatePoint
1395
            this.RotatedPoint = pt;
1396

    
1397
            Dispatcher.BeginInvoke((Action)(() =>
1398
            {
1399
                foreach (var member in this.Members)
1400
                {
1401
                    member.RotateAbout(CenterPoint, dDeltaAngle); 
1402
                    #region 보더 업데이트
1403
                    switch (member.Drawingtype)
1404
                    {
1405
                        case ControlType.TextControl:
1406
                            (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue;
1407

    
1408
                            DragThumb.RenderTransformOrigin = new Point(0, 0);
1409
                            DragThumb.RenderTransform = new RotateTransform()
1410
                            {
1411
                                Angle = (member.DrawingData as CommentUserInfo).CommentAngle
1412
                            };
1413

    
1414
                            AdornerBorder.RenderTransformOrigin = new Point(0, 0);
1415
                            AdornerBorder.RenderTransform = new RotateTransform()
1416
                            {
1417
                                Angle = (member.DrawingData as CommentUserInfo).CommentAngle
1418
                            };
1419

    
1420
                            (member.DrawingData as CommentUserInfo).UpdateControl();
1421
                            BorderUpdate();
1422
                            break;
1423

    
1424
                        case ControlType.ArrowMultiLine:
1425
                        case ControlType.ArcLine:
1426
                        case ControlType.ArcArrow:
1427
                        case ControlType.SingleLine:
1428
                        case ControlType.Triangle:
1429
                        case ControlType.ArrowTextControl:
1430
                        case ControlType.PolygonControl:
1431
                        case ControlType.Ink:
1432
                            BorderUpdate();
1433
                            break;
1434
                        case ControlType.Date:
1435
                        case ControlType.RectCloud:
1436
                        case ControlType.Rectangle:
1437
                        case ControlType.ImgControl:
1438
                        case ControlType.Sign:
1439
                        case ControlType.Symbol:
1440
                        case ControlType.Stamp:
1441
                            (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue;
1442
                            BorderUpdate();
1443
                            break;
1444
                        case ControlType.PolygonCloud:
1445
                            ((ICloudControl)member.DrawingData).DrawingCloud();
1446
                            BorderUpdate();
1447
                            break;
1448
                        case ControlType.Circle:
1449
                            (member.DrawingData as CommentUserInfo).CommentAngle = AngleValue;
1450
                            ((CircleControl)member.DrawingData).SetCenterXY();
1451
                            BorderUpdate();
1452
                            break;
1453
                        default:
1454
                            break;
1455
                    }
1456
                }
1457
                #endregion
1458
            }));
1459
        }
1460

    
1461
        /// <summary>
1462
        /// 객체 회전 시작
1463
        /// </summary>
1464
        /// <param name="sender"></param>
1465
        /// <param name="e"></param>
1466
        private void rotate_DragStarted(object sender, DragStartedEventArgs e)
1467
        {            
1468
            this.RotatedPoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung
1469
            rotateTop.Cursor = Cursors.SizeAll;
1470

    
1471
            /// get angle from text controls' angle if only text control exists - 2018.05.10 added by humkyung
1472
            if ((1 == this.Members.Count) && (this.Members[0]).DrawingData.GetType().Name == "TextControl")
1473
            {
1474
                this.AngleValue = ((this.Members[0]).DrawingData as TextControl).CommentAngle;
1475
            }
1476
            /// up to here
1477

    
1478
            if (ViewerDataModel.Instance.UndoDataList == null)
1479
            {
1480
                return;
1481
            }
1482

    
1483
            var comments = (from drawing in this.Members
1484
                            select drawing.DrawingData as CommentUserInfo).ToList();
1485
            UndoCommand.Instance.Push(EventType.Operation, comments);
1486
        }
1487
        
1488
        private void rotate_DragCompleted(object sender, DragCompletedEventArgs e)
1489
        {
1490
            rotateTop.Cursor = new Cursor(App.DefaultArrowCursorStream);
1491

    
1492
            var comments = (from drawing in this.Members
1493
                            select drawing.DrawingData as CommentUserInfo).ToList();
1494
        }
1495

    
1496
        public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
1497
        {
1498
            AdornerMember control = this.Members.FirstOrDefault();
1499

    
1500
            if ((control.DrawingData as ArrowTextControl) != null)
1501
            {
1502
                if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false)
1503
                {
1504
                    (control.DrawingData as ArrowTextControl).isTrans = true;
1505
                }
1506
            }
1507

    
1508
        }
1509

    
1510
        public void TextControlChanger()
1511
        {
1512
            if ((this.Members.First() as AdornerMember).DrawingData.GetType().Name == "TextControl")
1513
            {
1514
                TextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as TextControl;
1515
                AllControl.Base_TextBox.Focus();
1516
                AllControl.Base_TextBox.Visibility = Visibility.Visible;
1517
                AllControl.Base_TextBlock.Visibility = Visibility.Collapsed;
1518
                AllControl.Base_TextBox.IsHitTestVisible = true;
1519
                AllControl.IsEditingMode = true;
1520
                AllControl.Base_TextBox.Focus();
1521

    
1522
                AllControl.SizeChanged += (sen, ea) =>
1523
                {
1524
                    if (AllControl.Base_TextBox != null)
1525
                    {
1526
                        RectangleGeometry Data = new RectangleGeometry
1527
                        {
1528
                            Rect = new Rect()
1529
                            {
1530
                                X = AllControl.StartPoint.X,
1531
                                Y = AllControl.StartPoint.Y,
1532
                                Width = AllControl.Base_TextBox.Width,
1533
                                Height = AllControl.Base_TextBox.Height,
1534
                            }
1535
                        };
1536

    
1537
                        Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom);
1538
                        Point middle = MathSet.getMiddlePoint(AllControl.StartPoint, endPointV);
1539
                        AllControl.Base_Grid.RenderTransform = new RotateTransform()
1540
                        {
1541
                            Angle = AllControl.CommentAngle,
1542
                            CenterX = middle.X,
1543
                            CenterY = middle.Y,
1544
                        };
1545
                    }
1546
                    BorderUpdate();
1547
                };
1548
            }
1549
        }
1550

    
1551
        private void RectThumb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) //더블클릭
1552
        {
1553
            if (e.ClickCount == 2 && this.Members.Count == 1)
1554
            {
1555
                if (this.Members[0].DrawingData.GetType().Name == "TextControl")
1556
                {
1557
                    SelectionSet.Instance.UnSelect(ViewerDataModel.Instance.SystemMain.dzMainMenu);
1558
                    TextControlChanger();                    
1559
                }
1560

    
1561
                else if (this.Members[0].DrawingData.GetType().Name == "ArrowTextControl")
1562
                {
1563
                    ArrowTextControl AllControl = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl;
1564
                    Thumb tm = (this.Members.First() as AdornerMember).ThumbList.Last();
1565
               
1566
                    //ArrowControl TextBox Thumb없애기
1567
                    tm.Visibility = Visibility.Collapsed;
1568

    
1569
                    (this.Members[0].DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true;
1570
                    SelectionSet.Instance.UnSelect(ViewerDataModel.Instance.SystemMain.dzMainMenu);
1571

    
1572
                    ((ArrowTextControl)AllControl).Base_TextBox.Focus();
1573
                    
1574

    
1575
                    ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) =>
1576

    
1577
                    {
1578
                        tm.Width = (AllControl as ArrowTextControl).BoxWidth;
1579
                        tm.Height = (AllControl as ArrowTextControl).BoxHeight;
1580

    
1581
                        List<Point> ps = new List<Point>();
1582
                        
1583
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단
1584
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단
1585
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단
1586
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2));  //우단
1587

    
1588
                        var endP = MathSet.getNearPoint(ps, AllControl.MidPoint);
1589
                        var tempP = MathSet.getMiddlePoint(AllControl.StartPoint, endP);
1590
                        if (AllControl.isTrans)
1591
                        {
1592
                            Canvas.SetLeft((this.Members[0]).ThumbList[1], AllControl.MidPoint.X);
1593
                            Canvas.SetTop((this.Members[0]).ThumbList[1], AllControl.MidPoint.Y);
1594
                        }
1595
                        else
1596
                        {
1597
                            Canvas.SetLeft((this.Members[0]).ThumbList[1], tempP.X);
1598
                            Canvas.SetTop((this.Members[0]).ThumbList[1], tempP.Y);
1599
                        }
1600

    
1601

    
1602
                        BorderUpdate();
1603

    
1604
                    };
1605
                }
1606
                else if ((this.Members[0]).DrawingData.GetType().Name == "DateControl")
1607
                {
1608
                    DateControl data = (this.Members[0]).DrawingData as DateControl;
1609
                    CalendarControl instanceCal = new CalendarControl(data.Text);
1610
                    //dropData.IsOpen = true;
1611
                    RadWindow rc = new RadWindow();
1612
                    rc.Width = 300;
1613
                    rc.Height = 300;
1614
                    rc.Header = "Change Date";
1615
                    rc.Content = instanceCal;
1616
                    rc.BorderThickness = new Thickness(3);
1617
                    rc.ResizeMode = ResizeMode.NoResize;
1618
                    rc.WindowStartupLocation = WindowStartupLocation.CenterScreen;
1619
                    rc.ModalBackground = new SolidColorBrush(Colors.Black);
1620
                    rc.ModalBackground.Opacity = 0.6;
1621
                    Telerik.Windows.Controls.StyleManager.SetTheme(rc, new Telerik.Windows.Controls.Windows8Theme());
1622
                    instanceCal.changeDateCal.SelectionChanged += (sen, ea) =>
1623
                    {
1624
                        data.Text = instanceCal.changeDateCal.SelectedDate.Value.ToShortDateString();
1625
                        rc.Close();
1626
                    };
1627
                    rc.ShowDialog();
1628
                    //CalendarControl.xaml
1629
                }
1630
                else if ((this.Members[0]).DrawingData.GetType().Name == "ArcControl")
1631
                {
1632
                    ArcControl instance = ((this.Members[0]).DrawingData as ArcControl);
1633
                    if (instance.isTransOn)
1634
                    {
1635
                        instance.isTransOn = false;
1636
                    }
1637
                    else
1638
                    {
1639
                        instance.isTransOn = true;
1640
                    }
1641
                    ///instance.SetArcPath();
1642
                    BorderUpdate();
1643
                }
1644
                else if ((this.Members[0]).DrawingData.GetType().Name == "ArrowArcControl")
1645
                {
1646
                    ArrowArcControl instance = ((this.Members[0]).DrawingData as ArrowArcControl);
1647
                    if (instance.isTransOn)
1648
                    {
1649
                        instance.isTransOn = false;
1650
                    }
1651
                    else
1652
                    {
1653
                        instance.isTransOn = true;
1654
                    }
1655
                    instance.SetArcPath();
1656
                    BorderUpdate();
1657
                }
1658
            }
1659
        }
1660
        #endregion
1661

    
1662
        private void DragThumb_MouseDoubleClick(object sender, MouseButtonEventArgs e)
1663
        {
1664
            if (this.Members[0].DrawingData.GetType().Name == "TextControl" 
1665
                || this.Members[0].DrawingData.GetType().Name == "ArrowTextControl")
1666
            {
1667
                DragThumb.Visibility = Visibility.Collapsed;
1668
            }
1669
        }
1670
    }
1671
}
클립보드 이미지 추가 (최대 크기: 500 MB)