Esempio n. 1
0
 private void btnTestLogUpload_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(tbUploadKey.txtbox.Text))
     {
         try
         {
             using (WebClient client = new WebClient())
             {
                 byte[] response = client.UploadValues(GlobalVariables.site.Substring(0, GlobalVariables.site.Length - 6) + "/insert", new NameValueCollection()
                 {
                     { "key", tbUploadKey.txtbox.Text },
                     { "type", "1" },
                     { "pcname", "TEST LOG UPLOAD" },
                     { "log", "Log upload completed." },
                 });
                 string result = System.Text.Encoding.UTF8.GetString(response);
                 if (result.Equals("ok"))
                 {
                     MessageBox.Show("Log uploaded successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show("Log failed to upload.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         catch (Exception ex) { GlobalVariables.DumpErrorLog(ex); }
     }
 }
Esempio n. 2
0
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     try
     {
         Environment.Exit(0);
     }
     catch (Exception ex) { GlobalVariables.DumpErrorLog(ex); }
 }