Free cookie consent management tool by TermsFeed Policy Generator

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

Refactored class Loader in plugin infrastructure. #799

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.