1 |
787a4489
|
KangIngu
|
using KCOM.Common;
|
2 |
264c9309
|
ljiyeon
|
using KCOM.Views;
|
3 |
787a4489
|
KangIngu
|
using KCOMDataModel;
|
4 |
|
|
using KCOMDataModel.DataModel;
|
5 |
b0fb3ad7
|
ljiyeon
|
using MarkupToPDF.Common;
|
6 |
5529d2a2
|
humkyung
|
using MarkupToPDF.Controls.Parsing;
|
7 |
b0fb3ad7
|
ljiyeon
|
using MarkupToPDF.Serialize.Core;
|
8 |
|
|
using MarkupToPDF.Serialize.S_Control;
|
9 |
787a4489
|
KangIngu
|
using System;
|
10 |
|
|
using System.Collections.Generic;
|
11 |
264c9309
|
ljiyeon
|
using System.ComponentModel;
|
12 |
|
|
using System.Diagnostics;
|
13 |
6707a5c7
|
ljiyeon
|
using System.IO;
|
14 |
787a4489
|
KangIngu
|
using System.Linq;
|
15 |
264c9309
|
ljiyeon
|
using System.Net;
|
16 |
|
|
using System.Reflection;
|
17 |
71bfd53e
|
ljiyeon
|
using System.Runtime.InteropServices;
|
18 |
787a4489
|
KangIngu
|
using System.Text;
|
19 |
264c9309
|
ljiyeon
|
using System.Threading;
|
20 |
|
|
using System.Threading.Tasks;
|
21 |
787a4489
|
KangIngu
|
using System.Windows;
|
22 |
|
|
using System.Windows.Controls;
|
23 |
|
|
using System.Windows.Data;
|
24 |
|
|
using System.Windows.Documents;
|
25 |
|
|
using System.Windows.Input;
|
26 |
|
|
using System.Windows.Media;
|
27 |
|
|
using System.Windows.Media.Imaging;
|
28 |
|
|
using System.Windows.Navigation;
|
29 |
|
|
using System.Windows.Shapes;
|
30 |
6707a5c7
|
ljiyeon
|
using System.Xml;
|
31 |
992a98b4
|
KangIngu
|
using Telerik.Windows.Controls;
|
32 |
7e2d29a0
|
ljiyeon
|
using WinInterop = System.Windows.Interop;
|
33 |
787a4489
|
KangIngu
|
|
34 |
|
|
namespace KCOM
|
35 |
|
|
{
|
36 |
|
|
/// <summary>
|
37 |
|
|
/// MainWindow.xaml에 대한 상호 작용 논리
|
38 |
|
|
/// </summary>
|
39 |
|
|
public partial class MainWindow : Window
|
40 |
|
|
{
|
41 |
|
|
public MainWindow()
|
42 |
|
|
{
|
43 |
e0cfc73c
|
ljiyeon
|
App.splashString(ISplashMessage.MAINWINDOW);
|
44 |
787a4489
|
KangIngu
|
this.Loaded += MainWindow_Loaded;
|
45 |
|
|
this.KeyDown += new KeyEventHandler(KeyEventDownAction);
|
46 |
|
|
this.KeyUp += new KeyEventHandler(KeyEventUpAction);
|
47 |
7e2d29a0
|
ljiyeon
|
this.SourceInitialized += new EventHandler(win_SourceInitialized);
|
48 |
264c9309
|
ljiyeon
|
this.Closed += MainWindow_Closed;
|
49 |
29010418
|
ljiyeon
|
|
50 |
787a4489
|
KangIngu
|
}
|
51 |
ca16abb2
|
ljiyeon
|
|
52 |
|
|
public static BitmapImage CursorChange()
|
53 |
|
|
{
|
54 |
|
|
BitmapImage bmp = new BitmapImage();
|
55 |
|
|
bmp.BeginInit();
|
56 |
|
|
bmp.StreamSource = System.Windows.Application.GetResourceStream(new Uri("/KCOM;Component/Resources/Cursor/customCursor2.cur", UriKind.Relative)).Stream;
|
57 |
|
|
return bmp;
|
58 |
|
|
}
|
59 |
|
|
|
60 |
787a4489
|
KangIngu
|
public void DialogMessage_Alert(string content, string header)
|
61 |
|
|
{
|
62 |
|
|
var box = new TextBlock();
|
63 |
|
|
box.MinWidth = 400;
|
64 |
|
|
box.FontSize = 12;
|
65 |
|
|
box.Text = content;
|
66 |
|
|
box.TextWrapping = System.Windows.TextWrapping.Wrap;
|
67 |
|
|
|
68 |
|
|
Telerik.Windows.Controls.DialogParameters parameters = new Telerik.Windows.Controls.DialogParameters()
|
69 |
|
|
{
|
70 |
b9b01f8e
|
ljiyeon
|
Owner = Application.Current.MainWindow,
|
71 |
787a4489
|
KangIngu
|
Content = box,
|
72 |
|
|
Header = header,
|
73 |
|
|
Theme = new Telerik.Windows.Controls.VisualStudio2013Theme(),
|
74 |
|
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
75 |
|
|
};
|
76 |
|
|
Telerik.Windows.Controls.RadWindow.Alert(parameters);
|
77 |
|
|
}
|
78 |
7e2d29a0
|
ljiyeon
|
|
79 |
787a4489
|
KangIngu
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
80 |
|
|
{
|
81 |
0c997b99
|
ljiyeon
|
InitializeComponent();
|
82 |
ca16abb2
|
ljiyeon
|
|
83 |
|
|
//cursor change
|
84 |
|
|
this.Cursor = new Cursor(CursorChange().StreamSource);
|
85 |
|
|
|
86 |
787a4489
|
KangIngu
|
double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
|
87 |
|
|
double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
|
88 |
9f473fb7
|
KangIngu
|
//this.Width += 40;
|
89 |
787a4489
|
KangIngu
|
double windowWidth = this.Width;
|
90 |
|
|
double windowHeight = this.Height;
|
91 |
|
|
this.Left = (screenWidth / 2) - (windowWidth / 2);
|
92 |
|
|
this.Top = (screenHeight / 2) - (windowHeight / 2);
|
93 |
|
|
|
94 |
|
|
ViewerDataModel.Instance.SystemMain = this;
|
95 |
|
|
|
96 |
|
|
if (!App.ParameterMode)
|
97 |
|
|
{
|
98 |
|
|
//App.ViewInfo = new IKCOM.ViewInfo
|
99 |
|
|
//{
|
100 |
|
|
// DocumentItemID = "11111112",
|
101 |
|
|
// //DocumentItemID = "10001",
|
102 |
|
|
// bPartner = false,
|
103 |
|
|
// CreateFinalPDFPermission = true,
|
104 |
|
|
// NewCommentPermission = true,
|
105 |
|
|
// ProjectNO = "000000",
|
106 |
|
|
// UserID = "H2011357",
|
107 |
|
|
// //UserID = "H2009115",
|
108 |
|
|
// //Mode = 0 , 1 , 2
|
109 |
|
|
//};
|
110 |
|
|
//DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
|
111 |
|
|
|
112 |
7e2d29a0
|
ljiyeon
|
//#if DEBUG
|
113 |
|
|
// App.ViewInfo = new IKCOM.ViewInfo
|
114 |
|
|
// {
|
115 |
|
|
// DocumentItemID = "11111112",
|
116 |
|
|
// //DocumentItemID = "10001",
|
117 |
|
|
// bPartner = false,
|
118 |
|
|
// CreateFinalPDFPermission = true,
|
119 |
|
|
// NewCommentPermission = true,
|
120 |
|
|
// ProjectNO = "000000",
|
121 |
|
|
// UserID = "H2011357",
|
122 |
|
|
// //UserID = "H2009115",
|
123 |
|
|
// //Mode = 0 , 1 , 2
|
124 |
|
|
// };
|
125 |
|
|
// App.ParameterMode = true;
|
126 |
|
|
// this.dzMainMenu.ServiceOn();
|
127 |
|
|
// this.dzMainMenu.SetView(App.ViewInfo);
|
128 |
|
|
//#else
|
129 |
787a4489
|
KangIngu
|
|
130 |
|
|
DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
|
131 |
|
|
this.dzMainMenu.pageNavigator.Visibility = Visibility.Collapsed;
|
132 |
|
|
this.dzMainMenu.historyPane.Visibility = Visibility.Collapsed;
|
133 |
|
|
this.dzMainMenu.infoListPane.Visibility = Visibility.Collapsed;
|
134 |
|
|
this.dzMainMenu.searchPane.Visibility = Visibility.Collapsed;
|
135 |
|
|
this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed;
|
136 |
7e2d29a0
|
ljiyeon
|
//#endif
|
137 |
787a4489
|
KangIngu
|
}
|
138 |
|
|
else
|
139 |
|
|
{
|
140 |
|
|
this.dzMainMenu.ServiceOn();
|
141 |
992a98b4
|
KangIngu
|
|
142 |
|
|
if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
|
143 |
|
|
{
|
144 |
|
|
this.dzTopMenu.radRibbonView.HelpButtonVisibility = Visibility.Collapsed;
|
145 |
|
|
var list = this.dzTopMenu.ChildrenOfType<RadRibbonTab>().ToList();
|
146 |
|
|
list.ForEach(item => item.Visibility = Visibility.Collapsed);
|
147 |
|
|
this.dzTopMenu.ribbontab_ReadOnly.Visibility = Visibility.Visible;
|
148 |
|
|
this.dzTopMenu.radRibbonView.SelectedItem = this.dzTopMenu.ribbontab_ReadOnly;
|
149 |
e0204db0
|
djkim
|
//this.dzMainMenu.SymbolPane.Visibility = Visibility.Collapsed;
|
150 |
|
|
//this.dzMainMenu.FavoritePane.Visibility = Visibility.Collapsed;
|
151 |
|
|
//this.dzMainMenu.drawingRotateCanvas.IsHitTestVisible = false;
|
152 |
992a98b4
|
KangIngu
|
}
|
153 |
787a4489
|
KangIngu
|
this.dzMainMenu.SetView(App.ViewInfo);
|
154 |
7e2d29a0
|
ljiyeon
|
this.dzMainMenu.HubSet();
|
155 |
787a4489
|
KangIngu
|
}
|
156 |
6707a5c7
|
ljiyeon
|
|
157 |
787a4489
|
KangIngu
|
//App.ViewInfo = new IKCOM.ViewInfo
|
158 |
|
|
//{
|
159 |
|
|
// DocumentItemID = "11111112",
|
160 |
|
|
// //DocumentItemID = "10001",
|
161 |
|
|
// bPartner = false,
|
162 |
|
|
// CreateFinalPDFPermission = true,
|
163 |
|
|
// NewCommentPermission = true,
|
164 |
|
|
// ProjectNO = "000000",
|
165 |
|
|
// UserID = "H2011357",
|
166 |
|
|
// //UserID = "H2009115",
|
167 |
|
|
// //Mode = 0 , 1 , 2
|
168 |
|
|
//};
|
169 |
|
|
|
170 |
|
|
//this.dzMainMenu.ServiceOn();
|
171 |
|
|
//this.dzMainMenu.SetView(App.ViewInfo);
|
172 |
|
|
}
|
173 |
6707a5c7
|
ljiyeon
|
|
174 |
71bfd53e
|
ljiyeon
|
|
175 |
7e2d29a0
|
ljiyeon
|
bool restoreIfMove = false;
|
176 |
71bfd53e
|
ljiyeon
|
|
177 |
787a4489
|
KangIngu
|
private void WindowDragEvent(object sender, MouseButtonEventArgs e)
|
178 |
|
|
{
|
179 |
264c9309
|
ljiyeon
|
if(filename == null)
|
180 |
787a4489
|
KangIngu
|
{
|
181 |
264c9309
|
ljiyeon
|
if (e.ClickCount == 2)
|
182 |
787a4489
|
KangIngu
|
{
|
183 |
264c9309
|
ljiyeon
|
if ((ResizeMode == ResizeMode.CanResize) ||
|
184 |
|
|
(ResizeMode == ResizeMode.CanResizeWithGrip))
|
185 |
|
|
{
|
186 |
|
|
SwitchState();
|
187 |
|
|
}
|
188 |
787a4489
|
KangIngu
|
}
|
189 |
264c9309
|
ljiyeon
|
else
|
190 |
71bfd53e
|
ljiyeon
|
{
|
191 |
264c9309
|
ljiyeon
|
if (WindowState == WindowState.Maximized)
|
192 |
|
|
{
|
193 |
|
|
restoreIfMove = true;
|
194 |
|
|
}
|
195 |
3933072f
|
ljiyeon
|
|
196 |
264c9309
|
ljiyeon
|
this.DragMove();
|
197 |
|
|
}
|
198 |
|
|
}
|
199 |
787a4489
|
KangIngu
|
}
|
200 |
|
|
|
201 |
71bfd53e
|
ljiyeon
|
private void WindowDragEventUp(object sender, MouseButtonEventArgs e)
|
202 |
|
|
{
|
203 |
|
|
restoreIfMove = false;
|
204 |
|
|
}
|
205 |
|
|
|
206 |
|
|
private void WindowDragEventMove(object sender, MouseEventArgs e)
|
207 |
|
|
{
|
208 |
|
|
if (restoreIfMove)
|
209 |
|
|
{
|
210 |
|
|
if (Mouse.LeftButton == MouseButtonState.Pressed)
|
211 |
|
|
{
|
212 |
3933072f
|
ljiyeon
|
//this.WindowState = WindowState.Normal;
|
213 |
|
|
|
214 |
71bfd53e
|
ljiyeon
|
restoreIfMove = false;
|
215 |
|
|
|
216 |
|
|
double percentHorizontal = e.GetPosition(this).X / ActualWidth;
|
217 |
|
|
double targetHorizontal = RestoreBounds.Width * percentHorizontal;
|
218 |
|
|
|
219 |
|
|
double percentVertical = e.GetPosition(this).Y / ActualHeight;
|
220 |
|
|
double targetVertical = RestoreBounds.Height * percentVertical;
|
221 |
|
|
|
222 |
|
|
POINT lMousePosition;
|
223 |
7e2d29a0
|
ljiyeon
|
GetCursorPos(out lMousePosition);
|
224 |
71bfd53e
|
ljiyeon
|
|
225 |
|
|
Left = lMousePosition.X - targetHorizontal;
|
226 |
7e2d29a0
|
ljiyeon
|
double top = lMousePosition.Y - targetVertical;
|
227 |
|
|
if(top < 10)
|
228 |
|
|
{
|
229 |
|
|
top = 10;
|
230 |
|
|
}
|
231 |
|
|
Top = lMousePosition.Y;
|
232 |
71bfd53e
|
ljiyeon
|
|
233 |
3933072f
|
ljiyeon
|
|
234 |
71bfd53e
|
ljiyeon
|
WindowState = WindowState.Normal;
|
235 |
|
|
|
236 |
|
|
this.DragMove();
|
237 |
|
|
}
|
238 |
|
|
}
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
[DllImport("user32.dll")]
|
242 |
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
243 |
|
|
static extern bool GetCursorPos(out POINT lpPoint);
|
244 |
|
|
|
245 |
|
|
[StructLayout(LayoutKind.Sequential)]
|
246 |
|
|
public struct POINT
|
247 |
|
|
{
|
248 |
|
|
public int X;
|
249 |
|
|
public int Y;
|
250 |
|
|
|
251 |
|
|
public POINT(int x, int y)
|
252 |
|
|
{
|
253 |
|
|
this.X = x;
|
254 |
|
|
this.Y = y;
|
255 |
|
|
}
|
256 |
|
|
}
|
257 |
|
|
|
258 |
|
|
private void SwitchState()
|
259 |
|
|
{
|
260 |
|
|
switch (WindowState)
|
261 |
|
|
{
|
262 |
|
|
case WindowState.Normal:
|
263 |
|
|
{
|
264 |
|
|
WindowState = WindowState.Maximized;
|
265 |
|
|
break;
|
266 |
|
|
}
|
267 |
|
|
case WindowState.Maximized:
|
268 |
|
|
{
|
269 |
|
|
WindowState = WindowState.Normal;
|
270 |
|
|
break;
|
271 |
|
|
}
|
272 |
|
|
}
|
273 |
|
|
}
|
274 |
|
|
|
275 |
787a4489
|
KangIngu
|
private void RadButton_Click(object sender, RoutedEventArgs e)
|
276 |
|
|
{
|
277 |
|
|
Telerik.Windows.Controls.RadButton button = sender as Telerik.Windows.Controls.RadButton;
|
278 |
|
|
|
279 |
|
|
switch (button.CommandParameter.ToString())
|
280 |
|
|
{
|
281 |
|
|
case ("Min"):
|
282 |
|
|
{
|
283 |
|
|
WindowState = WindowState.Minimized;
|
284 |
|
|
}
|
285 |
|
|
break;
|
286 |
|
|
case ("Max"):
|
287 |
|
|
{
|
288 |
|
|
WindowState = WindowState.Maximized;
|
289 |
|
|
}
|
290 |
|
|
break;
|
291 |
|
|
case ("Exit"):
|
292 |
|
|
{
|
293 |
|
|
|
294 |
|
|
}
|
295 |
|
|
break;
|
296 |
|
|
}
|
297 |
|
|
}
|
298 |
|
|
|
299 |
|
|
private void WinState(object sender, MouseButtonEventArgs e)
|
300 |
|
|
{
|
301 |
af177ca1
|
djkim
|
switch ((e.Source as Image).Name)
|
302 |
787a4489
|
KangIngu
|
{
|
303 |
af177ca1
|
djkim
|
case ("Win_min"):
|
304 |
787a4489
|
KangIngu
|
{
|
305 |
|
|
WindowState = WindowState.Minimized;
|
306 |
|
|
}
|
307 |
|
|
break;
|
308 |
af177ca1
|
djkim
|
case ("Win_max"):
|
309 |
787a4489
|
KangIngu
|
{
|
310 |
af177ca1
|
djkim
|
if (WindowState == WindowState.Maximized)
|
311 |
|
|
{
|
312 |
787a4489
|
KangIngu
|
WindowState = WindowState.Normal;
|
313 |
af177ca1
|
djkim
|
}
|
314 |
787a4489
|
KangIngu
|
else
|
315 |
af177ca1
|
djkim
|
{
|
316 |
787a4489
|
KangIngu
|
WindowState = WindowState.Maximized;
|
317 |
af177ca1
|
djkim
|
}
|
318 |
787a4489
|
KangIngu
|
}
|
319 |
|
|
break;
|
320 |
af177ca1
|
djkim
|
case ("Win_Close"):
|
321 |
787a4489
|
KangIngu
|
{
|
322 |
316d0f5c
|
KangIngu
|
if (ViewerDataModel.Instance.UndoDataList.Count > 0)
|
323 |
69ef0800
|
KangIngu
|
{
|
324 |
316d0f5c
|
KangIngu
|
DateTime undoTime = ViewerDataModel.Instance.UndoDataList.OrderByDescending(order => order.EventTime).FirstOrDefault().EventTime;
|
325 |
d2cd1e16
|
djkim
|
DateTime updatetime = DateTime.Now.AddDays(-1);
|
326 |
|
|
if (ViewerDataModel.Instance._markupInfoList.Count > 0)
|
327 |
|
|
{
|
328 |
|
|
updatetime = ViewerDataModel.Instance._markupInfoList.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime;
|
329 |
|
|
}
|
330 |
6707a5c7
|
ljiyeon
|
|
331 |
316d0f5c
|
KangIngu
|
if (undoTime > updatetime)
|
332 |
|
|
{
|
333 |
69ef0800
|
KangIngu
|
var box = new TextBlock();
|
334 |
|
|
box.MinWidth = 400;
|
335 |
|
|
box.FontSize = 11;
|
336 |
|
|
box.Text = "저장되지 않은 코멘트가 있습니다. 저장 하시겠습니까?";
|
337 |
|
|
box.TextWrapping = System.Windows.TextWrapping.Wrap;
|
338 |
|
|
|
339 |
|
|
DialogParameters parameters = new DialogParameters()
|
340 |
|
|
{
|
341 |
b9b01f8e
|
ljiyeon
|
Owner = Application.Current.MainWindow,
|
342 |
69ef0800
|
KangIngu
|
Content = box,
|
343 |
|
|
Header = "Confirm",
|
344 |
|
|
Theme = new VisualStudio2013Theme(),
|
345 |
|
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
346 |
|
|
Closed = Onclose,
|
347 |
|
|
};
|
348 |
|
|
RadWindow.Confirm(parameters);
|
349 |
|
|
}
|
350 |
316d0f5c
|
KangIngu
|
}
|
351 |
264c9309
|
ljiyeon
|
|
352 |
|
|
MainWindow_Close();
|
353 |
787a4489
|
KangIngu
|
}
|
354 |
|
|
break;
|
355 |
|
|
}
|
356 |
|
|
}
|
357 |
|
|
|
358 |
264c9309
|
ljiyeon
|
private void MainWindow_Closed(object sender, EventArgs e)
|
359 |
|
|
{
|
360 |
|
|
splashScreen.Close();
|
361 |
|
|
ProcessStartInfo proInfo = new ProcessStartInfo();
|
362 |
|
|
proInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + filename;
|
363 |
|
|
Process.Start(proInfo);
|
364 |
|
|
}
|
365 |
|
|
|
366 |
|
|
//파일 다운로드 상황을 반영(수정 필요)
|
367 |
|
|
private void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
|
368 |
|
|
{
|
369 |
|
|
|
370 |
|
|
if (i <= 100)
|
371 |
|
|
{
|
372 |
|
|
i++;
|
373 |
|
|
}
|
374 |
|
|
Thread.Sleep(3);
|
375 |
|
|
splashScreen.Progress = i;
|
376 |
|
|
splashScreen.Close();
|
377 |
|
|
|
378 |
|
|
//splashScreen.Close();
|
379 |
|
|
}
|
380 |
|
|
private Thread theProgBarThread;
|
381 |
|
|
string filename = null;
|
382 |
|
|
int i = 1;
|
383 |
|
|
|
384 |
|
|
|
385 |
|
|
public static SplashScreenWindow splashScreen = new SplashScreenWindow();
|
386 |
|
|
private void MainWindow_Close()
|
387 |
|
|
{
|
388 |
|
|
try
|
389 |
|
|
{
|
390 |
|
|
string url = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetVersionData(Environment.Is64BitProcess, Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
391 |
|
|
if (!string.IsNullOrEmpty(url))
|
392 |
|
|
{
|
393 |
|
|
if (MessageBox.Show("새로운 버전이 있습니다. \n업데이트 하시겠습니까?", "MARKUS", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
|
394 |
|
|
{
|
395 |
|
|
//splashScreen.splashText.Text = " DownLoad...";
|
396 |
|
|
|
397 |
|
|
splashScreen.Show();
|
398 |
|
|
WebClient theDownloadThread = new WebClient();
|
399 |
|
|
//Uri url = new Uri(itemInfoList[i].FileName);
|
400 |
|
|
theDownloadThread.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
|
401 |
|
|
theDownloadThread.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
|
402 |
|
|
filename = System.IO.Path.GetFileName(url);
|
403 |
|
|
|
404 |
|
|
if (!File.Exists(TempFile.TempFolder))
|
405 |
|
|
{
|
406 |
|
|
Directory.CreateDirectory(TempFile.TempFolder);
|
407 |
|
|
}
|
408 |
|
|
|
409 |
|
|
theDownloadThread.DownloadFileAsync(new Uri(url), System.IO.Path.Combine(TempFile.TempFolder, filename));
|
410 |
|
|
|
411 |
|
|
}
|
412 |
|
|
else
|
413 |
|
|
{
|
414 |
|
|
this.Close();
|
415 |
|
|
}
|
416 |
|
|
}
|
417 |
|
|
else
|
418 |
|
|
{
|
419 |
|
|
this.Close();
|
420 |
|
|
}
|
421 |
|
|
|
422 |
|
|
}
|
423 |
|
|
catch (Exception)
|
424 |
|
|
{
|
425 |
|
|
this.Close();
|
426 |
|
|
}
|
427 |
|
|
}
|
428 |
|
|
|
429 |
|
|
private void Completed(object sender, AsyncCompletedEventArgs e)
|
430 |
|
|
{
|
431 |
|
|
try
|
432 |
|
|
{
|
433 |
|
|
this.Close();
|
434 |
|
|
}
|
435 |
|
|
catch (Exception ee)
|
436 |
|
|
{
|
437 |
|
|
}
|
438 |
|
|
|
439 |
|
|
}
|
440 |
|
|
|
441 |
69ef0800
|
KangIngu
|
private void Onclose(object sender, WindowClosedEventArgs e)
|
442 |
|
|
{
|
443 |
|
|
if (e.DialogResult == true)
|
444 |
|
|
{
|
445 |
cb5c7f06
|
humkyung
|
dzTopMenu.SaveEventCallback(null, null);
|
446 |
69ef0800
|
KangIngu
|
}
|
447 |
|
|
}
|
448 |
7e2d29a0
|
ljiyeon
|
|
449 |
|
|
void win_SourceInitialized(object sender, EventArgs e)
|
450 |
|
|
{
|
451 |
|
|
System.IntPtr handle = (new WinInterop.WindowInteropHelper(this)).Handle;
|
452 |
|
|
WinInterop.HwndSource.FromHwnd(handle).AddHook(new WinInterop.HwndSourceHook(WindowProc));
|
453 |
|
|
}
|
454 |
|
|
|
455 |
|
|
private static System.IntPtr WindowProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)
|
456 |
|
|
{
|
457 |
|
|
switch (msg)
|
458 |
|
|
{
|
459 |
|
|
case 0x0024:
|
460 |
|
|
WmGetMinMaxInfo(hwnd, lParam);
|
461 |
b0fb3ad7
|
ljiyeon
|
handled = true;
|
462 |
7e2d29a0
|
ljiyeon
|
break;
|
463 |
|
|
}
|
464 |
|
|
return (System.IntPtr)0;
|
465 |
|
|
}
|
466 |
|
|
|
467 |
|
|
private static void WmGetMinMaxInfo(System.IntPtr hwnd, System.IntPtr lParam)
|
468 |
|
|
{
|
469 |
|
|
MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
|
470 |
|
|
int MONITOR_DEFAULTTONEAREST = 0x00000002;
|
471 |
|
|
System.IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
|
472 |
|
|
|
473 |
|
|
if (monitor != System.IntPtr.Zero)
|
474 |
|
|
{
|
475 |
|
|
MONITORINFO monitorInfo = new MONITORINFO();
|
476 |
|
|
GetMonitorInfo(monitor, monitorInfo);
|
477 |
|
|
RECT rcWorkArea = monitorInfo.rcWork;
|
478 |
|
|
RECT rcMonitorArea = monitorInfo.rcMonitor;
|
479 |
|
|
mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left);
|
480 |
|
|
mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top);
|
481 |
|
|
mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left);
|
482 |
|
|
mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top);
|
483 |
|
|
}
|
484 |
|
|
Marshal.StructureToPtr(mmi, lParam, true);
|
485 |
|
|
}
|
486 |
|
|
|
487 |
|
|
[StructLayout(LayoutKind.Sequential)]
|
488 |
|
|
public struct POINT2
|
489 |
|
|
{
|
490 |
|
|
public int x;
|
491 |
|
|
public int y;
|
492 |
|
|
public POINT2(int x, int y)
|
493 |
|
|
{
|
494 |
|
|
this.x = x;
|
495 |
|
|
this.y = y;
|
496 |
|
|
}
|
497 |
|
|
}
|
498 |
|
|
|
499 |
|
|
[StructLayout(LayoutKind.Sequential)]
|
500 |
|
|
public struct MINMAXINFO
|
501 |
|
|
{
|
502 |
|
|
public POINT2 ptReserved;
|
503 |
|
|
public POINT2 ptMaxSize;
|
504 |
|
|
public POINT2 ptMaxPosition;
|
505 |
|
|
public POINT2 ptMinTrackSize;
|
506 |
|
|
public POINT2 ptMaxTrackSize;
|
507 |
|
|
};
|
508 |
|
|
|
509 |
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
510 |
|
|
public class MONITORINFO
|
511 |
b0fb3ad7
|
ljiyeon
|
{
|
512 |
|
|
public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
|
513 |
|
|
public RECT rcMonitor = new RECT();
|
514 |
|
|
public RECT rcWork = new RECT();
|
515 |
7e2d29a0
|
ljiyeon
|
public int dwFlags = 0;
|
516 |
|
|
}
|
517 |
|
|
|
518 |
|
|
[StructLayout(LayoutKind.Sequential, Pack = 0)]
|
519 |
|
|
public struct RECT
|
520 |
|
|
{
|
521 |
|
|
public int left;
|
522 |
|
|
public int top;
|
523 |
b0fb3ad7
|
ljiyeon
|
public int right;
|
524 |
7e2d29a0
|
ljiyeon
|
public int bottom;
|
525 |
|
|
|
526 |
|
|
public static readonly RECT Empty = new RECT();
|
527 |
|
|
|
528 |
|
|
public int Width
|
529 |
|
|
{
|
530 |
|
|
get { return Math.Abs(right - left); } // Abs needed for BIDI OS
|
531 |
|
|
}
|
532 |
|
|
|
533 |
|
|
public int Height
|
534 |
|
|
{
|
535 |
|
|
get { return bottom - top; }
|
536 |
|
|
}
|
537 |
|
|
|
538 |
|
|
public RECT(int left, int top, int right, int bottom)
|
539 |
|
|
{
|
540 |
|
|
this.left = left;
|
541 |
|
|
this.top = top;
|
542 |
|
|
this.right = right;
|
543 |
|
|
this.bottom = bottom;
|
544 |
|
|
}
|
545 |
|
|
|
546 |
|
|
public RECT(RECT rcSrc)
|
547 |
|
|
{
|
548 |
|
|
this.left = rcSrc.left;
|
549 |
|
|
this.top = rcSrc.top;
|
550 |
|
|
this.right = rcSrc.right;
|
551 |
|
|
this.bottom = rcSrc.bottom;
|
552 |
|
|
}
|
553 |
|
|
|
554 |
|
|
public bool IsEmpty
|
555 |
|
|
{
|
556 |
|
|
get
|
557 |
|
|
{
|
558 |
|
|
// BUGBUG : On Bidi OS (hebrew arabic) left > right
|
559 |
|
|
return left >= right || top >= bottom;
|
560 |
|
|
}
|
561 |
|
|
}
|
562 |
|
|
|
563 |
|
|
public override bool Equals(object obj)
|
564 |
|
|
{
|
565 |
|
|
if (!(obj is Rect)) { return false; }
|
566 |
|
|
return (this == (RECT)obj);
|
567 |
|
|
}
|
568 |
|
|
|
569 |
|
|
public override int GetHashCode()
|
570 |
|
|
{
|
571 |
|
|
return left.GetHashCode() + top.GetHashCode() + right.GetHashCode() + bottom.GetHashCode();
|
572 |
|
|
}
|
573 |
|
|
|
574 |
|
|
public static bool operator ==(RECT rect1, RECT rect2)
|
575 |
|
|
{
|
576 |
|
|
return (rect1.left == rect2.left && rect1.top == rect2.top && rect1.right == rect2.right && rect1.bottom == rect2.bottom);
|
577 |
|
|
}
|
578 |
|
|
|
579 |
|
|
public static bool operator !=(RECT rect1, RECT rect2)
|
580 |
|
|
{
|
581 |
|
|
return !(rect1 == rect2);
|
582 |
|
|
}
|
583 |
|
|
}
|
584 |
|
|
|
585 |
|
|
[DllImport("user32")]
|
586 |
|
|
internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
|
587 |
|
|
[DllImport("User32")]
|
588 |
|
|
internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
|
589 |
787a4489
|
KangIngu
|
}
|
590 |
|
|
} |