markus / KCOM / MainWindow.xaml.cs @ b2a6b24a
이력 | 보기 | 이력해설 | 다운로드 (9.66 KB)
1 | 787a4489 | KangIngu | using KCOM.Common; |
---|---|---|---|
2 | using KCOMDataModel; |
||
3 | using KCOMDataModel.DataModel; |
||
4 | using System; |
||
5 | using System.Collections.Generic; |
||
6 | using System.Linq; |
||
7 | using System.Text; |
||
8 | using System.Windows; |
||
9 | using System.Windows.Controls; |
||
10 | using System.Windows.Data; |
||
11 | using System.Windows.Documents; |
||
12 | using System.Windows.Input; |
||
13 | using System.Windows.Media; |
||
14 | using System.Windows.Media.Imaging; |
||
15 | using System.Windows.Navigation; |
||
16 | using System.Windows.Shapes; |
||
17 | 992a98b4 | KangIngu | using Telerik.Windows.Controls; |
18 | 787a4489 | KangIngu | |
19 | namespace KCOM |
||
20 | { |
||
21 | /// <summary> |
||
22 | /// MainWindow.xaml에 대한 상호 작용 논리 |
||
23 | /// </summary> |
||
24 | public partial class MainWindow : Window |
||
25 | { |
||
26 | |||
27 | public MainWindow() |
||
28 | { |
||
29 | InitializeComponent(); |
||
30 | this.Loaded += MainWindow_Loaded; |
||
31 | this.KeyDown += new KeyEventHandler(KeyEventDownAction); |
||
32 | this.KeyUp += new KeyEventHandler(KeyEventUpAction); |
||
33 | } |
||
34 | public void DialogMessage_Alert(string content, string header) |
||
35 | { |
||
36 | var box = new TextBlock(); |
||
37 | box.MinWidth = 400; |
||
38 | box.FontSize = 12; |
||
39 | box.Text = content; |
||
40 | box.TextWrapping = System.Windows.TextWrapping.Wrap; |
||
41 | |||
42 | Telerik.Windows.Controls.DialogParameters parameters = new Telerik.Windows.Controls.DialogParameters() |
||
43 | { |
||
44 | Content = box, |
||
45 | Header = header, |
||
46 | Theme = new Telerik.Windows.Controls.VisualStudio2013Theme(), |
||
47 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
48 | }; |
||
49 | Telerik.Windows.Controls.RadWindow.Alert(parameters); |
||
50 | } |
||
51 | |||
52 | public void test() |
||
53 | { |
||
54 | using (CIEntities Entity = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString())) |
||
55 | { |
||
56 | string key = "NXVjTcWcku8d54537cb3ed95a"; |
||
57 | |||
58 | MARKUP_INFO instance = Entity.MARKUP_INFO.Where(root => root.ID == key).FirstOrDefault(); |
||
59 | |||
60 | if (instance == null) |
||
61 | { |
||
62 | return; |
||
63 | } |
||
64 | MARKUP_INFO_VERSION version = instance.MARKUP_INFO_VERSION.FirstOrDefault(); |
||
65 | |||
66 | |||
67 | version.MARKUP_DATA.ToList().ForEach(data => |
||
68 | { |
||
69 | Entity.MARKUP_DATA.DeleteObject(data); |
||
70 | Entity.SaveChanges(); |
||
71 | }); |
||
72 | |||
73 | Entity.MARKUP_INFO_VERSION.DeleteObject(version); |
||
74 | Entity.SaveChanges(); |
||
75 | |||
76 | Entity.MARKUP_INFO.DeleteObject(instance); |
||
77 | Entity.SaveChanges(); |
||
78 | |||
79 | } |
||
80 | } |
||
81 | private void MainWindow_Loaded(object sender, RoutedEventArgs e) |
||
82 | { |
||
83 | double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth; |
||
84 | double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight; |
||
85 | 9f473fb7 | KangIngu | //this.Width += 40; |
86 | 787a4489 | KangIngu | double windowWidth = this.Width; |
87 | double windowHeight = this.Height; |
||
88 | this.Left = (screenWidth / 2) - (windowWidth / 2); |
||
89 | this.Top = (screenHeight / 2) - (windowHeight / 2); |
||
90 | |||
91 | |||
92 | //test(); |
||
93 | ViewerDataModel.Instance.SystemMain = this; |
||
94 | |||
95 | if (!App.ParameterMode) |
||
96 | { |
||
97 | //App.ViewInfo = new IKCOM.ViewInfo |
||
98 | //{ |
||
99 | // DocumentItemID = "11111112", |
||
100 | // //DocumentItemID = "10001", |
||
101 | // bPartner = false, |
||
102 | // CreateFinalPDFPermission = true, |
||
103 | // NewCommentPermission = true, |
||
104 | // ProjectNO = "000000", |
||
105 | // UserID = "H2011357", |
||
106 | // //UserID = "H2009115", |
||
107 | // //Mode = 0 , 1 , 2 |
||
108 | //}; |
||
109 | //DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내"); |
||
110 | |||
111 | //#if DEBUG |
||
112 | // App.ViewInfo = new IKCOM.ViewInfo |
||
113 | // { |
||
114 | // DocumentItemID = "11111112", |
||
115 | // //DocumentItemID = "10001", |
||
116 | // bPartner = false, |
||
117 | // CreateFinalPDFPermission = true, |
||
118 | // NewCommentPermission = true, |
||
119 | // ProjectNO = "000000", |
||
120 | // UserID = "H2011357", |
||
121 | // //UserID = "H2009115", |
||
122 | // //Mode = 0 , 1 , 2 |
||
123 | // }; |
||
124 | // App.ParameterMode = true; |
||
125 | // this.dzMainMenu.ServiceOn(); |
||
126 | // this.dzMainMenu.SetView(App.ViewInfo); |
||
127 | //#else |
||
128 | |||
129 | DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내"); |
||
130 | this.dzMainMenu.pageNavigator.Visibility = Visibility.Collapsed; |
||
131 | this.dzMainMenu.historyPane.Visibility = Visibility.Collapsed; |
||
132 | this.dzMainMenu.infoListPane.Visibility = Visibility.Collapsed; |
||
133 | this.dzMainMenu.searchPane.Visibility = Visibility.Collapsed; |
||
134 | this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed; |
||
135 | //#endif |
||
136 | } |
||
137 | else |
||
138 | { |
||
139 | this.dzMainMenu.ServiceOn(); |
||
140 | 992a98b4 | KangIngu | |
141 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
||
142 | { |
||
143 | this.dzTopMenu.radRibbonView.HelpButtonVisibility = Visibility.Collapsed; |
||
144 | var list = this.dzTopMenu.ChildrenOfType<RadRibbonTab>().ToList(); |
||
145 | list.ForEach(item => item.Visibility = Visibility.Collapsed); |
||
146 | this.dzTopMenu.ribbontab_ReadOnly.Visibility = Visibility.Visible; |
||
147 | this.dzTopMenu.radRibbonView.SelectedItem = this.dzTopMenu.ribbontab_ReadOnly; |
||
148 | this.dzMainMenu.SymbolPane.Visibility = Visibility.Collapsed; |
||
149 | this.dzMainMenu.FavoritePane.Visibility = Visibility.Collapsed; |
||
150 | this.dzMainMenu.drawingRotateCanvas.IsHitTestVisible = false; |
||
151 | } |
||
152 | 787a4489 | KangIngu | this.dzMainMenu.SetView(App.ViewInfo); |
153 | 992a98b4 | KangIngu | this.dzMainMenu.HubSet(); |
154 | 787a4489 | KangIngu | } |
155 | //App.ViewInfo = new IKCOM.ViewInfo |
||
156 | //{ |
||
157 | // DocumentItemID = "11111112", |
||
158 | // //DocumentItemID = "10001", |
||
159 | // bPartner = false, |
||
160 | // CreateFinalPDFPermission = true, |
||
161 | // NewCommentPermission = true, |
||
162 | // ProjectNO = "000000", |
||
163 | // UserID = "H2011357", |
||
164 | // //UserID = "H2009115", |
||
165 | // //Mode = 0 , 1 , 2 |
||
166 | //}; |
||
167 | |||
168 | //this.dzMainMenu.ServiceOn(); |
||
169 | //this.dzMainMenu.SetView(App.ViewInfo); |
||
170 | |||
171 | } |
||
172 | private void WindowDragEvent(object sender, MouseButtonEventArgs e) |
||
173 | { |
||
174 | if (e.ClickCount >= 2) |
||
175 | { |
||
176 | switch (this.WindowState) |
||
177 | { |
||
178 | case WindowState.Normal: |
||
179 | this.WindowState = WindowState.Maximized; |
||
180 | break; |
||
181 | case WindowState.Minimized: |
||
182 | break; |
||
183 | case WindowState.Maximized: |
||
184 | this.WindowState = WindowState.Normal; |
||
185 | break; |
||
186 | default: |
||
187 | break; |
||
188 | } |
||
189 | } |
||
190 | else |
||
191 | { |
||
192 | this.DragMove(); |
||
193 | } |
||
194 | } |
||
195 | |||
196 | private void RadButton_Click(object sender, RoutedEventArgs e) |
||
197 | { |
||
198 | Telerik.Windows.Controls.RadButton button = sender as Telerik.Windows.Controls.RadButton; |
||
199 | |||
200 | switch (button.CommandParameter.ToString()) |
||
201 | { |
||
202 | case ("Min"): |
||
203 | { |
||
204 | WindowState = WindowState.Minimized; |
||
205 | } |
||
206 | break; |
||
207 | case ("Max"): |
||
208 | { |
||
209 | WindowState = WindowState.Maximized; |
||
210 | } |
||
211 | break; |
||
212 | case ("Exit"): |
||
213 | { |
||
214 | |||
215 | } |
||
216 | break; |
||
217 | } |
||
218 | } |
||
219 | |||
220 | //강인구 추가 |
||
221 | private void WinState(object sender, MouseButtonEventArgs e) |
||
222 | { |
||
223 | switch((e.Source as TextBlock).Text) |
||
224 | { |
||
225 | case ("ㅡ"): |
||
226 | { |
||
227 | WindowState = WindowState.Minimized; |
||
228 | } |
||
229 | break; |
||
230 | case ("ㅁ"): |
||
231 | { |
||
232 | if(WindowState == WindowState.Maximized) |
||
233 | WindowState = WindowState.Normal; |
||
234 | else |
||
235 | WindowState = WindowState.Maximized; |
||
236 | } |
||
237 | break; |
||
238 | case ("X"): |
||
239 | { |
||
240 | this.Close(); |
||
241 | } |
||
242 | break; |
||
243 | } |
||
244 | } |
||
245 | |||
246 | // RasterSupport.SetLicense( |
||
247 | // @"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC", |
||
248 | // File.ReadAllText(@"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC.KEY") |
||
249 | //); |
||
250 | |||
251 | // codec = new RasterCodecs(); |
||
252 | // string filePath = @"F:\Dummy\demo.cmp"; |
||
253 | // //BitmapImage bitmap = new BitmapImage(); |
||
254 | // //bitmap.BeginInit(); |
||
255 | // //bitmap.UriSource = new Uri(filePath); |
||
256 | // //bitmap.EndInit(); |
||
257 | |||
258 | // //viewer.Source = bitmap; |
||
259 | // //viewer.ScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; |
||
260 | // //viewer.ScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; |
||
261 | // //viewer.ScrollViewer.Visibility = Visibility.Hidden; |
||
262 | // viewer.Image = codec.Load(filePath, 0, CodecsLoadByteOrder.RgbOrGray, 1, 1); |
||
263 | // viewer.SizeMode = Leadtools.Windows.Controls.SizeMode.FitAlways; |
||
264 | } |
||
265 | } |