markus / KCOM / App.xaml.cs @ b2948d06
이력 | 보기 | 이력해설 | 다운로드 (23.3 KB)
1 |
|
---|---|
2 |
using KCOM.Common; |
3 |
using KCOM.Views; |
4 |
using License.Validator; |
5 |
using log4net; |
6 |
using System; |
7 |
using System.ComponentModel; |
8 |
using System.IO; |
9 |
using System.Linq; |
10 |
using System.Net; |
11 |
using System.ServiceModel; |
12 |
using System.Threading.Tasks; |
13 |
using System.Windows; |
14 |
using System.Windows.Input; |
15 |
using System.Windows.Resources; |
16 |
|
17 |
namespace KCOM |
18 |
{ |
19 |
public class OpenProperties |
20 |
{ |
21 |
public string DocumentItemID { get; set; } |
22 |
public bool bPartner { get; set; } |
23 |
public bool CreateFinalPDFPermission { get; set; } |
24 |
public bool NewCommentPermission { get; set; } |
25 |
public string ProjectNO { get; set; } |
26 |
public string UserID { get; set; } |
27 |
public int Mode { get; set; } |
28 |
} |
29 |
public static OpenProperties ParamDecoding(string DecodingText, System.Text.Encoding oEncoding = null) |
30 |
{ |
31 |
if (oEncoding == null) |
32 |
oEncoding = System.Text.Encoding.UTF8; |
33 |
|
34 |
byte[] byteArray = Convert.FromBase64String(DecodingText); |
35 |
|
36 |
string jsonBack = oEncoding.GetString(byteArray); |
37 |
|
38 |
return Newtonsoft.Json.JsonConvert.DeserializeObject<OpenProperties>(jsonBack); |
39 |
} |
40 |
/// <summary> |
41 |
/// App.xaml에 대한 상호 작용 논리 |
42 |
/// </summary> |
43 |
public partial class App : Application |
44 |
{ |
45 |
public static PageManager.PageStorage PageStorage; |
46 |
public static string MarkusVersion = ""; |
47 |
public static string BaseAddress; |
48 |
public static string FileUploadUri; |
49 |
public static System.ServiceModel.Channels.Binding _binding; |
50 |
public static EndpointAddress _EndPoint; |
51 |
public static EndpointAddress _EndPoint_SaveLoad; |
52 |
public static EndpointAddress _EndPoint_Symbol; |
53 |
public static string UserName; |
54 |
public static IKCOM.ViewInfo ViewInfo; |
55 |
public static string urlHost; |
56 |
public static string urlPort; |
57 |
public static string urlHost_DB; |
58 |
public static string urlPort_DB; |
59 |
public static string Custom_ViewInfoId; |
60 |
public static bool ParameterMode = false; |
61 |
public static bool isExternal = false; |
62 |
public static bool isAuthenticate = false; |
63 |
public static string AuthenticateToken = null; |
64 |
|
65 |
/// <summary> |
66 |
/// logger |
67 |
/// </summary> |
68 |
public static ILog FileLogger = null; |
69 |
|
70 |
public static StreamResourceInfo DefaultArrowCursor; |
71 |
|
72 |
public static Stream DefaultArrowCursorStream |
73 |
{ |
74 |
get { |
75 |
return Application.GetResourceStream(new Uri(@"pack://application:,,,/Resources/Cursor/customCursor2.cur", UriKind.Absolute)).Stream; |
76 |
//DefaultArrowCursor.Stream.Position = 0; |
77 |
//return DefaultArrowCursor.Stream; |
78 |
} |
79 |
} |
80 |
|
81 |
public static kr.co.devdoftech.cloud.FileUpload FileUploader |
82 |
{ |
83 |
get { return new kr.co.devdoftech.cloud.FileUpload{ Url = FileUploadUri }; } |
84 |
|
85 |
private set {; } |
86 |
} |
87 |
|
88 |
/// <summary> |
89 |
/// VisualStudio Design Time여부 |
90 |
/// </summary> |
91 |
public static bool IsDesignMode |
92 |
{ |
93 |
get |
94 |
{ |
95 |
try |
96 |
{ |
97 |
return DesignerProperties.GetIsInDesignMode(new DependencyObject()); |
98 |
} |
99 |
catch (Exception) |
100 |
{ |
101 |
return false; |
102 |
} |
103 |
} |
104 |
private set { } |
105 |
} |
106 |
|
107 |
/// <summary> |
108 |
/// Application Data Folder |
109 |
/// </summary> |
110 |
public static string AppDataFolder |
111 |
{ |
112 |
get |
113 |
{ |
114 |
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MARKUS"); |
115 |
} |
116 |
} |
117 |
|
118 |
public static IKCOM.KCOM_SystemInfo SystemInfo { get; set; } |
119 |
|
120 |
|
121 |
|
122 |
private string versionPath = null; |
123 |
//public SplashScreen splash = new SplashScreen("splash.png"); |
124 |
public static SplashScreenWindow splashScreen = new SplashScreenWindow(); |
125 |
|
126 |
public App() |
127 |
{ |
128 |
Telerik.Windows.Controls.StyleManager.ApplicationTheme = new Telerik.Windows.Controls.VisualStudio2013Theme(); |
129 |
|
130 |
App.FileLogger = LogManager.GetLogger(typeof(App)); |
131 |
} |
132 |
|
133 |
protected override void OnExit(ExitEventArgs e) |
134 |
{ |
135 |
try |
136 |
{ |
137 |
if (App.PageStorage != null) |
138 |
{ |
139 |
App.PageStorage.Clear(); |
140 |
} |
141 |
} |
142 |
catch (Exception) |
143 |
{ |
144 |
} |
145 |
|
146 |
base.OnExit(e); |
147 |
} |
148 |
|
149 |
protected override async void OnStartup(StartupEventArgs e) |
150 |
{ |
151 |
try |
152 |
{ |
153 |
DefaultArrowCursor = Application.GetResourceStream(new Uri(@"pack://application:,,,/Resources/Cursor/customCursor2.cur", UriKind.Absolute)); |
154 |
|
155 |
splashScreen.Show(); |
156 |
|
157 |
App.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; |
158 |
/// up to here |
159 |
//AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); |
160 |
|
161 |
#region // DNS 체크 |
162 |
|
163 |
string localdomain = CommonLib.Common.GetConfigString("HOST_DOMAIN", "DOMAIN", ""); |
164 |
|
165 |
ViewerDataModel.Instance.IsDocumentHistory = Convert.ToBoolean(CommonLib.Common.GetConfigString("COMMON","IsDocumentHistory", "true")); |
166 |
|
167 |
var hostEntry = CommonLib.DNSHelper.GetHostEntryTask(); |
168 |
|
169 |
if (hostEntry == null) |
170 |
{ |
171 |
System.Diagnostics.Debug.WriteLine("(hostEntry == null"); |
172 |
//App.FileLogger.Debug("hostEntry == null"); |
173 |
isExternal = true; |
174 |
} |
175 |
else if (!string.IsNullOrEmpty(localdomain) && !hostEntry.HostName.ToUpper().EndsWith(localdomain.ToUpper())) |
176 |
{ |
177 |
// 외부 사용자 |
178 |
App.FileLogger.Debug(string.Format("You are external user because located out side of given domain({0})\nYour domain is {1}", localdomain, hostEntry.HostName)); |
179 |
isExternal = true; |
180 |
} |
181 |
#endregion |
182 |
|
183 |
|
184 |
if (e.Args.Count() > 0) |
185 |
{ |
186 |
var result = ParamDecoding(e.Args[0].Replace(@"kcom://", "").Replace(@"/", "")); |
187 |
|
188 |
App.ViewInfo = new IKCOM.ViewInfo |
189 |
{ |
190 |
DocumentItemID = result.DocumentItemID, |
191 |
EnsembleID = result.DocumentItemID, |
192 |
//DocumentItemID = "10001", |
193 |
bPartner = result.bPartner, |
194 |
CreateFinalPDFPermission = result.CreateFinalPDFPermission, |
195 |
NewCommentPermission = result.NewCommentPermission, |
196 |
ProjectNO = result.ProjectNO, |
197 |
UserID = result.UserID, |
198 |
isAdmin = Convert.ToBoolean(result.Mode) |
199 |
//UserID = "H2009115", |
200 |
//Mode = result.Mode |
201 |
}; |
202 |
ParameterMode = true; |
203 |
} |
204 |
else |
205 |
{ |
206 |
string[] strArg = Environment.GetCommandLineArgs(); |
207 |
if (strArg.Length > 1) |
208 |
{ |
209 |
var result = ParamDecoding(strArg[1].Replace(@"kcom://", "").Replace(@"/", "")); |
210 |
App.ViewInfo = new IKCOM.ViewInfo |
211 |
{ |
212 |
DocumentItemID = result.DocumentItemID, |
213 |
EnsembleID = result.DocumentItemID, |
214 |
//DocumentItemID = "10001", |
215 |
bPartner = result.bPartner, |
216 |
CreateFinalPDFPermission = result.CreateFinalPDFPermission, |
217 |
NewCommentPermission = result.NewCommentPermission, |
218 |
ProjectNO = result.ProjectNO, |
219 |
UserID = result.UserID, |
220 |
//UserID = "H2009115", |
221 |
//Mode = 0 , 1 , 2 |
222 |
}; |
223 |
ParameterMode = true; |
224 |
} |
225 |
else |
226 |
{ |
227 |
MessageBox.Show("문서 정보가 입력되지 않았습니다.\n프로그램이 종료됩니다.", "안내"); |
228 |
throw new ArgumentException("문서 정보가 입력되지 않았습니다."); |
229 |
} |
230 |
} |
231 |
|
232 |
//App.ViewInfo.CreateFinalPDFPermission = false; |
233 |
//App.ViewInfo.NewCommentPermission = false; |
234 |
//GetQueryStringParameters(); |
235 |
//_binding = new WSHttpBinding(); |
236 |
//_binding.Security = new WSHttpSecurity { Transport = new HttpTransportSecurity { ClientCredentialType = HttpClientCredentialType.None }, Mode = SecurityMode.Transport }; |
237 |
//_binding.MaxReceivedMessageSize = 2147483647; |
238 |
//_binding.OpenTimeout = new TimeSpan(0, 1, 0); |
239 |
//_binding.ReceiveTimeout = new TimeSpan(0, 10, 0); |
240 |
//_binding.CloseTimeout = new TimeSpan(0, 5, 0); |
241 |
//_binding.SendTimeout = new TimeSpan(0, 5, 0); |
242 |
#if BASIC_BINDING |
243 |
|
244 |
#region 기본 binding |
245 |
BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.None); |
246 |
basicHttpBinding.Security = new BasicHttpSecurity { Transport = new HttpTransportSecurity { ClientCredentialType = HttpClientCredentialType.None, ProxyCredentialType = HttpProxyCredentialType.None }, Mode = BasicHttpSecurityMode.None, Message = new BasicHttpMessageSecurity { AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.Basic256, ClientCredentialType = BasicHttpMessageCredentialType.UserName } }; |
247 |
basicHttpBinding.MaxBufferSize = 2147483647; |
248 |
basicHttpBinding.MaxBufferPoolSize = 2147483647; |
249 |
basicHttpBinding.MaxReceivedMessageSize = 2147483647; |
250 |
basicHttpBinding.OpenTimeout = new TimeSpan(4, 30, 0); |
251 |
basicHttpBinding.ReceiveTimeout = new TimeSpan(4, 30, 0); |
252 |
basicHttpBinding.CloseTimeout = new TimeSpan(4, 30, 0); |
253 |
basicHttpBinding.SendTimeout = new TimeSpan(4, 30, 0); |
254 |
basicHttpBinding.TextEncoding = System.Text.Encoding.UTF8; |
255 |
basicHttpBinding.TransferMode = TransferMode.Buffered; |
256 |
basicHttpBinding.MessageEncoding = WSMessageEncoding.Text; |
257 |
basicHttpBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; |
258 |
|
259 |
|
260 |
//System.ServiceModel.Channels.ReliableSessionBindingElement reliableSession = new System.ServiceModel.Channels.ReliableSessionBindingElement(); |
261 |
//reliableSession.Ordered = true; |
262 |
//reliableSession.MaxRetryCount = 3; |
263 |
//basicHttpBinding.CreateBindingElements().Add(reliableSession); |
264 |
//basicHttpBinding.ProxyAddress = null; |
265 |
//basicHttpBinding.AllowCookies = false; |
266 |
//basicHttpBinding.BypassProxyOnLocal = false; |
267 |
//basicHttpBinding.UseDefaultWebProxy = false; |
268 |
//basicHttpBinding.ProxyAddress = new Uri("Http://localhost:8888"); |
269 |
|
270 |
_binding = basicHttpBinding; |
271 |
|
272 |
//System.ServiceModel.Channels.ReliableSessionBindingElement reliableSession = new System.ServiceModel.Channels.ReliableSessionBindingElement(); |
273 |
//reliableSession.Ordered = true; |
274 |
|
275 |
//System.ServiceModel.Channels.HttpTransportBindingElement httpTransport = new System.ServiceModel.Channels.HttpTransportBindingElement(); |
276 |
//httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous; |
277 |
//httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; |
278 |
//System.ServiceModel.Channels.CustomBinding binding = new System.ServiceModel.Channels.CustomBinding(reliableSession, httpTransport); |
279 |
#endregion |
280 |
#elif _CUSTOM_BINDING |
281 |
#region custombinding |
282 |
var customBinding = new System.ServiceModel.Channels.CustomBinding() |
283 |
{ |
284 |
OpenTimeout = new TimeSpan(0, 30, 0), |
285 |
ReceiveTimeout = new TimeSpan(0, 30, 0), |
286 |
CloseTimeout = new TimeSpan(0, 30, 0), |
287 |
SendTimeout = new TimeSpan(0, 30, 0), |
288 |
}; |
289 |
|
290 |
//var messageEncoding = new WcfExtensions.ServiceModel.Channels.CompressionBindingElement(); |
291 |
//messageEncoding.Level = WcfExtensions.ServiceModel.Channels.CompressionLevel.Maximum; |
292 |
|
293 |
var httpTranport = new System.ServiceModel.Channels.HttpsTransportBindingElement |
294 |
{ |
295 |
MaxBufferPoolSize = Int32.MaxValue, |
296 |
MaxBufferSize = Int32.MaxValue, |
297 |
MaxReceivedMessageSize = Int32.MaxValue, |
298 |
RequestInitializationTimeout = new TimeSpan(0, 30, 0), |
299 |
//UseDefaultWebProxy = false, |
300 |
//ProxyAddress = new Uri("Http://127.0.0.1:8888") |
301 |
}; |
302 |
|
303 |
customBinding.CreateBindingElements(); |
304 |
//customBinding.Elements.Add(messageEncoding); |
305 |
customBinding.Elements.Add(httpTranport); |
306 |
|
307 |
|
308 |
_binding = customBinding; |
309 |
#endregion |
310 |
|
311 |
#elif CUSTOM_BINDING |
312 |
#region custombinding |
313 |
var customBinding = new System.ServiceModel.Channels.CustomBinding() |
314 |
{ |
315 |
OpenTimeout = new TimeSpan(0, 30, 0), |
316 |
ReceiveTimeout = new TimeSpan(0, 30, 0), |
317 |
CloseTimeout = new TimeSpan(0, 30, 0), |
318 |
SendTimeout = new TimeSpan(0, 30, 0), |
319 |
}; |
320 |
|
321 |
//var messageEncoding = new WcfExtensions.ServiceModel.Channels.CompressionBindingElement(); |
322 |
//messageEncoding.Level = WcfExtensions.ServiceModel.Channels.CompressionLevel.Maximum; |
323 |
|
324 |
var httpTranport = new System.ServiceModel.Channels.HttpsTransportBindingElement |
325 |
{ |
326 |
MaxBufferPoolSize = Int32.MaxValue, |
327 |
MaxBufferSize = Int32.MaxValue, |
328 |
MaxReceivedMessageSize = Int32.MaxValue, |
329 |
RequestInitializationTimeout = new TimeSpan(0, 30, 0), |
330 |
//UseDefaultWebProxy = false, |
331 |
//ProxyAddress = new Uri("Http://127.0.0.1:8888") |
332 |
}; |
333 |
|
334 |
customBinding.CreateBindingElements(); |
335 |
|
336 |
var reliableSession = new System.ServiceModel.Channels.ReliableSessionBindingElement(); |
337 |
|
338 |
var encoding = new System.ServiceModel.Channels.TextMessageEncodingBindingElement |
339 |
{ |
340 |
MaxReadPoolSize = Int32.MaxValue, |
341 |
MaxWritePoolSize = Int32.MaxValue, |
342 |
MessageVersion = System.ServiceModel.Channels.MessageVersion.Soap12WSAddressing10, |
343 |
WriteEncoding = System.Text.Encoding.UTF8, |
344 |
ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas |
345 |
{ |
346 |
MaxArrayLength = Int32.MaxValue, |
347 |
MaxBytesPerRead = Int32.MaxValue, |
348 |
MaxDepth = Int32.MaxValue, |
349 |
MaxNameTableCharCount = Int32.MaxValue, |
350 |
MaxStringContentLength = Int32.MaxValue |
351 |
} |
352 |
}; |
353 |
//reliableSession.Ordered = true; // Set other properties as needed |
354 |
customBinding.Elements.Add(reliableSession); |
355 |
//customBinding.Elements.Add(messageEncoding); |
356 |
//customBinding.Elements.Add(encoding); |
357 |
customBinding.Elements.Add(httpTranport); |
358 |
|
359 |
_binding = customBinding; |
360 |
#endregion |
361 |
|
362 |
#else |
363 |
|
364 |
#region 기본 binding |
365 |
//BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.None); |
366 |
//basicHttpBinding.Security = new BasicHttpSecurity { Transport = new HttpTransportSecurity { ClientCredentialType = HttpClientCredentialType.None, ProxyCredentialType = HttpProxyCredentialType.None }, Mode = BasicHttpSecurityMode.None, Message = new BasicHttpMessageSecurity { AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.Basic256, ClientCredentialType = BasicHttpMessageCredentialType.UserName } }; |
367 |
//basicHttpBinding.MaxBufferSize = 2147483647; |
368 |
//basicHttpBinding.MaxBufferPoolSize = 2147483647; |
369 |
//basicHttpBinding.MaxReceivedMessageSize = 2147483647; |
370 |
//basicHttpBinding.OpenTimeout = new TimeSpan(4, 30, 0); |
371 |
//basicHttpBinding.ReceiveTimeout = new TimeSpan(4, 30, 0); |
372 |
//basicHttpBinding.CloseTimeout = new TimeSpan(4, 30, 0); |
373 |
//basicHttpBinding.SendTimeout = new TimeSpan(4, 30, 0); |
374 |
//basicHttpBinding.TextEncoding = System.Text.Encoding.UTF8; |
375 |
//basicHttpBinding.TransferMode = TransferMode.Buffered; |
376 |
//basicHttpBinding.MessageEncoding = WSMessageEncoding.Text; |
377 |
//basicHttpBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; |
378 |
|
379 |
|
380 |
//System.ServiceModel.Channels.ReliableSessionBindingElement reliableSession = new System.ServiceModel.Channels.ReliableSessionBindingElement(); |
381 |
//reliableSession.Ordered = true; |
382 |
//reliableSession.MaxRetryCount = 3; |
383 |
//basicHttpBinding.CreateBindingElements().Add(reliableSession); |
384 |
|
385 |
//_binding = basicHttpBinding; |
386 |
#endregion |
387 |
#endif |
388 |
|
389 |
//Support.SetLicense(); |
390 |
|
391 |
#if DEBUG |
392 |
//sBaseServiceURL = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal); |
393 |
System.Diagnostics.Debug.WriteLine("sBaseServiceURL"); |
394 |
BaseAddress = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal); |
395 |
#else |
396 |
BaseAddress = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal); |
397 |
#endif |
398 |
|
399 |
if (isAuthenticate) |
400 |
{ |
401 |
App.AuthenticateToken = Authenticate(BaseAddress); |
402 |
} |
403 |
|
404 |
var UploadAddress = CommonLib.Common.GetConfigString("KCOM_kr_co_devdoftech_cloud_FileUpload", "URL", ""); |
405 |
|
406 |
if (!string.IsNullOrWhiteSpace(UploadAddress) && !string.IsNullOrWhiteSpace(BaseAddress)) |
407 |
{ |
408 |
var uploadUri = new UriBuilder(UploadAddress); |
409 |
var baseUri = new UriBuilder(BaseAddress); |
410 |
|
411 |
uploadUri.Host = baseUri.Host; |
412 |
uploadUri.Port = baseUri.Port; |
413 |
|
414 |
FileUploadUri = uploadUri.ToString(); |
415 |
} |
416 |
#if BASIC_BINDING |
417 |
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", BaseAddress)); |
418 |
#elif CUSTOM_BINDING |
419 |
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", BaseAddress)); |
420 |
|
421 |
#else |
422 |
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", BaseAddress)); |
423 |
#endif |
424 |
|
425 |
App.FileLogger.Debug(_EndPoint.Uri); |
426 |
|
427 |
#if !DEBUG |
428 |
#endif |
429 |
//var license = new License.Validator.Valid(BaseAddress + "/License"); |
430 |
|
431 |
//license.ValidateError += License_ValidateError; |
432 |
|
433 |
//license.GetLicense("public.xml"); |
434 |
|
435 |
//if (license.Activate()) |
436 |
//{ |
437 |
|
438 |
//} |
439 |
//else |
440 |
//{ |
441 |
|
442 |
//} |
443 |
|
444 |
|
445 |
await SplashScreenAsnyc(); |
446 |
|
447 |
base.OnStartup(e); |
448 |
System.Windows.Input.Keyboard.AddPreviewKeyDownHandler(this.MainWindow, KeyDownEvent); |
449 |
|
450 |
|
451 |
//System.Windows.Input.Keyboard.AddKeyDownHandler(this.MainWindow, KeyDownEvent); |
452 |
} |
453 |
catch (Exception ex) |
454 |
{ |
455 |
Logger.sendReqLog("OnStartUp",ex.ToString() + " " + ex.InnerException?.ToString(),1); |
456 |
} |
457 |
finally |
458 |
{ |
459 |
await SplashScreenAsnyc(); |
460 |
} |
461 |
} |
462 |
private string Authenticate(string baseUri) |
463 |
{ |
464 |
string result = null; |
465 |
|
466 |
try |
467 |
{ |
468 |
Uri uri = new Uri(baseUri); |
469 |
string baseUrl = uri.Scheme + "://" + uri.Host + (uri.IsDefaultPort ? "" : ":" + uri.Port); |
470 |
|
471 |
using (System.Net.WebClient client = new System.Net.WebClient()) |
472 |
{ |
473 |
client.Headers.Add(HttpRequestHeader.Authorization, "!dsfadsfa@@~"); |
474 |
var response = client.DownloadString(baseUrl + "/Authenticate"); |
475 |
|
476 |
if (response != null) |
477 |
{ |
478 |
result = response; |
479 |
} |
480 |
} |
481 |
} |
482 |
catch (Exception) |
483 |
{ |
484 |
|
485 |
throw; |
486 |
} |
487 |
|
488 |
return result; |
489 |
} |
490 |
|
491 |
private void License_ValidateError(object sender, ValidateErrorArgs e) |
492 |
{ |
493 |
e.Received = true; |
494 |
|
495 |
Telerik.Windows.Controls.RadWindow.Alert(new Telerik.Windows.Controls.DialogParameters |
496 |
{ |
497 |
Content = "License Error : " + e.Message, |
498 |
Owner = splashScreen |
499 |
}); |
500 |
///MessageBox.Show(e.Message); |
501 |
Application.Current.Shutdown(); |
502 |
} |
503 |
|
504 |
private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) |
505 |
{ |
506 |
Logger.sendReqLog("App Error ",e.Exception.ToString() + " " + e.Exception.InnerException?.ToString(), 1); |
507 |
} |
508 |
|
509 |
private void KeyDownEvent(object sender, KeyEventArgs e) |
510 |
{ |
511 |
//if (e.Key == Key.Escape || e.Key == Key.Delete) |
512 |
//{ |
513 |
System.Diagnostics.Debug.WriteLine("app key Event"); |
514 |
Common.ViewerDataModel.Instance.SystemMain.KeyEventDownAction(sender, e); |
515 |
//} |
516 |
} |
517 |
|
518 |
private async Task<bool> SplashScreenAsnyc() |
519 |
{ |
520 |
int value = 100 / ISplashMessage.SplashMessageCnt; |
521 |
|
522 |
for (int i = 1; i < ISplashMessage.SplashMessageCnt; i++) |
523 |
{ |
524 |
await Task.Delay(1); |
525 |
await splashScreen.Dispatcher.InvokeAsync(() => splashScreen.Progress = i * value); |
526 |
} |
527 |
|
528 |
//splashScreen.Close(); |
529 |
|
530 |
return true; |
531 |
} |
532 |
|
533 |
public static void splashString(string text) |
534 |
{ |
535 |
Task.Factory.StartNew(() => |
536 |
{ |
537 |
splashScreen.Dispatcher.Invoke(() => splashScreen.SplashText = text); |
538 |
}).ConfigureAwait(false); |
539 |
} |
540 |
|
541 |
|
542 |
/// <summary> |
543 |
/// log unhandled exception |
544 |
/// </summary> |
545 |
/// <author>humkyung</author> |
546 |
/// <date>2019.05.21</date> |
547 |
/// <param name="sender"></param> |
548 |
/// <param name="e"></param> |
549 |
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) |
550 |
{ |
551 |
try |
552 |
{ |
553 |
App.FileLogger.Fatal(e.ExceptionObject as Exception); |
554 |
} |
555 |
catch (Exception ex) |
556 |
{ |
557 |
Console.WriteLine(ex.InnerException?.ToString()); |
558 |
} |
559 |
finally |
560 |
{ |
561 |
#if RELEASE |
562 |
Environment.Exit(0); |
563 |
#endif |
564 |
} |
565 |
} |
566 |
|
567 |
private void ErrorLogFileWrite(string Err) |
568 |
{ |
569 |
App.FileLogger.Debug(Err); |
570 |
} |
571 |
} |
572 |
} |