프로젝트

일반

사용자정보

개정판 b2d0f316

IDb2d0f316125ad5439e7530cf5ec796805b5d1dd4
상위 ff2f8d1d
하위 5c3caba6

백흠경이(가) 5달 전에 추가함

Feature: 선택한 객체를 앞으로(+)/뒤로(-) 보내기 기능 추가

Change-Id: I9130a93cfdb2d079f28258f3d669a6f532695f89

차이점 보기:

MarkupToPDF/Controls/Parsing/MarkupParse.cs
29 29
using MarkupToPDF.Controls.Cad;
30 30
using MarkupToPDF.Controls.Common;
31 31
using System.Threading.Tasks;
32
using System.ComponentModel;
32 33

  
33 34
namespace MarkupToPDF.Controls.Parsing
34 35
{
......
45 46

  
46 47
        public static MarkupReturn MarkupToString(CommentUserInfo Control, string UserId)
47 48
        {
48
            MarkupReturn Data = new MarkupReturn();
49
            Data.ConvertData = "";
50
            Data.DATA_TYPE = (int)Control.ControlType;
51
            Data.CommentID = Control.CommentID;
52
            if (Data.CommentID == null)
49
            MarkupReturn res = new MarkupReturn();
50
            res.DATA_TYPE = (int)Control.ControlType;
51
            res.CommentID = Control.CommentID;
52
            if (res.CommentID == null)
53 53
            {
54
                Data.CommentID = shortGuid();
54
                res.CommentID = shortGuid();
55 55
            }
56 56

  
57
            Data.ConvertData = Control.Serialize();
57
            res.ConvertData = "";
58
            res.ConvertData = Control.Serialize();
58 59

  
59
            return Data;
60
            return res;
60 61
        }
61 62

  
62 63
        /// <summary>
......
277 278
        }
278 279

  
279 280
        /// <summary>
280
        /// 데이터베이스의 마크업데이터를 컨트롤로 변환한다.
281
        /// 데이터베이스의 마크업데이터를 컨트롤로 변환하여 baseLayer에 추가한다.
281 282
        /// </summary>
282 283
        /// <param name="MarkupString"></param>
283
        public static async Task<Control> ParseExAsync(string baseUri, System.Threading.CancellationToken? cts,string sProjectNo, string MarkupString, ObservableCollection<CommentUserInfo> baseLayer,double PageAngle, string DisplayColor, string ToolTipMessage, string markupInfoID = null, string commentId = null,Dictionary<string,string> STAMP_Contents = null)
284
        public static async Task<Control> ParseExAsync(string baseUri, System.Threading.CancellationToken? cts,string sProjectNo, 
285
            string MarkupString, ObservableCollection<CommentUserInfo> baseLayer,double PageAngle, string DisplayColor, string ToolTipMessage, string markupInfoID = null, string commentId = null,Dictionary<string,string> STAMP_Contents = null)
284 286
        {
285 287
            Control res = null;
286 288

  
287
            if (MarkupString != "False")
289
            if (string.IsNullOrEmpty(MarkupString) || MarkupString == "False") return res;
290

  
291
            SolidColorBrush _SetColor = new SolidColorBrush(Common.ValueConverter.StringToColorConverter.Parse(DisplayColor));
292
            string[] delimiterChars = { "|DZ|" };
293
            string[] delimiterChars2 = { "|" };
294
            string[] data = MarkupString.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
295

  
296
            foreach (var dataPease in data)
288 297
            {
289
                SolidColorBrush _SetColor = new SolidColorBrush(Common.ValueConverter.StringToColorConverter.Parse(DisplayColor));
290
                string[] delimiterChars = { "|DZ|" };
291
                string[] delimiterChars2 = { "|" };
292
                string[] data = MarkupString.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
298
                string item = await JsonSerializerHelper.UnCompressStringAsync(dataPease, null); //언패킹작업
299

  
300
                CommentUserInfo control = MarkupParser.FromString(baseUri, item, _SetColor, sProjectNo, PageAngle);
293 301

  
294
                foreach (var dataPease in data)
302
                res = control as Control;
303
                if (control != null)
295 304
                {
296
                    string item = "";
297
                    item = await JsonSerializerHelper.UnCompressStringAsync(dataPease, null); //언패킹작업
298
                    //if (cts == null)
299
                    //{
300
                    //    item = await JsonSerializerHelper.UnCompressStringAsync(dataPease, null); //언패킹작업
301
                    //}
302
                    //else
303
                    //{
304
                    //    if(cts.Value.IsCancellationRequested)
305
                    //    {
306
                    //        return null;
307
                    //    }
308

  
309
                    //    item = await JsonSerializerHelper.UnCompressStringAsync(dataPease, cts); //언패킹작업
310
                    //}
311

  
312
                    CommentUserInfo control = MarkupParser.FromString(baseUri, item, _SetColor, sProjectNo, PageAngle);
313

  
314
                    res = control as Control;
315
                    if (control != null)
305
                    if (!string.IsNullOrEmpty(commentId)) control.CommentID = commentId;
306
                    if (!string.IsNullOrEmpty(markupInfoID)) control.MarkupInfoID = markupInfoID;
307
                    if (baseLayer != null)
316 308
                    {
317
                        if (!string.IsNullOrEmpty(commentId)) control.CommentID = commentId;
318
                        if (!string.IsNullOrEmpty(markupInfoID)) control.MarkupInfoID = markupInfoID;
319
                        if (baseLayer != null)
320
                        {
321
                            baseLayer.Add(control);
322
                            control.ApplyTemplate();
309
                        baseLayer.Add(control);
310
                        control.ApplyTemplate();
311
                        Canvas.SetZIndex(control, control.ZIndex);
323 312

  
324
                            if (control is ArrowTextControl)
325
                            {
326
                                ArrowTextControl _instance = control as ArrowTextControl;
327
                                if (_instance.UnderLine == TextDecorations.Underline)
328
                                {
329
                                    _instance.Base_TextBox.TextDecorations = _instance.UnderLine;
330
                                }
331
                                _instance.Base_TextBox.IsHitTestVisible = false;
332
                            }
333
                            else if (control is TextControl)
313
                        if (control is ArrowTextControl ArrTextCtrl)
314
                        {
315
                            if (ArrTextCtrl.UnderLine == TextDecorations.Underline)
334 316
                            {
335
                                TextControl text = control as TextControl;
336
                                text.Base_TextBlock.TextDecorations = text.UnderLine;
337
                                text.Base_TextBlock.Margin = new Thickness(0, 0, 10, 0);
338
                                text.Base_TextBox.Visibility = Visibility.Collapsed;
339
                                text.Base_TextBlock.Visibility = Visibility.Visible;
317
                                ArrTextCtrl.Base_TextBox.TextDecorations = ArrTextCtrl.UnderLine;
340 318
                            }
341
                            else if (control is SymControlN)
342
                            {
343
                                SymControlN _instance = control as SymControlN;
344

  
345
                                var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStamp(_instance.PathXathData);
346
                                
347
                                System.IO.MemoryStream stream = new System.IO.MemoryStream();
348
                                System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
349
                                xamlData = xamlData.Replace("#FFFF0000", DisplayColor);
319
                            ArrTextCtrl.Base_TextBox.IsHitTestVisible = false;
320
                        }
321
                        else if (control is TextControl TextCtrl)
322
                        {
323
                            TextCtrl.Base_TextBlock.TextDecorations = TextCtrl.UnderLine;
324
                            TextCtrl.Base_TextBlock.Margin = new Thickness(0, 0, 10, 0);
325
                            TextCtrl.Base_TextBox.Visibility = Visibility.Collapsed;
326
                            TextCtrl.Base_TextBlock.Visibility = Visibility.Visible;
327
                        }
328
                        else if (control is SymControlN SymCtrl)
329
                        {
330
                            var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStamp(SymCtrl.PathXathData);
331
                            
332
                            System.IO.MemoryStream stream = new System.IO.MemoryStream();
333
                            System.IO.StreamWriter writer = new System.IO.StreamWriter(stream);
334
                            xamlData = xamlData.Replace("#FFFF0000", DisplayColor);
350 335

  
351
                                if (STAMP_Contents?.Count > 0)
336
                            if (STAMP_Contents?.Count > 0)
337
                            {
338
                                foreach (var Content in STAMP_Contents)
352 339
                                {
353
                                    foreach (var Content in STAMP_Contents)
354
                                    {
355
                                        xamlData = xamlData.Replace(Content.Key, System.Security.SecurityElement.Escape(Content.Value));
356
                                    }
340
                                    xamlData = xamlData.Replace(Content.Key, System.Security.SecurityElement.Escape(Content.Value));
357 341
                                }
342
                            }
358 343

  
359
                                writer.Write(xamlData);
360
                                writer.Flush();
361
                                stream.Position = 0;
344
                            writer.Write(xamlData);
345
                            writer.Flush();
346
                            stream.Position = 0;
362 347

  
363
                                object obj = XamlReader.Load(stream);
364
                                _instance.Base_ViewBox.Child = obj as UIElement;
365
                                _instance.SetViewBox();
366
                            }
348
                            object obj = XamlReader.Load(stream);
349
                            SymCtrl.Base_ViewBox.Child = obj as UIElement;
350
                            SymCtrl.SetViewBox();
367 351
                        }
368 352
                    }
369 353
                }

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)