// Create the instance as a singleton public static FPrinterEngine GetInstance() { if (instance == null) { instance = new FPrinterEngine(); } return(instance); }
// Form initialization private void StartUI_Load(object sender, EventArgs e) { ConnectProgress progressBar = new ConnectProgress(); progressBar.Show(this); DateTime currentDate = DateTime.Now; progressBar.GetProgressBar().Value = 10; progressBar.GetProgressBar().Update(); atDate.Text = currentDate.ToString(); ReadLogonFile("logon.txt"); progressBar.GetProgressBar().Value = 70; progressBar.GetProgressBar().Update(); sapReader = SAPReader.GetInstance(connection); sapReader.InitSAPDestionation(); progressBar.GetProgressBar().Value = 100; progressBar.GetProgressBar().Update(); progressBar.Close(); if (!sapReader.ConnectionSuccess) { Close(); } else { tbxCompany.Text = "1000"; tbxCashBox.Text = "1000"; } printEngine = FPrinterEngine.GetInstance(); printEngine.InitFiscalDevice(); dataTable = new DataTable(); columnsCollection = CreateTableHeader(); BuildTableHead(ref dataTable); dataGridViewOutput.DataSource = dataTable; // Add the double clicking event for the grid dataGridViewOutput.DoubleClick += new EventHandler(tableRow_DoubleClick); // Add a key down handler (ENTER, RETURN etc) dataGridViewOutput.KeyDown += new KeyEventHandler(grid_keyDown); }