프로젝트

일반

사용자정보

개정판 2a824927

ID2a82492728d6e1784e9cd794c6fc044137e3df78
상위 cda7efcc
하위 299f2c11

이지연이(가) 5달 전에 추가함

issue #000: Cut 후 Undo시 Error 수정

Change-Id: Id339fee3cecf320d88094857a96c78dd0559bac7

차이점 보기:

KCOM/Controls/AdornerFinal.xaml.cs
248 248
        public AdornerFinal(List<CommentUserInfo> comments) : this()
249 249
        {
250 250
            InitializeComponent();
251

  
252
            comments.ForEach(x => x.Index = ViewerDataModel.Instance.MarkupControls_USER.IndexOf(x)); 
251
            //comments.ForEach(x => x.Index = ViewerDataModel.Instance.MarkupControls_USER.IndexOf(x));          
252
            RemoveMultipleFromCanvas(comments);
253 253
            foreach (var item in comments)
254 254
            {
255 255
                if (item is ArrowTextControl ArrTextCtrl)
......
258 258
                }
259 259
                try
260 260
                {
261
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
261
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);                  
262 262
                    this.ContainerContent.Children.Add(item);
263 263
                }
264 264
                catch (Exception ex)
......
274 274
            this.Focus();
275 275
        }
276 276

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

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

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

  
277 307
        ~AdornerFinal()
278 308
        {
279 309
            this.Dispose(false);

내보내기 Unified diff

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