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