프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (73.7 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
                    List<double> xSet = am.Select(p => p.X).ToList();
732
                    List<double> ySet = am.Select(p => p.Y).ToList();
733
                    if (xSet.Min() < minX) minX = xSet.Min();
734
                    if (ySet.Min() < minY) minY = ySet.Min();
735
                    if (xSet.Max() > maxX) maxX = xSet.Max();
736
                    if (ySet.Max() > maxY) maxY = ySet.Max();
737
                }
738
                else if ((currentControl as IPath).PathData == null)
739
                {
740
                    Rect rt = new Rect
741
                    {
742
                        X = (currentControl as IPath).StartPoint.X,
743
                        Y = (currentControl as IPath).StartPoint.Y,
744
                        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),
745
                        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),
746
                    };
747
                    if (rt.Left < minX) minX = rt.Left;
748
                    if (rt.Top < minY) minY = rt.Top;
749
                    if (rt.Right > maxX) maxX = rt.Right;
750
                    if (rt.Bottom > maxY) maxY = rt.Bottom;
751
                }
752
                else if ((currentControl as IPath) == null)
753
                {
754
                    Rect rt = new Rect
755
                    {
756
                        X = (currentControl as IPath).StartPoint.X,
757
                        Y = (currentControl as IPath).StartPoint.Y,
758
                        Width = (currentControl as IPath).EndPoint.X - (currentControl as IPath).StartPoint.X,
759
                        Height = (currentControl as IPath).EndPoint.Y - (currentControl as IPath).StartPoint.Y
760
                    };
761
                    if (rt.Left < minX) minX = rt.Left;
762
                    if (rt.Top < minY) minY = rt.Top;
763
                    if (rt.Right > maxX) maxX = rt.Right;
764
                    if (rt.Bottom > maxY) maxY = rt.Bottom;
765
                }
766
                else if (currentControl is CircleControl CircleCtrl)
767
                {
768
                    List<Point> am = CircleCtrl.PointSet;
769
                    lineSize = CircleCtrl.LineSize;
770

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

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

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

    
829
            if (addHeightSize)
830
            {
831
                Canvas.SetTop(DragThumb, minY - 5);
832
            }
833
            else
834
            {
835
                Canvas.SetTop(DragThumb, minY);
836
            }
837
        }
838

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

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

    
872
            for (int i = 0; i < pts.Count; i++)
873
            {
874
                MyThumb tm = new MyThumb
875
                {
876
                    Style = (Style)this.LayoutRoot.Resources["ThumbResizeStyle"],
877
                };
878

    
879
                this.Members[this.Members.Count - 1].ThumbList.Add(tm);
880

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

    
892
                    if ((this.Members.First() as AdornerMember).DrawingData as ArrowTextControl != null)
893
                    {
894
                        var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl;
895

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

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

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

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

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

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

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

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

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

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

    
1048
                tm.DragStarted += new DragStartedEventHandler(tm_DragStarted);
1049
                tm.DragCompleted += new DragCompletedEventHandler(tm_DragCompleted);
1050
                
1051
                tm.MouseMove += new MouseEventHandler(resize_MouseMove);
1052
                count++;
1053
            }
1054
        }
1055

    
1056
        private void MidPoint_DragDelta(object sender, DragDeltaEventArgs e)
1057
        {
1058
            MyThumb thumb = sender as MyThumb;
1059
            double newHorizontalChange = e.HorizontalChange;
1060
            double newVerticalChange = e.VerticalChange;
1061

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

    
1064
            var direction = VisualHelper.GetPointDirection(newpoint, ViewerDataModel.Instance.PageAngle);
1065

    
1066
            System.Diagnostics.Debug.WriteLine("뱡향 : " + direction.ToString());
1067

    
1068
            AdornerMember control = CurrentAdornerMember(thumb);
1069
            var commentInfo = (control.DrawingData) as CommentUserInfo;
1070

    
1071
            if (commentInfo is ArrowTextControl)
1072
            {
1073
                Point getThumbPoint = GetPosition(thumb);
1074

    
1075
                var arrowText = commentInfo as ArrowTextControl;
1076

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

    
1083
                control.UpdateThumb();
1084

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

    
1087
                System.Diagnostics.Debug.WriteLine($"Page Angle : {ViewerDataModel.Instance.PageAngle} GetPoint : {getThumbPoint.X},{getThumbPoint.Y}  Change Value : {newpoint.X},{newpoint.Y}");
1088
            }
1089
        }
1090
        
1091

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

    
1101
            MyThumb thumb = sender as MyThumb;
1102

    
1103
            if (this.Members.Count > 1) return;
1104

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

    
1107
            double newHorizontalChange = e.HorizontalChange;
1108
            double newVerticalChange = e.VerticalChange;
1109

    
1110
            Point setPoint = GetPosition(thumb);
1111

    
1112
            AdornerMember control = CurrentAdornerMember(thumb);
1113
            var commentInfo = (control.DrawingData) as CommentUserInfo;
1114

    
1115
            double ratatePointAngle = 0;
1116

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

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

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

    
1143
        private AdornerMember CurrentAdornerMember(MyThumb thumb)
1144
        {
1145
            AdornerMember result = null;
1146

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

    
1158
            return result;
1159
        }
1160

    
1161
        private static Point GetPosition(Thumb thumb)
1162
        {
1163
            return new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb));
1164
        }
1165

    
1166
        #endregion
1167
        #region 이벤트
1168

    
1169
        void tm_DragCompleted(object sender, DragCompletedEventArgs e)
1170
        {
1171
            this.isDragging = false;
1172
            DraggerThumb = null;
1173

    
1174
            var comments = (from drawing in this.Members
1175
                            select drawing.DrawingData as CommentUserInfo).ToList();
1176
            ViewerDataModel.Instance.IsMarkupUpdate = true;
1177
        }
1178

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

    
1189
            if (ViewerDataModel.Instance.UndoDataList == null)
1190
            {
1191
                return;
1192
            }
1193

    
1194
            var comments = (from drawing in this.Members
1195
                            select drawing.DrawingData as CommentUserInfo).ToList();
1196

    
1197
            UndoCommand.Instance.Push(EventType.Operation, comments);
1198
        }
1199

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

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

    
1236
            if (ViewerDataModel.Instance.UndoDataList == null)
1237
            {
1238
                return;
1239
            }
1240

    
1241
            var comments = (from drawing in this.Members
1242
                            select drawing.DrawingData as CommentUserInfo).ToList();
1243

    
1244
            UndoCommand.Instance.Push(EventType.Operation, comments);
1245
        }
1246

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

    
1256
            var comments = (from drawing in this.Members
1257
                            select drawing.DrawingData as CommentUserInfo).ToList();
1258
        }
1259

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

    
1269
            var newMousePoint = Mouse.GetPosition(Window.GetWindow((DependencyObject)sender));
1270
         
1271
            var horzChange = (newMousePoint.X - this.CurrentMousePoint.X) / scale;/// Math.Round(tmp.X - this.CurrentMousePoint.X) / scale;
1272
            var vertChange = (newMousePoint.Y - this.CurrentMousePoint.Y) / scale;///Math.Round(tmp.Y - this.CurrentMousePoint.Y) / scale;
1273

    
1274
            try
1275
            {
1276
                DragThumb.Cursor = Cursors.SizeAll;
1277
                System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}");
1278
                System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}");
1279

    
1280

    
1281
                var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect();
1282

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

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

    
1287
                var rotationRect = MathHelper.RotateRect(rect, new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle);
1288
                
1289
                var moveDirection = mainRect.Movement(rotationRect);
1290

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

    
1293
                this.TranslateItems(horzChange, vertChange);
1294
            }
1295
            finally
1296
            {
1297
                /// update CurrentMousePoint
1298
                this.CurrentMousePoint = newMousePoint;
1299
            }
1300
        }
1301

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

    
1315
                this.BorderUpdate();
1316
            }));
1317
        }
1318

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

    
1332
                ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
1333
                        MarkupParser.MarkupToString((item.DrawingData as CommentUserInfo), App.ViewInfo.UserID), EventType.Operation, null, null);            
1334

    
1335
            item.UpdateThumb();
1336
        }
1337

    
1338
        private void resize_MouseMove(object sender, MouseEventArgs e)
1339
        {
1340
            //reSizePoint = e.GetPosition(this);
1341
        }
1342

    
1343
        /// <summary>
1344
        /// 회전
1345
        /// </summary>
1346
        /// <param name="sender"></param>
1347
        /// <param name="e"></param>
1348
        public void rotate_DragDelta(object sender, DragDeltaEventArgs e)
1349
        {
1350
            MoveRotate(e);
1351
        }
1352

    
1353
        double LastRotateHorizontalValue = 0;
1354
        double LastRotateVerticalValue = 0;
1355
        bool RotateFlag = false;
1356

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

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

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

    
1390
            /// save rotatePoint
1391
            this.RotatedPoint = pt;
1392

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

    
1404
                            DragThumb.RenderTransformOrigin = new Point(0, 0);
1405
                            DragThumb.RenderTransform = new RotateTransform()
1406
                            {
1407
                                Angle = (member.DrawingData as CommentUserInfo).CommentAngle
1408
                            };
1409

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

    
1416
                            (member.DrawingData as CommentUserInfo).UpdateControl();
1417
                            BorderUpdate();
1418
                            break;
1419

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

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

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

    
1474
            if (ViewerDataModel.Instance.UndoDataList == null)
1475
            {
1476
                return;
1477
            }
1478

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

    
1488
            var comments = (from drawing in this.Members
1489
                            select drawing.DrawingData as CommentUserInfo).ToList();
1490
        }
1491

    
1492
        public void ControlPointMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
1493
        {
1494
            AdornerMember control = this.Members.FirstOrDefault();
1495

    
1496
            if ((control.DrawingData as ArrowTextControl) != null)
1497
            {
1498
                if ((control.DrawingData as ArrowTextControl).isTrans == false && (control.DrawingData as ArrowTextControl).isFixed == false)
1499
                {
1500
                    (control.DrawingData as ArrowTextControl).isTrans = true;
1501
                }
1502
            }
1503

    
1504
        }
1505

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

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

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

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

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

    
1565
                    (this.Members[0].DrawingData as ArrowTextControl).Base_TextBox.IsHitTestVisible = true;
1566
                    SelectionSet.Instance.UnSelect(ViewerDataModel.Instance.SystemMain.dzMainMenu);
1567

    
1568
                    ((ArrowTextControl)AllControl).Base_TextBox.Focus();
1569
                    
1570

    
1571
                    ((ArrowTextControl)AllControl).Base_TextBox.SizeChanged += (sen, ea) =>
1572

    
1573
                    {
1574
                        tm.Width = (AllControl as ArrowTextControl).BoxWidth;
1575
                        tm.Height = (AllControl as ArrowTextControl).BoxHeight;
1576

    
1577
                        List<Point> ps = new List<Point>();
1578
                        
1579
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox))); //상단
1580
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth / 2, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight)); // 하단
1581
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox), Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2)); //좌단
1582
                        ps.Add(new Point(Canvas.GetLeft(AllControl.Base_TextBox) + AllControl.BoxWidth, Canvas.GetTop(AllControl.Base_TextBox) + AllControl.BoxHeight / 2));  //우단
1583

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

    
1597

    
1598
                        BorderUpdate();
1599

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

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