Esempio n. 1
0
        private void buttonRestart_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            string sError = string.Empty;

            if (DeviceControlClass.RestartDevice(1, ref sError, 2, "192.168.1.201", 4370) == true)
            {
                MessageBox.Show(@"Restarting Device...", @"Device Shutdown.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(sError.ToString(), @"Error.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void buttonRestart_Click(object sender, EventArgs e)
 {
     Cursor = Cursors.WaitCursor;
     try
     {
         string sError = string.Empty;
         if (DeviceControlClass.RestartDevice(1, ref sError, 2, sIP, iPort))
         {
             MessageBox.Show(@"Restarting Device...", @"Device Shutdown.", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show(@"Cannot connect to the device. " + sError, @"Device Connection Error.", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         groupBox2.Enabled = false;
     }
     catch (Exception)
     {
         MessageBox.Show(@"Please make sure the device is connected.", @"Device Connection", MessageBoxButtons.OK,
                         MessageBoxIcon.Information);
         //throw;
     }
     Cursor = Cursors.Default;
 }