markus / KCOM / MainWindow.xaml.cs @ 5ce56a3a
이력 | 보기 | 이력해설 | 다운로드 (8.79 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 |
double windowWidth = this.Width; |
85 |
double windowHeight = this.Height; |
86 |
this.Left = (screenWidth / 2) - (windowWidth / 2); |
87 |
this.Top = (screenHeight / 2) - (windowHeight / 2); |
88 |
|
89 |
|
90 |
//test(); |
91 |
ViewerDataModel.Instance.SystemMain = this; |
92 |
|
93 |
if (!App.ParameterMode) |
94 |
{ |
95 |
//App.ViewInfo = new IKCOM.ViewInfo |
96 |
//{ |
97 |
// DocumentItemID = "11111112", |
98 |
// //DocumentItemID = "10001", |
99 |
// bPartner = false, |
100 |
// CreateFinalPDFPermission = true, |
101 |
// NewCommentPermission = true, |
102 |
// ProjectNO = "000000", |
103 |
// UserID = "H2011357", |
104 |
// //UserID = "H2009115", |
105 |
// //Mode = 0 , 1 , 2 |
106 |
//}; |
107 |
//DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내"); |
108 |
|
109 |
//#if DEBUG |
110 |
// App.ViewInfo = new IKCOM.ViewInfo |
111 |
// { |
112 |
// DocumentItemID = "11111112", |
113 |
// //DocumentItemID = "10001", |
114 |
// bPartner = false, |
115 |
// CreateFinalPDFPermission = true, |
116 |
// NewCommentPermission = true, |
117 |
// ProjectNO = "000000", |
118 |
// UserID = "H2011357", |
119 |
// //UserID = "H2009115", |
120 |
// //Mode = 0 , 1 , 2 |
121 |
// }; |
122 |
// App.ParameterMode = true; |
123 |
// this.dzMainMenu.ServiceOn(); |
124 |
// this.dzMainMenu.SetView(App.ViewInfo); |
125 |
//#else |
126 |
|
127 |
DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내"); |
128 |
this.dzMainMenu.pageNavigator.Visibility = Visibility.Collapsed; |
129 |
this.dzMainMenu.historyPane.Visibility = Visibility.Collapsed; |
130 |
this.dzMainMenu.infoListPane.Visibility = Visibility.Collapsed; |
131 |
this.dzMainMenu.searchPane.Visibility = Visibility.Collapsed; |
132 |
this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed; |
133 |
//#endif |
134 |
} |
135 |
else |
136 |
{ |
137 |
this.dzMainMenu.ServiceOn(); |
138 |
this.dzMainMenu.SetView(App.ViewInfo); |
139 |
//this.dzMainMenu.HubSet(); |
140 |
} |
141 |
//App.ViewInfo = new IKCOM.ViewInfo |
142 |
//{ |
143 |
// DocumentItemID = "11111112", |
144 |
// //DocumentItemID = "10001", |
145 |
// bPartner = false, |
146 |
// CreateFinalPDFPermission = true, |
147 |
// NewCommentPermission = true, |
148 |
// ProjectNO = "000000", |
149 |
// UserID = "H2011357", |
150 |
// //UserID = "H2009115", |
151 |
// //Mode = 0 , 1 , 2 |
152 |
//}; |
153 |
|
154 |
//this.dzMainMenu.ServiceOn(); |
155 |
//this.dzMainMenu.SetView(App.ViewInfo); |
156 |
|
157 |
} |
158 |
private void WindowDragEvent(object sender, MouseButtonEventArgs e) |
159 |
{ |
160 |
if (e.ClickCount >= 2) |
161 |
{ |
162 |
switch (this.WindowState) |
163 |
{ |
164 |
case WindowState.Normal: |
165 |
this.WindowState = WindowState.Maximized; |
166 |
break; |
167 |
case WindowState.Minimized: |
168 |
break; |
169 |
case WindowState.Maximized: |
170 |
this.WindowState = WindowState.Normal; |
171 |
break; |
172 |
default: |
173 |
break; |
174 |
} |
175 |
} |
176 |
else |
177 |
{ |
178 |
this.DragMove(); |
179 |
} |
180 |
} |
181 |
|
182 |
private void RadButton_Click(object sender, RoutedEventArgs e) |
183 |
{ |
184 |
Telerik.Windows.Controls.RadButton button = sender as Telerik.Windows.Controls.RadButton; |
185 |
|
186 |
switch (button.CommandParameter.ToString()) |
187 |
{ |
188 |
case ("Min"): |
189 |
{ |
190 |
WindowState = WindowState.Minimized; |
191 |
} |
192 |
break; |
193 |
case ("Max"): |
194 |
{ |
195 |
WindowState = WindowState.Maximized; |
196 |
} |
197 |
break; |
198 |
case ("Exit"): |
199 |
{ |
200 |
|
201 |
} |
202 |
break; |
203 |
} |
204 |
} |
205 |
|
206 |
//강인구 추가 |
207 |
private void WinState(object sender, MouseButtonEventArgs e) |
208 |
{ |
209 |
switch((e.Source as TextBlock).Text) |
210 |
{ |
211 |
case ("ㅡ"): |
212 |
{ |
213 |
WindowState = WindowState.Minimized; |
214 |
} |
215 |
break; |
216 |
case ("ㅁ"): |
217 |
{ |
218 |
if(WindowState == WindowState.Maximized) |
219 |
WindowState = WindowState.Normal; |
220 |
else |
221 |
WindowState = WindowState.Maximized; |
222 |
} |
223 |
break; |
224 |
case ("X"): |
225 |
{ |
226 |
this.Close(); |
227 |
} |
228 |
break; |
229 |
} |
230 |
} |
231 |
|
232 |
// RasterSupport.SetLicense( |
233 |
// @"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC", |
234 |
// File.ReadAllText(@"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC.KEY") |
235 |
//); |
236 |
|
237 |
// codec = new RasterCodecs(); |
238 |
// string filePath = @"F:\Dummy\demo.cmp"; |
239 |
// //BitmapImage bitmap = new BitmapImage(); |
240 |
// //bitmap.BeginInit(); |
241 |
// //bitmap.UriSource = new Uri(filePath); |
242 |
// //bitmap.EndInit(); |
243 |
|
244 |
// //viewer.Source = bitmap; |
245 |
// //viewer.ScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; |
246 |
// //viewer.ScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; |
247 |
// //viewer.ScrollViewer.Visibility = Visibility.Hidden; |
248 |
// viewer.Image = codec.Load(filePath, 0, CodecsLoadByteOrder.RgbOrGray, 1, 1); |
249 |
// viewer.SizeMode = Leadtools.Windows.Controls.SizeMode.FitAlways; |
250 |
} |
251 |
} |