markus / KCOM / Views / TopMenu.xaml.cs @ df2e7646
이력 | 보기 | 이력해설 | 다운로드 (6.24 KB)
1 | e0cfc73c | ljiyeon | using KCOM.Common; |
---|---|---|---|
2 | using System; |
||
3 | 787a4489 | KangIngu | using System.Collections.Generic; |
4 | using System.Linq; |
||
5 | using System.Text; |
||
6 | using System.Windows; |
||
7 | using System.Windows.Controls; |
||
8 | using System.Windows.Data; |
||
9 | using System.Windows.Documents; |
||
10 | using System.Windows.Input; |
||
11 | using System.Windows.Media; |
||
12 | using System.Windows.Media.Imaging; |
||
13 | using System.Windows.Navigation; |
||
14 | using System.Windows.Shapes; |
||
15 | using Telerik.Windows.Controls; |
||
16 | |||
17 | namespace KCOM.Views |
||
18 | { |
||
19 | /// <summary> |
||
20 | /// TopMenu.xaml에 대한 상호 작용 논리 |
||
21 | /// </summary> |
||
22 | public partial class TopMenu : UserControl |
||
23 | { |
||
24 | public TopMenu() |
||
25 | { |
||
26 | 0f6604ce | taeseongkim | |
27 | e0cfc73c | ljiyeon | App.splashString(ISplashMessage.TOPMENU); |
28 | 0f6604ce | taeseongkim | InitializeComponent(); |
29 | 022d64c4 | ljiyeon | |
30 | 0f6604ce | taeseongkim | if (!App.IsDesignMode) |
31 | 022d64c4 | ljiyeon | { |
32 | 0f6604ce | taeseongkim | InitDataSet(); |
33 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
||
34 | { |
||
35 | SAVE.Visibility = Visibility.Collapsed; |
||
36 | b10671a4 | taeseongkim | } |
37 | 19abb0c0 | ljiyeon | |
38 | 0f6604ce | taeseongkim | if (KCOM.Properties.Settings.Default.cad == 0) |
39 | { |
||
40 | AutoCAD.Visibility = Visibility.Hidden; |
||
41 | } |
||
42 | |||
43 | if (KCOM.Properties.Settings.Default.grouping == 0) |
||
44 | { |
||
45 | GROUP.Visibility = Visibility.Hidden; |
||
46 | } |
||
47 | 19abb0c0 | ljiyeon | } |
48 | |||
49 | 787a4489 | KangIngu | } |
50 | private void btnFromFile_Click(object sender, RoutedEventArgs e) |
||
51 | { |
||
52 | System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog(); |
||
53 | var result = dialog.ShowDialog(); |
||
54 | if (result == System.Windows.Forms.DialogResult.OK) |
||
55 | { |
||
56 | //using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs()) |
||
57 | //{ |
||
58 | System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName); |
||
59 | |||
60 | System.IO.MemoryStream ms = new System.IO.MemoryStream(); |
||
61 | t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); |
||
62 | BitmapImage ix = new BitmapImage(); |
||
63 | ix.BeginInit(); |
||
64 | ix.CacheOption = BitmapCacheOption.OnLoad; |
||
65 | ix.StreamSource = ms; |
||
66 | ix.EndInit(); |
||
67 | |||
68 | this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix; |
||
69 | this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width; |
||
70 | this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height; |
||
71 | |||
72 | |||
73 | //this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1); |
||
74 | //imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1); |
||
75 | //imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White; |
||
76 | |||
77 | //var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None); |
||
78 | //RasterImageViewer vvv = new RasterImageViewer(); |
||
79 | //vvv.Image = d; |
||
80 | //zoomAndPanCanvas.Children.Add(vvv); |
||
81 | |||
82 | this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width); |
||
83 | this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height); |
||
84 | |||
85 | //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth); |
||
86 | //this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight); |
||
87 | |||
88 | Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width; |
||
89 | Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height; |
||
90 | //zoomAndPanControl.AnimatedScaleToFit(); |
||
91 | this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit(); |
||
92 | //} |
||
93 | } |
||
94 | } |
||
95 | |||
96 | private void btnSync_Click(object sender, RoutedEventArgs e) |
||
97 | { |
||
98 | if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden) |
||
99 | { |
||
100 | this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false; |
||
101 | this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout(); |
||
102 | this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit(); |
||
103 | } |
||
104 | else |
||
105 | { |
||
106 | this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true; |
||
107 | this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout(); |
||
108 | this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit(); |
||
109 | } |
||
110 | |||
111 | } |
||
112 | d4b0c723 | KangIngu | |
113 | b10671a4 | taeseongkim | private void AppScaleValue_Chnaged(object sender, RoutedPropertyChangedEventArgs<double> e) |
114 | { |
||
115 | var windows = App.Current.Windows.OfType<MainWindow>(); |
||
116 | |||
117 | if (windows != null) |
||
118 | { |
||
119 | var grid = windows.First().FindChildByType<Grid>(); |
||
120 | |||
121 | if(grid != null) |
||
122 | { |
||
123 | var scaler = grid.LayoutTransform as ScaleTransform; |
||
124 | |||
125 | if (scaler == null) |
||
126 | { |
||
127 | grid.LayoutTransform = new ScaleTransform(e.NewValue, e.NewValue); |
||
128 | } |
||
129 | else if (scaler.HasAnimatedProperties) |
||
130 | { |
||
131 | // Do nothing because the value is being changed by animation. |
||
132 | // Setting scaler.ScaleX will cause infinite recursion due to the |
||
133 | // binding specified in the XAML. |
||
134 | } |
||
135 | else |
||
136 | { |
||
137 | scaler.ScaleX = e.NewValue; |
||
138 | scaler.ScaleY = e.NewValue; |
||
139 | } |
||
140 | } |
||
141 | } |
||
142 | |||
143 | } |
||
144 | 787a4489 | KangIngu | } |
145 | } |