Exemplo n.º 1
0
        private static void Ping()
        {
            var worker = new BackgroundWorker();

            worker.DoWork += (sender, args) =>
            {
                var mfiService         = ServicesProvider.GetInstance().GetMFIServices();
                var pingInfo           = mfiService.GetPingInfo();
                var appSettingsService = ServicesProvider.GetInstance().GetApplicationSettingsServices();
                var guid = appSettingsService.GetGuid();
                if (guid == null)
                {
                    guid = Guid.NewGuid();
                    appSettingsService.SetGuid(guid.Value);
                }
                var collection = new Dictionary <string, string>
                {
                    { "Guid", guid.ToString() },
                    { "Username", User.CurrentUser.UserName },
                    { "Version", TechnicalSettings.GetDisplayVersion() },
                    { "Olb", pingInfo.Olb.ToString("0") },
                    { "NumberOfIndividualClients", pingInfo.NumberOfIndividualClients.ToString("0") },
                    { "NumberOfSolidarityGroups", pingInfo.NumberOfSolidarityGroups.ToString("0") },
                    { "NumberOfNonSolidarityGroups", pingInfo.NumberOfNonSolidarityGroups.ToString("0") },
                    { "NumberOfCompanies", pingInfo.NumberOfCompanies.ToString("0") }
                };
                var parameters = string.Join("&", collection.Select(x => string.Format("{0}={1}", x.Key, x.Value)).ToArray());
                var data       = Encoding.UTF8.GetBytes(parameters);
                var request    = (HttpWebRequest)WebRequest.Create("http://opencbsping.apphb.com/Ping");
                request.Method        = "POST";
                request.ContentType   = "application/x-www-form-urlencoded";
                request.ContentLength = data.Length;
                request.UserAgent     = "OpenCBS";
                request.Timeout       = 5000;
                try
                {
                    using (var stream = request.GetRequestStream())
                    {
                        stream.Write(data, 0, data.Length);
                    }
                }
                catch
                {
                }
            };
            worker.RunWorkerCompleted += (sender, args) =>
            {
                if (args.Error != null)
                {
                    Debug.WriteLine(args.Error.Message);
                }
            };
            worker.RunWorkerAsync();
        }
Exemplo n.º 2
0
 private void OnLoad(object sender, System.EventArgs e)
 {
     versionLabel.Text = "version " + TechnicalSettings.GetDisplayVersion();
 }
Exemplo n.º 3
0
 private void OnLoad(object sender, System.EventArgs e)
 {
     versionLabel.Text = "OpenCBS LLC Kyrgyz Republic. v" + TechnicalSettings.GetDisplayVersion();
 }