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