Ejemplo n.º 1
0
 /// <summary>
 /// Tracks a custom data without cache support
 /// </summary>
 /// <param name="CustomDataName">
 /// Self-explanatory ;)
 /// </param>
 /// <param name="CustomDataValue">
 /// Self-explanatory ;)
 /// </param>
 /// <returns>
 /// 
 /// </returns>
 public void TrackCustomDataR(string CustomDataName, string CustomDataValue)
 {
     lock (ObjectLock)
     {
         if (Started)
         {
             CheckApplicationCorrectness();
             try
             {
                 var json = new CustomDataRJson(CustomDataName, CustomDataValue, GetFlowNumber(), ApplicationId, ApplicationVersion);
                 Services.PostData(Settings.ApiEndpoint, JsonBuilder.GetJsonFromHashTable(json.GetJsonHashTable()));
             }
             catch (WebException)
             {
                 // only hide unhandled exception due no internet connection
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Tracks a custom data without cache support
 /// </summary>
 /// <param name="customDataName">
 /// Self-explanatory ;)
 /// </param>
 /// <param name="customDataValue">
 /// Self-explanatory ;)
 /// </param>
 /// <returns>
 /// True if it was sent in real time, false otherwise
 /// </returns>
 public bool TrackCustomDataR(string customDataName, string customDataValue)
 {
     lock (_objectLock)
     {
         if (Started)
         {
             CheckIfEnabled();
             try
             {
                 var json = new CustomDataRJson(_sessionGUID, customDataName, customDataValue, GetFlowNumber(), _applicationId, _applicationVersion);
                 Services.PostData(_applicationId, JsonBuilder.GetJsonFromHashTable(json.GetJsonHashTable()));
                 return true;
             }
             catch (WebException)
             {
                 return false;
             }
         }
         else
             return false;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Try to track real time customized data and caches it to send later if any network error occurs.
 /// </summary>
 /// <param name="CustomDataName">
 /// A <see cref="System.String"/>
 /// </param>
 /// <param name="CustomDataValue">
 /// A <see cref="System.String"/>
 /// </param>
 /// <returns>
 /// True if it was sended in real time, false otherwise
 /// </returns>
 public bool TrackCachedCustomDataR(string CustomDataName, string CustomDataValue)
 {
     try
     {
         TrackCustomDataR(CustomDataName, CustomDataValue);
     }
     catch (Exception)
     {
         lock (ObjectLock)
         {
             var json = new CustomDataRJson(CustomDataName, CustomDataValue, GetFlowNumber(), ApplicationId, ApplicationVersion);
             JSON.Add(JsonBuilder.GetJsonFromHashTable(json.GetJsonHashTable()));
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Try to track real time customized data and caches it to send later if any network error occurs.
        /// </summary>
        /// <param name="customDataName">
        /// A <see cref="System.String"/>
        /// </param>
        /// <param name="customDataValue">
        /// A <see cref="System.String"/>
        /// </param>
        /// <returns>
        /// True if it was sended in real time, false otherwise
        /// </returns>
        public bool TrackCachedCustomDataR(string customDataName, string customDataValue)
        {
            lock (_objectLock)
            {
                if (Started)
                {
                    CheckIfEnabled();

                    bool sentInRealTime = TrackCustomDataR(customDataName, customDataValue);
                    if(sentInRealTime == false)
                    {
                        var json = new CustomDataRJson(_sessionGUID, customDataName, customDataValue, GetFlowNumber(), _applicationId, _applicationVersion);
                        _json.Add(JsonBuilder.GetJsonFromHashTable(json.GetJsonHashTable()));
                    }
                    return sentInRealTime;
                }
                else
                    return false;
            }
        }