예제 #1
0
        /// <summary>
        /// Profile data thread
        /// </summary>
        /// <param name="obj"></param>
        private void ProfileDataThreadStart(object obj)
        {
            try
            {
                if (SystemProfileUrl != null)
                {
                    // get the config
                    NetSparkleConfiguration config = obj as NetSparkleConfiguration;

                    // collect data
                    NetSparkleDeviceInventory inv = new NetSparkleDeviceInventory(config);
                    inv.CollectInventory();

                    // build url
                    String requestUrl = inv.BuildRequestUrl(SystemProfileUrl.ToString() + "?");

                    // perform the webrequest
                    HttpWebRequest request = HttpWebRequest.Create(requestUrl) as HttpWebRequest;
                    using (WebResponse response = request.GetResponse())
                    {
                        // close the response
                        response.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                // No exception during data send
                ReportDiagnosticMessage(ex.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// Profile data thread
        /// </summary>
        /// <param name="obj">the configuration object</param>
        private void ProfileDataThreadStart(object obj)
        {
            try
            {
                if (SystemProfileUrl != null)
                {
                    // get the config
                    NetSparkleConfiguration config = obj as NetSparkleConfiguration;

                    // collect data
                    NetSparkleDeviceInventory inv = new NetSparkleDeviceInventory(config);
                    inv.CollectInventory();

                    // build url
                    String requestUrl = inv.BuildRequestUrl(SystemProfileUrl.ToString() + "?");

                    // perform the webrequest
                    HttpWebRequest request = HttpWebRequest.Create(requestUrl) as HttpWebRequest;
                    if (request != null)
                    {
                        request.UseDefaultCredentials = true;
                        using (WebResponse response = request.GetResponse())
                        {
                            // close the response
                            response.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // No exception during data send
                ReportDiagnosticMessage(ex.Message);
            }
        }