Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledHandler);
- .........
- static private void UnhandledHandler(object sender, UnhandledExceptionEventArgs args)
- {
- Exception e = (Exception)args.ExceptionObject;
- sendStatus("unhandled_error", e.Message);
- }
- public static void sendStatus(string act, string data)
- {
- Dictionary<string, string> messageObj = new Dictionary<string, string>();
- messageObj.Add("act", act);
- messageObj.Add("data", data);
- string JSONstr = "";
- try
- {
- JSONstr = new JavaScriptSerializer().Serialize(messageObj);
- Console.WriteLine(JSONstr);
- }
- catch (Exception e)
- {
- }
- }
- ..................
- sendStatus("error", ex.GetType().ToString());
- ..................
- sendStatus("info", "Printer is ready");
- sendStatus("paperCount", "255");
- sendStatus("printStatus", "printStart");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement