Beispiel #1
0
 public void Exit()
 {
     //if (VRage.Plugins.MyPlugins.Loaded)
     //{
     //    VRage.Plugins.MyPlugins.Unload();
     //}
     TempfileUtil.Dispose();
 }
Beispiel #2
0
 public void Exit()
 {
     if (VRage.Plugins.MyPlugins.Loaded)
     {
         VRage.Plugins.MyPlugins.Unload();
     }
     TempfileUtil.Dispose();
 }
Beispiel #3
0
        public void GenerateTempFiles()
        {
            for (var i = 0; i < 10; i++)
            {
                var file1 = TempfileUtil.NewFilename(null);
                File.WriteAllBytes(file1, new byte[] { 0x00, 0x01, 0x02 });

                var file2 = TempfileUtil.NewFilename(".txt");
                File.WriteAllText(file2, "blah blah");
            }

            TempfileUtil.Dispose();
        }
Beispiel #4
0
        private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            var comException = e.Exception as System.Runtime.InteropServices.COMException;

            if (comException != null && comException.ErrorCode == -2147221040)
            {
                // To fix 'OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN)'
                // http://stackoverflow.com/questions/12769264/openclipboard-failed-when-copy-pasting-data-from-wpf-datagrid

                e.Handled = true;
                return;
            }

            // Log details to Application Event Log.
            DiagnosticsLogging.LogException(e.Exception);

            string message;

            if (e.Exception is ToolboxException)
            {
                message = e.Exception.Message;
            }
            else
            {
                // Unhandled Exception.
                if (DiagnosticsLogging.LoggingSourceExists())
                {
                    message = string.Format(Res.DialogUnhandledExceptionEventMessage, e.Exception.Message);
                }
                else
                {
                    message = string.Format(Res.DialogUnhandledExceptionMessage, e.Exception.Message);
                }
            }

            MessageBox.Show(message, String.Format(Res.DialogUnhandledExceptionTitle, GlobalSettings.GetAppVersion()), MessageBoxButton.OK, MessageBoxImage.Error);

            TempfileUtil.Dispose();

            e.Handled = true;

            if (Application.Current != null)
            {
                Application.Current.Shutdown();
            }
        }
Beispiel #5
0
 public void Exit()
 {
     TempfileUtil.Dispose();
 }