Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8076 for trunk


Ignore:
Timestamp:
06/21/12 13:42:34 (12 years ago)
Author:
ascheibe
Message:

#1648 fetch user and client information when the optimizer starts

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Access.Views/3.3/UserViews/UserInformationDialog.cs

    r8042 r8076  
    2020#endregion
    2121
     22using System;
    2223using System.Windows.Forms;
    2324
     
    3738    }
    3839
    39     void Instance_Refreshed(object sender, System.EventArgs e) {
    40       closeButton.Enabled = true;
     40    void Instance_Refreshed(object sender, EventArgs e) {
     41      if (this.InvokeRequired)
     42        this.Invoke(new Action<object, EventArgs>(Instance_Refreshed), sender, e);
     43      else
     44        closeButton.Enabled = true;
    4145    }
    4246
    43     void Instance_Refreshing(object sender, System.EventArgs e) {
    44       closeButton.Enabled = false;
     47    void Instance_Refreshing(object sender, EventArgs e) {
     48      if (this.InvokeRequired)
     49        this.Invoke(new Action<object, EventArgs>(Instance_Refreshing), sender, e);
     50      else
     51        closeButton.Enabled = false;
    4552    }
    4653
  • trunk/sources/HeuristicLab.Clients.Access/3.3/ClientInformation.cs

    r8042 r8076  
    2222using System;
    2323using System.ServiceModel.Security;
     24using System.Threading.Tasks;
    2425
    2526namespace HeuristicLab.Clients.Access {
     
    2829    public static ClientInformation Instance {
    2930      get {
    30         if (instance == null) instance = new ClientInformation();
     31        InitializeClientInformation();
    3132        return instance;
    3233      }
     
    5455
    5556    private ClientInformation() {
    56       if (ClientInformationUtils.IsClientHeuristicLab()) {
    57         FetchClientInformationFromServer();
    58       } else {
    59         // this means we are executed by an Hive slave, therefore we just get our machine id (e.g. for OKB Algs)
    60         // because the slave has already done the registration process
    61         GenerateLocalClientConfig();
     57      if (instance == null) {
     58        if (ClientInformationUtils.IsClientHeuristicLab()) {
     59          FetchClientInformationFromServer();
     60        } else {
     61          // this means we are executed by an Hive slave, therefore we just get our machine id (e.g. for OKB Algs)
     62          // because the slave has already done the registration process
     63          GenerateLocalClientConfig();
     64        }
    6265      }
    6366    }
     
    100103      FetchClientInformationFromServer();
    101104    }
     105
     106    private static void InitializeClientInformation() {
     107      if (instance == null) instance = new ClientInformation();
     108    }
     109
     110    public static void InitializeAsync() {
     111      Task.Factory.StartNew(InitializeClientInformation);
     112    }
    102113  }
    103114}
  • trunk/sources/HeuristicLab.Clients.Access/3.3/UserInformation.cs

    r8043 r8076  
    2222using System;
    2323using System.ServiceModel.Security;
     24using System.Threading.Tasks;
    2425
    2526namespace HeuristicLab.Clients.Access {
     
    3031    public static UserInformation Instance {
    3132      get {
    32         if (instance == null) instance = new UserInformation();
     33        InitializeUserInformation();
    3334        return instance;
    3435      }
     
    6162
    6263    private UserInformation() {
    63       //this blocks, so there should be anywhere in the Optimizer startup process
    64       //a call to FetchUserInformationFromServerAsync which is non-blocking
    65       FetchUserInformationFromServer();
     64      if (instance == null) {
     65        FetchUserInformationFromServer();
     66      }
    6667    }
    67 
    6868
    6969    private void FetchUserInformationFromServer() {
     
    9292      FetchUserInformationFromServer();
    9393    }
     94
     95    private static void InitializeUserInformation() {
     96      if (instance == null) instance = new UserInformation();
     97    }
     98
     99    public static void InitializeAsync() {
     100      Task.Factory.StartNew(InitializeUserInformation);
     101    }
    94102  }
    95103}
  • trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj

    r8022 r8076  
    215215  </ItemGroup>
    216216  <ItemGroup>
     217    <ProjectReference Include="..\..\HeuristicLab.Clients.Access\3.3\HeuristicLab.Clients.Access-3.3.csproj">
     218      <Project>{494F87F4-0F25-4D33-A382-10CDB2174D48}</Project>
     219      <Name>HeuristicLab.Clients.Access-3.3</Name>
     220      <Private>False</Private>
     221    </ProjectReference>
    217222    <ProjectReference Include="..\..\HeuristicLab.Clients.Common\3.3\HeuristicLab.Clients.Common-3.3.csproj">
    218223      <Project>{730A9104-D4D1-4360-966B-E49B7571DDA3}</Project>
  • trunk/sources/HeuristicLab.Optimizer/3.3/Plugin.cs.frame

    r7985 r8076  
    2121
    2222using System.Windows.Forms;
     23using HeuristicLab.Clients.Access;
    2324using HeuristicLab.Optimizer.Properties;
    2425using HeuristicLab.PluginInfrastructure;
     
    4142  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    4243  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
     44  [PluginDependency("HeuristicLab.Clients.Access", "3.3")]
    4345  public class HeuristicLabOptimizerPlugin : PluginBase {
    4446  }
     
    5860
    5961      if (mainForm != null) {
     62        ClientInformation.InitializeAsync();
     63        UserInformation.InitializeAsync();
     64
    6065        mainForm.ShowContentInViewHost = true;
    6166        Application.Run(mainForm);
Note: See TracChangeset for help on using the changeset viewer.