Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/11/09 18:25:15 (15 years ago)
Author:
gkronber
Message:

Refactored class Loader in plugin infrastructure. #799

Location:
branches/PluginInfrastructure Refactoring/HeuristicLab
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/PluginInfrastructure Refactoring/HeuristicLab/HeuristicLab.csproj

    r1970 r2481  
    1919    </UpgradeBackupLocation>
    2020    <RunPostBuildEvent>Always</RunPostBuildEvent>
     21    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    2122  </PropertyGroup>
    2223  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     
    7273  <ItemGroup>
    7374    <Reference Include="System" />
     75    <Reference Include="System.Core">
     76      <RequiredTargetFramework>3.5</RequiredTargetFramework>
     77    </Reference>
    7478    <Reference Include="System.Data" />
    7579    <Reference Include="System.Deployment" />
     
    123127  </ItemGroup>
    124128  <ItemGroup>
    125     <ProjectReference Include="..\HeuristicLab.PluginInfrastructure.GUI\HeuristicLab.PluginInfrastructure.GUI.csproj">
    126       <Project>{D3F92C1F-42B4-4EFB-9E73-B64FD3428ADE}</Project>
    127       <Name>HeuristicLab.PluginInfrastructure.GUI</Name>
     129    <ProjectReference Include="..\HeuristicLab.PluginInfrastructure.Manager\HeuristicLab.PluginInfrastructure.Manager.csproj">
     130      <Project>{CA8AAD91-E8E2-41AF-96AD-2BA94BC3EF2D}</Project>
     131      <Name>HeuristicLab.PluginInfrastructure.Manager</Name>
    128132    </ProjectReference>
    129133    <ProjectReference Include="..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
  • branches/PluginInfrastructure Refactoring/HeuristicLab/MainForm.cs

    r1394 r2481  
    2929using System.Diagnostics;
    3030using HeuristicLab.PluginInfrastructure;
    31 using HeuristicLab.PluginInfrastructure.GUI;
    3231using System.Threading;
     32using HeuristicLab.PluginInfrastructure.Manager;
    3333
    3434namespace HeuristicLab {
     
    3838    private bool abortRequested;
    3939
    40     public MainForm() {
     40    public MainForm()
     41      : base() {
     42      InitializeComponent();
     43
    4144      abortRequested = false;
    42       SplashScreen splashScreen = new SplashScreen(1000, "Loading HeuristicLab...");
     45      PluginManager pluginManager = new PluginManager(HeuristicLab.PluginInfrastructure.Properties.Settings.Default.PluginDir);
     46      SplashScreen splashScreen = new SplashScreen(pluginManager, 1000, "Loading HeuristicLab...");
    4347      splashScreen.Owner = this;
    4448      splashScreen.Show();
     
    4751      this.Enabled = false;
    4852
    49       PluginManager.Manager.Action += new PluginManagerActionEventHandler(splashScreen.Manager_Action);
    50       PluginManager.Manager.Initialize();
     53      pluginManager.Initialize();
    5154
    52       InitializeComponent();
    53 
    54       RefreshApplicationsList();
    55 
    56       this.Enabled = true;
    57       this.Visible = true;
    58     }
    59 
    60     private void RefreshApplicationsList() {
    6155      applicationsListView.Items.Clear();
    6256
     
    6963      applicationsListView.Items.Add(pluginManagerListViewItem);
    7064
    71       foreach (ApplicationInfo info in PluginManager.Manager.InstalledApplications) {
     65      foreach (ApplicationDescription info in pluginManager.Applications) {
    7266        ListViewItem item = new ListViewItem(info.Name, 0);
    7367        item.Tag = info;
     
    7872        applicationsListView.Items.Add(item);
    7973      }
     74
     75
     76      this.Enabled = true;
     77      this.Visible = true;
    8078    }
    8179
     
    8987            this.Visible = false;
    9088            form.ShowDialog(this);
    91             RefreshApplicationsList();
     89            // RefreshApplicationsList();
    9290            this.Visible = true;
    9391          }
     
    9694          }
    9795        } else {
    98           ApplicationInfo app = (ApplicationInfo)applicationsListView.SelectedItems[0].Tag;
     96          ApplicationDescription app = (ApplicationDescription)applicationsListView.SelectedItems[0].Tag;
    9997          SplashScreen splashScreen = new SplashScreen(2000, "Loading " + app.Name);
    10098          splashScreen.Owner = this;
  • branches/PluginInfrastructure Refactoring/HeuristicLab/SplashScreen.cs

    r2442 r2481  
    2727using System.Reflection;
    2828using HeuristicLab.PluginInfrastructure;
     29using HeuristicLab.PluginInfrastructure.Manager;
    2930
    3031namespace HeuristicLab {
     
    3536    private object bigLock = new object();
    3637    private bool closing = false;
     38    private PluginManager manager;
    3739
    3840    public SplashScreen() {
    3941      InitializeComponent();
     42    }
    4043
     44    public SplashScreen(PluginManager manager, int initialInterval, string initialText)
     45      : this() {
     46      this.initialInterval = initialInterval;
     47      infoLabel.Text = initialText;
     48      this.manager = manager;
     49      manager.Action += new PluginManagerActionEventHandler(Manager_Action);
    4150      Assembly assembly = this.GetType().Assembly;
    4251      object[] attributes = assembly.GetCustomAttributes(false);
     
    4756      infoLabel.Text = "";
    4857
    49       foreach(object obj in attributes) {
    50         if(obj is AssemblyCopyrightAttribute) {
     58      foreach (object obj in attributes) {
     59        if (obj is AssemblyCopyrightAttribute) {
    5160          copyrightLabel.Text = "Copyright " + ((AssemblyCopyrightAttribute)obj).Copyright;
    5261        }
     
    5766        company = HeuristicLab.Properties.Settings.Default.Organization;
    5867
    59         if((user == null) || (user.Equals(""))) {
     68        if ((user == null) || (user.Equals(""))) {
    6069          userNameLabel.Text = "-";
    6170        } else {
     
    6372        }
    6473
    65         if((company == null) || (company.Equals(""))) {
     74        if ((company == null) || (company.Equals(""))) {
    6675          companyLabel.Text = "-";
    6776        } else {
    6877          companyLabel.Text = company;
    6978        }
    70       } catch(Exception) {
     79      }
     80      catch (Exception) {
    7181        userNameLabel.Text = "-";
    7282        companyLabel.Text = "-";
    7383      }
    74     }
    75 
    76     public SplashScreen(int initialInterval, string initialText)
    77       : this() {
    78       this.initialInterval = initialInterval;
    79       infoLabel.Text = initialText;
    8084    }
    8185
     
    8690    public void Manager_Action(object sender, PluginManagerActionEventArgs e) {
    8791      string info;
    88       if(e.Action == PluginManagerAction.Initializing) info = "Initializing ...";
    89       else if(e.Action == PluginManagerAction.InitializingPlugin) info = "Initializing Plugin " + e.Id + " ...";
    90       else if(e.Action == PluginManagerAction.InitializedPlugin) info = "Initializing Plugin " + e.Id + " ... Initialized";
    91       else if(e.Action == PluginManagerAction.Initialized) {
     92      if (e.Action == PluginManagerAction.Initializing) info = "Initializing ...";
     93      else if (e.Action == PluginManagerAction.PluginLoaded) info = "Loaded plugin " + e.Id + " ...";
     94      else if (e.Action == PluginManagerAction.Initialized) {
    9295        info = "Initialization Completed";
    9396        fadeTimer = new System.Timers.Timer();
     
    98101        fadeTimer.Start();
    99102      } else {
    100         if(e.Id != null) info = e.Action.ToString() + "   (" + e.Id + ")";
     103        if (e.Id != null) info = e.Action.ToString() + "   (" + e.Id + ")";
    101104        else info = e.Action.ToString();
    102105      }
     
    107110    private void fadeTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
    108111      fadeTimer.Stop();
    109       if(InvokeRequired) {
     112      if (InvokeRequired) {
    110113        Invoke((MethodInvoker)UpdateOpacity);
    111114      } else {
     
    140143          closing = true;
    141144          if (fadeTimer != null) fadeTimer.Stop();
    142           PluginManager.Manager.Action -= new PluginManagerActionEventHandler(this.Manager_Action); // remove event before calling close
     145          manager.Action -= new PluginManagerActionEventHandler(this.Manager_Action); // remove event before calling close
    143146          Application.DoEvents(); // work up all existing events
    144147          Close(); // close
Note: See TracChangeset for help on using the changeset viewer.