개정판 1c7f408a
mainWindow를 RadWindow로 변경
Change-Id: I0ac468f572b53cd39e832aed20e7d350b5c03d42
KCOM/MainWindow.xaml.cs | ||
---|---|---|
37 | 37 |
/// <summary> |
38 | 38 |
/// MainWindow.xaml에 대한 상호 작용 논리 |
39 | 39 |
/// </summary> |
40 |
public partial class MainWindow : Window
|
|
40 |
public partial class MainWindow : RadWindow, System.Windows.Markup.IComponentConnector
|
|
41 | 41 |
{ |
42 | 42 |
bool isSaveCheck = false; |
43 | 43 |
|
... | ... | |
54 | 54 |
App.splashString(ISplashMessage.MAINWINDOW); |
55 | 55 |
this.Loaded += MainWindow_Loaded; |
56 | 56 |
this.KeyDown += new KeyEventHandler(KeyEventDownAction); |
57 |
this.SourceInitialized += new EventHandler(win_SourceInitialized); |
|
57 |
//this.SourceInitialized += new EventHandler(win_SourceInitialized);
|
|
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
public static BitmapImage CursorChange() |
... | ... | |
91 | 91 |
//cursor change |
92 | 92 |
this.Cursor = new Cursor(CursorChange().StreamSource); |
93 | 93 |
|
94 |
double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth; |
|
95 |
double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight; |
|
96 |
//this.Width += 40; |
|
97 |
double windowWidth = this.Width; |
|
98 |
double windowHeight = this.Height; |
|
99 |
this.Left = (screenWidth / 2) - (windowWidth / 2); |
|
100 |
this.Top = (screenHeight / 2) - (windowHeight / 2); |
|
101 |
|
|
102 | 94 |
ViewerDataModel.Instance.SystemMain = this; |
103 | 95 |
|
104 | 96 |
if (!App.ParameterMode) |
... | ... | |
172 | 164 |
} |
173 | 165 |
} |
174 | 166 |
|
167 |
//double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth; |
|
168 |
//double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight; |
|
169 |
////this.Width += 40; |
|
170 |
|
|
171 |
var graphics = System.Drawing.Graphics.FromHwnd(IntPtr.Zero); |
|
172 |
var screenWidth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width; |
|
173 |
var screenHeight = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height; |
|
174 |
var pixelToDPI = 96.0 / graphics.DpiX; |
|
175 |
this.Width = screenWidth * pixelToDPI; |
|
176 |
this.Height = screenHeight * pixelToDPI; |
|
177 |
|
|
178 |
//double windowWidth = this.Width; |
|
179 |
//double windowHeight = this.Height; |
|
180 |
|
|
181 |
this.Left = (screenWidth / 2) - (this.Width / 2); |
|
182 |
this.Top = (screenHeight / 2) - (this.Height / 2); |
|
183 |
|
|
184 |
|
|
175 | 185 |
//App.ViewInfo = new IKCOM.ViewInfo |
176 | 186 |
//{ |
177 | 187 |
// DocumentItemID = "11111112", |
... | ... | |
189 | 199 |
//this.dzMainMenu.SetView(App.ViewInfo); |
190 | 200 |
} |
191 | 201 |
|
192 |
|
|
202 |
|
|
193 | 203 |
bool restoreIfMove = false; |
194 | 204 |
|
195 | 205 |
private void WindowDragEvent(object sender, MouseButtonEventArgs e) |
196 | 206 |
{ |
197 |
if(string.IsNullOrEmpty(destfilepath)) |
|
198 |
{ |
|
199 |
if (e.ClickCount == 2) |
|
200 |
{ |
|
201 |
if ((ResizeMode == ResizeMode.CanResize) || |
|
202 |
(ResizeMode == ResizeMode.CanResizeWithGrip)) |
|
203 |
{ |
|
204 |
SwitchState(); |
|
205 |
} |
|
206 |
} |
|
207 |
else |
|
208 |
{ |
|
209 |
if (WindowState == WindowState.Maximized) |
|
210 |
{ |
|
211 |
restoreIfMove = true; |
|
212 |
} |
|
213 |
|
|
214 |
this.DragMove(); |
|
215 |
} |
|
216 |
} |
|
207 |
//if(string.IsNullOrEmpty(destfilepath))
|
|
208 |
//{
|
|
209 |
// if (e.ClickCount == 2)
|
|
210 |
// {
|
|
211 |
// if ((ResizeMode == ResizeMode.CanResize) ||
|
|
212 |
// (ResizeMode == ResizeMode.CanResizeWithGrip))
|
|
213 |
// {
|
|
214 |
// SwitchState();
|
|
215 |
// }
|
|
216 |
// }
|
|
217 |
// else
|
|
218 |
// {
|
|
219 |
// if (WindowState == WindowState.Maximized)
|
|
220 |
// {
|
|
221 |
// restoreIfMove = true;
|
|
222 |
// }
|
|
223 |
|
|
224 |
// this.DragMove();
|
|
225 |
// }
|
|
226 |
//}
|
|
217 | 227 |
} |
218 | 228 |
|
219 | 229 |
private void WindowDragEventUp(object sender, MouseButtonEventArgs e) |
... | ... | |
223 | 233 |
|
224 | 234 |
private void WindowDragEventMove(object sender, MouseEventArgs e) |
225 | 235 |
{ |
226 |
if (restoreIfMove) |
|
227 |
{ |
|
228 |
if (Mouse.LeftButton == MouseButtonState.Pressed) |
|
229 |
{ |
|
230 |
//this.WindowState = WindowState.Normal; |
|
236 |
//if (restoreIfMove)
|
|
237 |
//{
|
|
238 |
// if (Mouse.LeftButton == MouseButtonState.Pressed)
|
|
239 |
// {
|
|
240 |
// //this.WindowState = WindowState.Normal;
|
|
231 | 241 |
|
232 |
restoreIfMove = false; |
|
242 |
// restoreIfMove = false;
|
|
233 | 243 |
|
234 |
double percentHorizontal = e.GetPosition(this).X / ActualWidth; |
|
235 |
double targetHorizontal = RestoreBounds.Width * percentHorizontal; |
|
244 |
// double percentHorizontal = e.GetPosition(this).X / ActualWidth;
|
|
245 |
// double targetHorizontal = RestoreBounds.Width * percentHorizontal;
|
|
236 | 246 |
|
237 |
double percentVertical = e.GetPosition(this).Y / ActualHeight; |
|
238 |
double targetVertical = RestoreBounds.Height * percentVertical; |
|
247 |
// double percentVertical = e.GetPosition(this).Y / ActualHeight;
|
|
248 |
// double targetVertical = RestoreBounds.Height * percentVertical;
|
|
239 | 249 |
|
240 |
POINT lMousePosition; |
|
241 |
GetCursorPos(out lMousePosition); |
|
250 |
// POINT lMousePosition;
|
|
251 |
// GetCursorPos(out lMousePosition);
|
|
242 | 252 |
|
243 |
Left = lMousePosition.X - targetHorizontal; |
|
244 |
double top = lMousePosition.Y - targetVertical; |
|
245 |
if(top < 10) |
|
246 |
{ |
|
247 |
top = 10; |
|
248 |
} |
|
249 |
Top = lMousePosition.Y; |
|
253 |
// Left = lMousePosition.X - targetHorizontal;
|
|
254 |
// double top = lMousePosition.Y - targetVertical;
|
|
255 |
// if(top < 10)
|
|
256 |
// {
|
|
257 |
// top = 10;
|
|
258 |
// }
|
|
259 |
// Top = lMousePosition.Y;
|
|
250 | 260 |
|
251 | 261 |
|
252 |
WindowState = WindowState.Normal; |
|
262 |
// WindowState = WindowState.Normal;
|
|
253 | 263 |
|
254 |
this.DragMove(); |
|
255 |
} |
|
256 |
} |
|
264 |
// this.DragMove();
|
|
265 |
// }
|
|
266 |
//}
|
|
257 | 267 |
} |
258 | 268 |
|
259 | 269 |
[DllImport("user32.dll")] |
... | ... | |
509 | 519 |
|
510 | 520 |
void win_SourceInitialized(object sender, EventArgs e) |
511 | 521 |
{ |
512 |
System.IntPtr handle = (new WinInterop.WindowInteropHelper(this)).Handle; |
|
513 |
WinInterop.HwndSource.FromHwnd(handle).AddHook(new WinInterop.HwndSourceHook(WindowProc)); |
|
522 |
//System.IntPtr handle = (new WinInterop.WindowInteropHelper(this)).Handle;
|
|
523 |
//WinInterop.HwndSource.FromHwnd(handle).AddHook(new WinInterop.HwndSourceHook(WindowProc));
|
|
514 | 524 |
} |
515 | 525 |
|
516 | 526 |
private static System.IntPtr WindowProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) |
내보내기 Unified diff