private void cmdExecute_Click(object sender, EventArgs e) { try { using (AppDomainProxy pAppDomainProxy = new AppDomainProxy()) { AssemblyProxy pAssemblyProxy = pAppDomainProxy.GetAssemblyProxy(); TypeProxy pTypeProxy = pAssemblyProxy.FindClassInAssemblies(new string[] { cboAssemblyName.Text }, cboClassName.Text); if (pTypeProxy != null) { MethodInfoProxy pMethodInfoProxy = pTypeProxy.FindMethod("GetValue", new string[] { "System.String" }); if (pMethodInfoProxy != null) { object pInstance = pAppDomainProxy.CreateInstance(cboAssemblyName.Text, cboClassName.Text); object pResult = pMethodInfoProxy.Invoke(pInstance, new object[] { txtParameter.Text }); txtOutput.Text = Convert.ToString(pResult); MessageBox.Show("Now is the time to look both AppDomain before it gets deleted!"); } } } } catch (Exception pException) { MessageBox.Show(pException.Message); } }
private void cmdExecute_Click(object sender, EventArgs e) { try { using (AppDomainProxy pAppDomainProxy = new AppDomainProxy()) { ISampleInterface pI = pAppDomainProxy.CreateInstance(cboAssemblyName.Text, cboClassName.Text); if (pI != null) { txtOutput.Text = pI.GetValue(txtParameter.Text); MessageBox.Show("Now is the time to look both AppDomain before it gets deleted!"); } else { throw new ApplicationException("Could not load assembly " + cboAssemblyName.Text); } } } catch (Exception pException) { MessageBox.Show(pException.Message); } }