FP300Service.UserControls.SaleUC.timer_Tick C# (CSharp) Метод

timer_Tick() приватный Метод

private timer_Tick ( object sender, EventArgs e, bool isDeptSale ) : void
sender object
e EventArgs
isDeptSale bool
Результат void
        private void timer_Tick(object sender, EventArgs e, bool isDeptSale)
        {
            if (String.IsNullOrEmpty(jsonStr))
            {
                string jsonFileName = System.Configuration.ConfigurationManager.AppSettings["JSONDocName"];
                if (!File.Exists(jsonFileName))
                {
                    bridge.Log(FormMessage.JSON_FILE_NOT_EXISTS);
                    return;
                }

                jsonStr = File.ReadAllText(jsonFileName);
            }

            try
            {
                bridge.Log(String.Format("AUTO PRINT DOC COUNTER: {0}", docCounter));
                CPResponse response = new CPResponse(bridge.Printer.PrintDocumentHeader());
                if (response.ErrorCode == 0)
                    if (isDeptSale)
                        response = new CPResponse(bridge.Printer.PrintJSONDocumentDeptOnly(jsonStr));
                    else
                        response = new CPResponse(bridge.Printer.PrintJSONDocument(jsonStr));
                else
                {
                    if (isDeptSale)
                        buttonAutoPrintDEPT.Text = "AUTO PRINT    JSON DEPT";
                    else
                        buttonAutoPrintPLU.Text = "AUTO PRINT    JSON PLU";
                }
                System.Threading.Thread.Sleep(500);

                if (docCounter % GetZRepAt == 0)
                {
                    bridge.Log(String.Format("AUTO PRINT: Z PRINTING... AT {0}", docCounter));
                    response = new CPResponse(bridge.Printer.PrintZReport());
                }

                docCounter++;
            }
            catch (Exception ex)
            {
                bridge.Log(FormMessage.OPERATION_FAILS + ": " + ex.Message);
                if (isDeptSale)
                    buttonAutoPrintDEPT.Text = "AUTO PRINT    JSON DEPT";
                else
                    buttonAutoPrintPLU.Text = "AUTO PRINT    JSON PLU";
            }
        }