44using System . Collections . Generic ;
55using System . Configuration ;
66using System . Globalization ;
7- using System . IO ;
87using System . Threading ;
98using System . Windows ;
109using System . Windows . Markup ;
11- using Autodesk . DataExchange . Authentication ;
12- using Autodesk . DataExchange . UI . ViewModels . Models ;
13- using System . Windows . Interop ;
1410using Autodesk . DataExchange . Core . Models ;
15- using ILogger = Autodesk . DataExchange . Core . Interface . ILogger ;
16- using Autodesk . DataExchange . Extensions . HostingProvider ;
17- using Autodesk . DataExchange . Core . Enums ;
18- using Autodesk . DataExchange . Models ;
19-
11+ using Autodesk . DataExchange . Core . Enums ;
12+
2013namespace SampleConnector
2114{
2215 /// <summary>
@@ -37,17 +30,11 @@ private void StartConnector()
3730 var authClientSecret = ConfigurationManager . AppSettings [ "AuthClientSecret" ] ;
3831 var authCallBack = ConfigurationManager . AppSettings [ "AuthCallBack" ] ;
3932
40- string logLevel = ConfigurationManager . AppSettings ? [ "LogLevel" ] ;
41- var appBasePath = ConfigurationManager . AppSettings [ "ApplicationDataPath" ] ;
33+ var logLevel = ConfigurationManager . AppSettings ? [ "LogLevel" ] ;
4234 var applicationName = ConfigurationManager . AppSettings [ "ApplicationName" ] ;
4335 if ( string . IsNullOrEmpty ( applicationName ) )
4436 applicationName = "SampleConnector" ;
4537
46- if ( string . IsNullOrEmpty ( appBasePath ) )
47- appBasePath = Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) ;
48-
49- appBasePath = Path . Combine ( appBasePath , applicationName + "-Connector" ) ;
50-
5138 _sdkOptions = new SDKOptionsDefaultSetup ( )
5239 {
5340 ApplicationName = applicationName ,
@@ -66,9 +53,12 @@ private void StartConnector()
6653 uiConfiguration . HostingProductID = "Dummy" ;
6754 uiConfiguration . HostingProductVersion = "1.0" ;
6855
69- uiConfiguration . LogLevel = Autodesk . DataExchange . Core . Enums . LogLevel . Debug ;
70- if ( uiConfiguration . LogLevel == Autodesk . DataExchange . Core . Enums . LogLevel . Debug )
71- SetDebugLogLevel ( _sdkOptions ? . Logger ) ;
56+ uiConfiguration . LogLevel = GetLogLevel ( logLevel ) ;
57+ if ( uiConfiguration . LogLevel == Autodesk . DataExchange . Core . Enums . LogLevel . Debug )
58+ {
59+ SetDebugLogLevel ( _sdkOptions ? . Logger ) ;
60+ EnableHttpLogsForDebugging ( client ) ;
61+ }
7262
7363 var application = new Autodesk . DataExchange . UI . Application ( customReadWriteModel , uiConfiguration ) ;
7464 customReadWriteModel . Application = application ;
@@ -77,11 +67,26 @@ private void StartConnector()
7767 application . Show ( ) ;
7868 }
7969
70+ private LogLevel GetLogLevel ( string logLevel )
71+ {
72+ LogLevel parsedlogLevel ;
73+ bool canConvertToEnum = Enum . TryParse < LogLevel > ( logLevel , true , out parsedlogLevel ) ;
74+
75+ if ( canConvertToEnum )
76+ return parsedlogLevel ;
77+ else return LogLevel . Error ;
78+ }
79+
8080 private void SetDebugLogLevel ( Autodesk . DataExchange . Core . Interface . ILogger logger )
8181 {
8282 logger ? . SetDebugLogLevel ( ) ;
8383 }
8484
85+ private void EnableHttpLogsForDebugging ( Client client )
86+ {
87+ ( client as Client ) ? . EnableHttpDebugLogging ( ) ;
88+ }
89+
8590 private void AppManager_AdvanceLoadExchangeEvent ( object obj )
8691 {
8792
0 commit comments