CrossThreadRunner.RunInSTA C# (CSharp) 메소드

RunInSTA() 공개 메소드

public RunInSTA ( Action function ) : void
function Action
리턴 void
    public void RunInSTA(Action function)
    {
        RunInSTA(new ThreadStart(() => function()));
    }

Same methods

CrossThreadRunner::RunInSTA ( ThreadStart, userDelegate ) : void

Usage 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()));
        }
All Usage Examples Of CrossThreadRunner::RunInSTA