프로젝트

일반

사용자정보

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

markus / KCOM / Views / TopMenu.xaml.cs @ 90e7968d

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

1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Windows;
6
using System.Windows.Controls;
7
using System.Windows.Data;
8
using System.Windows.Documents;
9
using System.Windows.Input;
10
using System.Windows.Media;
11
using System.Windows.Media.Imaging;
12
using System.Windows.Navigation;
13
using System.Windows.Shapes;
14
using Telerik.Windows.Controls;
15

    
16
namespace KCOM.Views
17
{
18
    /// <summary>
19
    /// TopMenu.xaml에 대한 상호 작용 논리
20
    /// </summary>
21
    public partial class TopMenu : UserControl
22
    {
23
        public TopMenu()
24
        {
25
            InitializeComponent();
26
            InitDataSet();
27
            if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
28
            {
29
                SAVE.Visibility = Visibility.Collapsed;
30
            }
31

    
32
            if (KCOM.Properties.Settings.Default.cad == 0)
33
            {
34
                AutoCAD.Visibility = Visibility.Hidden;
35
                //whiteHeader1.Visibility = Visibility.Hidden;
36
                //cadExport.Visibility = Visibility.Hidden;
37
                //cadViewer.Visibility = Visibility.Hidden;
38
            }
39
        }
40
        private void btnFromFile_Click(object sender, RoutedEventArgs e)
41
        {
42
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
43
            var result = dialog.ShowDialog();
44
            if (result == System.Windows.Forms.DialogResult.OK)
45
            {
46
                //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs())
47
                //{
48
                    System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName);
49

    
50
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
51
                    t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
52
                    BitmapImage ix = new BitmapImage();
53
                    ix.BeginInit();
54
                    ix.CacheOption = BitmapCacheOption.OnLoad;
55
                    ix.StreamSource = ms;
56
                    ix.EndInit();
57

    
58
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix;
59
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width;
60
                    this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height;
61

    
62

    
63
                    //this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
64
                    //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1);
65
                    //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White;
66

    
67
                    //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None);
68
                    //RasterImageViewer vvv = new RasterImageViewer();
69
                    //vvv.Image = d;
70
                    //zoomAndPanCanvas.Children.Add(vvv);
71

    
72
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width);
73
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height);
74

    
75
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth);
76
                    //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight);
77

    
78
                    Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width;
79
                    Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height;
80
                    //zoomAndPanControl.AnimatedScaleToFit();
81
                    this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
82
                //}
83
            }
84
        }
85
        
86
        private void btnSync_Click(object sender, RoutedEventArgs e)
87
        {
88
            if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden)
89
            {
90
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false;
91
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout();
92
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit();
93
            }
94
            else
95
            {
96
                this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true;
97
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout();
98
                this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit();
99
            }
100
            
101
        }
102

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