This may be because a thread can be restarted in the component.
Public void beginshowform ()
{
System. Threading. Thread thread1 = new system. Threading. Thread (New threadstart (this. showform ));
Thread1.apartmentstate = apartmentstate. Sta;
Thread1.start ();
Thread1.join ();
}
Public void showform ()
// Private void publinkinterface_load (Object sender, system. eventargs E)
{
Try
{
/*********************** Test *************** *****************/
// This. dll = "pu_control.dll ";
// This. isclassname = "genersoft. DRP. PU. Control. im_estqutity_query ";
// This. processid = "fqq ";
// This. iscondition = "_ companyid: 1010: _ org: 00000000000000000003: _ warehouse: 00000000000000000066: _ fiscalyear: 2004: _ ficalperiod: 12 :: _ module: Im ";
/************************* End ************* ******************/
/*************************************** ********************
If focusupdate exists, find the DLL in the registry.
Otherwise, manually copy the DLL to the corresponding directory for the development environment test.
**************************************** *******************/
Registrykey HKLM = registry. localmachine;
Registrykey software = HKLM. opensubkey ("software ");
Registrykey genersoft = software. opensubkey ("genersoft ");
Genersoft = genersoft. opensubkey ("focusupdate ");
This. Error = "An error occurred while retrieving the registry information! ";
If (genersoft = NULL)
{
This. Error = "An error occurred while constructing the DLL file path in the development environment :";
Appdomain MyApp = appdomain. currentdomain;
Isassemblyname = MyApp. basedirectory + this. dll;
// In the development environment: Obtain the DLL file directly from appdomain; if the file does not exist, construct the module path based on the DLL file name
// By vaooya
Fileinfo vfileinfo = new fileinfo (isassemblyname );
If (! Vfileinfo. exists)
{
Isassemblyname = isassemblyname. substring (0, isassemblyname. indexof (@ "pub_debug \ bin \ debug \") + this. DLL. substring (0, this. DLL. lastindexof (". ") + @" \ bin \ "+ this. DLL;
}
}
Else
{
Isassemblyname = genersoft. getvalue ("storagelocation"). tostring ();
Isassemblyname = isassemblyname + "\" + this. dll;
}
/*************************************** *****
Load the required DLL Dynamic Link Library
**************************************** ****/
This. Error = "assembly loading error! ";
System. reflection. Assembly assem = assembly. loadfrom (this. isassemblyname );
Type classtype = assem. GetType (this. isclassname );
Object OBJ = classtype. Assembly. createinstance (classtype. fullname );
Bindingflags BF = bindingflags. instance | bindingflags. nonpublic | bindingflags. Public | bindingflags. flattenhierarchy | bindingflags. setfield;
Propertyinfo Pi = classtype. getproperty ("processid ");
Pi. setvalue (OBJ, processid, null );
/*************************************** *****
Split the iscondition parameter passed
**************************************** *****/
This. Error = "parsing iscondition error! ";
RegEx Regexp = new RegEx ("::");
String [] isconditions = Regexp. Split (iscondition );
Hashtable HL = new hashtable ();
For (INT I = 0; I <isconditions. length; I ++)
{
Hl. Add (isconditions [I], isconditions [I + 1]);
I ++;
}
/*************************************** ****
Construct the corresponding key-Value Pair and setvalue to the corresponding class
**************************************** **/
This. Error = "no corresponding attribute! ";
Foreach (dictionaryentry de In hl) // HT is a hashtable instance.
{
String A = de. Key. tostring (); // de. Key corresponds to key/value pairs
String B = de. value. tostring (); // de. Key corresponds to the key/value Key-Value Pair Value
If (! = "") & (B! = ""))
{
Propertyinfo PII = classtype. getproperty (A. tostring (), BF );
Pii. setvalue (OBJ, B, null );
}
}
// Type [] bt = new type [] {};
// Methodinfo MI = classtype. getmethod ("showdialog", BT );
// Mi. Invoke (OBJ, null );
Form form1 = (form) OBJ;
Form1.mdiparent = This. parentform;
Form1.showdialog ();
Form1.focus ();
If (this. parent! = NULL)
This. Parent. Dispose ();
Else
This. Close ();
}
Catch (exception ex)
{
MessageBox. Show (error + ex. Message );
}
}