private void buttonExecute_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                int iYear  = Convert.ToInt16(comboBoxYear.Text);
                int iMonth = comboBoxMonth.SelectedIndex + 1;
                int iDay   = Convert.ToInt16(comboBoxDay.Text);
                int iHour  = Convert.ToInt16(comboBoxHour.Text);
                int iMin   = Convert.ToInt16(comboBoxMin.Text);
                int iSec   = Convert.ToInt16(comboBoxSec.Text);

                if (DeviceControlClass.SetDeviceTime(1, 2, iYear, iMonth, iDay, iHour, iMin, iSec, sIP, iPort))
                {
                    string sCurrntTime = string.Empty;
                    if (DeviceControlClass.GetDeviceTime(1, 2, out sCurrntTime, sIP, iPort))
                    {
                        textBoxNew.Text = sCurrntTime;
                        MessageBox.Show(@"Device time sync successfull.", @"Time Sychronization", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        textBoxNew.Text = @"No Time Set.";
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(@"Error - " + ex.Message);
                //throw;
            }
            Cursor.Current = Cursors.Default;
        }
Beispiel #2
0
 private void buttonSetTime_Click(object sender, EventArgs e)
 {
     if (DeviceControlClass.SetDeviceTime(1, 2, "192.168.1.201", 4370))
     {
         MessageBox.Show(@"Device time sync with the PC");
     }
 }
        private void buttonSetTime_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            try
            {
                if (DeviceControlClass.SetDeviceTime(1, 2, sIP, iPort))
                {
                    MessageBox.Show(@"Device time sync with PC's.", @"Time Sychronization", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                groupBox2.Enabled = false;
            }
            catch (Exception)
            {
                MessageBox.Show(@"Please make sure the device is connected.", @"Device", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                //throw;
            }

            Cursor = Cursors.Default;
        }