Beispiel #1
0
        /***********************************************************************************************************/


        #region ----- Constructor ------


        public TicketManager(ComaToolCredentials credentials, ComaToolSession session)
        {
            if (credentials == null || session == null)
            {
                throw new Exception("Could not initialize TicketManager");
            }

            _ticketUri   = new ComaToolUri();
            _credentials = credentials;
            _session     = session;

            if (!_session.isNullOrEmpty())
            {
                _session.Status = (int)Enums.SESSION_STATUS.UNKNOWN;
                _httpClient     = new ComaToolWebClient(_credentials.WebClientUsername, _credentials.WebClientPassword, _session.Cookies);
            }
            else
            {
                _httpClient = new ComaToolWebClient(_credentials.WebClientUsername, _credentials.WebClientPassword);
            }

            _httpClient.WebClientCredentialsModified += new ComaToolWebClient.WebClientCredentialsEventHandler(_httpClient_WebClientCredentialsModified);
            _httpClient.LogWebClientException        += new ComaToolWebClient.LogWebClientExceptionEventHandler(_httpClient_LogWebClientException);
            _httpClient.ErrorOccurred       += new ComaToolWebClient.ErrorOccurredEventHandler(httpClient_ErrorOccurred);
            _httpClient.SessionStatusChange += new ComaToolWebClient.SessionStatusHandler(OnSessionStatusChange);
            _httpClient.BytesDownloaded     += new ComaToolWebClient.BytesDownloadedHandler(_httpClient_BytesDownloaded);
        }
Beispiel #2
0
 private void SetSession(List <WebClientCookie> cookies, int status)
 {
     if (_session == null)
     {
         _session = new ComaToolSession();
     }
     _session.SetSession(cookies, status);
 }
Beispiel #3
0
        private void ClearSession()
        {
            if (_session == null)
            {
                _session = new ComaToolSession();
            }

            _session.Reset((int)Enums.SESSION_STATUS.INVALID);
            _httpClient.ClearCookies();
            OnLoggedOut();
        }