Esempio n. 1
0
 /// <summary>
 /// This method pings a webservice deployed for 3P, it simply allows to do
 /// statistics on the number of users of the software
 /// </summary>
 public static void Ping()
 {
     try {
         // ping once x hours
         if (Utils.IsLastCallFromMoreThanXMinAgo("Ping", Config.PostPingEveryXMin))
         {
             var webServiceJson = new WebServiceJson(WebServiceJson.WebRequestMethod.Post, Config.PostPingWebWervice);
             webServiceJson.OnInitHttpWebRequest += request => {
                 request.Proxy = Config.Instance.GetWebClientProxy();
             };
             webServiceJson.AddToReq("UUID", UniqueId);
             webServiceJson.AddToReq("userName", Name);
             webServiceJson.AddToReq("version", AssemblyInfo.Version);
             webServiceJson.OnRequestEnded += req => {
                 if (req.StatusCodeResponse != HttpStatusCode.OK)
                 {
                     if (Config.IsDeveloper)
                     {
                         ErrorHandler.ShowErrors(new Exception(req.JsonResponse), "Error when pinging : " + req.StatusCodeResponse.ToString());
                     }
                 }
             };
             webServiceJson.Execute();
         }
     } catch (Exception e) {
         if (Config.IsDeveloper)
         {
             ErrorHandler.ShowErrors(e);
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// ASYNC - Call this method to start checking for updates every 2 hours, also check once immediately if
 /// Config.Instance.TechnicalCheckUpdateEveryXMin condition is met
 /// </summary>
 public void StartCheckingForUpdate()
 {
     // check for updates every now and then
     CheckRegularlyAction = RecurentAction.StartNew(() => {
         // Check for new updates
         if (!Config.Instance.GlobalDontCheckUpdates)
         {
             CheckForUpdate(false);
         }
     }, 1000 * 60 * Config.UpdateCheckEveryXMin, 0, Utils.IsLastCallFromMoreThanXMinAgo(UpdatedSoftName + "update", Config.UpdateCheckEveryXMin));
 }