private void buttonClearLogs_Click(object sender, EventArgs e) { DialogResult d = MessageBox.Show(@"You are about to clear machine logs, continue?", "Clear Logs", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d == DialogResult.Yes) { Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; try { int iError = 0; if (AccessDataClass.ClearDeviceLogs(1, ref iError, 2, sIP, iPort)) { MessageBox.Show(@"Device Logs Cleared", @"Clear Logs", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(iError.ToString(), @"Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } groupBox2.Enabled = false; } catch (Exception) { MessageBox.Show(@"Please make sure the device is connected.", @"Device", MessageBoxButtons.OK, MessageBoxIcon.Information); //throw; } Cursor.Current = Cursors.Default; } }
private void buttonClearLogs_Click(object sender, EventArgs e) { Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; dataGridView1.DataSource = null; int iError = 0; if (AccessDataClass.ClearDeviceLogs(1, ref iError, 2, "192.168.1.201", 4370)) { labelInfo.Text = @"Device Logs Clear"; MessageBox.Show(@"Device Logs Cleared", @"Clear Logs", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(iError.ToString(), @"Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Cursor.Current = Cursors.Default; }