Exemple #1
0
        private static async Task Main()
        {
            UnhandledExceptionHandler.Init();
            Paths.BotCore = Directory.GetCurrentDirectory();
            if (CommandLineArgsParser.Args.TryGetValue("data", out string dataDirectory))
            {
                if (Path.IsPathFullyQualified(dataDirectory))
                {
                    Paths.Data = dataDirectory;
                }
                else
                {
                    Paths.Data = Path.Combine(Paths.BotCore, dataDirectory);
                }
            }
            else
            {
                Paths.Data = Path.Combine(Paths.BotCore, "Data");
            }

            Paths.Init();
            await ServiceManager.StartAsync();

            Log.Info(typeof(Program), "Введите \"exit\", чтобы остановить бота и выйти.");
            await ServiceManager.WaitToStopAsync();
        }
Exemple #2
0
 static void Main()
 {
     Application.EnableVisualStyles();
     // Make sure no exceptions escape unnoticed
     UnhandledExceptionHandler.Register();
     Application.Run(new frmChat());
 }
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler,
            ReportExceptionEventArgs reportExceptionEventArgs) : this() {
            var newHeight = Height;

            this.reportExceptionEventArgs = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            errorMessage.Text = reportExceptionEventArgs.Exception.Message;

            newHeight += errorMessage.Height - FontHeight;

            if (!reportExceptionEventArgs.ShowContinueCheckbox) {
                continueCheckBox.Visible = false;
                newHeight -= continueCheckBox.Height;
            }

            if (newHeight > Height)
                Height = newHeight;

            if (reportExceptionEventArgs.CanDebug) {
                unhandledExceptionHandler.DebuggerLaunched += OnDebuggerLaunched;
                debug.Visible = true;
                poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport) {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus)
                    dontSendReport.Focus();
            }

            email.Text = RegistryHelper.TryReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += OnFeedback;
        }
Exemple #4
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                MessageBox.Show("Invalid argument length.");
                return;
            }
            log4net.GlobalContext.Properties["ImgName"] = args[0];
            XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(Environment.CurrentDirectory, "..", "DataSvr", "logging-config-game.xml")));

            IMGFilename = args[0];
            UnhandledExceptionHandler.Set(args, IMGFilename, LogFile);

            MasterThread.Load(IMGFilename);
            LogFile = new Logfile(IMGFilename);

            var mainForm = new GameMainForm();

            MainForm = mainForm;
            mainForm.InitializeServer();
#if FORMS
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(mainForm);
#else
            mainForm.ReadInput();
#endif
        }
 // This is the helper macro that runs (on the main thread)
 void SyncMacro(double _unused_)
 {
     // Check for timer and disable
     if (_timerId != 0)
     {
         KillTimer(new HandleRef(_syncWindow, _syncWindow.Handle), _timerId);
         _timerId = 0; // No race condition between the check and the reset here, since we're always on the main thread.
     }
     // Run everything currently in the queue
     _isRunningMacros = true;
     while (_isRunningMacros)
     {
         SendOrPostCallback work  = null;
         object             state = null;
         lock (_sendOrPostLock)
         {
             _isRunningMacros = _postCallbacks.Count > 0;
             if (_isRunningMacros)
             {
                 work  = _postCallbacks.Dequeue();
                 state = _postStates.Dequeue();
             }
             else
             {
                 // set flag that we need to post again for work
                 // and exit
                 _syncPosted = false;
                 return;
             }
         }
         try
         {
             work(state);
         }
         catch (Exception ex)
         {
             UnhandledExceptionHandler handler = ExcelIntegration.GetRegisterUnhandledExceptionHandler();
             if (handler != null)
             {
                 try
                 {
                     handler(ex);
                 }
                 catch (Exception uehex)
                 {
                     Logger.Runtime.Error(ex, "Unhandled exception in async delegate call.");
                     Logger.Runtime.Error(uehex, "Unhandled exception in UnhandledExceptionHandler after async delegate call.");
                 }
             }
             else
             {
                 Logger.Runtime.Error(ex, "Unhandled exception in async delegate call.");
             }
         }
     }
 }
Exemple #6
0
        private static void Main(string[] args)
        {
            UnhandledExceptionHandler.Attach();
            AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;

            Thread.CurrentThread.SetName("Main");

            VirtualClientController clientController = null;

            try
            {
                TraceFactory.Logger.Debug("Args: {0}".FormatWith(string.Join(" ", args)));
                int    startIndex = 0;
                string sessionId  = string.Empty;
                switch (args.Length)
                {
                case 2:
                    sessionId = args[1];
                    break;

                case 3:
                    sessionId  = args[1];
                    startIndex = int.Parse(args[2], CultureInfo.InvariantCulture);
                    break;

                default:
                    TraceFactory.Logger.Fatal("Invalid number of arguments.  Arguments passed in: {0}".FormatWith(args.Length));
                    TraceFactory.Logger.Fatal("Usage: {0} <Dispatcher Fully Qualified Domain Name> <Session Id> <Start Index for Software Installer>".FormatWith(AppDomain.CurrentDomain.FriendlyName));
                    Environment.Exit(1);
                    break;
                }

                // Set the logging context
                var dispatcher = args[0].Split('.')[0];
                TraceFactory.SetSessionContext(sessionId);
                TraceFactory.SetThreadContextProperty("Dispatcher", dispatcher, false);
                using (var officeWorkerStream =
                           File.Create(Path.Combine(Environment.CurrentDirectory, "OfficeWorkerBootStrapper.exe")))
                {
                    officeWorkerStream.Write(Properties.Resources.OfficeWorkerBootStrapper, 0,
                                             Properties.Resources.OfficeWorkerBootStrapper.Length);
                    officeWorkerStream.Flush(true);
                }


                clientController = new VirtualClientController(dispatcher, startIndex);
                clientController.Start(sessionId);
                TraceFactory.Logger.Debug("Client controller started.  Press Enter to terminate.");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                TraceFactory.Logger.Error(ex);
            }
        }
Exemple #7
0
        /// <summary>
        /// args[0] = VirtualResourceId
        /// args[1] = Host Name
        /// </summary>
        /// <param name="args"></param>
        private static void Main(string[] args)
        {
            Thread.CurrentThread.SetName("PerfMoncollectorMain");
            TraceFactory.SetThreadContextProperty("ResourceName", "PerfMonCounter_" + DateTime.Now.ToString("ddMMyyy", CultureInfo.InvariantCulture));

            UnhandledExceptionHandler.Attach();

            using (Program program = new Program(args[0]))
            {
                Console.ReadLine();
            }
        }
Exemple #8
0
        public static void Main(string[] args)
        {
            var h = new UnhandledExceptionHandler(HandleException);

            ExceptionManager.UnhandledException += h;

            Application.Init();
            MainWindow win = new MainWindow();

            win.Show();
            Application.Run();
        }
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs) : this()
        {
            int newHeight = Height;

            this.reportExceptionEventArgs  = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            this.errorMessage.Text         = reportExceptionEventArgs.Exception.Message;

            newHeight += (this.errorMessage.Height - FontHeight);

            if (!reportExceptionEventArgs.ShowContinueCheckbox)
            {
                this.continueCheckBox.Visible = false;
                newHeight -= (this.continueCheckBox.Height);
            }

            if (newHeight > Height)
            {
                Height = newHeight;
            }

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += new EventHandler(OnDebuggerLaunched);
                debug.Visible     = true;
                poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus)
                {
                    dontSendReport.Focus();
                }
            }

            switch (reportExceptionEventArgs.Exception.HelpLink)
            {
            //We don't ask for sending or not, we go directly to the email information
            //Used by SmartAssembly if the developer clicks the "Send Report" button from the Main Application
            case "{send}":
                reportExceptionEventArgs.TryToContinue = true;
                panelInformation.Visible = false;
                panelProxy.Visible       = true;
                saveAsFile2.Visible      = true;
                break;
            }

            this.proxy.Text = RegistryHelper.ReadHKLMRegistryString("Proxy");
            unhandledExceptionHandler.SendingReportFeedback += new SendingReportFeedbackEventHandler(OnFeedback);
        }
Exemple #10
0
        public static void Main(string[] args)
        {
            //System.Diagnostics.Debug.WriteLine(OpenTK.Graphics.GraphicsMode.Default);
            UnhandledExceptionHandler h = new UnhandledExceptionHandler(OnException);

            ExceptionManager.UnhandledException += h;
            OpenTK.Toolkit.Init();
            Gtk.Application.Init();
            MainWindow win = new MainWindow();

            win.Show();

            Gtk.Application.Run();
        }
Exemple #11
0
        public RTPClient(IPEndPoint multiCastIP, Image image, String cname, String name)
        {
            UnhandledExceptionHandler.Register();
            this.ipe    = multiCastIP;
            this.image  = image;
            this.vpList = null;
            rtpSession  = new RtpSession(ipe, new RtpParticipant(cname, name), true, true);

            System.Diagnostics.Debug.WriteLine(rtpSession.MulticastInterface.ToString());
            rtpSender   = rtpSession.CreateRtpSenderFec(name, PayloadType.JPEG, null, 0, 1);
            waveWriters = new Dictionary <IPAddress, WaveFileWriter>();

            EvetnBinding();
        }
        public static void HookErrors(UnhandledExceptionHandler handler)
        {
            if (glibHooked)
            {
                return;
            }

            glibHooked       = true;
            exceptionHandler = handler;
            ExceptionManager.UnhandledException += OnUnhandledException;
            gtkLogHandle  = Log.SetLogHandler("Gtk", LogLevelFlags.All, LogFunc);
            gdkLogHandle  = Log.SetLogHandler("Gdk", LogLevelFlags.All, LogFunc);
            glibLogHandle = Log.SetLogHandler("GLib", LogLevelFlags.All, LogFunc);
        }
Exemple #13
0
        private static void Main()
        {
            Application.Init();
            var h = new UnhandledExceptionHandler(OnException);

            ExceptionManager.UnhandledException += h;

            new MainWindow().Show();
            Application.Run();

            void OnException(UnhandledExceptionArgs args)
            {
                Console.WriteLine("Error in application: " + args.ExceptionObject);
                args.ExitApplication = false;
            }
        }
Exemple #14
0
        public static void Main(string [] args)
        {
            Bootstrapper.Initialize();
            Log.Info("Application Start.");

            Application.Init();
            var loginWindow = new LoginWindow();

            loginWindow.Show();

            UnhandledExceptionHandler handler = OnUnhandledException;

            ExceptionManager.UnhandledException += handler;

            Application.Run();
        }
Exemple #15
0
        static void Main(string[] args)
        {
            var database = args[0];
            _sessionId = args[1];
            var proxyServiceUri = new Uri(args[2]);

            TraceFactory.SetThreadContextProperty("PID", Process.GetCurrentProcess().Id.ToString());
            TraceFactory.SetSessionContext(_sessionId);
            TraceFactory.Logger.Debug(string.Join(", ", args));

            UnhandledExceptionHandler.Attach();

            GlobalSettings.Load(database);
            FrameworkServicesInitializer.InitializeExecution();

            try
            {
                using (var sessionProxy = new SessionProxy(_sessionId))
                {
                    sessionProxy.OnExit += _sessionProxy_OnExit;
                    sessionProxy.StartFrontendService(proxyServiceUri);
                    sessionProxy.StartBackendService();

                    TraceFactory.Logger.Debug("Notify Dispatcher process is up...");
                    Retry.WhileThrowing
                        (
                            () =>
                            {
                                using (var connection = SessionDispatcherConnection.Create("localhost"))
                                {
                                    connection.Channel.NotifyProxyStarted(_sessionId);
                                }
                            },
                            10,
                            TimeSpan.FromSeconds(2),
                            new List<Type>() { typeof(EndpointNotFoundException) }
                        );
                    TraceFactory.Logger.Debug("Notify Dispatcher process is up...Done");

                    _mainThreadBlock.WaitOne();
                }
            }
            catch (Exception ex)
            {
                TraceFactory.Logger.Error(ex);
            }
        }
Exemple #16
0
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs)
        {
            InitializeComponent();

            int newHeight = Height;

            this.reportExceptionEventArgs = reportExceptionEventArgs;
            errorMessage.Text             = reportExceptionEventArgs.Exception.Message;

            newHeight += (errorMessage.Height - FontHeight);

            if (!reportExceptionEventArgs.ShowContinueCheckbox)
            {
                continueCheckBox.Visible = false;
                newHeight -= (continueCheckBox.Height);
            }

            if (newHeight > Height)
            {
                Height = newHeight;
            }

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += new EventHandler(OnDebuggerLaunched);
                debug.Visible = true;
                if (debug.Left < powered.Right)
                {
                    powered.Visible = false;
                }
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus)
                {
                    dontSendReport.Focus();
                }
            }

            unhandledExceptionHandler.SendingReportFeedback += new SendingReportFeedbackEventHandler(OnFeedback);
        }
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler,
                                      ReportExceptionEventArgs reportExceptionEventArgs) : this()
        {
            var newHeight = Height;

            this.reportExceptionEventArgs  = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            errorMessage.Text = reportExceptionEventArgs.Exception.Message;

            newHeight += errorMessage.Height - FontHeight;

            if (!reportExceptionEventArgs.ShowContinueCheckbox)
            {
                continueCheckBox.Visible = false;
                newHeight -= continueCheckBox.Height;
            }

            if (newHeight > Height)
            {
                Height = newHeight;
            }

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += OnDebuggerLaunched;
                debug.Visible     = true;
                poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus)
                {
                    dontSendReport.Focus();
                }
            }

            email.Text = RegistryHelper.TryReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += OnFeedback;
        }
Exemple #18
0
        public static void Main(string[] args)
        {
            Bootstrapper.Initialize();
            Log.Info("Application Start.");

            if (PlatformDetection.IsWindows && !CheckWindowsGtk())
            {
                throw new SystemException(
                          "Cannot find GTKSharp - please raise an issue at https://github.com/flickr-downloadr/flickr-downloadr-gtk/issues/new");
            }

            Application.Init();
            var loginWindow = new LoginWindow();

            loginWindow.Show();

            UnhandledExceptionHandler handler = OnUnhandledException;

            ExceptionManager.UnhandledException += handler;

            Application.Run();
        }
Exemple #19
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                MessageBox.Show("Invalid argument length.");
                return;
            }

            log4net.GlobalContext.Properties["ImgName"] = args[0];
            XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(Environment.CurrentDirectory, "..", "DataSvr", "logging-config-shop.xml")));

            IMGFilename = args[0];
            LogFile     = new Common.Logfile(IMGFilename);


            UnhandledExceptionHandler.Set(args, IMGFilename, LogFile);
            MasterThread.Load(IMGFilename);
            Pinger.Init();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(MainForm = new frmMain());
        }
Exemple #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="multiCastIP"></param>
        /// <param name="vpList"></param>
        /// <param name="cname"></param>
        /// <param name="name"></param>
        public RTPClient(IPEndPoint multiCastIP, Dictionary <IPAddress, VideoPreview> vpList, String cname, String name)

        {
            UnhandledExceptionHandler.Register();
            this.ipe    = multiCastIP;
            this.vpList = vpList;
            this.image  = null;
            rtpSession  = new RtpSession(ipe, new RtpParticipant(cname, name), true, true);

            System.Diagnostics.Debug.WriteLine(rtpSession.MulticastInterface.ToString());
            rtpSender = rtpSession.CreateRtpSenderFec(name, PayloadType.JPEG, null, 0, 1);

            EvetnBinding();
            //stream = new MemoryStream();
            //sBuffer = new Dictionary<IPAddress, System.IO.MemoryStream>();
            //rBuffer = new Dictionary<IPAddress, System.IO.MemoryStream>();
            //listen_thread = new Thread(new ThreadStart(listener_proc));
            //listen_thread.SetApartmentState(ApartmentState.STA);
            //port =(int)MainWindow.Ports.RTP;
            //rtpSendClient = new UdpClient();
            //rtpReceClient = new UdpClient((int)MainWindow.Ports.RTP);
        }
Exemple #21
0
        public static void Init(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) =>
            {
                ShowError(e.ExceptionObject as Exception);
            };

            //check single open
            bool single;

            if (bool.TryParse(ConfigurationManager.AppSettings["single"], out single) && single)
            {
                var procName = Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location);
                var procList = Process.GetProcessesByName(procName);
                if (procList.Length > 1)
                {
                    return;
                }
            }

            try
            {
                Application.Init();
                UnhandledExceptionHandler h = new UnhandledExceptionHandler(OnError);
                ExceptionManager.UnhandledException += h;
                mainForm = new MainForm();
                bool autoopen;
                if (bool.TryParse(ConfigurationManager.AppSettings["autoopen"], out autoopen) && autoopen)
                {
                    mainForm.OnRecentProject(mainForm, EventArgs.Empty);
                }

                Application.Run();
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
        }
Exemple #22
0
        public static void Register(UnhandledExceptionHandler eventHandler)
        {
            if (UnhandledExceptionEvent != null)
            {
                throw new InvalidOperationException("You can only specify one Unhandled Event Handler.");
            }

            UnhandledExceptionEvent = eventHandler ?? throw new NullReferenceException("You have to specify an event handler.");

            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                Exception     e  = (Exception)args.ExceptionObject;
                StringBuilder sb = new StringBuilder();
                sb.AppendLine($"EXCEPTION OCCURED: {DateTime.Now}");
                sb.AppendLine(args.ExceptionObject.GetType().Name);
                sb.AppendLine($"Is terminating: {args.IsTerminating}");
                sb.AppendLine("=====MESSAGE=====");
                sb.AppendLine(e.Message);
                sb.AppendLine("=====STACK=====");
                sb.AppendLine(e.StackTrace);
TRAVERSE:
                e = e.InnerException;
                if (e != null)
                {
                    sb.AppendLine("=======INNER=====");
                    sb.AppendLine(e.Message);
                    sb.AppendLine("=======STACK=====");
                    sb.AppendLine(e.StackTrace);
                    goto TRAVERSE;
                }
                sb.AppendLine();
                sb.AppendLine();


                OnUnhandledException(sb);
            };
        }
Exemple #23
0
        /*public override void OnTrimMemory
         * (
         *  [GeneratedEnum] TrimMemory level
         * )
         * {
         *  base.OnTrimMemory(level);
         * }*/

        public override void OnCreate()
        {
            //ApplicationLogger.LogDebug("MEMORY 0 : {0}",
            //                           GC.GetTotalMemory(false));
            base.OnCreate();

            //ApplicationLogger.LogDebug("MEMORY 1 : {0}",
            //                           GC.GetTotalMemory(false));

            UnhandledExceptionHandler.Activate();

            CreateBitmapCache();

            RegisterActivityLifecycleCallbacks(new ActivityLifecycleCallbacks());

            PortableObjectRepository <Activity> .RegisterPlatformSpecific
            (
                getUiContext : () => { return(CurrentActivity); },

                showExceptionAndExit : (activity,
                                        exception) => ShowExceptionAndExit(activity,
                                                                           exception),
                fileObjectDescriber : new DefaultFileDescriber(),

                objectLoadingTask : AndroidObjectRepository.LoadAndroidObjectsAsync
            );

            PortableSourceRepository.RegisterPlatformSpecific
            (
                sourceReaderFactory: AndroidSourceRepository.CreateSourceReader,

                sourceWriterFactory: AndroidSourceRepository.CreateSourceWriter
            );

            //ApplicationLogger.LogDebug("MEMORY 2 : {0}",
            //                           GC.GetTotalMemory(false));
        }
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs)
            : this()
        {
            int newHeight = Height;

            this.reportExceptionEventArgs = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            this.errorMessage.Text = reportExceptionEventArgs.Exception.Message;

            foreach (var key in reportExceptionEventArgs.Exception.Data.Keys)
                reportExceptionEventArgs.AddCustomProperty(string.Format("Data [{0}]", key.ToString()), reportExceptionEventArgs.Exception.Data[key].ToString());

            newHeight += (this.errorMessage.Height - FontHeight);

            if (!reportExceptionEventArgs.CanContinue)
            {
                this.continueCheckBox.Visible = false;
                newHeight -= (this.continueCheckBox.Height);
            }

            if (newHeight > Height) Height = newHeight;

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += new EventHandler(OnDebuggerLaunched);
                debug.Visible = true;
                poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus) dontSendReport.Focus();
            }

            this.email.Text = RegistryHelper.ReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += new SendingReportFeedbackEventHandler(OnFeedback);

            // GFH
            //if (WebProxy.Credentials != null)
            unhandledExceptionHandler.SetProxy(WebProxy);

            string reportedExceptions = RegistryHelper.ReadHKLMRegistryString("ReportedExceptions");
            string currentVersion;

            try
            {
                currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                if (!reportedExceptions.StartsWith(currentVersion))
                    reportedExceptions = currentVersion + ":";
            }
            catch
            {
                currentVersion = "";
            }
            string newHashCode = GetExceptionHashCode(reportExceptionEventArgs.Exception).ToString();

            if (reportedExceptions.Contains(newHashCode))
            {
                labelRequiredInfo.Visible = false;
                dontSendReport.Enabled = true;
                cancelSending.Enabled = true;
                saveAsFile.Enabled = true;
            }
            else
            {
                labelRequiredInfo.Visible = true;
                dontSendReport.Enabled = false;
                cancelSending.Enabled = false;
                saveAsFile.Enabled = false;
                RegistryHelper.SaveHKLMRegistryString("ReportedExceptions", reportedExceptions + "," + newHashCode);
            }
        }
Exemple #25
0
 public static void RegisterUnhandledExceptionHandler(UnhandledExceptionHandler h)
 {
     ExcelIntegration.RegisterUnhandledExceptionHandler(h);
 }
Exemple #26
0
 public static void RegisterUnhandledExceptionHandler(UnhandledExceptionHandler h)
 {
     unhandledExceptionHandler = h;
 }
 public static void RegisterUnhandledExceptionHandler(UnhandledExceptionHandler h)
 {
     unhandledExceptionHandler = h;
 }
 public static void RegisterUnhandledExceptionHandler(UnhandledExceptionHandler h)
 {
     ExcelIntegration.RegisterUnhandledExceptionHandler(h);
 }
Exemple #29
0
        public static void Main(string[] args)
        {
            try
            {
                WindowStartupFix.WindowsCheck();
                Application.Init();
                QSMain.GuiThread = System.Threading.Thread.CurrentThread;
#if DEBUG
                var errorSettings = new ErrorReportingSettings(false, true, false, null);
#else
                var errorSettings = new ErrorReportingSettings(true, false, true, 300);
#endif
                UnhandledExceptionHandler.SubscribeToUnhadledExceptions(errorSettings);
                GtkGuiDispatcher.GuiThread = System.Threading.Thread.CurrentThread;
                UnhandledExceptionHandler.ApplicationInfo = new ApplicationVersionInfo();
                //Настройка обычных обработчиков ошибок.
                UnhandledExceptionHandler.CustomErrorHandlers.Add(CommonErrorHandlers.MySqlException1055OnlyFullGroupBy);
                UnhandledExceptionHandler.CustomErrorHandlers.Add(CommonErrorHandlers.MySqlException1366IncorrectStringValue);
                UnhandledExceptionHandler.CustomErrorHandlers.Add(CommonErrorHandlers.NHibernateFlushAfterException);
            }
            catch (Exception falalEx)
            {
                if (WindowStartupFix.IsWindows)
                {
                    WindowStartupFix.DisplayWindowsOkMessage(falalEx.ToString(), "Критическая ошибка");
                }
                else
                {
                    Console.WriteLine(falalEx);
                }

                logger.Fatal(falalEx);
                return;
            }

            CreateProjectParam();
            try
            {
                AutofacClassConfig();
            }
            catch (MissingMethodException ex) when(ex.Message.Contains("System.String System.String.Format"))
            {
                WindowStartupFix.DisplayWindowsOkMessage("Версия .Net Framework должна быть не ниже 4.6.1. Установите боллее новую платформу.", "Старая версия .Net");
            }

            // Создаем окно входа
            Login LoginDialog = new QSProjectsLib.Login();
            LoginDialog.Logo = Gdk.Pixbuf.LoadFromResource("CarGlass.icons.logo.png");
            LoginDialog.SetDefaultNames("CarGlass");
            LoginDialog.DefaultLogin  = "";
            LoginDialog.DefaultServer = "stekloff.qsolution.ru";
            LoginDialog.UpdateFromGConf();

            ResponseType LoginResult;
            LoginResult = (ResponseType)LoginDialog.Run();
            if (LoginResult == ResponseType.DeleteEvent || LoginResult == ResponseType.Cancel)
            {
                return;
            }

            LoginDialog.Destroy();

            //Настройка базы
            CreateBaseConfig();

            // Для корректного удаления в справочниках
            QSOrmProject.OrmMain.DisableLegacyDeletion();

            //Запускаем программу
            MainWin = new MainWindow();
            QSMain.ErrorDlgParrent = MainWin;
            if (QSMain.User.Login == "root")
            {
                return;
            }
            MainWin.Show();
            Application.Run();
        }
 public override void RegisterUnhandledExceptionHandler(UnhandledExceptionHandler exceptionHandler)
 {
     ExcelIntegration.RegisterUnhandledExceptionHandler(exceptionHandler);
 }
Exemple #31
0
 public virtual void RegisterUnhandledExceptionHandler(UnhandledExceptionHandler exceptionHandler)
 {
     throw new NotImplementedException();
 }
Exemple #32
0
 /// <summary>Prevents a default instance of the <see cref="Application"/> class from being created.</summary>
 private Application()
 {
     UnhandledExceptionHandler.Register(this.Notify);
 }
		static extern UnhandledExceptionHandler SetUnhandledExceptionFilter(UnhandledExceptionHandler lpTopLevelExceptionFilter);
Exemple #34
0
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs)
            : this()
        {
            int newHeight = Height;

            this.reportExceptionEventArgs  = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            this.errorMessage.Text         = reportExceptionEventArgs.Exception.Message;
            this.header1.Text = string.Format("{1} has encountered a problem.{0}We are sorry for the inconvenience.", Environment.NewLine, UnhandledExceptionHandler.ApplicationName);
            this.header2.Text = string.Format("Please wait while {0} sends the report to {1} through the Internet.", UnhandledExceptionHandler.ApplicationName, UnhandledExceptionHandler.CompanyName);
            this.header3.Text = string.Format("Do you want to be contacted by {0} regarding this problem?", UnhandledExceptionHandler.CompanyName);
            this.label3.Text  = string.Format("If you want to be contacted by {0} regarding this error, please provide your e-mail address. This information will not be used for any other purpose.", UnhandledExceptionHandler.CompanyName);
            //this.pleaseTellMessage.Text = string.Format("To help improve the software you use, {0} is interested in learning more about this error. We have created a report about the error for you to send to us.", UnhandledExceptionHandler.CompanyName);

            foreach (var key in reportExceptionEventArgs.Exception.Data.Keys)
            {
                reportExceptionEventArgs.AddCustomProperty(string.Format("Data [{0}]", key.ToString()), reportExceptionEventArgs.Exception.Data[key].ToString());
            }

            newHeight += (this.errorMessage.Height - FontHeight);

            if (!reportExceptionEventArgs.CanContinue)
            {
                this.continueCheckBox.Visible = false;
                newHeight -= (this.continueCheckBox.Height);
            }

            if (newHeight > Height)
            {
                Height = newHeight;
            }

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += new EventHandler(OnDebuggerLaunched);
                debug.Visible = true;
                //poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus)
                {
                    dontSendReport.Focus();
                }
            }

            this.email.Text = RegistryHelper.ReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += new SendingReportFeedbackEventHandler(OnFeedback);

            // GFH
            //if (WebProxy.Credentials != null)
            unhandledExceptionHandler.SetProxy(WebProxy);

            string reportedExceptions = RegistryHelper.ReadHKLMRegistryString("ReportedExceptions");
            string currentVersion;

            try
            {
                currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                if (!reportedExceptions.StartsWith(currentVersion))
                {
                    reportedExceptions = currentVersion + ":";
                }
            }
            catch
            {
                currentVersion = "";
            }
            string newHashCode = GetExceptionHashCode(reportExceptionEventArgs.Exception).ToString();

            // Force reporting of first-time exceptions
            if (reportedExceptions.Contains(newHashCode))
            {
                //labelRequiredInfo.Visible = false;
                dontSendReport.Enabled = true;
                cancelSending.Enabled  = true;
                saveAsFile.Enabled     = true;
            }
            else
            {
                //labelRequiredInfo.Visible = true;
                //dontSendReport.Enabled = false;
                //cancelSending.Enabled = false;
                //saveAsFile.Enabled = false;

                // Temp: Don't force user to send new message. These 4 lines below are repeated above, and should be removed once we decide what to do going forward.
                //labelRequiredInfo.Visible = false;
                dontSendReport.Enabled = true;
                cancelSending.Enabled  = true;
                saveAsFile.Enabled     = true;

                RegistryHelper.SaveHKLMRegistryString("ReportedExceptions", reportedExceptions + "," + newHashCode);
            }
            if (NoUi)
            {
                panelInformation.Visible = false;
                continueSendReport_Click(null, null);
            }
        }
Exemple #35
0
        /// <summary>
        /// Prevents a default instance of the <see cref="Application"/> class from being created.
        /// </summary>
        private Application()
        {
            Action <string> notifier = this.Notify;

            this.unhandledExceptionHandler = new UnhandledExceptionHandler(notifier);
        }