Пример #1
0
    /// <summary>
    /// Returns a new AppDomain with loaded assemblies/plugins from applicationBase
    /// </summary>    
    public static AppDomain CreateAndInitSandbox(string appDomainName, string applicationBase, string configFilePath) {
      PermissionSet pSet;
      pSet = new PermissionSet(PermissionState.Unrestricted);

      AppDomainSetup setup = new AppDomainSetup();
      setup.PrivateBinPath = applicationBase;
      setup.ApplicationBase = applicationBase;
      setup.ConfigurationFile = configFilePath;

      Type applicationManagerType = typeof(DefaultApplicationManager);
      AppDomain applicationDomain = AppDomain.CreateDomain(appDomainName, null, setup, pSet, null);
      DefaultApplicationManager applicationManager = (DefaultApplicationManager)applicationDomain.CreateInstanceAndUnwrap(applicationManagerType.Assembly.FullName, applicationManagerType.FullName, true, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null, null);

      PluginManager pm = new PluginManager(applicationBase);
      pm.DiscoverAndCheckPlugins();
      applicationManager.PrepareApplicationDomain(pm.Applications, pm.Plugins);

      return applicationDomain;
    }
Пример #2
0
    /// <summary>
    /// Initializes an instance of the starter form.
    /// The starter form shows a splashscreen and initializes the plugin infrastructure.
    /// </summary>
    public StarterForm()
      : base() {
      InitializeComponent();
      largeImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.HeuristicLab.ToBitmap());
      largeImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.UpdateAvailable.ToBitmap());
      smallImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.HeuristicLab.ToBitmap());
      smallImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.UpdateAvailable.ToBitmap());
      Text = "HeuristicLab " + AssemblyHelpers.GetFileVersion(GetType().Assembly);

      string pluginPath = Path.GetFullPath(Application.StartupPath);
      pluginManager = new PluginManager(pluginPath);
      splashScreen = new SplashScreen(pluginManager, 1000);
      splashScreen.VisibleChanged += new EventHandler(splashScreen_VisibleChanged);
      splashScreen.Show(this, "Loading HeuristicLab...");

      pluginManager.DiscoverAndCheckPlugins();
      UpdateApplicationsList();

      CheckUpdatesAvailableAsync();
    }