Пример #1
0
        static void Main(string[] args)
        {
            string fContent = "";

            if (args == null || args.Length == 0)
            {
                Console.WriteLine("This EXE must run with the VRArcade Managing System!"); // Check for null array
            }
            else if (args.Length == 1)
            {
                InitCoreConfig();
                InitWebService();

                try
                {
                    fContent = File.ReadAllText(args[0]);
                }
                catch (Exception)
                {
                    throw;
                }



                if (fContent.Length > 10)
                {
                    XmlSerializer SerializerObj  = new XmlSerializer(typeof(BarcodeInfo));
                    FileStream    readFileStream = null;
                    BarcodeInfo   bInfo          = null;

                    try
                    {
                        readFileStream = new FileStream(args[0], FileMode.Open, FileAccess.Read, FileShare.Read);
                        bInfo          = (BarcodeInfo)SerializerObj.Deserialize(readFileStream);
                    }
                    catch (Exception)
                    {
                    }
                    finally
                    {
                        readFileStream.Close();
                    }

                    if (bInfo != null && bInfo.BarcodeItems != null && bInfo.BarcodeItems.Count > 0)
                    {
                        BarcodePrinterWrapper bPrint = null;

                        try
                        {
                            bPrint = BarcodePrinterWrapper.Instance;

                            if (bInfo.BarcodeItems[0].IsPrintingTicket)
                            {
                                bPrint.PrintTickets(bInfo.BarcodeItems);

                                foreach (var item in bInfo.BarcodeItems)
                                {
                                    _dashboardClient.BarcodeDonePrinting(item.WaiverLogID, true, item.BookingReference, true, true);
                                }
                            }
                            else if (bInfo.BarcodeItems[0].IsPrintingKey)
                            {
                                bPrint.PrintKeys(bInfo.BarcodeItems);
                            }
                        }
                        catch (Exception ex)
                        {
                            System.Windows.Forms.MessageBox.Show("Error! " + ex.Message);
                        }
                        finally
                        {
                            if (bPrint != null)
                            {
                                bPrint.Dispose();
                            }
                        }
                    }
                }
            }
        }
 public void Release()
 {
     IsReleased = true;
     BarcodePrinterWrapper._instance = null;
 }