Free cookie consent management tool by TermsFeed Policy Generator

Changeset 741


Ignore:
Timestamp:
11/13/08 15:14:04 (15 years ago)
Author:
svonolfe
Message:

Server interface implementation (#351)

Location:
trunk/sources
Files:
2 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Core/HeuristicLab.Hive.Server.Core.csproj

    r713 r741  
    4848  </ItemGroup>
    4949  <ItemGroup>
     50    <Compile Include="ClientCommunicator.cs" />
    5051    <Compile Include="HiveServerCorePlugin.cs" />
    5152    <Compile Include="Properties\AssemblyInfo.cs" />
     
    5657  </ItemGroup>
    5758  <ItemGroup>
     59    <ProjectReference Include="..\HeuristicLab.Hive.Server\HeuristicLab.Hive.Server.csproj">
     60      <Project>{A04AE929-D0E1-466D-A9D3-BF3C4B2C209F}</Project>
     61      <Name>HeuristicLab.Hive.Server</Name>
     62    </ProjectReference>
    5863    <ProjectReference Include="..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
    5964      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
  • trunk/sources/HeuristicLab.Hive.Server/BusinessObjects/Client.cs

    r738 r741  
    2424using System.Linq;
    2525using System.Text;
     26using System.Runtime.Serialization;
    2627
    2728namespace HeuristicLab.Hive.Server.BusinessObjects {
    28   class Client {
     29  [DataContract]
     30  public class Client {
     31    [DataMember]
    2932    public Guid ClientId { get; set; }
    3033  }
  • trunk/sources/HeuristicLab.Hive.Server/HeuristicLab.Hive.Server.csproj

    r713 r741  
    4040      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    4141    </Reference>
     42    <Reference Include="System.Runtime.Serialization">
     43      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     44    </Reference>
     45    <Reference Include="System.ServiceModel">
     46      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     47    </Reference>
    4248    <Reference Include="System.Xml.Linq">
    4349      <RequiredTargetFramework>3.5</RequiredTargetFramework>
     
    5359  </ItemGroup>
    5460  <ItemGroup>
     61    <Compile Include="BusinessObjects\Client.cs" />
     62    <Compile Include="Interfaces\IClientCommunicator.cs" />
     63    <Compile Include="Response.cs" />
    5564    <Compile Include="Properties\AssemblyInfo.cs" />
    5665    <Compile Include="HiveServerPlugin.cs" />
     
    92101    </ProjectReference>
    93102  </ItemGroup>
    94   <ItemGroup>
    95     <Folder Include="Interfaces\" />
    96   </ItemGroup>
    97103  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    98104  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • trunk/sources/HeuristicLab.Hive.Server/HiveServerApplication.cs

    r713 r741  
    2525using System.Windows.Forms;
    2626using HeuristicLab.PluginInfrastructure;
     27using System.ServiceModel;
     28using HeuristicLab.Hive.Server.Interfaces;
    2729
    2830namespace HeuristicLab.Hive.Server {
     
    3133      AutoRestart = true)]
    3234  class HiveServerApplication : ApplicationBase {
     35
     36    private bool Startup() {
     37      return true;
     38    }
     39
    3340    public override void Run() {
    34       Form mainForm = new MainForm();
    35       Application.Run(mainForm);
     41
     42      DiscoveryService discService =
     43        new DiscoveryService();
     44
     45      IClientCommunicator[] instances =
     46        discService.GetInstances<IClientCommunicator>();
     47
     48      if (instances.Length > 0) {
     49        ServiceHost serviceHost =
     50                new ServiceHost(instances[0].GetType());
     51
     52        serviceHost.Open();
     53
     54        Form mainForm = new MainForm(serviceHost.BaseAddresses[0]);
     55        Application.Run(mainForm);
     56
     57        serviceHost.Close();
     58      } else {
     59        MessageBox.Show("Error - no ClientCommunicator instance");
     60      }
    3661    }
    3762  }
  • trunk/sources/HeuristicLab.Hive.Server/Interfaces/IClientCommunicator.cs

    r738 r741  
    3232  /// </summary>
    3333  [ServiceContract]
    34   interface IClientCommunicator {
     34  public interface IClientCommunicator {
    3535    [OperationContract]
    3636    Response Login(Client clientInfo);
  • trunk/sources/HeuristicLab.Hive.Server/MainForm.Designer.cs

    r713 r741  
    2929        private void InitializeComponent()
    3030        {
     31          this.label1 = new System.Windows.Forms.Label();
     32          this.lblAddress = new System.Windows.Forms.Label();
    3133          this.SuspendLayout();
     34          //
     35          // label1
     36          //
     37          this.label1.AutoSize = true;
     38          this.label1.Location = new System.Drawing.Point(18, 18);
     39          this.label1.Name = "label1";
     40          this.label1.Size = new System.Drawing.Size(113, 13);
     41          this.label1.TabIndex = 0;
     42          this.label1.Text = "Hive server running @";
     43          //
     44          // lblAddress
     45          //
     46          this.lblAddress.AutoSize = true;
     47          this.lblAddress.Location = new System.Drawing.Point(18, 43);
     48          this.lblAddress.Name = "lblAddress";
     49          this.lblAddress.Size = new System.Drawing.Size(44, 13);
     50          this.lblAddress.TabIndex = 1;
     51          this.lblAddress.Text = "address";
    3252          //
    3353          // MainForm
     
    3555          this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    3656          this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    37           this.ClientSize = new System.Drawing.Size(292, 273);
     57          this.ClientSize = new System.Drawing.Size(304, 78);
     58          this.Controls.Add(this.lblAddress);
     59          this.Controls.Add(this.label1);
    3860          this.Name = "MainForm";
    3961          this.Text = "Hive Server Console";
    4062          this.ResumeLayout(false);
     63          this.PerformLayout();
    4164
    4265        }
    4366
    4467        #endregion
     68
     69        private System.Windows.Forms.Label label1;
     70        private System.Windows.Forms.Label lblAddress;
    4571    }
    4672}
  • trunk/sources/HeuristicLab.Hive.Server/MainForm.cs

    r713 r741  
    1010namespace HeuristicLab.Hive.Server
    1111{
    12     public partial class MainForm : Form
    13     {
    14         public MainForm()
    15         {
    16             InitializeComponent();
     12    public partial class MainForm : Form {
     13        public MainForm(Uri address) {
     14          InitializeComponent();
     15          if(address != null)
     16            this.lblAddress.Text = address.ToString();
    1717        }
    1818    }
Note: See TracChangeset for help on using the changeset viewer.