private void buttonAutoPrintDEPT_Click(object sender, EventArgs e)
{
if (buttonAutoPrintDEPT.InvokeRequired)
{
buttonAutoPrintDEPT.Invoke(new buttonAutoPrintDEPTClickDelegate(buttonAutoPrintDEPT_Click), sender, e);
}
else
{
try
{
if (buttonAutoPrintDEPT.Text == "AUTO PRINT JSON DEPT")
{
buttonAutoPrintDEPT.Text = "STOP PRINT";
GetZRepAt = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["GetZReportAt"]);
docCounter = 1;
timer1.Tick += (object s, EventArgs a) => timer_Tick(s,a, true);
timer1.Interval = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["AutoPrintTimerInterval"]); // must be dividable by 1000
timer1.Start();
timer2.Interval = 1000;
wTime = timer1.Interval - timer2.Interval;
timer2.Start();
}
else
{
buttonAutoPrintDEPT.Text = "AUTO PRINT JSON DEPT";
timer1.Tick -= (object s, EventArgs a) => timer_Tick(s, a, true);
timer1.Stop();
timer2.Stop();
}
}
catch (Exception ex)
{
bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
}
}
}