private static void ProcessException(Exception ex)
        {
            try
            {
                CatchMe me = null;
#if !WindowsCE
                (me = CatchMe.WriteException(ex).Level(1).Screen().Where().To <LogFile>()).Write();
#else
                (me = CatchMe.WriteException(ex).Level(1).Screen().Where("UnhandledExceptionHandler").To <LogFile>()).Write();
#endif

                if (_bind != null)
                {
                    _bind(me);
                }
            }
            catch (Exception ex2)
            {
#if !WindowsCE
                new LogFile().Write((CatchMe.WriteException(ex2).Level(1).Screen().Where()));
#else
                new LogFile().Write((CatchMe.WriteException(ex2).Level(1).Screen().Where("Double UnhandledExceptionHandler")));
#endif
            }
            finally
            {
                if (!IsBatch)
                {
                    ExceptionDialog d = new ExceptionDialog();
                    d.ShowDialog();
                }
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            }
        }
Пример #2
0
 public void OnAsyncWifiLog(IAsyncResult result)
 {
     try
     {
         _fs.EndWriteInJournal(result);
     }
     catch (Exception ex)
     {
         CatchMe.WriteException(ex).Where("cWifi::OnAsyncWifiLog").WriteOnly <LogFile>();
     }
 }
Пример #3
0
        public void Write(ICatchMe Entry)
        {
            if (IpAddress != null)
            {
                return;
            }

            if (Entry.UrgenceLevel.HasValue && (Level != 0))
            {
                if (Entry.UrgenceLevel.Value > Level)
                {
                    return;
                }
            }

            try
            {
#if !NET35
                if (_fs == null)
                {
                    _fs = new CatchException.Service.CatchException();
                }
                _fs.WriteInJournal(Entry.ComputerName, Entry.GetApplicationId(), true, Entry.ToHtml());
#else
#if !WindowsCE
                if (_fs == null)
                {
                    _fs = new CatchException.Service.CatchExceptionClient(new BasicHttpBinding(), new EndpointAddress(FullUrl));
                }
                _fs.WriteInJournal(Entry.ComputerName, Entry.GetApplicationId(), Entry.ToHtml());

                _fs.Close();
#else
                if (_fs == null)
                {
                    _fs = new WcfException.CatchException();
                }

                AsyncCallback cb = new AsyncCallback(OnAsyncWifiLog);
                _fs.BeginWriteInJournal(Entry.ComputerName, Entry.GetApplicationId(), true, Entry.ToHtml(), cb, null);
#endif
#endif
            }
            catch (Exception ex)
            {
                CatchMe.WriteException(ex).Where("LogWcf::Write").WriteOnly <LogFile>();
            }
        }
        public static void CatchUnhandled()
        {
#if !WindowsCE
            System.Windows.Forms.Application.ThreadException -= ThreadExceptionHandler;
            System.Windows.Forms.Application.ThreadException += ThreadExceptionHandler;
            try
            {
                System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.CatchException);
            }
            catch (Exception ex)
            {
                new LogFile().Write((CatchMe.WriteException(ex).Level(1).Screen().Where()));
                throw new Exception("Manque la Declaration SecurityPermission");
            }
#endif

            System.AppDomain.CurrentDomain.UnhandledException -= UnhandledExceptionHandler;
            System.AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
        }