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