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