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 |
787a4489
|
KangIngu
|
if (e.Args.Count() > 0)
|
190 |
|
|
{
|
191 |
c4a4d59c
|
ljiyeon
|
var result = ParamDecoding(e.Args[0].Replace(@"kcom://", "").Replace(@"/", ""));
|
192 |
f0c9e80e
|
이지연
|
|
193 |
|
|
#if DEBUG
|
194 |
|
|
/*
|
195 |
|
|
ViewerDataModel.Instance.IsDocumentHistory = true;
|
196 |
|
|
result.DocumentItemID = "3712215963";
|
197 |
|
|
result.ProjectNO = "00000";
|
198 |
|
|
result.UserID = "user1";
|
199 |
|
|
doftech
|
200 |
|
|
* humkyung
|
201 |
|
|
P190111_qa03
|
202 |
|
|
P190111_qa04
|
203 |
|
|
P190111_sa03
|
204 |
|
|
P190111_sa04
|
205 |
|
|
P190111_sa05
|
206 |
|
|
user1
|
207 |
|
|
*/
|
208 |
|
|
#endif
|
209 |
|
|
|
210 |
787a4489
|
KangIngu
|
App.ViewInfo = new IKCOM.ViewInfo
|
211 |
|
|
{
|
212 |
|
|
DocumentItemID = result.DocumentItemID,
|
213 |
35afe17c
|
djkim
|
EnsembleID = result.DocumentItemID,
|
214 |
787a4489
|
KangIngu
|
//DocumentItemID = "10001",
|
215 |
|
|
bPartner = result.bPartner,
|
216 |
bc664e9b
|
djkim
|
CreateFinalPDFPermission = result.CreateFinalPDFPermission,
|
217 |
|
|
NewCommentPermission = result.NewCommentPermission,
|
218 |
787a4489
|
KangIngu
|
ProjectNO = result.ProjectNO,
|
219 |
|
|
UserID = result.UserID,
|
220 |
9d5b4bc2
|
taeseongkim
|
isAdmin = Convert.ToBoolean(result.Mode)
|
221 |
787a4489
|
KangIngu
|
//UserID = "H2009115",
|
222 |
7cf8b728
|
taeseongkim
|
//Mode = result.Mode
|
223 |
787a4489
|
KangIngu
|
};
|
224 |
77cdac33
|
taeseongkim
|
ParameterMode = true;
|
225 |
401a87f8
|
taeseongkim
|
}
|
226 |
c4a4d59c
|
ljiyeon
|
else
|
227 |
|
|
{
|
228 |
|
|
string[] strArg = Environment.GetCommandLineArgs();
|
229 |
|
|
if (strArg.Length > 1)
|
230 |
|
|
{
|
231 |
|
|
var result = ParamDecoding(strArg[1].Replace(@"kcom://", "").Replace(@"/", ""));
|
232 |
|
|
App.ViewInfo = new IKCOM.ViewInfo
|
233 |
|
|
{
|
234 |
|
|
DocumentItemID = result.DocumentItemID,
|
235 |
35afe17c
|
djkim
|
EnsembleID = result.DocumentItemID,
|
236 |
c4a4d59c
|
ljiyeon
|
//DocumentItemID = "10001",
|
237 |
|
|
bPartner = result.bPartner,
|
238 |
|
|
CreateFinalPDFPermission = result.CreateFinalPDFPermission,
|
239 |
|
|
NewCommentPermission = result.NewCommentPermission,
|
240 |
|
|
ProjectNO = result.ProjectNO,
|
241 |
|
|
UserID = result.UserID,
|
242 |
|
|
//UserID = "H2009115",
|
243 |
|
|
//Mode = 0 , 1 , 2
|
244 |
|
|
};
|
245 |
|
|
ParameterMode = true;
|
246 |
1137be84
|
djkim
|
}
|
247 |
1ed8da93
|
humkyung
|
else
|
248 |
|
|
{
|
249 |
|
|
MessageBox.Show("문서 정보가 입력되지 않았습니다.\n프로그램이 종료됩니다.", "안내");
|
250 |
|
|
throw new ArgumentException("문서 정보가 입력되지 않았습니다.");
|
251 |
|
|
}
|
252 |
c4a4d59c
|
ljiyeon
|
}
|
253 |
992a98b4
|
KangIngu
|
|
254 |
|
|
//App.ViewInfo.CreateFinalPDFPermission = false;
|
255 |
|
|
//App.ViewInfo.NewCommentPermission = false;
|
256 |
c4a4d59c
|
ljiyeon
|
//GetQueryStringParameters();
|
257 |
a7578175
|
taeseongkim
|
//_binding = new WSHttpBinding();
|
258 |
|
|
//_binding.Security = new WSHttpSecurity { Transport = new HttpTransportSecurity { ClientCredentialType = HttpClientCredentialType.None }, Mode = SecurityMode.Transport };
|
259 |
|
|
//_binding.MaxReceivedMessageSize = 2147483647;
|
260 |
|
|
//_binding.OpenTimeout = new TimeSpan(0, 1, 0);
|
261 |
|
|
//_binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
|
262 |
|
|
//_binding.CloseTimeout = new TimeSpan(0, 5, 0);
|
263 |
|
|
//_binding.SendTimeout = new TimeSpan(0, 5, 0);
|
264 |
66bd3240
|
taeseongkim
|
#if BASIC_BINDING
|
265 |
a7578175
|
taeseongkim
|
|
266 |
6a19b48d
|
taeseongkim
|
#region 기본 binding
|
267 |
|
|
BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
|
268 |
|
|
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 } };
|
269 |
|
|
basicHttpBinding.MaxBufferSize = 2147483647;
|
270 |
|
|
basicHttpBinding.MaxBufferPoolSize = 2147483647;
|
271 |
|
|
basicHttpBinding.MaxReceivedMessageSize = 2147483647;
|
272 |
2b1f30fe
|
taeseongkim
|
basicHttpBinding.OpenTimeout = new TimeSpan(4, 30, 0);
|
273 |
6a19b48d
|
taeseongkim
|
basicHttpBinding.ReceiveTimeout = new TimeSpan(4, 30, 0);
|
274 |
2b1f30fe
|
taeseongkim
|
basicHttpBinding.CloseTimeout = new TimeSpan(4, 30, 0);
|
275 |
6a19b48d
|
taeseongkim
|
basicHttpBinding.SendTimeout = new TimeSpan(4, 30, 0);
|
276 |
|
|
basicHttpBinding.TextEncoding = System.Text.Encoding.UTF8;
|
277 |
|
|
basicHttpBinding.TransferMode = TransferMode.Buffered;
|
278 |
|
|
basicHttpBinding.MessageEncoding = WSMessageEncoding.Text;
|
279 |
|
|
basicHttpBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
|
280 |
2b1f30fe
|
taeseongkim
|
|
281 |
|
|
|
282 |
5639752b
|
taeseongkim
|
//System.ServiceModel.Channels.ReliableSessionBindingElement reliableSession = new System.ServiceModel.Channels.ReliableSessionBindingElement();
|
283 |
|
|
//reliableSession.Ordered = true;
|
284 |
|
|
//reliableSession.MaxRetryCount = 3;
|
285 |
|
|
//basicHttpBinding.CreateBindingElements().Add(reliableSession);
|
286 |
45ac2822
|
taeseongkim
|
//basicHttpBinding.ProxyAddress = null;
|
287 |
5c64268e
|
taeseongkim
|
//basicHttpBinding.AllowCookies = false;
|
288 |
|
|
//basicHttpBinding.BypassProxyOnLocal = false;
|
289 |
6a19b48d
|
taeseongkim
|
//basicHttpBinding.UseDefaultWebProxy = false;
|
290 |
|
|
//basicHttpBinding.ProxyAddress = new Uri("Http://localhost:8888");
|
291 |
|
|
|
292 |
|
|
_binding = basicHttpBinding;
|
293 |
|
|
|
294 |
2b1f30fe
|
taeseongkim
|
//System.ServiceModel.Channels.ReliableSessionBindingElement reliableSession = new System.ServiceModel.Channels.ReliableSessionBindingElement();
|
295 |
|
|
//reliableSession.Ordered = true;
|
296 |
|
|
|
297 |
|
|
//System.ServiceModel.Channels.HttpTransportBindingElement httpTransport = new System.ServiceModel.Channels.HttpTransportBindingElement();
|
298 |
|
|
//httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
|
299 |
|
|
//httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
|
300 |
|
|
//System.ServiceModel.Channels.CustomBinding binding = new System.ServiceModel.Channels.CustomBinding(reliableSession, httpTransport);
|
301 |
6a19b48d
|
taeseongkim
|
#endregion
|
302 |
3b938959
|
taeseongkim
|
#elif _CUSTOM_BINDING
|
303 |
6a19b48d
|
taeseongkim
|
#region custombinding
|
304 |
66bd3240
|
taeseongkim
|
var customBinding = new System.ServiceModel.Channels.CustomBinding()
|
305 |
|
|
{
|
306 |
a8aec13a
|
taeseongkim
|
OpenTimeout = new TimeSpan(0, 30, 0),
|
307 |
|
|
ReceiveTimeout = new TimeSpan(0, 30, 0),
|
308 |
|
|
CloseTimeout = new TimeSpan(0, 30, 0),
|
309 |
|
|
SendTimeout = new TimeSpan(0, 30, 0),
|
310 |
66bd3240
|
taeseongkim
|
};
|
311 |
6a19b48d
|
taeseongkim
|
|
312 |
3b938959
|
taeseongkim
|
//var messageEncoding = new WcfExtensions.ServiceModel.Channels.CompressionBindingElement();
|
313 |
|
|
//messageEncoding.Level = WcfExtensions.ServiceModel.Channels.CompressionLevel.Maximum;
|
314 |
6a19b48d
|
taeseongkim
|
|
315 |
3b938959
|
taeseongkim
|
var httpTranport = new System.ServiceModel.Channels.HttpsTransportBindingElement
|
316 |
66bd3240
|
taeseongkim
|
{
|
317 |
|
|
MaxBufferPoolSize = Int32.MaxValue,
|
318 |
|
|
MaxBufferSize = Int32.MaxValue,
|
319 |
|
|
MaxReceivedMessageSize = Int32.MaxValue,
|
320 |
a8aec13a
|
taeseongkim
|
RequestInitializationTimeout = new TimeSpan(0, 30, 0),
|
321 |
66bd3240
|
taeseongkim
|
//UseDefaultWebProxy = false,
|
322 |
|
|
//ProxyAddress = new Uri("Http://127.0.0.1:8888")
|
323 |
|
|
};
|
324 |
6a19b48d
|
taeseongkim
|
|
325 |
66bd3240
|
taeseongkim
|
customBinding.CreateBindingElements();
|
326 |
3b938959
|
taeseongkim
|
//customBinding.Elements.Add(messageEncoding);
|
327 |
66bd3240
|
taeseongkim
|
customBinding.Elements.Add(httpTranport);
|
328 |
3b938959
|
taeseongkim
|
|
329 |
|
|
|
330 |
|
|
_binding = customBinding;
|
331 |
|
|
#endregion
|
332 |
|
|
|
333 |
|
|
#elif CUSTOM_BINDING
|
334 |
|
|
#region custombinding
|
335 |
|
|
var customBinding = new System.ServiceModel.Channels.CustomBinding()
|
336 |
|
|
{
|
337 |
|
|
OpenTimeout = new TimeSpan(0, 30, 0),
|
338 |
|
|
ReceiveTimeout = new TimeSpan(0, 30, 0),
|
339 |
|
|
CloseTimeout = new TimeSpan(0, 30, 0),
|
340 |
|
|
SendTimeout = new TimeSpan(0, 30, 0),
|
341 |
|
|
};
|
342 |
|
|
|
343 |
|
|
//var messageEncoding = new WcfExtensions.ServiceModel.Channels.CompressionBindingElement();
|
344 |
|
|
//messageEncoding.Level = WcfExtensions.ServiceModel.Channels.CompressionLevel.Maximum;
|
345 |
|
|
|
346 |
|
|
var httpTranport = new System.ServiceModel.Channels.HttpsTransportBindingElement
|
347 |
|
|
{
|
348 |
|
|
MaxBufferPoolSize = Int32.MaxValue,
|
349 |
|
|
MaxBufferSize = Int32.MaxValue,
|
350 |
|
|
MaxReceivedMessageSize = Int32.MaxValue,
|
351 |
|
|
RequestInitializationTimeout = new TimeSpan(0, 30, 0),
|
352 |
|
|
//UseDefaultWebProxy = false,
|
353 |
|
|
//ProxyAddress = new Uri("Http://127.0.0.1:8888")
|
354 |
|
|
};
|
355 |
|
|
|
356 |
|
|
customBinding.CreateBindingElements();
|
357 |
6a19b48d
|
taeseongkim
|
|
358 |
3b938959
|
taeseongkim
|
var reliableSession = new System.ServiceModel.Channels.ReliableSessionBindingElement();
|
359 |
|
|
|
360 |
|
|
var encoding = new System.ServiceModel.Channels.TextMessageEncodingBindingElement
|
361 |
|
|
{
|
362 |
|
|
MaxReadPoolSize = Int32.MaxValue,
|
363 |
|
|
MaxWritePoolSize = Int32.MaxValue,
|
364 |
|
|
MessageVersion = System.ServiceModel.Channels.MessageVersion.Soap12WSAddressing10,
|
365 |
|
|
WriteEncoding = System.Text.Encoding.UTF8,
|
366 |
|
|
ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas
|
367 |
|
|
{
|
368 |
|
|
MaxArrayLength = Int32.MaxValue,
|
369 |
|
|
MaxBytesPerRead = Int32.MaxValue,
|
370 |
|
|
MaxDepth = Int32.MaxValue,
|
371 |
|
|
MaxNameTableCharCount = Int32.MaxValue,
|
372 |
|
|
MaxStringContentLength = Int32.MaxValue
|
373 |
|
|
}
|
374 |
|
|
};
|
375 |
|
|
//reliableSession.Ordered = true; // Set other properties as needed
|
376 |
|
|
customBinding.Elements.Add(reliableSession);
|
377 |
|
|
//customBinding.Elements.Add(messageEncoding);
|
378 |
|
|
//customBinding.Elements.Add(encoding);
|
379 |
|
|
customBinding.Elements.Add(httpTranport);
|
380 |
6a19b48d
|
taeseongkim
|
|
381 |
66bd3240
|
taeseongkim
|
_binding = customBinding;
|
382 |
6a19b48d
|
taeseongkim
|
#endregion
|
383 |
|
|
|
384 |
32fb9425
|
taeseongkim
|
#else
|
385 |
|
|
|
386 |
|
|
#region 기본 binding
|
387 |
a8aec13a
|
taeseongkim
|
//BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
|
388 |
|
|
//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 } };
|
389 |
|
|
//basicHttpBinding.MaxBufferSize = 2147483647;
|
390 |
|
|
//basicHttpBinding.MaxBufferPoolSize = 2147483647;
|
391 |
|
|
//basicHttpBinding.MaxReceivedMessageSize = 2147483647;
|
392 |
|
|
//basicHttpBinding.OpenTimeout = new TimeSpan(4, 30, 0);
|
393 |
|
|
//basicHttpBinding.ReceiveTimeout = new TimeSpan(4, 30, 0);
|
394 |
|
|
//basicHttpBinding.CloseTimeout = new TimeSpan(4, 30, 0);
|
395 |
|
|
//basicHttpBinding.SendTimeout = new TimeSpan(4, 30, 0);
|
396 |
|
|
//basicHttpBinding.TextEncoding = System.Text.Encoding.UTF8;
|
397 |
|
|
//basicHttpBinding.TransferMode = TransferMode.Buffered;
|
398 |
|
|
//basicHttpBinding.MessageEncoding = WSMessageEncoding.Text;
|
399 |
|
|
//basicHttpBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
|
400 |
32fb9425
|
taeseongkim
|
|
401 |
|
|
|
402 |
a8aec13a
|
taeseongkim
|
//System.ServiceModel.Channels.ReliableSessionBindingElement reliableSession = new System.ServiceModel.Channels.ReliableSessionBindingElement();
|
403 |
|
|
//reliableSession.Ordered = true;
|
404 |
|
|
//reliableSession.MaxRetryCount = 3;
|
405 |
|
|
//basicHttpBinding.CreateBindingElements().Add(reliableSession);
|
406 |
32fb9425
|
taeseongkim
|
|
407 |
a8aec13a
|
taeseongkim
|
//_binding = basicHttpBinding;
|
408 |
3b938959
|
taeseongkim
|
#endregion
|
409 |
66bd3240
|
taeseongkim
|
#endif
|
410 |
|
|
|
411 |
787a4489
|
KangIngu
|
//Support.SetLicense();
|
412 |
af22332b
|
ljiyeon
|
|
413 |
84c48033
|
djkim
|
#if DEBUG
|
414 |
eb5cdefc
|
djkim
|
//sBaseServiceURL = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal);
|
415 |
34ac8db7
|
humkyung
|
System.Diagnostics.Debug.WriteLine("BaseServiceURL");
|
416 |
76dc223b
|
taeseongkim
|
BaseAddress = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal);
|
417 |
992a98b4
|
KangIngu
|
#else
|
418 |
76dc223b
|
taeseongkim
|
BaseAddress = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal);
|
419 |
992a98b4
|
KangIngu
|
#endif
|
420 |
66bd3240
|
taeseongkim
|
|
421 |
|
|
if (isAuthenticate)
|
422 |
|
|
{
|
423 |
|
|
App.AuthenticateToken = Authenticate(BaseAddress);
|
424 |
|
|
}
|
425 |
|
|
|
426 |
76dc223b
|
taeseongkim
|
var UploadAddress = CommonLib.Common.GetConfigString("KCOM_kr_co_devdoftech_cloud_FileUpload", "URL", "");
|
427 |
|
|
|
428 |
|
|
if (!string.IsNullOrWhiteSpace(UploadAddress) && !string.IsNullOrWhiteSpace(BaseAddress))
|
429 |
|
|
{
|
430 |
6a19b48d
|
taeseongkim
|
var uploadUri = new UriBuilder(UploadAddress);
|
431 |
76dc223b
|
taeseongkim
|
var baseUri = new UriBuilder(BaseAddress);
|
432 |
|
|
|
433 |
6a19b48d
|
taeseongkim
|
uploadUri.Host = baseUri.Host;
|
434 |
|
|
uploadUri.Port = baseUri.Port;
|
435 |
a1e2ba68
|
taeseongkim
|
|
436 |
6a19b48d
|
taeseongkim
|
FileUploadUri = uploadUri.ToString();
|
437 |
76dc223b
|
taeseongkim
|
}
|
438 |
66bd3240
|
taeseongkim
|
#if BASIC_BINDING
|
439 |
32fb9425
|
taeseongkim
|
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", BaseAddress));
|
440 |
66bd3240
|
taeseongkim
|
#elif CUSTOM_BINDING
|
441 |
3b938959
|
taeseongkim
|
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", BaseAddress));
|
442 |
|
|
|
443 |
32fb9425
|
taeseongkim
|
#else
|
444 |
|
|
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", BaseAddress));
|
445 |
66bd3240
|
taeseongkim
|
#endif
|
446 |
|
|
|
447 |
|
|
App.FileLogger.Debug(_EndPoint.Uri);
|
448 |
76dc223b
|
taeseongkim
|
|
449 |
77cdac33
|
taeseongkim
|
#if !DEBUG
|
450 |
|
|
#endif
|
451 |
a7bee7cf
|
taeseongkim
|
//var license = new License.Validator.Valid(BaseAddress + "/License");
|
452 |
1305c420
|
taeseongkim
|
|
453 |
a7bee7cf
|
taeseongkim
|
//license.ValidateError += License_ValidateError;
|
454 |
1305c420
|
taeseongkim
|
|
455 |
a7bee7cf
|
taeseongkim
|
//license.GetLicense("public.xml");
|
456 |
1305c420
|
taeseongkim
|
|
457 |
a7bee7cf
|
taeseongkim
|
//if (license.Activate())
|
458 |
|
|
//{
|
459 |
77cdac33
|
taeseongkim
|
|
460 |
a7bee7cf
|
taeseongkim
|
//}
|
461 |
|
|
//else
|
462 |
|
|
//{
|
463 |
cf1cc862
|
taeseongkim
|
|
464 |
a7bee7cf
|
taeseongkim
|
//}
|
465 |
cf1cc862
|
taeseongkim
|
|
466 |
77cdac33
|
taeseongkim
|
|
467 |
cf1cc862
|
taeseongkim
|
await SplashScreenAsnyc();
|
468 |
|
|
|
469 |
|
|
base.OnStartup(e);
|
470 |
|
|
System.Windows.Input.Keyboard.AddPreviewKeyDownHandler(this.MainWindow, KeyDownEvent);
|
471 |
|
|
|
472 |
|
|
|
473 |
1edefbdf
|
taeseongkim
|
//System.Windows.Input.Keyboard.AddKeyDownHandler(this.MainWindow, KeyDownEvent);
|
474 |
787a4489
|
KangIngu
|
}
|
475 |
|
|
catch (Exception ex)
|
476 |
|
|
{
|
477 |
274cde11
|
taeseongkim
|
Logger.sendReqLog("OnStartUp",ex.ToString() + " " + ex.InnerException?.ToString(),1);
|
478 |
787a4489
|
KangIngu
|
}
|
479 |
f7e7a61a
|
ljiyeon
|
finally
|
480 |
|
|
{
|
481 |
cdfb57ff
|
taeseongkim
|
await SplashScreenAsnyc();
|
482 |
1137be84
|
djkim
|
}
|
483 |
787a4489
|
KangIngu
|
}
|
484 |
5622deac
|
taeseongkim
|
|
485 |
|
|
|
486 |
66bd3240
|
taeseongkim
|
private string Authenticate(string baseUri)
|
487 |
|
|
{
|
488 |
|
|
string result = null;
|
489 |
|
|
|
490 |
|
|
try
|
491 |
|
|
{
|
492 |
|
|
Uri uri = new Uri(baseUri);
|
493 |
|
|
string baseUrl = uri.Scheme + "://" + uri.Host + (uri.IsDefaultPort ? "" : ":" + uri.Port);
|
494 |
|
|
|
495 |
|
|
using (System.Net.WebClient client = new System.Net.WebClient())
|
496 |
|
|
{
|
497 |
|
|
client.Headers.Add(HttpRequestHeader.Authorization, "!dsfadsfa@@~");
|
498 |
|
|
var response = client.DownloadString(baseUrl + "/Authenticate");
|
499 |
|
|
|
500 |
|
|
if (response != null)
|
501 |
|
|
{
|
502 |
|
|
result = response;
|
503 |
|
|
}
|
504 |
|
|
}
|
505 |
|
|
}
|
506 |
|
|
catch (Exception)
|
507 |
|
|
{
|
508 |
|
|
|
509 |
|
|
throw;
|
510 |
|
|
}
|
511 |
|
|
|
512 |
|
|
return result;
|
513 |
|
|
}
|
514 |
a7346d3c
|
humkyung
|
|
515 |
1305c420
|
taeseongkim
|
private void License_ValidateError(object sender, ValidateErrorArgs e)
|
516 |
|
|
{
|
517 |
|
|
e.Received = true;
|
518 |
|
|
|
519 |
cf1cc862
|
taeseongkim
|
Telerik.Windows.Controls.RadWindow.Alert(new Telerik.Windows.Controls.DialogParameters
|
520 |
|
|
{
|
521 |
|
|
Content = "License Error : " + e.Message,
|
522 |
|
|
Owner = splashScreen
|
523 |
|
|
});
|
524 |
|
|
///MessageBox.Show(e.Message);
|
525 |
1305c420
|
taeseongkim
|
Application.Current.Shutdown();
|
526 |
|
|
}
|
527 |
|
|
|
528 |
b60e844d
|
taeseongkim
|
private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
529 |
|
|
{
|
530 |
766cdfa1
|
taeseongkim
|
Logger.sendReqLog("App Error ",e.Exception.ToString() + " " + e.Exception.InnerException?.ToString(), 1);
|
531 |
b60e844d
|
taeseongkim
|
}
|
532 |
|
|
|
533 |
fa48eb85
|
taeseongkim
|
private void KeyDownEvent(object sender, KeyEventArgs e)
|
534 |
|
|
{
|
535 |
8e6884a5
|
taeseongkim
|
//if (e.Key == Key.Escape || e.Key == Key.Delete)
|
536 |
|
|
//{
|
537 |
fa48eb85
|
taeseongkim
|
System.Diagnostics.Debug.WriteLine("app key Event");
|
538 |
|
|
Common.ViewerDataModel.Instance.SystemMain.KeyEventDownAction(sender, e);
|
539 |
8e6884a5
|
taeseongkim
|
//}
|
540 |
fa48eb85
|
taeseongkim
|
}
|
541 |
|
|
|
542 |
cdfb57ff
|
taeseongkim
|
private async Task<bool> SplashScreenAsnyc()
|
543 |
|
|
{
|
544 |
|
|
int value = 100 / ISplashMessage.SplashMessageCnt;
|
545 |
|
|
|
546 |
|
|
for (int i = 1; i < ISplashMessage.SplashMessageCnt; i++)
|
547 |
|
|
{
|
548 |
3b938959
|
taeseongkim
|
await Task.Delay(1);
|
549 |
cdfb57ff
|
taeseongkim
|
await splashScreen.Dispatcher.InvokeAsync(() => splashScreen.Progress = i * value);
|
550 |
|
|
}
|
551 |
|
|
|
552 |
2007ecaa
|
taeseongkim
|
//splashScreen.Close();
|
553 |
cdfb57ff
|
taeseongkim
|
|
554 |
|
|
return true;
|
555 |
|
|
}
|
556 |
|
|
|
557 |
e0cfc73c
|
ljiyeon
|
public static void splashString(string text)
|
558 |
|
|
{
|
559 |
|
|
Task.Factory.StartNew(() =>
|
560 |
|
|
{
|
561 |
|
|
splashScreen.Dispatcher.Invoke(() => splashScreen.SplashText = text);
|
562 |
2917ab4a
|
taeseongkim
|
}).ConfigureAwait(false);
|
563 |
e0cfc73c
|
ljiyeon
|
}
|
564 |
|
|
|
565 |
|
|
|
566 |
a7346d3c
|
humkyung
|
/// <summary>
|
567 |
|
|
/// log unhandled exception
|
568 |
|
|
/// </summary>
|
569 |
|
|
/// <author>humkyung</author>
|
570 |
|
|
/// <date>2019.05.21</date>
|
571 |
|
|
/// <param name="sender"></param>
|
572 |
|
|
/// <param name="e"></param>
|
573 |
|
|
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
574 |
|
|
{
|
575 |
|
|
try
|
576 |
|
|
{
|
577 |
360e4f75
|
djkim
|
App.FileLogger.Fatal(e.ExceptionObject as Exception);
|
578 |
a7346d3c
|
humkyung
|
}
|
579 |
|
|
catch (Exception ex)
|
580 |
|
|
{
|
581 |
8614f701
|
taeseongkim
|
Console.WriteLine(ex.InnerException?.ToString());
|
582 |
a7346d3c
|
humkyung
|
}
|
583 |
|
|
finally
|
584 |
|
|
{
|
585 |
8614f701
|
taeseongkim
|
#if RELEASE
|
586 |
a7346d3c
|
humkyung
|
Environment.Exit(0);
|
587 |
8614f701
|
taeseongkim
|
#endif
|
588 |
a7346d3c
|
humkyung
|
}
|
589 |
|
|
}
|
590 |
|
|
|
591 |
c4a4d59c
|
ljiyeon
|
private void ErrorLogFileWrite(string Err)
|
592 |
|
|
{
|
593 |
ce3f0d7a
|
humkyung
|
App.FileLogger.Debug(Err);
|
594 |
c4a4d59c
|
ljiyeon
|
}
|
595 |
787a4489
|
KangIngu
|
}
|
596 |
|
|
} |