프로젝트

일반

사용자정보

개정판 7fa95b67

ID7fa95b67b2188294dfc9d6c9ea6ab79f3fae90cb
상위 5a223b60
하위 26c9c3bf

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

Fix: 이미지 심볼 배치 오류 수정

Change-Id: Ice2ccb7ab56cedc7adc7c535d95c410d01001cd3

차이점 보기:

KCOM/Common/Commons.cs
1 1
using System;
2
using System.Net.Http;
2 3
using System.Text;
4
using System.Threading.Tasks;
3 5

  
4 6
namespace KCOM.Common
5 7
{
......
34 36

  
35 37
            return System.IO.Path.GetRandomFileName();
36 38
        }
39

  
40
        /// <summary>
41
        /// url의 파일이 존재하는지 검사하여 결과를 리턴한다.
42
        /// </summary>
43
        /// <param name="url"></param>
44
        /// <returns></returns>
45
        public static async Task<bool> DoesFileExist(string url)
46
        {
47
            using (HttpClient client = new HttpClient())
48
            {
49
                var restponse = await client.GetAsync(url);
50

  
51
                return restponse.StatusCode == System.Net.HttpStatusCode.OK;
52
            }
53
        }
37 54
    }
38 55
}
KCOM/Controls/Symbol.xaml.cs
420 420
                };
421 421

  
422 422
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
423
                //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
424 423
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
425 424
            }
426 425
            catch (Exception)
......
453 452

  
454 453
        private async void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
455 454
        {
456
            //Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
457 455
            await DataBindAsync();
458 456
        }
459 457

  
460 458
        private async void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
461 459
        {
462
            //Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
463 460
            await DataBindAsync();
464 461
        }
465 462

  
......
509 506
        /// <param name="id"></param>
510 507
        private async Task PlaceSymbol(string id, Point CurrentMousePoint)
511 508
        {
512
            string Data_ = "";
513

  
514 509
            var systemMain = Common.ViewerDataModel.Instance.SystemMain;
515 510
            var mainMenu = systemMain.dzMainMenu;
516 511
            
......
518 513

  
519 514
            try
520 515
            {
521
                Data_ = mainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex);
522
                if (string.IsNullOrEmpty(Data_)) return;
523

  
524
                if (Data_.Contains("|DZ|"))
516
                string Data_ = mainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex);
517
                if (!string.IsNullOrEmpty(Data_) && Data_.Contains("|DZ|"))
525 518
                {
526 519
                    List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
527 520

  
528 521
                    string[] delimiterChars = { "|DZ|" };
529 522
                    string[] data = Data_.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
530 523

  
531
                    UndoData multi_UndoData = new UndoData();
532 524
                    UndoDataGroup = new UndoDataGroup()
533 525
                    {
534 526
                        IsUndo = false,
......
552 544

  
553 545
                            adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
554 546

  
555
                            multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
556

  
547
                            var multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
557 548
                            UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
558 549
                            ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
559 550
                        }
......
576 567

  
577 568
                    mainMenu.SelectLayer.Children.Add(final);
578 569

  
579

  
580 570
                    //var finalPosition = new Point(Canvas.GetLeft(final), Canvas.GetTop(final));
581 571
                    //Rect rect = new Rect(finalPosition, Point.Add(finalPosition,new Vector(final.Width,final.Height)));
582 572

  
......
585 575
                }
586 576
                else
587 577
                {
588
                    PlaceImageSymbol(id, 0);
578
                    await PlaceImageSymbol(id, 0);
589 579
                }
590 580
            }
591 581
            catch (Exception ex)
......
608 598
            return targetPoint;
609 599
        }
610 600

  
611

  
612

  
613
        private void PlaceImageSymbol(string id, long group_id)
601
        /// <summary>
602
        /// 이미지 심볼을 배치한다.
603
        /// </summary>
604
        /// <param name="id"></param>
605
        /// <param name="group_id"></param>
606
        private async Task PlaceImageSymbol(string id, long group_id)
614 607
        {
615
           
616
            //canvasZoommovingMouseDownPoint
617
            string Data_ = "";
618

  
619 608
            try
620 609
            {
621
                //Logger.sendReqLog("GetSymbolImageURL: ", id + "," + RadTab.SelectedIndex, 1);
622
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, RadTab.SelectedIndex);
623
                if (Data_ != null || Data_ != "")
610
                string FilePath = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, RadTab.SelectedIndex);
611
                if (!string.IsNullOrEmpty(FilePath))
624 612
                {
625
                    //Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
626
                }
627
                else
628
                {
629
                    //Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
630
                }
631

  
632
                //MARKUP_DATA_GROUP INSERT
633
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
634
                //{
635
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
636
                //    STATE = 0,
637
                //};
638
                //long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
639
                ////Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
613
                    bool exists = await Commons.DoesFileExist(FilePath);
614
                    if (!exists)
615
                    {
616
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert($"{FilePath} doesn't exist", "Warning");
617
                        return;
618
                    }
640 619

  
641
                if (Data_ != null)
642
                {
643 620
                    Image img = new Image();
644
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
645
                    if (Data_.Contains(".svg"))
621
                    if (FilePath.Contains(".svg"))
646 622
                    {
647
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(Data_);
623
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(FilePath);
648 624
                        img.Source = (DrawingImage)svgImage.ProvideValue(null);
649 625
                    }
650 626
                    else
651 627
                    {
652
                        img.Source = new BitmapImage(new Uri(Data_));
628
                        img.Source = new BitmapImage(new Uri(FilePath));
653 629
                    }
654 630

  
655 631
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
656 632
                    {
657 633
                        PointSet = new List<Point>(),
658
                        FilePath = Data_,
634
                        FilePath = FilePath,
659 635
                        ImageData = img.Source,
660 636
                        StartPoint = new Point(0, 0),
661 637
                        EndPoint = new Point(img.Source.Width, img.Source.Height),
......
670 646
                                            currentControl.EndPoint,
671 647
                                            currentControl.TopRightPoint,
672 648
                                        };
673
                    UndoData multi_UndoData = new UndoData();
674 649
                    UndoDataGroup = new UndoDataGroup()
675 650
                    {
676 651
                        IsUndo = false,
......
678 653
                        EventTime = DateTime.Now,
679 654
                        MarkupDataColl = new List<UndoData>()
680 655
                    };
681
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
656
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo).ToList().ForEach(i =>
682 657
                    {
683 658
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
684 659
                    });
685 660

  
686
                    //multi_UndoData = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
687
                    multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
661
                    var multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
688 662
                    UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
689 663
                    ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
690 664

  
......
695 669
                    currentControl.ApplyTemplate();
696 670
                    currentControl.SetImage();
697 671

  
698
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
672
                    ///ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
699 673
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
700 674
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
701 675

  
676
                    #region 마우스 위치에 배치
702 677
                    /*
703 678
                    // this.ParentOfType<MainWindow>().dzMainMenu.isLeftMouseButtonDownOnWindow = true;
704 679
                    // final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
......
710 685
                    //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = MouseHandlingMode.DragSymbol;
711 686
                    ///this.ParentOfType<MainWindow>().dzMainMenu.mouseButtonDown = MouseButton.Left;
712 687
                    //this.ParentOfType<MainWindow>().dzMainMenu.symboldata(id, group_id, RadTab.SelectedIndex, Data_, img.Source);*/
713
                    
688
                    #endregion
714 689
                }
715 690
            }
716 691
            catch(Exception ex)
......
719 694
            }
720 695
        }
721 696

  
722
        public UndoData multi_UndoData;
697
        /// <summary>
698
        /// 
699
        /// </summary>
723 700
        private void ApplyDragSelectionRect()
724 701
        {
725
            multi_UndoData = new UndoData();
702
            var multi_UndoData = new UndoData();
726 703

  
727 704
            UndoDataGroup = new UndoDataGroup()
728 705
            {
KCOM/Controls/SymbolPrompt.xaml.cs
20 20
    /// </summary>
21 21
    public partial class SymbolPrompt : UserControl
22 22
    {
23
        public string SymbolName { get; set; }
24
        public bool IsSvg { get; set; } = true;
25
        public bool IsPng { get; set; } = false;
26

  
23 27
        public SymbolPrompt()
24 28
        {
25 29
            InitializeComponent();
26
            //t;
27 30
        }
28 31
        
29 32
        private void BtnOK_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
30 33
        {
31 34
            Window window = Window.GetWindow(this);
32
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.symbolname = symbolName.Text;
33
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.symbolsvg = svgRadioBox.IsChecked.Value;
34
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.symbolpng = pngRadioBox.IsChecked.Value;
35
            SymbolName = symbolName.Text;
36
            IsSvg = svgRadioBox.IsChecked.Value;
37
            IsPng = pngRadioBox.IsChecked.Value;
35 38
            window.Close();
36 39
        }
37 40

  
KCOM/Controls/test.xaml
1
<UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="KCOM.Controls.test"
2
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
5
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
6
             xmlns:local="clr-namespace:KCOM.Controls"
7
             mc:Ignorable="d" 
8
             Height="371" Width ="2000">
9
    <Grid x:Name="LayoutRoot" Background="White">
10

  
11

  
12
        <Grid.RowDefinitions>
13
            <RowDefinition Height="80" />
14
            <RowDefinition Height="*"/>
15
            <RowDefinition Height="80"/>
16
        </Grid.RowDefinitions>
17
        <Grid.ColumnDefinitions>
18
            <ColumnDefinition Width="1100"/>
19
            <ColumnDefinition Width="50"/>
20
            <ColumnDefinition Width="500"/>
21
        </Grid.ColumnDefinitions>
22
        <Grid Background="White" Grid.Row="0" Grid.Column="0">
23
            <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="25"><Bold> My CHECK LIST</Bold></TextBlock>
24
        </Grid>
25
        <Grid Grid.Row="1" Grid.Column="0">
26
            <telerik:RadGridView x:Name="tb" telerik:StyleManager.Theme="Office2016" IsFilteringAllowed="False" ScrollViewer.VerticalScrollBarVisibility="Auto" CellLoaded="tb_CellLoaded"
27
                                                     AutoGenerateColumns="False" ShowGroupPanel="False" Loaded="RadGridView_Loaded" ShowGroupFooters="False"
28
												     CanUserDeleteRows="True" CanUserInsertRows="False" EditTriggers="TextInput" BorderThickness="1">
29

  
30
                <telerik:RadGridView.Columns>
31
                    <telerik:GridViewDataColumn Width="50" IsReadOnly="True" HeaderTextAlignment="Center" DataMemberBinding="{Binding CK_NO}" TextAlignment="Center" Header="No" />
32
                    <telerik:GridViewDataColumn Width="80" IsReadOnly="True" HeaderTextAlignment="Center" DataMemberBinding="{Binding CK_REV_NO}" TextAlignment="Center" Header="Rev. No" />
33
                    <telerik:GridViewDataColumn Width="60" IsReadOnly="True" HeaderTextAlignment="Center" DataMemberBinding="{Binding CK_PAGE}" TextAlignment="Center"  Header="Page"  />
34
                    <telerik:GridViewDataColumn Width="150" IsReadOnly="True" HeaderTextAlignment="Center" DataMemberBinding="{Binding CK_COMMENT}" TextAlignment="Center" Header="VP Comment image  (to Vendor)" />
35
                    <telerik:GridViewDataColumn Width="*" IsReadOnly="True" HeaderTextAlignment="Center" DataMemberBinding="{Binding CK_TODO}" Header="To Do List"/>
36
                    <telerik:GridViewDataColumn Width="100" IsReadOnly="True" HeaderTextAlignment="Center" DataMemberBinding="{Binding CK_STATUS}" TextAlignment="Center" Name="Status" Header="Status" />
37
                    <telerik:GridViewDataColumn Width="120" IsReadOnly="True" HeaderTextAlignment="Center" DataMemberBinding="{Binding CK_RESULT}" TextAlignment="Center" Header="Result / History"/>
38
                    <telerik:GridViewHyperlinkColumn Width="120" HeaderTextAlignment="Center" Header="Ch" ></telerik:GridViewHyperlinkColumn>
39
                    <telerik:GridViewDataColumn Header="Check">
40
                        <telerik:GridViewDataColumn.CellTemplate>
41
                            <DataTemplate>
42
                                <TextBlock HorizontalAlignment="Center" Text="☞" FontSize="13" TextDecorations="Underline" MouseLeftButtonUp="TextBlock_MouseLeftButtonUp">
43
                                </TextBlock>
44
                            </DataTemplate>
45
                        </telerik:GridViewDataColumn.CellTemplate>
46
                    </telerik:GridViewDataColumn>
47
                </telerik:RadGridView.Columns>
48
            </telerik:RadGridView>
49
        </Grid>
50
        <Grid Grid.Row="1" Grid.Column="1">
51

  
52
        </Grid>
53
        
54
        <Grid Background="White" Grid.Row="0" Grid.Column="2" x:Name="grid1" Visibility="Collapsed">
55
            <TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Left" FontSize="18"><Bold> Comment Overall Histroy</Bold></TextBlock>
56
        </Grid>
57
        
58
        <Grid Grid.Row="1"  Grid.Column="2" x:Name="grid2" Visibility="Collapsed">
59
            
60
            
61
            <telerik:RadGridView x:Name="tb1" telerik:StyleManager.Theme="Office2016" IsFilteringAllowed="False" ScrollViewer.VerticalScrollBarVisibility="Auto" CellLoaded="tb_CellLoaded"
62
                                                     AutoGenerateColumns="False" ShowGroupPanel="False" Loaded="RadGridView_Loaded" ShowGroupFooters="False"
63
												     CanUserDeleteRows="True" CanUserInsertRows="False" EditTriggers="TextInput" BorderThickness="1" >
64
                
65
                <telerik:RadGridView.Columns>
66
                    <telerik:GridViewDataColumn Width="*" IsReadOnly="True" HeaderTextAlignment="Center" TextAlignment="Center" Header="Rev. 4" />
67
                    <telerik:GridViewDataColumn Width="*" IsReadOnly="True" HeaderTextAlignment="Center" TextAlignment="Center" Header="Rev. 3" />
68
                    <telerik:GridViewDataColumn Width="*" IsReadOnly="True" HeaderTextAlignment="Center"  TextAlignment="Center" Header="Rev. 2" />
69
                    <telerik:GridViewDataColumn Width="*" IsReadOnly="True" HeaderTextAlignment="Center"  TextAlignment="Center" Header="Rev. 1" />
70
                    <telerik:GridViewDataColumn Width="*" IsReadOnly="True" HeaderTextAlignment="Center"  TextAlignment="Center" Header="Rev. 0" />
71
                </telerik:RadGridView.Columns>
72
            </telerik:RadGridView>
73
        </Grid>
74
        <Grid Grid.Row="3">
75
            <telerik:RadButton Width="100" Height="30" VerticalAlignment="Bottom" HorizontalAlignment="Right" Click="CampareEvent" Margin="0,0,115,0">Compare</telerik:RadButton>
76
            <telerik:RadButton Width="100" Height="30" VerticalAlignment="Bottom" HorizontalAlignment="Right" Click="ExportEvent">Excel</telerik:RadButton>
77
        </Grid>
78

  
79

  
80
    </Grid>
81
</UserControl>
KCOM/Controls/test.xaml.cs
1
using KCOMDataModel.Common;
2
using KCOMDataModel.DataModel;
3
using System;
4
using System.Collections.Generic;
5
using System.Linq;
6
using System.Text;
7
using System.Windows;
8
using System.Windows.Controls;
9
using System.Windows.Data;
10
using System.Windows.Documents;
11
using System.Windows.Input;
12
using System.Windows.Media;
13
using System.Windows.Media.Imaging;
14
using System.Windows.Navigation;
15
using System.Windows.Shapes;
16
using Telerik.Windows.Controls;
17

  
18
namespace KCOM.Controls
19
{
20
    /// <summary>
21
    /// test.xaml에 대한 상호 작용 논리
22
    /// </summary>
23
    public partial class test : UserControl
24
    {
25
        List<MARKUP_CHECKLIST> items = new List<MARKUP_CHECKLIST>();
26
        double orginalWidth, originalHeight;
27
        ScaleTransform scale = new ScaleTransform();
28

  
29
        public test()
30
        {
31
            InitializeComponent();
32
            this.Loaded += Test_Loaded;
33
        }
34

  
35
        private void Test_Loaded(object sender, RoutedEventArgs e)
36
        {
37
        }
38

  
39
        private void RadGridView_Loaded(object sender, RoutedEventArgs e)
40
        {
41
            using (CIEntities Entity = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
42
            {
43
                items = Entity.MARKUP_CHECKLIST.ToList();
44
                (sender as Telerik.Windows.Controls.RadGridView).ItemsSource = items;
45
                foreach (var item in (sender as Telerik.Windows.Controls.RadGridView).Items)
46
                {
47
                    
48
                }
49
            }
50

  
51
            orginalWidth = this.Width;
52
            originalHeight = this.Height;
53
            ChangeSize(this.ActualWidth, this.ActualHeight);
54
            this.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
55
        }
56

  
57
        private void tb_CellLoaded(object sender, Telerik.Windows.Controls.GridView.CellEventArgs e)
58
        {
59
            if(e.Cell.Column.Header.ToString().ToUpper() == "STATUS")
60
            {
61
                //if(((Telerik.Windows.Controls.RadGridView)e.Cell).Value.ToString().ToUpper() == "OPEN")
62
                {
63

  
64
                    //if(((Telerik.Windows.Controls.GridView.GridViewCellBase)e.Cell).GetValue(.ToString().ToUpper() != "OPEN")
65
                    //{
66

  
67
                    //}
68
                    e.Cell.Foreground = System.Windows.Media.Brushes.Red;
69
                }
70
            }
71
        }
72

  
73
        private void ExportEvent(object sender, RoutedEventArgs e)
74
        {
75
            MessageBox.Show("미 구현 기능입니다.");
76
        }
77

  
78
        private void CampareEvent(object sender, RoutedEventArgs e)
79
        {
80

  
81
            //grid1.Visibility = Visibility.Visible;
82
            //grid2.Visibility = Visibility.Visible;
83

  
84
            
85
            //IKCOM.VPRevision VP = new IKCOM.VPRevision();
86
            //VP.DOCUMENT_ID = "11111112";
87
            //VP.RevNo = "1";
88

  
89
            //KCOM.Views.MainMenu main = new Views.MainMenu();
90
            //main.SyncEvent(VP);
91

  
92
        }
93

  
94
        void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
95
        {
96
            ChangeSize(e.NewSize.Width, e.NewSize.Height);
97
        }
98

  
99
        private void ChangeSize(double width, double height)
100
        {
101
            scale.ScaleX = width / orginalWidth;
102
            scale.ScaleY = height / originalHeight;
103

  
104
            FrameworkElement rootElement = this.Content as FrameworkElement;
105

  
106
            rootElement.LayoutTransform = scale;
107
        }
108

  
109
        private void TextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
110
        {
111

  
112
            if (grid1.Visibility == Visibility.Visible)
113
            {
114
                //Application.Current.MainWindow.Width -= 400;
115
                //ChangeSize(orginalWidth, this.ActualHeight);
116
                grid1.Visibility = Visibility.Collapsed;
117
                grid2.Visibility = Visibility.Collapsed;
118
            }
119
            else
120
            {
121
                //Application.Current.MainWindow.Width += 400;
122
                //ChangeSize(orginalWidth + 400, this.ActualHeight);
123
                grid1.Visibility = Visibility.Visible;
124
                grid2.Visibility = Visibility.Visible;
125
            }
126
            
127
        }
128

  
129
        private void RadButton_Click_1(object sender, RoutedEventArgs e)
130
        {
131

  
132
        }
133
    }
134
}
KCOM/Views/MainMenu.xaml.cs
5511 5511
            }
5512 5512
        }
5513 5513

  
5514
        private void Create_Symbol(object sender, RoutedEventArgs e)
5515
        {
5516
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
5514
        public int symbolselectindex = 0;
5517 5515

  
5518
            if (SelectLayer.Children.Count < 1) //선택된 것이 없으면
5519
            {
5520
                DialogMessage_Alert("Please Select Controls", "Alert");
5521
            }
5522
            else //선택된 것이 있으면
5516
        /// <summary>
5517
        /// 심볼을 저장한다.
5518
        /// </summary>
5519
        /// <param name="Img_byte"></param>
5520
        /// <param name="data"></param>
5521
        /// <param name="args"></param>
5522
        private void SymbolMarkupNamePromptClose(SymbolPrompt prompt, byte[] Img_byte, string data, WindowClosedEventArgs args)
5523
        {
5524
            try
5523 5525
            {
5524
                string MarkupData = "";
5525
                adorner_ = new AdornerFinal();
5526
                string svgfilename = null;
5527
                if (string.IsNullOrEmpty(prompt.SymbolName)) return;
5526 5528

  
5527
                foreach (var item in SelectLayer.Children)
5529
                kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
5530
                string guid = Commons.ShortGuid();
5531

  
5532
                fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
5533
                fileUploader.RunCompleted += (ex, arg) =>
5528 5534
                {
5529
                    if (item.GetType().Name == "AdornerFinal")
5535
                    filename = arg.Result;
5536
                    if (prompt.IsPng)
5530 5537
                    {
5531
                        adorner_ = (item as Controls.AdornerFinal);
5532
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
5538
                        if (!string.IsNullOrEmpty(filename))
5533 5539
                        {
5534
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
5540
                            if (symbolselectindex == 0)
5535 5541
                            {
5536
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
5537
                                MarkupData += markupReturn.ConvertData;
5542
                                SavePrivateSymbol(prompt.SymbolName, filename, data);
5543
                            }
5544
                            else
5545
                            {
5546
                                SavePublicSymbol(prompt.SymbolName, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5538 5547
                            }
5539 5548
                        }
5540 5549
                    }
5541
                }
5542
                DialogParameters parameters = new DialogParameters()
5543
                {
5544
                    Owner = Application.Current.MainWindow,
5545
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
5546
                    DefaultPromptResultValue = "Custom State",
5547
                    Content = "Name :",
5548
                    Header = "Insert Custom Symbol Name",
5549
                    Theme = new VisualStudio2013Theme(),
5550
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
5551
                };
5552
                RadWindow.Prompt(parameters);
5553
            }
5554
        }
5555

  
5556
        public int symbolselectindex = 0;
5557

  
5558
        private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args)
5559
        {
5560
            //Save save = new Save();
5561
            try
5562
            {
5563
                string svgfilename = null;
5564
                if (symbolname != null)
5565
                {
5566
                    if (symbolpng == true || symbolsvg == true)
5550
                    else if (prompt.IsSvg)
5567 5551
                    {
5568
                        kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
5569
                        string guid = Commons.ShortGuid();
5570

  
5571
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
5572
                        //Check_Uri.UriCheck();
5573
                        fileUploader.RunCompleted += (ex, arg) =>
5552
                        try
5574 5553
                        {
5575
                            filename = arg.Result;
5576
                            if (symbolpng == true)
5577
                            {
5578
                                if (filename != null)
5579
                                {
5580
                                    if (symbolselectindex == 0)
5581
                                    {
5582
                                        SymbolSave(symbolname, filename, data);
5583
                                    }
5584
                                    else
5585
                                    {
5586
                                        SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5587
                                    }
5588
                                    DataBind();
5589
                                }
5590
                            }
5554
                            var defaultBitmapImage = new BitmapImage();
5555
                            defaultBitmapImage.BeginInit();
5556
                            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
5557
                            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
5558
                            Check_Uri.UriCheck(filename);
5559
                            defaultBitmapImage.UriSource = new Uri(filename);
5560
                            defaultBitmapImage.EndInit();
5561

  
5562
                            System.Drawing.Bitmap image;
5591 5563

  
5592
                            if (symbolsvg == true)
5564
                            if (defaultBitmapImage.IsDownloading)
5593 5565
                            {
5594
                                try
5566
                                defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
5595 5567
                                {
5596
                                    var defaultBitmapImage = new BitmapImage();
5597
                                    defaultBitmapImage.BeginInit();
5598
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
5599
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
5600
                                    Check_Uri.UriCheck(filename);
5601
                                    defaultBitmapImage.UriSource = new Uri(filename);
5602
                                    defaultBitmapImage.EndInit();
5568
                                    defaultBitmapImage.Freeze();
5569
                                    image = GetBitmap(defaultBitmapImage);
5570
                                    image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
5571
                                    Process potrace = new Process
5572
                                    {
5573
                                        StartInfo = new ProcessStartInfo
5574
                                        {
5575
                                            FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
5576
                                            Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
5577
                                            RedirectStandardInput = true,
5578
                                            RedirectStandardOutput = true,
5579
                                            RedirectStandardError = true,
5580
                                            UseShellExecute = false,
5581
                                            CreateNoWindow = true,
5582
                                            WindowStyle = ProcessWindowStyle.Hidden
5583
                                        },
5584
                                    };
5603 5585

  
5604
                                    System.Drawing.Bitmap image;
5586
                                    StringBuilder svgBuilder = new StringBuilder();
5587
                                    potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
5588
                                    {
5589
                                        svgBuilder.AppendLine(e2.Data);
5590
                                    };
5605 5591

  
5606
                                    if (defaultBitmapImage.IsDownloading)
5592
                                    potrace.EnableRaisingEvents = true;
5593
                                    potrace.Start();
5594
                                    potrace.Exited += (sender, e) =>
5607 5595
                                    {
5608
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
5596
                                        byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
5597
                                        svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
5598
                                        Check_Uri.UriCheck(svgfilename);
5599
                                        if (symbolselectindex == 0)
5609 5600
                                        {
5610
                                            defaultBitmapImage.Freeze();
5611
                                            image = GetBitmap(defaultBitmapImage);
5612
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
5613
                                            Process potrace = new Process
5614
                                            {
5615
                                                StartInfo = new ProcessStartInfo
5616
                                                {
5617
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
5618
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
5619
                                                    RedirectStandardInput = true,
5620
                                                    RedirectStandardOutput = true,
5621
                                                    RedirectStandardError = true,
5622
                                                    UseShellExecute = false,
5623
                                                    CreateNoWindow = true,
5624
                                                    WindowStyle = ProcessWindowStyle.Hidden
5625
                                                },
5626
                                            };
5627

  
5628
                                            StringBuilder svgBuilder = new StringBuilder();
5629
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
5630
                                            {
5631
                                                svgBuilder.AppendLine(e2.Data);
5632
                                            };
5633

  
5634
                                            potrace.EnableRaisingEvents = true;
5635
                                            potrace.Start();
5636
                                            potrace.Exited += (sender, e) =>
5637
                                            {
5638
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
5639
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
5640
                                                Check_Uri.UriCheck(svgfilename);
5641
                                                if (symbolselectindex == 0)
5642
                                                {
5643
                                                    SymbolSave(symbolname, svgfilename, data);
5644
                                                }
5645
                                                else
5646
                                                {
5647
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5648
                                                }
5649

  
5650
                                                DataBind();
5651
                                            };
5652
                                            potrace.WaitForExit();
5653
                                        };
5654
                                    }
5655
                                    else
5656
                                    {
5657
                                        //GC.Collect();
5658
                                    }
5659
                                }
5660
                                catch (Exception ee)
5661
                                {
5662
                                    DialogMessage_Alert("" + ee, "Alert");
5663
                                }
5601
                                            SavePrivateSymbol(prompt.SymbolName, svgfilename, data);
5602
                                        }
5603
                                        else
5604
                                        {
5605
                                            SavePublicSymbol(prompt.SymbolName, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5606
                                        }
5607
                                    };
5608
                                    potrace.WaitForExit();
5609
                                };
5664 5610
                            }
5665
                        };
5611
                            else
5612
                            {
5613
                                //GC.Collect();
5614
                            }
5615
                        }
5616
                        catch (Exception ee)
5617
                        {
5618
                            DialogMessage_Alert("" + ee, "Alert");
5619
                        }
5666 5620
                    }
5667
                }
5621
                };
5668 5622
            }
5669 5623
            catch (Exception e)
5670 5624
            {
5671
                //DialogMessage_Alert(e + "", "Alert");
5625
                throw new InvalidOperationException(e.Message);
5672 5626
            }
5673 5627
        }
5674 5628

  
5675
        public void SymbolSave(string Name, string Url, string Data)
5629
        public void SavePrivateSymbol(string Name, string Url, string Data)
5676 5630
        {
5677 5631
            try
5678 5632
            {
......
5686 5640
                };
5687 5641

  
5688 5642
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
5689
                //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
5690 5643
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
5691 5644
            }
5692 5645
            catch (Exception)
......
5695 5648
            }
5696 5649
        }
5697 5650

  
5698
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
5651
        public void SavePublicSymbol(string Name, string Url, string Data, string Department)
5699 5652
        {
5700 5653
            try
5701 5654
            {
......
5719 5672

  
5720 5673
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
5721 5674
        {
5722
            //Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5723
            DataBind();
5675
            BindSymbolData();
5724 5676
        }
5725 5677

  
5726 5678
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
5727 5679
        {
5728
            //Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
5729
            DataBind();
5680
            BindSymbolData();
5730 5681
        }
5731 5682

  
5732
        private void DataBind()
5683
        /// <summary>
5684
        /// Symbol 데이터를 화면에 표시한다.
5685
        /// </summary>
5686
        private void BindSymbolData()
5733 5687
        {
5734 5688
            try
5735 5689
            {
......
5779 5733
            }
5780 5734
        }
5781 5735

  
5782
        private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
5783
        {
5784
            try
5785
            {
5786
                if (args.PromptResult != null)
5787
                {
5788
                    if (args.DialogResult.Value)
5789
                    {
5790
                        PngBitmapEncoder _Encoder = await symImageAsync(data);
5791

  
5792
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
5793
                        _Encoder.Save(fs);
5794
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
5795

  
5796
                        byte[] Img_byte = fs.ToArray();
5797

  
5798
                        kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
5799
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.ShortGuid() + ".png", Img_byte);
5800
                        Check_Uri.UriCheck(filename);
5801
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
5802
                        {
5803
                            SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data);
5804
                        }
5805
                        else
5806
                        {
5807
                            SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
5808
                        }
5809
                        DataBind();
5810
                    }
5811
                }
5812
            }
5813
            catch (Exception ex)
5814
            {
5815
                DialogMessage_Alert("" + ex, "Alert");
5816
            }
5817
        }
5818

  
5819 5736
        public async Task<PngBitmapEncoder> symImageAsync(string data)
5820 5737
        {
5821 5738
            Canvas _canvas = new Canvas();
......
5954 5871
            return bmp;
5955 5872
        }
5956 5873

  
5957
        public string symbolname = null;
5958
        public bool symbolsvg = true;
5959
        public bool symbolpng = true;
5960

  
5961 5874
        public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height)
5962 5875
        {
5963 5876
            System.Drawing.Bitmap image = GetBitmap(source);
......
5991 5904
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
5992 5905
                IsTopmost = true,
5993 5906
            };
5994
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args);
5907
            CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(symbolPrompt, imageBytes, "", args);
5995 5908
            StyleManager.SetTheme(CheckPop, new Office2013Theme());
5996 5909
            CheckPop.ShowDialog();
5997 5910

  

내보내기 Unified diff

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