프로젝트

일반

사용자정보

개정판 129ca191

ID129ca1915a4614cbe559ed03a5986204fa8631df
상위 3ffd4b2d
하위 f9fb5500, 073f6118

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

issue #923: fixed save changed controls logic

Change-Id: I434adb979a8adcf0407d75504e0ecfc48085f988

차이점 보기:

KCOM/Controls/Sample.xaml.cs
51 51
        private List<DOCPAGE> _PageList = null;
52 52
        private string _DefaultUri = null;
53 53
        public ThumbnailItem CurrentPage = null;
54
        ///public ThumbnailItem _NextPage = null;
55 54
        public int PageCount = 0;
56 55

  
57 56
        private bool _Initialize;
......
143 142
            SetCommentPages();
144 143
        }
145 144

  
145
        /// <summary>
146
        /// called when image list box's selection is changed
147
        /// </summary>
148
        /// <param name="sender"></param>
149
        /// <param name="e"></param>
146 150
        private void ImgListbox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
147 151
        {            
148 152
            if (ImgListbox.SelectedItem != null)
149 153
            {
150 154
                int _CurrentPageNo = -1;
151
                if (this.CurrentPage != null) _CurrentPageNo = this.CurrentPage.PageNumber;
155
                if (this.CurrentPage != null)
156
                {
157
                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);   /// save controls
158
                    _CurrentPageNo = this.CurrentPage.PageNumber;
159
                }
152 160

  
153
                int iPageNo = ((ImgListbox.SelectedItem as ThumbnailItem).PageNumber);
161
                this.CurrentPage = ImgListbox.SelectedItem as ThumbnailItem;
162
                int iPageNo = this.CurrentPage.PageNumber;
154 163
                if(_CurrentPageNo != iPageNo)
155 164
                {
156
                    ///this.CurrentPage = this._NextPage;
157
                    ///this._NextPage = thumbnailItem;
158 165
                    PageChanging(this, new PageChangeEventArgs
159 166
                    {
160 167
                        CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == iPageNo).First(),
......
168 175
            if(border!= null)
169 176
            {
170 177
                IEnumerable<ScrollViewer> scrollViewer = border.ChildrenOfType<ScrollViewer>();
171

  
172 178
            }
173 179
        }
174 180

  
......
214 220
            if ((PageChanged != null) && (thumbitem != null))
215 221
            {
216 222
                var uri = _DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString());
217
                //var _thumbitem = _thumbnailItems.Where(item => item.PageNumber == DocPage.PageNumber).First();
218 223

  
219 224
                var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber);
220 225
                if (_DocPages.Count() > 0)
KCOM/Events/Implementation/TopMenuEvent.cs
34 34
        public bool isClosed = true;
35 35
        public RadWindow CheckPop;
36 36
        public RadWindow OptionPop;
37
        public MarkupToPDF.Common.Undo_data UndoData;
38
        MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
39 37

  
40 38
        /// <summary>
41 39
        /// TaskBar에 메시지를 입력합니다
......
44 42
        /// <param name="type"></param>
45 43
        public void TaskMessage(string message, TaskMessageType type)
46 44
        {
47
            //if (taskBar != null)
48
            //{
49
            //    string color = "";
50
            //    taskBar.Content = message;
51
            //    DicTaskMessage.TryGetValue(type, out color);
52
            //    taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
53
            //}
45
            /*
46
            if (taskBar != null)
47
            {
48
                string color = "";
49
                taskBar.Content = message;
50
                DicTaskMessage.TryGetValue(type, out color);
51
                taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
52
            }
53
            */
54 54
        }
55 55

  
56 56
        /// <summary>
......
119 119
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
120 120
                });
121 121
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
122
                
123

  
124 122
            }
125

  
126 123
        }
127 124

  
128 125
        private void SetHighlightEvent()
......
236 233
            SetPaintEvent();
237 234
        }
238 235

  
239
 		//강인구 추가
240
        private string SetColor(string ID)
241
        {
242
            try
243
            {
244
                return ViewerDataModel.Instance._markupInfoList.Where(info => info.MarkupInfoID == ID).First().DisplayColor;
245
            }
246
            catch (Exception)
247
            {
248
                return "#FFFFFF";
249
            }
250
        }
251

  
252 236
        void SaveTimer_Tick(object sender, EventArgs e)
253 237
        {
254 238
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
......
335 319
                // update mylist and gridview
336 320
                menu.UpdateMyMarkupList();
337 321

  
338
                if (ViewerDataModel.Instance.UndoDataList.Count == 0) return;
339

  
340
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
341
                {
342
                    this.ExecuteSaveCommand(menu);
343
                }
344
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
322
                if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
345 323
                {
346 324
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
347 325
                }
......
355 333
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
356 334
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
357 335
                            {
358
                                if (ViewerDataModel.Instance.IsPressCtrl)
359
                                {
360
                                    ViewerDataModel.Instance.IsPressCtrl = false;
361
                                }
336
                                if (ViewerDataModel.Instance.IsPressCtrl) ViewerDataModel.Instance.IsPressCtrl = false;
362 337
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
363 338
                            }
364 339
                        }
......
404 379
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
405 380
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
406 381
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
407
            SaveCommand.Instance.page_no = Convert.ToInt32(tlcurrentPage.Text);
382
            SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
408 383

  
409 384
            try
410 385
            {
411
                this.ParentOfType<MainWindow>().dzMainMenu.ConvertInkControlToPolygon();
412

  
413
                List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
414
                foreach (var item in menu.gridViewMarkup.SelectedItems)
386
                if (ViewerDataModel.Instance.UndoDataList.Count > 0)
415 387
                {
416
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
388
                    List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
389
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
417 390
                    {
418
                        SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
391
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
392
                        {
393
                            SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
394
                        }
419 395
                    }
396

  
397
                    SaveCommand.Instance.Execute(SelectedMarkupInfos);
420 398
                }
421 399

  
422
                
423
                SaveCommand.Instance.Execute(SelectedMarkupInfos, SaveCommand.Instance.page_no);
424
                SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
400
                if(ViewerDataModel.Instance.RotationDocs.Count > 0)
401
                    SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
425 402
            }
426 403
            catch (Exception ex)
427 404
            {
......
2681 2658
                        {
2682 2659
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2683 2660
                            {
2684
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2685
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2661
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2662
                                MarkupData += "|OR|" + res.ConvertData;
2686 2663
                            }
2687 2664
                        }
2688 2665
                        Clipboard.SetText(MarkupData);
......
2705 2682
                        {
2706 2683
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2707 2684
                            {
2708
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2709
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2685
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2686
                                MarkupData += "|OR|" + res.ConvertData;
2710 2687
                            }
2711 2688
                        }
2712 2689
                        //클립보드에 넣음
......
2733 2710
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2734 2711

  
2735 2712
                //강인구 Undo/Redo 보류
2736
                UndoData = new Undo_data()
2713
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2737 2714
                {
2738 2715
                    IsUndo = false,
2739 2716
                    Event = Event_Type.Create,
......
2802 2779
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2803 2780

  
2804 2781
                    //강인구 Undo/Redo 보류
2805
                    UndoData = new Undo_data()
2782
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2806 2783
                    {
2807 2784
                        IsUndo = false,
2808 2785
                        Event = Event_Type.Create,
KCOM/Events/SaveCommand.cs
71 71
        /// </summary>
72 72
        /// <param name="UserState"></param>
73 73
        /// <param name="iPageNo"></param>
74
        public void Execute(ICollection<MarkupInfoItem> UserStates, int iPageNo)
74
        public void Execute(ICollection<MarkupInfoItem> UserStates)
75 75
        {
76 76
            try
77 77
            {
78 78
                foreach (var UserState in UserStates)
79 79
                {
80 80
                    List<MARKUP_DATA> markupdata = new List<MARKUP_DATA>();
81
                    ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.CommentID).Select(g => g.First()).ToList().ForEach(value =>
81
                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.MarkupInfoID == UserState.MarkupInfoID).ToList().GroupBy(p => p.ID).Select(g => g.First()).ToList().ForEach(value =>
82 82
                    {
83
                        markupdata.Add(value.GetMarkupData(App.ViewInfo.UserID, iPageNo, UserState.MarkupVersionID));
83
                        var control = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, value.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "",
84
                                        value.MarkupInfoID, value.ID);
85
                        markupdata.Add((control as CommentUserInfo).GetMarkupData(App.ViewInfo.UserID, value.PageNumber, UserState.MarkupVersionID));
84 86
                    });
85 87

  
86
                    Logger.sendReqLog("GetMarkupDataListperPage: ", UserState + "," + Project_No + "," + document_id + "," + user_id + "," + markupdata, 1);
87 88
                    Logger.sendResLog("GetMarkupDataListperPage", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveMarkupData(UserState, Project_No, document_id, user_id, markupdata).ToString(), 1);
88 89
                }
89 90
                TempFile.Remove(); //임시파일삭제
......
136 137
                throw;
137 138
            }
138 139
        }
140

  
139 141
        public void PageAngleSave(string project_no, List<DOCPAGE> _mldocpage)
140 142
        {
141 143
            try
142 144
            {
143

  
144 145
                Logger.sendReqLog("SavePageAngle: ", project_no + "," + _mldocpage, 1);
145 146
                Logger.sendResLog("SavePageAngle", Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SavePageAngle(project_no, _mldocpage).ToString(), 1);
146 147
                Common.ViewerDataModel.Instance.RotationDocs.Clear();
KCOM/Services/BaseServices.cs
374 374
                gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
375 375
                SetCommentPages();
376 376

  
377
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.GotoPage(1);
377 378
                var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault();
378 379
                this.gridViewMarkup.SelectedItem = (PreviewUserMarkupInfoItem != null) ? PreviewUserMarkupInfoItem : SelectedItem;
379 380

  
......
485 486
                            var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
486 487
                            if (controls.Count == 0)
487 488
                            {
488
                                var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
489
                                var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
489 490
                                foreach (var markup in instance)
490 491
                                {
491 492
                                    MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", 
......
505 506
                            var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
506 507
                            if (controls.Count == 0)
507 508
                            {
508
                                var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == ViewerDataModel.Instance.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
509
                                var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
509 510
                                foreach (var markup in instance)
510 511
                                {
511 512
                                    MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "",
KCOM/Views/MainMenu.xaml.cs
297 297
            return false;
298 298
        }
299 299

  
300

  
301 300
        public void DeleteItem(MarkupInfoItem item)
302 301
        {
303 302
            if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0)
......
319 318

  
320 319
            ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a =>
321 320
            {
322
                ComingNewBieEnd = false;
323 321
                ViewerDataModel.Instance.MyMarkupList.Remove(a);
324 322
                //임시파일에서도 삭제
325 323
                TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString());
......
435 433
        public void UpdateMyMarkupList()
436 434
        {
437 435
            Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1);
438
            bool isComingNewBie = false;
439 436

  
440 437
            /// add or update markup list
441 438
            foreach (var control in ViewerDataModel.Instance.MarkupControls_USER)
......
449 446
                    {
450 447
                        exist.Data = root.ConvertData;
451 448
                        exist.IsUpdate = true;
452
                        ComingNewBieEnd = false;
453 449
                    }
454 450
                }
455 451
                else if (root.CommentID != null)
456 452
                {
457
                    isComingNewBie = true;
458 453
                    ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx
459 454
                    {
460 455
                        ID = control.CommentID,
......
465 460
                        Symbol_ID = control.SymbolID,
466 461
                        //Group_ID = control.GroupID,
467 462
                    });
468
                    ComingNewBieEnd = false;
469 463
                }
470 464
            }
471 465

  
472 466
            /// delete markup list
473
            int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text);
467
            int iPageNo = this.pageNavigator.CurrentPage.PageNumber;
474 468
            var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList
475 469
                          where (markup.PageNumber == iPageNo) && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault())
476 470
                          select markup).ToList();
477 471
            foreach(var markup in deleted) ViewerDataModel.Instance.MyMarkupList.Remove(markup);
478 472
            /// up to here
479 473

  
480
            if (isComingNewBie && !ComingNewBieEnd)
481
            {
482
                if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
483
                {
484
                    ComingNewBieEnd = true;
485
                    ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
486
                    PreviewUserMarkupInfoItem.IsPreviewUser = false;
487
                    gridViewMarkup.ItemsSource = null;
488
                    gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
489
                    gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
490

  
491
                    GroupDescriptor descriptor = new GroupDescriptor();
492
                    descriptor.Member = "Depatment";
493
                    descriptor.DisplayContent = "DEPT";
494
                    descriptor.SortDirection = ListSortDirection.Ascending;
495
                    gridViewMarkup.GroupDescriptors.Add(descriptor);
496
                }
497
            }
474
            //if (modified)
475
            //{
476
            //    if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null)
477
            //    {
478
            //        ComingNewBieEnd = true;
479
            //        ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
480
            //        PreviewUserMarkupInfoItem.IsPreviewUser = false;
481
            //        gridViewMarkup.ItemsSource = null;
482
            //        gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
483
            //        gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
484

  
485
            //        GroupDescriptor descriptor = new GroupDescriptor();
486
            //        descriptor.Member = "Depatment";
487
            //        descriptor.DisplayContent = "DEPT";
488
            //        descriptor.SortDirection = ListSortDirection.Ascending;
489
            //        gridViewMarkup.GroupDescriptors.Add(descriptor);
490
            //    }
491
            //}
498 492
        }
499 493

  
500
        bool ComingNewBieEnd = false;
501

  
502 494
        /// <summary>
503 495
        /// start page changing
504 496
        ///  - save controls if page is modified
......
508 500
        /// <param name="e"></param>
509 501
        private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
510 502
        {
511
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);
512

  
513 503
            CompareMode.IsChecked = false;
514 504
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber;
515 505

  

내보내기 Unified diff

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