1 |
787a4489
|
KangIngu
|
using KCOM.Common;
|
2 |
32af2c3b
|
djkim
|
using KCOM.Controls;
|
3 |
264c9309
|
ljiyeon
|
using KCOM.Views;
|
4 |
787a4489
|
KangIngu
|
using KCOMDataModel;
|
5 |
|
|
using KCOMDataModel.DataModel;
|
6 |
b0fb3ad7
|
ljiyeon
|
using MarkupToPDF.Common;
|
7 |
5529d2a2
|
humkyung
|
using MarkupToPDF.Controls.Parsing;
|
8 |
b0fb3ad7
|
ljiyeon
|
using MarkupToPDF.Serialize.Core;
|
9 |
|
|
using MarkupToPDF.Serialize.S_Control;
|
10 |
787a4489
|
KangIngu
|
using System;
|
11 |
|
|
using System.Collections.Generic;
|
12 |
264c9309
|
ljiyeon
|
using System.ComponentModel;
|
13 |
|
|
using System.Diagnostics;
|
14 |
6707a5c7
|
ljiyeon
|
using System.IO;
|
15 |
787a4489
|
KangIngu
|
using System.Linq;
|
16 |
264c9309
|
ljiyeon
|
using System.Net;
|
17 |
|
|
using System.Reflection;
|
18 |
71bfd53e
|
ljiyeon
|
using System.Runtime.InteropServices;
|
19 |
787a4489
|
KangIngu
|
using System.Text;
|
20 |
264c9309
|
ljiyeon
|
using System.Threading;
|
21 |
|
|
using System.Threading.Tasks;
|
22 |
787a4489
|
KangIngu
|
using System.Windows;
|
23 |
|
|
using System.Windows.Controls;
|
24 |
|
|
using System.Windows.Data;
|
25 |
|
|
using System.Windows.Documents;
|
26 |
|
|
using System.Windows.Input;
|
27 |
|
|
using System.Windows.Media;
|
28 |
|
|
using System.Windows.Media.Imaging;
|
29 |
|
|
using System.Windows.Navigation;
|
30 |
|
|
using System.Windows.Shapes;
|
31 |
6707a5c7
|
ljiyeon
|
using System.Xml;
|
32 |
992a98b4
|
KangIngu
|
using Telerik.Windows.Controls;
|
33 |
7e2d29a0
|
ljiyeon
|
using WinInterop = System.Windows.Interop;
|
34 |
787a4489
|
KangIngu
|
|
35 |
|
|
namespace KCOM
|
36 |
|
|
{
|
37 |
|
|
/// <summary>
|
38 |
|
|
/// MainWindow.xaml에 대한 상호 작용 논리
|
39 |
|
|
/// </summary>
|
40 |
68302e9d
|
taeseongkim
|
public partial class MainWindow : KCOM.Controls.CustomizedWindow.CustomWindow
|
41 |
787a4489
|
KangIngu
|
{
|
42 |
32af2c3b
|
djkim
|
bool isSaveCheck = false;
|
43 |
d33ef543
|
taeseongkim
|
|
44 |
32af2c3b
|
djkim
|
ProgressControl progressControl = null;
|
45 |
|
|
string destfilepath = string.Empty;
|
46 |
|
|
|
47 |
787a4489
|
KangIngu
|
public MainWindow()
|
48 |
|
|
{
|
49 |
e0cfc73c
|
ljiyeon
|
App.splashString(ISplashMessage.MAINWINDOW);
|
50 |
c362d2a5
|
taeseongkim
|
|
51 |
787a4489
|
KangIngu
|
this.Loaded += MainWindow_Loaded;
|
52 |
eeb0a39c
|
taeseongkim
|
this.Unloaded += MainWindow_Unloaded;
|
53 |
8e6884a5
|
taeseongkim
|
//this.PreviewKeyDown += new KeyEventHandler(KeyEventDownAction);
|
54 |
d97dbc7f
|
taeseongkim
|
this.Activated += MainWindow_Activated;
|
55 |
|
|
}
|
56 |
|
|
|
57 |
9d5b4bc2
|
taeseongkim
|
|
58 |
2007ecaa
|
taeseongkim
|
|
59 |
d97dbc7f
|
taeseongkim
|
private void MainWindow_Activated(object sender, EventArgs e)
|
60 |
|
|
{
|
61 |
|
|
this.Topmost = true;
|
62 |
448c5399
|
taeseongkim
|
this.Topmost = false;
|
63 |
787a4489
|
KangIngu
|
}
|
64 |
ca16abb2
|
ljiyeon
|
|
65 |
eeb0a39c
|
taeseongkim
|
private void MainWindow_Unloaded(object sender, RoutedEventArgs e)
|
66 |
|
|
{
|
67 |
|
|
}
|
68 |
|
|
|
69 |
787a4489
|
KangIngu
|
public void DialogMessage_Alert(string content, string header)
|
70 |
|
|
{
|
71 |
c362d2a5
|
taeseongkim
|
App.splashScreen.Close();
|
72 |
|
|
|
73 |
787a4489
|
KangIngu
|
Telerik.Windows.Controls.DialogParameters parameters = new Telerik.Windows.Controls.DialogParameters()
|
74 |
|
|
{
|
75 |
b9b01f8e
|
ljiyeon
|
Owner = Application.Current.MainWindow,
|
76 |
0d32593b
|
ljiyeon
|
Content = new TextBlock()
|
77 |
d33ef543
|
taeseongkim
|
{
|
78 |
0d32593b
|
ljiyeon
|
MinWidth = 400,
|
79 |
|
|
FontSize = 12,
|
80 |
|
|
Text = content,
|
81 |
|
|
TextWrapping = System.Windows.TextWrapping.Wrap
|
82 |
|
|
},
|
83 |
787a4489
|
KangIngu
|
Header = header,
|
84 |
|
|
Theme = new Telerik.Windows.Controls.VisualStudio2013Theme(),
|
85 |
|
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
86 |
|
|
};
|
87 |
|
|
Telerik.Windows.Controls.RadWindow.Alert(parameters);
|
88 |
|
|
}
|
89 |
7e2d29a0
|
ljiyeon
|
|
90 |
787a4489
|
KangIngu
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
91 |
|
|
{
|
92 |
0c997b99
|
ljiyeon
|
InitializeComponent();
|
93 |
d33ef543
|
taeseongkim
|
|
94 |
ca16abb2
|
ljiyeon
|
//cursor change
|
95 |
902faaea
|
taeseongkim
|
this.Cursor = new Cursor(App.DefaultArrowCursorStream);
|
96 |
ca16abb2
|
ljiyeon
|
|
97 |
d33ef543
|
taeseongkim
|
var point = GetScreenCenter();
|
98 |
|
|
|
99 |
c362d2a5
|
taeseongkim
|
//this.Left = point.X;
|
100 |
|
|
//this.Top = point.Y;
|
101 |
787a4489
|
KangIngu
|
|
102 |
|
|
ViewerDataModel.Instance.SystemMain = this;
|
103 |
|
|
|
104 |
|
|
if (!App.ParameterMode)
|
105 |
|
|
{
|
106 |
|
|
//App.ViewInfo = new IKCOM.ViewInfo
|
107 |
|
|
//{
|
108 |
|
|
// DocumentItemID = "11111112",
|
109 |
|
|
// //DocumentItemID = "10001",
|
110 |
|
|
// bPartner = false,
|
111 |
|
|
// CreateFinalPDFPermission = true,
|
112 |
|
|
// NewCommentPermission = true,
|
113 |
|
|
// ProjectNO = "000000",
|
114 |
|
|
// UserID = "H2011357",
|
115 |
|
|
// //UserID = "H2009115",
|
116 |
|
|
// //Mode = 0 , 1 , 2
|
117 |
|
|
//};
|
118 |
|
|
//DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
|
119 |
|
|
|
120 |
7e2d29a0
|
ljiyeon
|
//#if DEBUG
|
121 |
|
|
// App.ViewInfo = new IKCOM.ViewInfo
|
122 |
|
|
// {
|
123 |
|
|
// DocumentItemID = "11111112",
|
124 |
|
|
// //DocumentItemID = "10001",
|
125 |
|
|
// bPartner = false,
|
126 |
|
|
// CreateFinalPDFPermission = true,
|
127 |
|
|
// NewCommentPermission = true,
|
128 |
|
|
// ProjectNO = "000000",
|
129 |
|
|
// UserID = "H2011357",
|
130 |
|
|
// //UserID = "H2009115",
|
131 |
|
|
// //Mode = 0 , 1 , 2
|
132 |
|
|
// };
|
133 |
|
|
// App.ParameterMode = true;
|
134 |
|
|
// this.dzMainMenu.ServiceOn();
|
135 |
|
|
// this.dzMainMenu.SetView(App.ViewInfo);
|
136 |
|
|
//#else
|
137 |
787a4489
|
KangIngu
|
|
138 |
|
|
DialogMessage_Alert("데모버전은 단독 실행모드를 지원하지 않습니다", "안내");
|
139 |
|
|
this.dzMainMenu.pageNavigator.Visibility = Visibility.Collapsed;
|
140 |
|
|
this.dzMainMenu.historyPane.Visibility = Visibility.Collapsed;
|
141 |
|
|
this.dzMainMenu.infoListPane.Visibility = Visibility.Collapsed;
|
142 |
|
|
this.dzMainMenu.searchPane.Visibility = Visibility.Collapsed;
|
143 |
|
|
this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed;
|
144 |
7e2d29a0
|
ljiyeon
|
//#endif
|
145 |
787a4489
|
KangIngu
|
}
|
146 |
|
|
else
|
147 |
|
|
{
|
148 |
43e1d368
|
taeseongkim
|
this.dzMainMenu.talkPane.Visibility = Visibility.Collapsed;
|
149 |
787a4489
|
KangIngu
|
this.dzMainMenu.ServiceOn();
|
150 |
992a98b4
|
KangIngu
|
|
151 |
|
|
if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission)
|
152 |
|
|
{
|
153 |
|
|
this.dzTopMenu.radRibbonView.HelpButtonVisibility = Visibility.Collapsed;
|
154 |
|
|
var list = this.dzTopMenu.ChildrenOfType<RadRibbonTab>().ToList();
|
155 |
|
|
list.ForEach(item => item.Visibility = Visibility.Collapsed);
|
156 |
|
|
this.dzTopMenu.ribbontab_ReadOnly.Visibility = Visibility.Visible;
|
157 |
|
|
this.dzTopMenu.radRibbonView.SelectedItem = this.dzTopMenu.ribbontab_ReadOnly;
|
158 |
e0204db0
|
djkim
|
//this.dzMainMenu.SymbolPane.Visibility = Visibility.Collapsed;
|
159 |
|
|
//this.dzMainMenu.FavoritePane.Visibility = Visibility.Collapsed;
|
160 |
|
|
//this.dzMainMenu.drawingRotateCanvas.IsHitTestVisible = false;
|
161 |
992a98b4
|
KangIngu
|
}
|
162 |
3d31db34
|
송근호
|
|
163 |
|
|
try
|
164 |
|
|
{
|
165 |
ff01c725
|
humkyung
|
///this.dzMainMenu.HubSet();
|
166 |
3d31db34
|
송근호
|
this.dzMainMenu.SetView(App.ViewInfo);
|
167 |
|
|
}
|
168 |
5a6493ad
|
humkyung
|
catch (Exception ex)
|
169 |
3d31db34
|
송근호
|
{
|
170 |
5a6493ad
|
humkyung
|
MessageBox.Show(string.Format("웹 서비스 접속시 에러가 발생했습니다.\n{0}", ex.StackTrace));
|
171 |
3724d2a2
|
송근호
|
|
172 |
|
|
System.Environment.Exit(0);
|
173 |
3d31db34
|
송근호
|
}
|
174 |
787a4489
|
KangIngu
|
}
|
175 |
|
|
}
|
176 |
6707a5c7
|
ljiyeon
|
|
177 |
d33ef543
|
taeseongkim
|
private Point GetScreenCenter()
|
178 |
787a4489
|
KangIngu
|
{
|
179 |
d33ef543
|
taeseongkim
|
Point result = new Point();
|
180 |
3933072f
|
ljiyeon
|
|
181 |
d33ef543
|
taeseongkim
|
//first get all the screens
|
182 |
|
|
System.Drawing.Rectangle ret;
|
183 |
|
|
int ScreenWidth = 0;
|
184 |
787a4489
|
KangIngu
|
|
185 |
d33ef543
|
taeseongkim
|
var mousePosition = System.Windows.Forms.Cursor.Position;
|
186 |
71bfd53e
|
ljiyeon
|
|
187 |
d33ef543
|
taeseongkim
|
for (int i = 1; i <= System.Windows.Forms.Screen.AllScreens.Count(); i++)
|
188 |
71bfd53e
|
ljiyeon
|
{
|
189 |
d33ef543
|
taeseongkim
|
ret = System.Windows.Forms.Screen.AllScreens[i - 1].Bounds;
|
190 |
3933072f
|
ljiyeon
|
|
191 |
d33ef543
|
taeseongkim
|
if (ret.Contains(mousePosition))
|
192 |
|
|
{
|
193 |
|
|
result.X = ScreenWidth + (ret.Width / 2 - this.Width / 2);
|
194 |
|
|
result.Y = (ret.Height / 2 - this.Height / 2);
|
195 |
71bfd53e
|
ljiyeon
|
|
196 |
d33ef543
|
taeseongkim
|
break;
|
197 |
|
|
}
|
198 |
|
|
else
|
199 |
|
|
{
|
200 |
|
|
ScreenWidth += ret.Width;
|
201 |
71bfd53e
|
ljiyeon
|
}
|
202 |
|
|
|
203 |
d33ef543
|
taeseongkim
|
}
|
204 |
71bfd53e
|
ljiyeon
|
|
205 |
|
|
|
206 |
d33ef543
|
taeseongkim
|
return result;
|
207 |
71bfd53e
|
ljiyeon
|
}
|
208 |
|
|
|
209 |
d33ef543
|
taeseongkim
|
protected override void OnStateChanged(EventArgs e)
|
210 |
71bfd53e
|
ljiyeon
|
{
|
211 |
d33ef543
|
taeseongkim
|
base.OnStateChanged(e);
|
212 |
71bfd53e
|
ljiyeon
|
}
|
213 |
|
|
|
214 |
d33ef543
|
taeseongkim
|
protected override void OnClosing(CancelEventArgs e)
|
215 |
787a4489
|
KangIngu
|
{
|
216 |
d33ef543
|
taeseongkim
|
base.OnClosing(e);
|
217 |
cf1cc862
|
taeseongkim
|
|
218 |
bae83c92
|
taeseongkim
|
if(!ViewerDataModel.Instance.SaveCheck())
|
219 |
75f6ff19
|
taeseongkim
|
{
|
220 |
c362d2a5
|
taeseongkim
|
var IsConfirm = SaveConfirm();
|
221 |
|
|
|
222 |
|
|
if (IsConfirm == null)
|
223 |
75f6ff19
|
taeseongkim
|
{
|
224 |
|
|
e.Cancel = true;
|
225 |
|
|
}
|
226 |
c362d2a5
|
taeseongkim
|
else if(IsConfirm == true)
|
227 |
|
|
{
|
228 |
|
|
dzTopMenu.SaveEventCallback(null, null);
|
229 |
|
|
}
|
230 |
75f6ff19
|
taeseongkim
|
}
|
231 |
787a4489
|
KangIngu
|
|
232 |
bae83c92
|
taeseongkim
|
if (App.ViewInfo.CreateFinalPDFPermission)
|
233 |
|
|
{
|
234 |
|
|
if (!ViewerDataModel.Instance.FinalPDFCheck())
|
235 |
|
|
{
|
236 |
|
|
var result = FinalConfirm();
|
237 |
|
|
|
238 |
9380813b
|
swate0609
|
if(result == null)
|
239 |
|
|
e.Cancel = true;
|
240 |
|
|
|
241 |
bae83c92
|
taeseongkim
|
if (result == false)
|
242 |
|
|
{
|
243 |
|
|
e.Cancel = true;
|
244 |
|
|
}
|
245 |
|
|
else
|
246 |
|
|
{
|
247 |
6a19b48d
|
taeseongkim
|
//Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveLog(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, "최종 Merged PDF 안됨.");
|
248 |
bae83c92
|
taeseongkim
|
}
|
249 |
|
|
}
|
250 |
|
|
}
|
251 |
|
|
|
252 |
d33ef543
|
taeseongkim
|
//Update Check 를 통해 update url 을 Get 하고 결과값이 있을 경우에는 SmartUpdater 실행.
|
253 |
9d5b4bc2
|
taeseongkim
|
//KeyValuePair<bool, string> updatecheck = UpdateCheck();
|
254 |
|
|
//if (updatecheck.Key && !string.IsNullOrEmpty(updatecheck.Value))
|
255 |
|
|
//{
|
256 |
|
|
// CallUpdateProcess(updatecheck.Value);
|
257 |
|
|
//}
|
258 |
787a4489
|
KangIngu
|
}
|
259 |
d33ef543
|
taeseongkim
|
|
260 |
bae83c92
|
taeseongkim
|
|
261 |
|
|
private bool? SaveConfirm()
|
262 |
264c9309
|
ljiyeon
|
{
|
263 |
bae83c92
|
taeseongkim
|
bool? result = null;
|
264 |
|
|
|
265 |
|
|
EventHandler<WindowClosedEventArgs> Closedhandler = null;
|
266 |
75f6ff19
|
taeseongkim
|
|
267 |
bae83c92
|
taeseongkim
|
Closedhandler = (snd, evt) =>
|
268 |
32af2c3b
|
djkim
|
{
|
269 |
bae83c92
|
taeseongkim
|
result = evt.DialogResult;
|
270 |
|
|
};
|
271 |
264c9309
|
ljiyeon
|
|
272 |
bae83c92
|
taeseongkim
|
DialogParameters parameters = new DialogParameters()
|
273 |
|
|
{
|
274 |
|
|
Content = new TextBlock()
|
275 |
32af2c3b
|
djkim
|
{
|
276 |
bae83c92
|
taeseongkim
|
MinWidth = 300,
|
277 |
|
|
FontSize = 11,
|
278 |
|
|
Text = "Found unsaved comments. Save now?",
|
279 |
|
|
TextWrapping = System.Windows.TextWrapping.Wrap
|
280 |
|
|
},
|
281 |
|
|
|
282 |
|
|
Header = "Confirm",
|
283 |
|
|
Theme = new VisualStudio2013Theme(),
|
284 |
|
|
ContentStyle = Application.Current.Resources["RadConfirmYNCStyle"] as Style,
|
285 |
|
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
286 |
|
|
|
287 |
|
|
Owner = Application.Current.MainWindow,
|
288 |
|
|
Opened = (s, openedEvent) =>
|
289 |
32af2c3b
|
djkim
|
{
|
290 |
bae83c92
|
taeseongkim
|
RadWindow confirm = s as RadWindow;
|
291 |
|
|
//Button Cancel = confirm.ChildrenOfType<Button>()[5];
|
292 |
|
|
//FocusManager.SetIsFocusScope(confirm, true);
|
293 |
|
|
//FocusManager.SetFocusedElement(confirm, Cancel);
|
294 |
|
|
},
|
295 |
|
|
|
296 |
|
|
Closed = Closedhandler
|
297 |
|
|
};
|
298 |
|
|
|
299 |
|
|
RadWindow.Confirm(parameters);
|
300 |
75f6ff19
|
taeseongkim
|
|
301 |
|
|
return result;
|
302 |
264c9309
|
ljiyeon
|
}
|
303 |
75f6ff19
|
taeseongkim
|
|
304 |
bae83c92
|
taeseongkim
|
private bool? FinalConfirm()
|
305 |
32af2c3b
|
djkim
|
{
|
306 |
bae83c92
|
taeseongkim
|
bool? result = false;
|
307 |
75f6ff19
|
taeseongkim
|
|
308 |
|
|
EventHandler<WindowClosedEventArgs> Closedhandler = null;
|
309 |
|
|
|
310 |
|
|
Closedhandler = (snd, evt) =>
|
311 |
32af2c3b
|
djkim
|
{
|
312 |
c362d2a5
|
taeseongkim
|
result = evt.DialogResult;
|
313 |
75f6ff19
|
taeseongkim
|
};
|
314 |
|
|
|
315 |
|
|
DialogParameters parameters = new DialogParameters()
|
316 |
|
|
{
|
317 |
|
|
Content = new TextBlock()
|
318 |
|
|
{
|
319 |
c362d2a5
|
taeseongkim
|
MinWidth = 300,
|
320 |
75f6ff19
|
taeseongkim
|
FontSize = 11,
|
321 |
bae83c92
|
taeseongkim
|
Text = "Merged PDF가 수행되지 않았습니다. 창을 닫으시겠습니까?",
|
322 |
75f6ff19
|
taeseongkim
|
TextWrapping = System.Windows.TextWrapping.Wrap
|
323 |
|
|
},
|
324 |
c362d2a5
|
taeseongkim
|
|
325 |
75f6ff19
|
taeseongkim
|
Header = "Confirm",
|
326 |
|
|
Theme = new VisualStudio2013Theme(),
|
327 |
bae83c92
|
taeseongkim
|
ContentStyle = Application.Current.Resources["RadConfirmYNStyle"] as Style,
|
328 |
75f6ff19
|
taeseongkim
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
329 |
c362d2a5
|
taeseongkim
|
|
330 |
|
|
Owner = Application.Current.MainWindow,
|
331 |
|
|
Opened = (s, openedEvent) =>
|
332 |
|
|
{
|
333 |
|
|
RadWindow confirm = s as RadWindow;
|
334 |
|
|
},
|
335 |
|
|
|
336 |
75f6ff19
|
taeseongkim
|
Closed = Closedhandler
|
337 |
|
|
};
|
338 |
|
|
|
339 |
|
|
RadWindow.Confirm(parameters);
|
340 |
|
|
|
341 |
|
|
return result;
|
342 |
32af2c3b
|
djkim
|
}
|
343 |
d33ef543
|
taeseongkim
|
|
344 |
32af2c3b
|
djkim
|
private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
|
345 |
|
|
{
|
346 |
|
|
Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate
|
347 |
|
|
{
|
348 |
|
|
double bytesIn = double.Parse(e.BytesReceived.ToString());
|
349 |
|
|
double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
|
350 |
|
|
double percentage = bytesIn / totalBytes * 100;
|
351 |
|
|
progressControl.splashText.Text = "Download : " + Math.Truncate(percentage).ToString() + " %";
|
352 |
d33ef543
|
taeseongkim
|
progressControl.progressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
|
353 |
32af2c3b
|
djkim
|
}));
|
354 |
310eff8b
|
djkim
|
}
|
355 |
|
|
|
356 |
|
|
/// <summary>
|
357 |
|
|
/// KCOM_API 를 통해 업데이트 URL 을 가져옴.
|
358 |
|
|
/// false : 업데이트 불필요.
|
359 |
|
|
/// true : 업데이트 필요. url 을 같이 Return.
|
360 |
|
|
/// </summary>
|
361 |
|
|
/// <returns></returns>
|
362 |
|
|
private KeyValuePair<bool, string> UpdateCheck()
|
363 |
264c9309
|
ljiyeon
|
{
|
364 |
310eff8b
|
djkim
|
bool isUpdateCheck = false;
|
365 |
|
|
string updateurl = string.Empty;
|
366 |
264c9309
|
ljiyeon
|
try
|
367 |
|
|
{
|
368 |
ffddbe4e
|
djkim
|
bool is64bit = Environment.Is64BitProcess;
|
369 |
|
|
string clientversion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
370 |
|
|
updateurl = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetVersionData(is64bit, clientversion);
|
371 |
d33ef543
|
taeseongkim
|
|
372 |
ffddbe4e
|
djkim
|
if (Check_Uri.isUri(updateurl))
|
373 |
d33ef543
|
taeseongkim
|
{
|
374 |
32af2c3b
|
djkim
|
DialogParameters parameters = new DialogParameters()
|
375 |
264c9309
|
ljiyeon
|
{
|
376 |
32af2c3b
|
djkim
|
Owner = Application.Current.MainWindow,
|
377 |
97cde7e3
|
ljiyeon
|
Content = new TextBlock()
|
378 |
|
|
{
|
379 |
|
|
MinWidth = 400,
|
380 |
|
|
FontSize = 11,
|
381 |
eeb0a39c
|
taeseongkim
|
Text = "Update is available. \n Update now?",
|
382 |
97cde7e3
|
ljiyeon
|
TextWrapping = System.Windows.TextWrapping.Wrap
|
383 |
|
|
},
|
384 |
32af2c3b
|
djkim
|
Header = "Confirm",
|
385 |
|
|
Theme = new VisualStudio2013Theme(),
|
386 |
d33ef543
|
taeseongkim
|
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
|
387 |
32af2c3b
|
djkim
|
Closed = delegate (object windowSender, WindowClosedEventArgs e)
|
388 |
264c9309
|
ljiyeon
|
{
|
389 |
32af2c3b
|
djkim
|
if (e.DialogResult == true)
|
390 |
d33ef543
|
taeseongkim
|
{
|
391 |
|
|
isUpdateCheck = true;
|
392 |
97cde7e3
|
ljiyeon
|
}
|
393 |
|
|
else
|
394 |
32af2c3b
|
djkim
|
{
|
395 |
310eff8b
|
djkim
|
isUpdateCheck = false;
|
396 |
d33ef543
|
taeseongkim
|
}
|
397 |
|
|
}
|
398 |
32af2c3b
|
djkim
|
};
|
399 |
d33ef543
|
taeseongkim
|
RadWindow.Confirm(parameters);
|
400 |
|
|
|
401 |
264c9309
|
ljiyeon
|
}
|
402 |
|
|
else
|
403 |
|
|
{
|
404 |
310eff8b
|
djkim
|
isUpdateCheck = false;
|
405 |
264c9309
|
ljiyeon
|
}
|
406 |
|
|
}
|
407 |
5a6493ad
|
humkyung
|
catch (Exception ex)
|
408 |
264c9309
|
ljiyeon
|
{
|
409 |
5a6493ad
|
humkyung
|
throw ex;
|
410 |
310eff8b
|
djkim
|
}
|
411 |
|
|
return new KeyValuePair<bool, string>(isUpdateCheck, updateurl);
|
412 |
264c9309
|
ljiyeon
|
}
|
413 |
|
|
|
414 |
310eff8b
|
djkim
|
/// <summary>
|
415 |
|
|
/// SmartUpdate 를 호출.
|
416 |
|
|
/// </summary>
|
417 |
|
|
/// <param name="updateurl">Download 할 설치파일 경로</param>
|
418 |
|
|
private void CallUpdateProcess(string updateurl)
|
419 |
|
|
{
|
420 |
|
|
ProcessStartInfo proInfo = new ProcessStartInfo();
|
421 |
|
|
string smartupdaterpath = string.Empty;
|
422 |
|
|
smartupdaterpath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SmartUpdate.exe");
|
423 |
|
|
Process.Start(smartupdaterpath, updateurl);
|
424 |
|
|
}
|
425 |
d04e8ee9
|
taeseongkim
|
private async void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
426 |
32af2c3b
|
djkim
|
{
|
427 |
264c9309
|
ljiyeon
|
try
|
428 |
|
|
{
|
429 |
d33ef543
|
taeseongkim
|
await Dispatcher.InvokeAsync(() => progressControl.splashText.Text = "Download Completed");
|
430 |
d04e8ee9
|
taeseongkim
|
|
431 |
d33ef543
|
taeseongkim
|
if (progressControl != null)
|
432 |
32af2c3b
|
djkim
|
{
|
433 |
|
|
progressControl.Close();
|
434 |
|
|
progressControl = null;
|
435 |
|
|
}
|
436 |
d33ef543
|
taeseongkim
|
if (File.Exists(destfilepath))
|
437 |
32af2c3b
|
djkim
|
{
|
438 |
|
|
ProcessStartInfo update_msi = new ProcessStartInfo();
|
439 |
|
|
update_msi.FileName = destfilepath;
|
440 |
|
|
Process.Start(update_msi);
|
441 |
d33ef543
|
taeseongkim
|
}
|
442 |
32af2c3b
|
djkim
|
this.Close();
|
443 |
264c9309
|
ljiyeon
|
}
|
444 |
32af2c3b
|
djkim
|
catch (Exception)
|
445 |
69ef0800
|
KangIngu
|
{
|
446 |
32af2c3b
|
djkim
|
throw;
|
447 |
69ef0800
|
KangIngu
|
}
|
448 |
7e2d29a0
|
ljiyeon
|
|
449 |
|
|
}
|
450 |
787a4489
|
KangIngu
|
}
|
451 |
|
|
} |