public MockeGeneratorUi(IMockGenrator mockGenerator)
 {
     InitializeComponent();
     m_mockGenerator = mockGenerator;
 }
예제 #2
0
        /// <summary>
        /// Load the mock generator plugin
        /// </summary>
        /// <param name="dllPath">path to the dll</param>
        /// <param name="className">Class name of the plugin</param>
        protected void LoadMockGenerator(string dllPath, string className)
        {
            Type ObjType = null;
            if (File.Exists(dllPath))
            {
            
                try
                {
                    Assembly ass = null;
                    ass = Assembly.LoadFile(dllPath);
                    if (ass != null)
                    {
                        ObjType = ass.GetType(className);
                        if (ObjType != null)
                        {
                            IMockGenrator plugin = (IMockGenrator)Activator.CreateInstance(ObjType);
                            if (plugin != null)
                            {
                                plugin.registerCallBack(this);
                                PluginList.Add(plugin);
                                m_mockGenerator = plugin;
                                plugin.Owner = this;
                                plugin.Show(dockParent, WeifenLuo.WinFormsUI.Docking.DockState.DockRightAutoHide);
                                evPluginLoaded(plugin);

                            }
                            else
                            {
                                //do nothing
                            }
                        }
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.ToString());

                }
            }
        }