コード例 #1
0
 public NvrUserSession(NvrSessionInfo sessionInfo, string sdkLogDir, bool isDebugEnabled)
 {
     sdkLogDir_      = sdkLogDir;
     isDebugEnabled_ = isDebugEnabled;
     userSession_    = new UserSession(sessionInfo);
     debugInfo("NvrSdkLogsDir: '" + sdkLogDir_ + "'");
 }
コード例 #2
0
        public async Task LoginAsync(NvrSessionInfo sessionInfo)
        {
            string sdkLogDir = System.Reflection.Assembly.GetEntryAssembly().Location + @"_NvrSdkLogs\";

            NvrUserSession = new NvrUserSession(sessionInfo, sdkLogDir, true);

            await Task.Factory.StartNew(() => {
                try {
                    NvrUserSession.StartSession();
                } catch (NvrSdkException ex) {
                    throw new SystemException($"StartSession failed: NvrException Code[{ex.SdkErrorCode}]: {ex.Message}", ex);
                } catch (Exception ex) {
                    throw new SystemException("StartSession failed: " + ex.Message, ex);
                }
            }, TaskCreationOptions.AttachedToParent);
        }