Example #1
0
 private static void ConsoleMain(string[] args)
 {
     if (args[0] == "ghl")
     {
         using (var form = new SnifferBarCode(true))
         {
             try
             {
                 Console.WriteLine(SerelizeHidDeviceList(form.CollectionHidDeviceInfo));
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.Data);
             }
         }
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                AllocConsole();
                ShowWindow(GetConsoleWindow(), SwHide);
                ConsoleMain(args);
            }
            else
            {
                try
                {
                    if (!EventLog.SourceExists("SnifferBarCodeLoger"))
                    {
                        EventLog.CreateEventSource("SnifferBarCodeLoger", "Application");
                    }

                    var loger = new EventLog {Source = "SnifferBarCodeLoger"};

                    loger.WriteEntry("Start using SnifferBarCode");
                    using (var form = new SnifferBarCode())
                    {
                        loger.WriteEntry("Started SnifferBarCode");
                        form.HookKeyPressed += FormOnKeyPressed;
                        loger.WriteEntry("subscribe to FormOnKeyPressed");

                        loger.WriteEntry("Starting   Application.Run();");
                        Application.Run();
                        loger.WriteEntry("Started   Application.Run();");
                    }
                }
                catch (Exception ex)
                {
                    
                }
            }
        }