프로젝트

일반

사용자정보

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

markus / MarkupToPDF / Controls / Etc / SignControl.cs @ b1c2c6fe

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

1 787a4489 KangIngu
using System;
2
using System.Net;
3
using System.Windows;
4
using System.Windows.Controls;
5
using System.Windows.Documents;
6
using System.Windows.Ink;
7
using System.Windows.Input;
8
using System.Windows.Media;
9
using System.Windows.Media.Animation;
10
using System.Windows.Shapes;
11
using System.Collections.Generic;
12
using System.ComponentModel;
13
using System.Linq;
14
using MarkupToPDF.Controls.Common;
15
using MarkupToPDF.Common;
16 036650a0 humkyung
using MarkupToPDF.Serialize.Core;
17
using MarkupToPDF.Serialize.S_Control;
18 661b7416 humkyung
using System.Windows.Media.Imaging;
19 366f00c2 taeseongkim
using System.Threading.Tasks;
20 b1c2c6fe swate0609
using static System.Windows.Forms.AxHost;
21 787a4489 KangIngu
22
//강인구 추가
23
namespace MarkupToPDF.Controls.Etc
24
{
25
    [TemplatePart(Name = "PART_Image", Type = typeof(Image))]
26 9005f973 humkyung
    public class SignControl : CommentUserInfo, IDisposable, INormal, INotifyPropertyChanged, IViewBox
27 787a4489 KangIngu
    {
28
        #region 초기선언
29 a6272c57 humkyung
        public string ProjectNO { get; set; }
30
31 787a4489 KangIngu
        private const string PART_Image = "PART_Image";
32
        public Image Base_Image = null;
33
        #endregion
34
35
        static SignControl()
36
        {
37
            DefaultStyleKeyProperty.OverrideMetadata(typeof(SignControl), new FrameworkPropertyMetadata(typeof(SignControl)));
38
            //Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/MarkupToPDF;Component/Themes/generic.xaml")) as ResourceDictionary);
39 a6f7f9b6 djkim
            //ResourceDictionary dictionary = new ResourceDictionary();
40
            //dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute);
41
            //Application.Current.Resources.MergedDictionaries.Add(dictionary);
42
            //System.Diagnostics.Debug.WriteLine("resource Count :" + Application.Current.Resources.MergedDictionaries.Count);
43 787a4489 KangIngu
        }
44
45 86143026 humkyung
        public override void Copy(CommentUserInfo lhs)
46
        {
47
            if(lhs is SignControl item)
48
            {
49
                this.CommentAngle = item.CommentAngle;
50
                this.StartPoint = new Point(item.StartPoint.X, item.StartPoint.Y);
51
                this.TopRightPoint = new Point(item.TopRightPoint.X, item.TopRightPoint.Y);
52
                this.EndPoint = new Point(item.EndPoint.X, item.EndPoint.Y);
53
                this.LeftBottomPoint = new Point(item.LeftBottomPoint.X, item.LeftBottomPoint.Y);
54
                this.PointSet = item.PointSet.ConvertAll(x => new Point(x.X, x.Y));
55
                this.Opacity = item.Opacity;
56
                this.SignImage = item.SignImage;
57
                this.UserID = item.UserID;
58
                this.UserNumber = item.UserNumber;
59
                this.Memo = item.Memo;
60
            }
61
        }
62
63
        public override CommentUserInfo Clone()
64
        {
65
            var clone = new SignControl();
66
            clone.Copy(this);
67
            return clone;
68
        }
69
70 787a4489 KangIngu
        public void Dispose()
71
        {
72 a6f7f9b6 djkim
            //GC.Collect();
73 24c5e56c taeseongkim
            ////GC.SuppressFinalize(this);
74 a6f7f9b6 djkim
            this.Base_Image = null;
75 787a4489 KangIngu
        }
76
        #region Dependency Properties
77
        public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
78
                "UserID", typeof(string), typeof(SignControl), new PropertyMetadata(null));
79
        public static readonly DependencyProperty SignImageProperty = DependencyProperty.Register(
80
            "SignImage", typeof(ImageSource), typeof(SignControl), new PropertyMetadata(null));
81
        public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
82
            "StartPoint", typeof(Point), typeof(SignControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
83
        public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
84
            "EndPoint", typeof(Point), typeof(SignControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
85
        public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
86
            "PointSet", typeof(List<Point>), typeof(SignControl), new PropertyMetadata(new List<Point>()));
87
        public static readonly DependencyProperty UserNubmerProperty = DependencyProperty.Register(
88
            "UserNumber", typeof(string), typeof(SignControl), new PropertyMetadata(null));
89
        public static readonly DependencyProperty TopRightPointProperty = DependencyProperty.Register(
90
             "TopRightPoint", typeof(Point), typeof(SignControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
91
        public static readonly DependencyProperty LeftBottomPointProperty = DependencyProperty.Register(
92
              "LeftBottomPoint", typeof(Point), typeof(SignControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
93
        public static readonly DependencyProperty AngleProperty = DependencyProperty.Register("Angle", typeof(double), typeof(SignControl),
94
                        new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
95
        public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register("CenterX", typeof(double), typeof(SignControl),
96
                        new PropertyMetadata((double)0, OnCenterXYChanged));
97
        public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register("CenterY", typeof(double), typeof(SignControl),
98
                        new PropertyMetadata((double)0, OnCenterXYChanged));
99
        public static readonly DependencyProperty IsSelectedProperty =
100
            DependencyProperty.Register("IsSelected", typeof(bool), typeof(SignControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
101
102
        public static readonly DependencyProperty ControlTypeProperty =
103
            DependencyProperty.Register("ControlType", typeof(ControlType), typeof(SignControl), new FrameworkPropertyMetadata(ControlType.Sign));
104
        #endregion
105
        #region PropertyChanged Method
106
        public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
107
        {
108
            var instance = (SignControl)sender;
109
            if (e.OldValue != e.NewValue && instance.Base_Image != null)
110
            {
111
                instance.SetValue(e.Property, e.NewValue);
112
                instance.SetImage();
113
            }
114
        }
115
        public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
116
        {
117
118
        }
119
            public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
120
        {
121
            var instance = (SignControl)sender;
122
            if (e.OldValue != e.NewValue && instance.Base_Image != null)
123
            {
124
                instance.SetValue(e.Property, e.NewValue);
125
                instance.SetImage();
126
            }
127
        }
128
        public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
129
        {
130
            var instance = (SignControl)sender;
131
            if (e.OldValue != e.NewValue && instance.Base_Image != null)
132
            {
133
                instance.SetValue(e.Property, e.NewValue);
134
                instance.SetImage();
135
            }
136
        }
137
        #endregion
138
        #region Properties
139
        public string UserID
140
        {
141
            get { return (string)GetValue(UserIDProperty); }
142
            set
143
            {
144
                if (this.UserID != value)
145
                {
146
                    SetValue(UserIDProperty, value);
147
                    RaisePropertyChanged("UserID");
148
                }
149
            }
150
        }
151 eeb0a39c taeseongkim
152 787a4489 KangIngu
        public double CenterX
153
        {
154
            get { return (double)GetValue(CenterXProperty); }
155
            set { SetValue(CenterXProperty, value); }
156
        }
157
        public double CenterY
158
        {
159
            get { return (double)GetValue(CenterYProperty); }
160
            set { SetValue(CenterYProperty, value); }
161
        }
162
        public Point EndPoint
163
        {
164
            get { return (Point)GetValue(EndPointProperty); }
165
            set
166
            {
167
                if (this.EndPoint != value)
168
                {
169
                    SetValue(EndPointProperty, value);
170
                    RaisePropertyChanged("EndPoint");
171
                }
172
            }
173
        }
174
        public List<Point> PointSet
175
        {
176
            get { return (List<Point>)GetValue(PointSetProperty); }
177
            set { SetValue(PointSetProperty, value); }
178
        }
179
        public Point StartPoint
180
        {
181
            get { return (Point)GetValue(StartPointProperty); }
182
            set
183
            {
184
                if (this.StartPoint != value)
185
                {
186
                    SetValue(StartPointProperty, value);
187
                    RaisePropertyChanged("StartPoint");
188
                }
189
            }
190
        }
191
        public string UserNumber
192
        {
193
            get { return (string)GetValue(UserNubmerProperty); }
194
            set
195
            {
196
                if (this.UserNumber != value)
197
                {
198
                    SetValue(UserNubmerProperty, value);
199
                    RaisePropertyChanged("UserNumber");
200
                }
201
            }
202
        }
203
        public Point TopRightPoint
204
        {
205
            get { return (Point)GetValue(TopRightPointProperty); }
206
            set
207
            {
208
                SetValue(TopRightPointProperty, value);
209
                RaisePropertyChanged("TopRightPoint");
210
            }
211
        }
212
        public Point LeftBottomPoint
213
        {
214
            get { return (Point)GetValue(LeftBottomPointProperty); }
215
            set
216
            {
217
                SetValue(LeftBottomPointProperty, value);
218
                RaisePropertyChanged("LeftBottomPoint");
219
            }
220
        }
221 fa48eb85 taeseongkim
        public override double CommentAngle
222 787a4489 KangIngu
        {
223
            get { return (double)GetValue(AngleProperty); }
224
            set
225
            {
226 fa48eb85 taeseongkim
                if (this.CommentAngle != value)
227 787a4489 KangIngu
                {
228
                    SetValue(AngleProperty, value);
229
                }
230
            }
231
        }
232
        public ImageSource SignImage
233
        {
234
            get { return (ImageSource)this.GetValue(SignImageProperty); }
235
            set { this.SetValue(SignImageProperty, value); }
236
        }
237
238 959b3ef2 humkyung
        public override bool IsSelected
239 787a4489 KangIngu
        {
240
            get
241
            {
242
                return (bool)GetValue(IsSelectedProperty);
243
            }
244
            set
245
            {
246
                SetValue(IsSelectedProperty, value);
247
            }
248
        }
249
250 5529d2a2 humkyung
        public override ControlType ControlType
251 787a4489 KangIngu
        {
252
            set
253
            {
254
                SetValue(ControlTypeProperty, value);
255
            }
256
            get
257
            {
258
                return (ControlType)GetValue(ControlTypeProperty);
259
            }
260
        }
261
262
        #endregion
263
        public override void OnApplyTemplate()
264
        {
265
            base.OnApplyTemplate();
266
            Base_Image = GetTemplateChild(PART_Image) as Image;
267
            SetImage();
268
        }
269 661b7416 humkyung
270
        private void SetImage()
271 787a4489 KangIngu
        {
272
            this.ApplyTemplate();
273
274
            Point mid = MathSet.FindCentroid(new List<Point>()
275
            {
276
                this.StartPoint,
277
                this.LeftBottomPoint,
278
                this.EndPoint,
279
                this.TopRightPoint,                
280
            });
281
282 fa48eb85 taeseongkim
            double AngleData = this.CommentAngle * -1;
283 787a4489 KangIngu
284
            PathFigure pathFigure = new PathFigure();
285
            pathFigure.StartPoint = MathSet.RotateAbout(mid, this.StartPoint, AngleData);
286
287
            LineSegment lineSegment0 = new LineSegment();
288
            lineSegment0.Point = MathSet.RotateAbout(mid, this.StartPoint, AngleData);
289
            pathFigure.Segments.Add(lineSegment0);
290
291
            LineSegment lineSegment1 = new LineSegment();
292
            lineSegment1.Point = MathSet.RotateAbout(mid, this.LeftBottomPoint, AngleData);
293
            pathFigure.Segments.Add(lineSegment1);
294
295
            LineSegment lineSegment2 = new LineSegment();
296
            lineSegment2.Point = MathSet.RotateAbout(mid, this.EndPoint, AngleData);
297
            pathFigure.Segments.Add(lineSegment2);
298
299
            LineSegment lineSegment3 = new LineSegment();
300
            lineSegment3.Point = MathSet.RotateAbout(mid, this.TopRightPoint, AngleData);
301
            pathFigure.Segments.Add(lineSegment3);
302
303
            PathGeometry pathGeometry = new PathGeometry();
304
            pathGeometry.Figures = new PathFigureCollection();
305
            pathFigure.IsClosed = true;
306
            pathGeometry.Figures.Add(pathFigure);
307 b1c2c6fe swate0609
308 787a4489 KangIngu
            this.Base_Image.Width = pathGeometry.Bounds.Width;
309
            this.Base_Image.Height = pathGeometry.Bounds.Height;
310 b1c2c6fe swate0609
311 787a4489 KangIngu
            this.Tag = pathGeometry;
312
313
            Canvas.SetLeft(this, MathSet.RotateAbout(mid, mid, AngleData).X - this.Base_Image.Width / 2);
314
            Canvas.SetTop(this, MathSet.RotateAbout(mid, mid, AngleData).Y - this.Base_Image.Height / 2);
315
        }
316
        public event PropertyChangedEventHandler PropertyChanged;
317
        protected void RaisePropertyChanged(string propName)
318
        {
319
            if (PropertyChanged != null)
320
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
321
        }
322 0d00f9c8 humkyung
323
        public override void UpdateControl()
324 787a4489 KangIngu
        {
325
            this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
326
            this.TopRightPoint = new Point(this.PointSet[3].X, this.PointSet[3].Y);
327
            this.LeftBottomPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
328
            this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y);
329
        }
330 036650a0 humkyung
331
        /// <summary>
332 a6272c57 humkyung
        /// call when mouse is moving while drawing control
333
        /// </summary>
334
        /// <author>humkyung</author>
335
        /// <param name="pt"></param>
336
        /// <param name="bAxisLocked"></param>
337 233ef333 taeseongkim
        public override  void OnCreatingMouseMove(Point pt, bool bAxisLocked)
338 a6272c57 humkyung
        {
339
            this.EndPoint = pt;
340
            this.LeftBottomPoint = new Point(this.StartPoint.X, this.EndPoint.Y);
341
            this.TopRightPoint = new Point(this.EndPoint.X, this.StartPoint.Y);
342 74abcf6f taeseongkim
343
            var _sign = Application.Current.FindResource("UserSign");
344
345
            if (this.StartPoint != this.EndPoint && this.SignImage == null && _sign != null)
346 a6272c57 humkyung
            {
347 74abcf6f taeseongkim
                //var _sign = GetUserSign.GetSign(this.UserNumber, this.ProjectNO);
348 366f00c2 taeseongkim
349 74abcf6f taeseongkim
                byte[] imageBytes = System.Convert.FromBase64String(_sign.ToString());
350 eeb0a39c taeseongkim
351 a6272c57 humkyung
                System.IO.MemoryStream stream = new System.IO.MemoryStream();
352
                stream.Write(imageBytes, 0, imageBytes.Length);
353
                stream.Position = 0;
354
                System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
355
                BitmapImage returnImage = new BitmapImage();
356
                returnImage.BeginInit();
357
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
358
                img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
359
                ms.Seek(0, System.IO.SeekOrigin.Begin);
360
                returnImage.StreamSource = ms;
361
                returnImage.EndInit();
362
                stream.Close();
363
364
                this.SignImage = returnImage;
365 b1c2c6fe swate0609
366 a6272c57 humkyung
            }
367 eeb0a39c taeseongkim
368 a6272c57 humkyung
            this.PointSet = new List<Point>
369
            {
370
                this.StartPoint,
371
                this.LeftBottomPoint,
372
                this.EndPoint,
373
                this.TopRightPoint,
374
            };
375
        }
376
377
        /// <summary>
378 d2114d3b humkyung
        /// move control point has same location of given pt along given delta
379
        /// </summary>
380
        /// <author>humkyung</author>
381
        /// <date>2019.06.20</date>
382
        /// <param name="pt"></param>
383
        /// <param name="dx"></param>
384
        /// <param name="dy"></param>
385 233ef333 taeseongkim
        public override void OnMoveCtrlPoint(Point pt, double dx, double dy, bool bAxisLocked = false)
386 d2114d3b humkyung
        {
387
            IPath path = (this as IPath);
388
389
            Point selected = MathSet.getNearPoint(path.PointSet, pt);
390
            selected.X += dx;
391
            selected.Y += dy;
392
393 9005f973 humkyung
            int idx = (this as IPath).PointSet.FindIndex(x => x.Equals(pt));
394
395
            var OppositeP = (idx + path.PointSet.Count / 2) % path.PointSet.Count;
396
            var PreviousP = (idx + (path.PointSet.Count - 1)) % path.PointSet.Count;
397
            var NextP = (idx + 1) % path.PointSet.Count;
398 d2114d3b humkyung
399 ab7fe8c0 humkyung
            if (bAxisLocked)
400
            {
401 9005f973 humkyung
                var PrevV = path.PointSet[PreviousP] - path.PointSet[OppositeP];
402
                double PrevLength = PrevV.Length;
403
                PrevV.Normalize();
404 d2114d3b humkyung
405 ab7fe8c0 humkyung
                var NextV = path.PointSet[NextP] - path.PointSet[OppositeP];
406 9005f973 humkyung
                double NextVLength = NextV.Length;
407 ab7fe8c0 humkyung
                NextV.Normalize();
408 d2114d3b humkyung
409 9005f973 humkyung
                double _dx = selected.X - path.PointSet[OppositeP].X;
410
                double _dy = selected.Y - path.PointSet[OppositeP].Y;
411
                var dir = new Vector(_dx, _dy);
412
                if (PrevLength > NextVLength)
413
                {
414
                    double ratio = NextVLength / PrevLength;
415
416
                    double dot = MathSet.DotProduct(PrevV.X, PrevV.Y, dir.X, dir.Y);
417
418
                    path.PointSet[PreviousP] = path.PointSet[OppositeP] + PrevV * dot;
419
                    path.PointSet[NextP] = path.PointSet[OppositeP] + NextV * dot * ratio;
420
                    path.PointSet[idx] = path.PointSet[OppositeP] + PrevV * dot + NextV * dot * ratio;
421
                }
422
                else
423
                {
424
                    double ratio = PrevLength / NextVLength;
425
426
                    double dot = MathSet.DotProduct(NextV.X, NextV.Y, dir.X, dir.Y);
427
428
                    path.PointSet[PreviousP] = path.PointSet[OppositeP] + PrevV * dot * ratio;
429
                    path.PointSet[NextP] = path.PointSet[OppositeP] + NextV * dot;
430
                    path.PointSet[idx] = path.PointSet[OppositeP] + PrevV * dot * ratio + NextV * dot;
431
                }
432 ab7fe8c0 humkyung
            }
433
            else
434
            {
435
                var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[OppositeP], path.PointSet[PreviousP]);
436 9005f973 humkyung
                var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[idx].X - path.PointSet[OppositeP].X,
437
                    path.PointSet[idx].Y - path.PointSet[OppositeP].Y);
438 ab7fe8c0 humkyung
                path.PointSet[PreviousP] = new Point(path.PointSet[OppositeP].X + PreviousV.X * l, path.PointSet[OppositeP].Y + PreviousV.Y * l);
439
440
                var NextV = MathSet.GetNormVectorBetween(path.PointSet[OppositeP], path.PointSet[NextP]);
441 9005f973 humkyung
                l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[idx].X - path.PointSet[OppositeP].X, path.PointSet
442
                    [idx].Y - path.PointSet[OppositeP].Y);
443 ab7fe8c0 humkyung
                path.PointSet[NextP] = new Point(path.PointSet[OppositeP].X + NextV.X * l, path.PointSet[OppositeP].Y + NextV.Y * l);
444 9005f973 humkyung
445
                path.PointSet[idx] = selected;
446 ab7fe8c0 humkyung
            }
447 d2114d3b humkyung
448 0d00f9c8 humkyung
            this.UpdateControl();
449 d2114d3b humkyung
        }
450
451
        /// <summary>
452 91efe37a humkyung
        /// return SignControl's area
453
        /// </summary>
454
        /// <author>humkyung</author>
455
        /// <date>2019.06.13</date>
456
        public override Rect ItemRect
457
        {
458
            get
459
            {
460
                double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X);
461
                double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y);
462
                double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X);
463
                double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y);
464
465
                return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY));
466
            }
467
        }
468
469
        /// <summary>
470 036650a0 humkyung
        /// Serialize this
471
        /// </summary>
472
        /// <param name="sUserId"></param>
473
        /// <returns></returns>
474
        public override string Serialize()
475
        {
476
            using (S_SignControl STemp = new S_SignControl())
477
            {
478 fa48eb85 taeseongkim
                STemp.Angle = this.CommentAngle;
479 036650a0 humkyung
                STemp.EndPoint = this.EndPoint;
480
                STemp.UserID = this.UserID;
481
                STemp.LB = this.LeftBottomPoint;
482
                STemp.Name = this.GetType().Name;
483
                STemp.PointSet = this.PointSet;
484
                STemp.StartPoint = this.StartPoint;
485
                STemp.Opac = this.Opacity;
486
                STemp.TR = this.TopRightPoint;
487
                STemp.UserNumber = this.UserNumber == null ? this.UserID: this.UserNumber;
488
489
                ///강인구 추가(2017.11.02)
490
                ///Memo 추가
491
                STemp.Memo = this.Memo;
492
493
                return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize()));
494
            }
495
        }
496
497 661b7416 humkyung
        /// <summary>
498
        /// create a signcontrol from given string
499
        /// </summary>
500
        /// <param name="str"></param>
501
        /// <returns></returns>
502
        public static SignControl FromString(string str, SolidColorBrush brush, string sProjectNo)
503
        {
504
            SignControl instance = null;
505
            using (S_SignControl s = JsonSerializerHelper.JsonDeserialize<S_SignControl>(str))
506
            {
507
                instance = new SignControl
508
                {
509 fa48eb85 taeseongkim
                    CommentAngle = s.Angle,
510 661b7416 humkyung
                    StartPoint = s.StartPoint,
511
                    TopRightPoint = s.TR,
512
                    EndPoint = s.EndPoint,
513
                    LeftBottomPoint = s.LB,
514
                    PointSet = s.PointSet,
515
                    Opacity = s.Opac,
516
                    SignImage = null,
517
                    UserID = s.UserID,
518 8f15cc2b humkyung
                    UserNumber = s.UserNumber,
519 661b7416 humkyung
                    Memo = s.Memo
520
                };
521
522
                if (s.UserNumber != null)
523
                {
524
                    var _sign = GetUserSign.GetSign(s.UserNumber, sProjectNo);
525
                    if (_sign != null)
526
                    {
527
                        byte[] imageBytes = System.Convert.FromBase64String(_sign);
528
529
                        BitmapImage returnImage = new BitmapImage();
530 ac4f1e13 taeseongkim
531
                        using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
532
                        {
533
                            stream.WriteAsync(imageBytes, 0, imageBytes.Length);
534 366f00c2 taeseongkim
535 ac4f1e13 taeseongkim
                            stream.Position = 0;
536
                            System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
537
                            returnImage.BeginInit();
538
                            System.IO.MemoryStream ms = new System.IO.MemoryStream();
539
                            img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
540
                            ms.Seek(0, System.IO.SeekOrigin.Begin);
541
                            returnImage.StreamSource = ms;
542
                            returnImage.EndInit();
543
                            stream.Close();
544
                        }
545
546 661b7416 humkyung
                        instance.SignImage = returnImage;
547
                    }
548
                }
549
            }
550
551
            return instance;
552
        }
553
554
        public double LineSize
555 787a4489 KangIngu
        {
556
            get;
557
            set;
558
        }
559
        public Geometry PathData
560
        {
561
            get;
562
            set;
563
        }
564
    }
565
}
클립보드 이미지 추가 (최대 크기: 500 MB)