c# - update wpf UI label before running pearl script -


I want to update label content and then run a pearl script (which only restart services). Here is my code

  personal process p = new process (); Private Zero NextBtn_Click (Object Sender, RoutedEventArgs E) {// Update Label this.lblmsg.Content = "Hello World !!" ;; // run pearl script assembly assembly assembly assembly = assembly Load Fraomed (Activation Configuration Settings. Source Interface Assignment Name); Type logicalType = osInterfaceAssembly.GetType (Activation Configuration Studio. Logical); Lawif logicalmethinfo = faucet; LogicalMethInfo = logicalType.GetMethod (Active Adjustment Constants. Logical Transcript Lost Item, New Type [] {Typef (string)}); String Gyro Commider = LogicalMethinfo Invoke (empty, new object [] {activate configuration stans Gorikomedir}). Toasting (); String arg = string.format ("\" {0} activate_configuration.pl \ "", gyroComDir); ProcessStartInfo processInfo = New ProcessStart Infos ("Pearl.exe", RGR + "Batch"); ProcessInfo.CreateNoWindow = True; ProcessInfo.WindowStyle = Process WindowStyle.Hidden; P.StartInfo = processInfo; P.Start (); p.WaitForExit (); }   

But if the script is run on the first UI then the label is updated. What can I do behind this, first update the label and then run the script

Should not be inside the GUI thread (which is effective in button click event handler).

BackgroundWorker , ThreadPool or Task to wait in the background:

  Task.Run ((=) => {Console.WriteLine ("start and wait for external process");});   

Such a GUI Thread Button can end the click event and update the label.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -