RunInSTA() public method

public RunInSTA ( Action function ) : void
function Action
return void
Example #1
0
        void View_CopyLogOutput(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("IMPORTANT: In order to help us find out the source of this problem, please let us know what you were doing before the crash, or inform us of the steps to reproduce the problem.");
            sb.AppendLine();
            sb.AppendLine("System Information");
            sb.AppendLine("==================");

            sb.AppendLine("MGDF Version: " + Assembly.GetExecutingAssembly().GetName().Version);
            sb.AppendLine("OS: " + EnvironmentSettings.Current.OSName);
            sb.AppendLine("OS Architecture: " + EnvironmentSettings.Current.OSArchitecture + " bit");
            sb.AppendLine("RAM: " + EnvironmentSettings.Current.TotalMemory);
            sb.AppendLine("Processor Count: " + EnvironmentSettings.Current.ProcessorCount);
            sb.AppendLine();
            sb.AppendLine("Details");
            sb.AppendLine("=======");
            sb.AppendLine(_detail);
            sb.AppendLine();

            if (Game.Current != null)
            {
                sb.AppendLine("GamesManager Log output");
                sb.AppendLine("=======================");

                IFile gamesManagerLog = FileSystem.Current.GetFile(Path.Combine(Resources.GameUserDir, "GamesManagerLog.txt"));
                if (gamesManagerLog.Exists)
                {
                    using (var stream = gamesManagerLog.OpenStream(FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        using (TextReader reader = new StreamReader(stream))
                        {
                            sb.Append(reader.ReadToEnd());
                        }
                    }
                }
            }

            var runner = new CrossThreadRunner();

            runner.RunInSTA(() => Clipboard.SetText(sb.ToString()));
        }
Example #2
0
        void View_CopyLogOutput(object sender, EventArgs e)
        {
            var runner = new CrossThreadRunner();

            runner.RunInSTA(() => Clipboard.SetText(SubmitCoreErrorPresenter.GetLogContent(_game, _detail)));
        }