c# - Windows Forms - How to kick of a seperate thread and hold current thread -


I have a windows app and a DLL (windows form) that is trying to open (activation check) In an attempt to stop im the current thread open a new thread (activation check) to wait for that form to be true, continue the main thread. Someone can explain to me what I'm doing wrong - thanks.

  Fixed class program {Private Static Splash Screen Splash; Apps by leaving Private Static Bull; Private Static Bull activation; [STAThread] static zero main () {thread thread = new thread (activation probe); Thread.Start (); Do {Thread. Sleep (1000); } While (activating); If (left app) {Thread. Sleep (0); // Wizards (); Application.Run (new main (riff splash)); }}} Private Static Zero Activation Test () {splash.SetStatus = "Checking License ..."; Guid productId = new Guid (properties.Settings.Default.ProductId); Gid version iid = new guide (properties settings default.versionID); Client.u. Entrypoint entrypoint = new entrypoint (); Activation field = wrong; Client BLL Product Activation Generated trial licenses (Product ID 1, Version Ed. 2, ed. Ed. 3); EntryPoint.IniatePlugin (Product ID, Version ID); EntryPoint.PluginFinished + = New EventHolders. PluginFinishAventHandler (entryPoint_PluginFinished); } Fixed zero entryPoint_PluginFinished (bool strength) {quitApp = forceQuit; Activation field = true; }  

You can just type .join () ? Despite being honest, I am not sure what is the point of starting another thread and first Posing ; Just work on the original thread?

With the code problem possibly activation is being organized in a register; Try marking it as volatile , or alternatively use a lock at both locations that access this variable We do. Even better, use ManualResetEvent or similar, and open it from the activation code.

  using the system; Using System.Threading; Static Class Program (Static Zero Main () (New Thread (DoActivation). Start (); Console. Light Line ("Main: Waiting for Activation"); activation.WaitOne (); Console.light line ("Main: and We know ... "); static zero DoActivation (object state) {Console.WriteLine (" DoActivation: Active ... "); Thread.Sleep (2000); // Excuse It takes a time console. WrightLine ( "DoActivation: Active"); activation.Set (); // Any other stuff on this thread ...} Fixed Manual RSetset Activation = New Manual Retset (incorrect);}  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -