Exemplo n.º 1
0
        private void LoadDllAndShowResourcesOnClick(object sender, RoutedEventArgs e)
        {
            // Thanks to Thomas Levesque : http://stackoverflow.com/questions/2517407/enumerating-net-assembly-resources-at-runtime

            OpenFileDialog dlg = new OpenFileDialog();
            if (dlg.ShowDialog(this) == true)
            {
                string path = dlg.FileName;

                Assembly asm = null;
                try
                {
                    asm = Assembly.LoadFrom(path);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unable to load assembly, exception: " + ex.ToString());
                    return;
                }

                // Assembly asm = AppDomain.CurrentDomain.Load(path);

                // AppDomain.CurrentDomain.CreateInstanceAndUnwrap(path)

                DlgResource dlgResource = new DlgResource();
                dlgResource.Model.Assembly = asm;
                dlgResource.Show();
            }
        }
Exemplo n.º 2
0
        private void LoadDllAndShowResourcesOnClick(object sender, RoutedEventArgs e)
        {
            // Thanks to Thomas Levesque : http://stackoverflow.com/questions/2517407/enumerating-net-assembly-resources-at-runtime

            OpenFileDialog dlg = new OpenFileDialog();

            if (dlg.ShowDialog(this) == true)
            {
                string path = dlg.FileName;

                Assembly asm = null;
                try
                {
                    asm = Assembly.LoadFrom(path);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unable to load assembly, exception: " + ex.ToString());
                    return;
                }

                // Assembly asm = AppDomain.CurrentDomain.Load(path);

                // AppDomain.CurrentDomain.CreateInstanceAndUnwrap(path)

                DlgResource dlgResource = new DlgResource();
                dlgResource.Model.Assembly = asm;
                dlgResource.Show();
            }
        }