markus / KCOM / Views / TopMenu.xaml.cs @ 366f00c2
이력 | 보기 | 이력해설 | 다운로드 (5.3 KB)
1 |
using KCOM.Common; |
---|---|
2 |
using System; |
3 |
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 |
//App.splashString(ISplashMessage.TOPMENU); |
27 |
InitializeComponent(); |
28 |
|
29 |
this.Loaded += TopMenu_Loaded; |
30 |
|
31 |
} |
32 |
|
33 |
bool _Initialize = false; |
34 |
|
35 |
private void TopMenu_Loaded(object sender, RoutedEventArgs e) |
36 |
{ |
37 |
if(!_Initialize) |
38 |
{ |
39 |
_Initialize = true; |
40 |
|
41 |
InitDataSet(); |
42 |
if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
43 |
{ |
44 |
SAVE.Visibility = Visibility.Collapsed; |
45 |
} |
46 |
|
47 |
if (KCOM.Properties.Settings.Default.cad == 0) |
48 |
{ |
49 |
AutoCAD.Visibility = Visibility.Hidden; |
50 |
} |
51 |
|
52 |
if (KCOM.Properties.Settings.Default.grouping == 0) |
53 |
{ |
54 |
GROUP.Visibility = Visibility.Hidden; |
55 |
} |
56 |
} |
57 |
} |
58 |
|
59 |
private void btnFromFile_Click(object sender, RoutedEventArgs e) |
60 |
{ |
61 |
System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog(); |
62 |
var result = dialog.ShowDialog(); |
63 |
if (result == System.Windows.Forms.DialogResult.OK) |
64 |
{ |
65 |
//using (Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs()) |
66 |
//{ |
67 |
System.Drawing.Image t_image = System.Drawing.Image.FromFile(dialog.FileName); |
68 |
|
69 |
System.IO.MemoryStream ms = new System.IO.MemoryStream(); |
70 |
t_image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); |
71 |
BitmapImage ix = new BitmapImage(); |
72 |
ix.BeginInit(); |
73 |
ix.CacheOption = BitmapCacheOption.OnLoad; |
74 |
ix.StreamSource = ms; |
75 |
ix.EndInit(); |
76 |
|
77 |
this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Source = ix; |
78 |
this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width = ix.Width; |
79 |
this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height = ix.Height; |
80 |
|
81 |
|
82 |
//this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image = codecs.Load(dialog.FileName, 0, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1); |
83 |
//imageViewer.Image = codecs.Load(dialog.FileName, 24, Leadtools.Codecs.CodecsLoadByteOrder.BgrOrGray, 1, 1); |
84 |
//imageViewer.Image.AnimationBackground = Leadtools.RasterColor.White; |
85 |
|
86 |
//var d = imageViewer.Image.CreateThumbnail(100, 100, 24, Leadtools.RasterViewPerspective.TopLeft, Leadtools.RasterSizeFlags.None); |
87 |
//RasterImageViewer vvv = new RasterImageViewer(); |
88 |
//vvv.Image = d; |
89 |
//zoomAndPanCanvas.Children.Add(vvv); |
90 |
|
91 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Width); |
92 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Height); |
93 |
|
94 |
//this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageWidth); |
95 |
//this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height = Convert.ToDouble(this.ParentOfType<MainWindow>().dzMainMenu.imageViewer.Image.ImageHeight); |
96 |
|
97 |
Common.ViewerDataModel.Instance.ContentWidth = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Width; |
98 |
Common.ViewerDataModel.Instance.ContentHeight = this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanCanvas.Height; |
99 |
//zoomAndPanControl.AnimatedScaleToFit(); |
100 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit(); |
101 |
//} |
102 |
} |
103 |
} |
104 |
|
105 |
private void btnSync_Click(object sender, RoutedEventArgs e) |
106 |
{ |
107 |
if (this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden) |
108 |
{ |
109 |
this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = false; |
110 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.UpdateLayout(); |
111 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl2.ScaleToFit(); |
112 |
} |
113 |
else |
114 |
{ |
115 |
this.ParentOfType<MainWindow>().dzMainMenu.testPanel2.IsHidden = true; |
116 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.UpdateLayout(); |
117 |
this.ParentOfType<MainWindow>().dzMainMenu.zoomAndPanControl.ScaleToFit(); |
118 |
} |
119 |
|
120 |
} |
121 |
|
122 |
|
123 |
} |
124 |
} |