Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4466 for branches/OKB


Ignore:
Timestamp:
09/22/10 05:54:13 (14 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

Location:
branches/OKB/HeuristicLab.Clients.OKB-3.3
Files:
7 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Administrator.cs

    r4441 r4466  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Linq;
    2425using HeuristicLab.Clients.Common;
     
    5152      get { return algorithms; }
    5253    }
     54    private ItemCollection<DataType> dataTypes;
     55    public ItemCollection<DataType> DataTypes {
     56      get { return dataTypes; }
     57    }
     58    private IEnumerable<User> users;
     59    public IEnumerable<User> Users {
     60      get { return users; }
     61    }
    5362
    5463    private Administrator() { }
     
    7180      }
    7281      algorithms.Clear();
     82      if (dataTypes == null) {
     83        dataTypes = new ItemCollection<DataType>();
     84        dataTypes.ItemsRemoved += new CollectionItemsChangedEventHandler<DataType>(dataTypes_ItemsRemoved);
     85      }
     86      dataTypes.Clear();
    7387
    7488      var call = new Func<Exception>(delegate() {
    7589        try {
    76           platforms.AddRange(CallAdminService<ItemCollection<Platform>>(s => s.GetPlatforms()).OrderBy(a => a.Name));
    77           algorithmClasses.AddRange(CallAdminService<ItemCollection<AlgorithmClass>>(s => s.GetAlgorithmClasses()).OrderBy(a => a.Name));
    78           algorithms.AddRange(CallAdminService<ItemCollection<Algorithm>>(s => s.GetAlgorithms()).OrderBy(a => a.Name));
     90          platforms.AddRange(CallAdminService<Platform[]>(s => s.GetPlatforms()).OrderBy(x => x.Name));
     91          algorithmClasses.AddRange(CallAdminService<AlgorithmClass[]>(s => s.GetAlgorithmClasses()).OrderBy(x => x.Name));
     92          algorithms.AddRange(CallAdminService<Algorithm[]>(s => s.GetAlgorithms()).OrderBy(x => x.Name));
     93          dataTypes.AddRange(CallAdminService<DataType[]>(s => s.GetDataTypes()).OrderBy(x => x.Name));
     94          users = CallAuthenticationService<User[]>(s => s.GetUsers()).OrderBy(x => x.Name);
    7995          return null;
    8096        }
     
    98114        else if (item is Algorithm)
    99115          CallAdminService(s => s.StoreAlgorithm((Algorithm)item));
     116        else if (item is DataType)
     117          CallAdminService(s => s.StoreDataType((DataType)item));
    100118        return true;
    101119      }
    102120      catch (Exception ex) {
    103121        ErrorHandling.ShowErrorDialog("Store failed.", ex);
     122        return false;
     123      }
     124    }
     125
     126    public Guid[] GetAlgorithmUsers(long algorithmId) {
     127      try {
     128        return CallAdminService<Guid[]>(s => s.GetAlgorithmUsers(algorithmId));
     129      }
     130      catch (Exception ex) {
     131        ErrorHandling.ShowErrorDialog("Refresh authorized algorithm users failed.", ex);
     132        return null;
     133      }
     134    }
     135    public bool StoreAlgorithmUsers(long algorithmId, Guid[] users) {
     136      try {
     137        CallAdminService(s => s.StoreAlgorithmUsers(algorithmId, users));
     138        return true;
     139      }
     140      catch (Exception ex) {
     141        ErrorHandling.ShowErrorDialog("Store authorized algorithm users failed.", ex);
     142        return false;
     143      }
     144    }
     145
     146    public bool StoreAlgorithmData(AlgorithmData algorithmData) {
     147      try {
     148        CallAdminService(s => s.StoreAlgorithmData(algorithmData));
     149        return true;
     150      }
     151      catch (Exception ex) {
     152        ErrorHandling.ShowErrorDialog("Store serialized algorithm failed.", ex);
    104153        return false;
    105154      }
     
    144193      }
    145194    }
     195    private void dataTypes_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<DataType> e) {
     196      try {
     197        foreach (DataType d in e.Items)
     198          CallAdminService(s => s.DeleteDataType(d.Id));
     199      }
     200      catch (Exception ex) {
     201        ErrorHandling.ShowErrorDialog("Delete failed.", ex);
     202      }
     203    }
    146204
    147205    #region Helpers
     
    174232      }
    175233    }
     234    private T CallAuthenticationService<T>(Func<IAuthenticationService, T> call) where T : class {
     235      AuthenticationServiceClient client = ClientFactory.CreateClient<AuthenticationServiceClient, IAuthenticationService>();
     236      try {
     237        return call(client);
     238      }
     239      finally {
     240        try {
     241          client.Close();
     242        }
     243        catch (Exception) {
     244          client.Abort();
     245        }
     246      }
     247    }
    176248    #endregion
    177249  }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/HeuristicLab.Clients.OKB-3.3.csproj

    r4456 r4466  
    7777    <Compile Include="HeuristicLabClientsOKBPlugin.cs" />
    7878    <Compile Include="Properties\AssemblyInfo.cs" />
     79    <Compile Include="ServiceClients\AdminServiceClient.cs" />
    7980    <Compile Include="ServiceClients\Algorithm.cs">
    8081      <SubType>Code</SubType>
     
    8384      <SubType>Code</SubType>
    8485    </Compile>
     86    <Compile Include="ServiceClients\AuthenticationServiceClient.cs" />
     87    <Compile Include="ServiceClients\DataType.cs" />
    8588    <Compile Include="ServiceClients\NamedOKBItem.cs" />
    8689    <Compile Include="ServiceClients\Platform.cs" />
     
    9497      <SubType>Code</SubType>
    9598    </Compile>
    96     <Compile Include="ServiceClients\ServiceClients.cs" />
    9799    <Compile Include="Views\AdministratorView.cs">
    98100      <SubType>UserControl</SubType>
     
    118120    <Compile Include="Views\AlgorithmView.Designer.cs">
    119121      <DependentUpon>AlgorithmView.cs</DependentUpon>
     122    </Compile>
     123    <Compile Include="Views\DataTypeView.cs">
     124      <SubType>UserControl</SubType>
     125    </Compile>
     126    <Compile Include="Views\DataTypeView.Designer.cs">
     127      <DependentUpon>DataTypeView.cs</DependentUpon>
     128    </Compile>
     129    <Compile Include="Views\DataTypeCollectionView.cs">
     130      <SubType>UserControl</SubType>
     131    </Compile>
     132    <Compile Include="Views\DataTypeCollectionView.Designer.cs">
     133      <DependentUpon>DataTypeCollectionView.cs</DependentUpon>
    120134    </Compile>
    121135    <Compile Include="Views\PlatformCollectionView.cs">
     
    146160    <None Include="HeuristicLabClientsOKBPlugin.cs.frame" />
    147161  </ItemGroup>
     162  <ItemGroup>
     163    <EmbeddedResource Include="Views\AdministratorView.resx">
     164      <DependentUpon>AdministratorView.cs</DependentUpon>
     165    </EmbeddedResource>
     166    <EmbeddedResource Include="Views\AlgorithmView.resx">
     167      <DependentUpon>AlgorithmView.cs</DependentUpon>
     168    </EmbeddedResource>
     169  </ItemGroup>
    148170  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    149171  <PropertyGroup>
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/GenerateServiceClients.cmd

    r4456 r4466  
    11echo off
     2
     3echo.
     4echo *******************************************************************************************
     5echo Generating AdminService client
     6echo.
     7
    28svcutil.exe ^
    39  http://localhost:8732/Design_Time_Addresses/OKB-3.3/AdminService/mex ^
    4   /out:ServiceClients ^
     10  /out:AdminServiceClient ^
    511  /namespace:*,HeuristicLab.Clients.OKB ^
    612  /targetClientVersion:Version35 ^
    713  /enableDataBinding ^
    8   /reference:"C:\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll" ^
    9   /collectionType:HeuristicLab.Core.ItemCollection`1 ^
    1014  /config:..\app.config
    1115
    1216echo.
    13 echo --------------------------------------------------------------------------------------
    14 echo ATTENTION!!!
     17echo ---------------------------------------------------------------------------------------
     18echo !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!!
     19echo.
    1520echo Following modifications have to be done manually in generated data contracts:
    1621echo  * Remove method "protected void RaisePropertyChanged(string propertyName)" in OKBItem
    17 echo --------------------------------------------------------------------------------------
     22echo.
     23echo !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!!
     24echo ---------------------------------------------------------------------------------------
     25echo.
     26echo Generation of AdminService client finished.
     27echo *******************************************************************************************
     28echo.
     29echo.
     30echo *******************************************************************************************
     31echo Generating AuthenticationService client
     32echo.
     33
     34svcutil.exe ^
     35  http://localhost:8732/Design_Time_Addresses/OKB-3.3/AuthenticationService/mex ^
     36  /out:AuthenticationServiceClient ^
     37  /namespace:*,HeuristicLab.Clients.OKB ^
     38  /targetClientVersion:Version35 ^
     39  /enableDataBinding ^
     40  /config:..\app.config ^
     41  /mergeConfig
     42
     43echo.
     44echo Generation of AuthenticationService client finished.
     45echo *******************************************************************************************
    1846echo.
    1947
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AdministratorView.Designer.cs

    r4441 r4466  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
     48      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AdministratorView));
    4849      this.tabControl = new System.Windows.Forms.TabControl();
    4950      this.platformsTabPage = new System.Windows.Forms.TabPage();
     
    5354      this.algorithmsTabPage = new System.Windows.Forms.TabPage();
    5455      this.algorithmCollectionView = new HeuristicLab.Clients.OKB.AlgorithmCollectionView();
     56      this.dataTypesTabPage = new System.Windows.Forms.TabPage();
    5557      this.refreshButton = new System.Windows.Forms.Button();
    5658      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     59      this.dataTypeCollectionView = new HeuristicLab.Clients.OKB.DataTypeCollectionView();
    5760      this.tabControl.SuspendLayout();
    5861      this.platformsTabPage.SuspendLayout();
    5962      this.algorithmClassesTabPage.SuspendLayout();
    6063      this.algorithmsTabPage.SuspendLayout();
     64      this.dataTypesTabPage.SuspendLayout();
    6165      this.SuspendLayout();
    6266      //
     
    6973      this.tabControl.Controls.Add(this.algorithmClassesTabPage);
    7074      this.tabControl.Controls.Add(this.algorithmsTabPage);
     75      this.tabControl.Controls.Add(this.dataTypesTabPage);
    7176      this.tabControl.Location = new System.Drawing.Point(0, 29);
    7277      this.tabControl.Name = "tabControl";
     
    147152      this.algorithmCollectionView.TabIndex = 0;
    148153      //
     154      // dataTypesTabPage
     155      //
     156      this.dataTypesTabPage.Controls.Add(this.dataTypeCollectionView);
     157      this.dataTypesTabPage.Location = new System.Drawing.Point(4, 22);
     158      this.dataTypesTabPage.Name = "dataTypesTabPage";
     159      this.dataTypesTabPage.Padding = new System.Windows.Forms.Padding(3);
     160      this.dataTypesTabPage.Size = new System.Drawing.Size(719, 380);
     161      this.dataTypesTabPage.TabIndex = 3;
     162      this.dataTypesTabPage.Text = "Data Types";
     163      this.dataTypesTabPage.UseVisualStyleBackColor = true;
     164      //
    149165      // refreshButton
    150166      //
    151       this.refreshButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Refresh;
     167      this.refreshButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshButton.Image")));
    152168      this.refreshButton.Location = new System.Drawing.Point(0, 0);
    153169      this.refreshButton.Name = "refreshButton";
     
    157173      this.refreshButton.UseVisualStyleBackColor = true;
    158174      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
     175      //
     176      // dataTypeCollectionView
     177      //
     178      this.dataTypeCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     179                  | System.Windows.Forms.AnchorStyles.Left)
     180                  | System.Windows.Forms.AnchorStyles.Right)));
     181      this.dataTypeCollectionView.Caption = "DataTypeCollection View";
     182      this.dataTypeCollectionView.Content = null;
     183      this.dataTypeCollectionView.Location = new System.Drawing.Point(6, 6);
     184      this.dataTypeCollectionView.Name = "dataTypeCollectionView";
     185      this.dataTypeCollectionView.ReadOnly = false;
     186      this.dataTypeCollectionView.Size = new System.Drawing.Size(707, 368);
     187      this.dataTypeCollectionView.TabIndex = 0;
    159188      //
    160189      // AdministratorView
     
    170199      this.algorithmClassesTabPage.ResumeLayout(false);
    171200      this.algorithmsTabPage.ResumeLayout(false);
     201      this.dataTypesTabPage.ResumeLayout(false);
    172202      this.ResumeLayout(false);
    173203
     
    185215    private System.Windows.Forms.TabPage platformsTabPage;
    186216    private PlatformCollectionView platformCollectionView;
     217    private System.Windows.Forms.TabPage dataTypesTabPage;
     218    private DataTypeCollectionView dataTypeCollectionView;
    187219
    188220  }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AdministratorView.cs

    r4441 r4466  
    5656        algorithmClassCollectionView.Content = null;
    5757        algorithmCollectionView.Content = null;
     58        dataTypeCollectionView.Content = null;
    5859      } else {
    5960        platformCollectionView.Content = Content.Platforms;
    6061        algorithmClassCollectionView.Content = Content.AlgorithmClasses;
    6162        algorithmCollectionView.Content = Content.Algorithms;
     63        dataTypeCollectionView.Content = Content.DataTypes;
    6264      }
    6365    }
     
    6971      algorithmClassCollectionView.Enabled = Content != null;
    7072      algorithmCollectionView.Enabled = Content != null;
     73      dataTypeCollectionView.Enabled = Content != null;
    7174    }
    7275
     
    8790        algorithmClassCollectionView.Content = Content.AlgorithmClasses;
    8891        algorithmCollectionView.Content = Content.Algorithms;
     92        dataTypeCollectionView.Content = Content.DataTypes;
    8993        refreshButton.Enabled = true;
    9094        tabControl.Enabled = true;
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.Designer.cs

    r4441 r4466  
    4949      this.algorithmClassLabel = new System.Windows.Forms.Label();
    5050      this.algorithmClassComboBox = new System.Windows.Forms.ComboBox();
     51      this.usersListBox = new System.Windows.Forms.ListBox();
     52      this.tabControl = new System.Windows.Forms.TabControl();
     53      this.usersTabPage = new System.Windows.Forms.TabPage();
     54      this.storeUsersButton = new System.Windows.Forms.Button();
     55      this.refreshUsersButton = new System.Windows.Forms.Button();
     56      this.dataTabPage = new System.Windows.Forms.TabPage();
     57      this.fileLabel = new System.Windows.Forms.Label();
     58      this.storeDataButton = new System.Windows.Forms.Button();
     59      this.fileTextBox = new System.Windows.Forms.TextBox();
     60      this.openFileButton = new System.Windows.Forms.Button();
     61      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
     62      this.dataTypeLabel = new System.Windows.Forms.Label();
     63      this.dataTypeComboBox = new System.Windows.Forms.ComboBox();
    5164      ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit();
     65      this.tabControl.SuspendLayout();
     66      this.usersTabPage.SuspendLayout();
     67      this.dataTabPage.SuspendLayout();
    5268      this.SuspendLayout();
    5369      //
     
    5571      //
    5672      this.nameTextBox.Location = new System.Drawing.Point(90, 29);
    57       this.nameTextBox.Size = new System.Drawing.Size(197, 20);
     73      this.nameTextBox.Size = new System.Drawing.Size(495, 20);
    5874      //
    5975      // descriptionTextBox
    6076      //
    6177      this.descriptionTextBox.Location = new System.Drawing.Point(90, 55);
    62       this.descriptionTextBox.Size = new System.Drawing.Size(197, 20);
     78      this.descriptionTextBox.Size = new System.Drawing.Size(495, 20);
    6379      //
    6480      // storeButton
     
    6884      // modifiedPictureBox
    6985      //
    70       this.modifiedPictureBox.Location = new System.Drawing.Point(293, 3);
    71       this.modifiedPictureBox.Size = new System.Drawing.Size(39, 130);
     86      this.modifiedPictureBox.Location = new System.Drawing.Point(591, 3);
    7287      //
    7388      // platformLabel
     
    88103      this.platformComboBox.Location = new System.Drawing.Point(90, 81);
    89104      this.platformComboBox.Name = "platformComboBox";
    90       this.platformComboBox.Size = new System.Drawing.Size(197, 21);
     105      this.platformComboBox.Size = new System.Drawing.Size(495, 21);
    91106      this.platformComboBox.TabIndex = 6;
    92107      this.platformComboBox.SelectedValueChanged += new System.EventHandler(this.platformComboBox_SelectedValueChanged);
     
    109124      this.algorithmClassComboBox.Location = new System.Drawing.Point(90, 108);
    110125      this.algorithmClassComboBox.Name = "algorithmClassComboBox";
    111       this.algorithmClassComboBox.Size = new System.Drawing.Size(197, 21);
     126      this.algorithmClassComboBox.Size = new System.Drawing.Size(495, 21);
    112127      this.algorithmClassComboBox.TabIndex = 8;
    113128      this.algorithmClassComboBox.SelectedValueChanged += new System.EventHandler(this.algorithmClassComboBox_SelectedValueChanged);
    114129      //
     130      // usersListBox
     131      //
     132      this.usersListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     133                  | System.Windows.Forms.AnchorStyles.Left)
     134                  | System.Windows.Forms.AnchorStyles.Right)));
     135      this.usersListBox.Enabled = false;
     136      this.usersListBox.FormattingEnabled = true;
     137      this.usersListBox.Location = new System.Drawing.Point(6, 35);
     138      this.usersListBox.Name = "usersListBox";
     139      this.usersListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
     140      this.usersListBox.Size = new System.Drawing.Size(613, 225);
     141      this.usersListBox.TabIndex = 2;
     142      this.usersListBox.SelectedIndexChanged += new System.EventHandler(this.usersListBox_SelectedIndexChanged);
     143      //
     144      // tabControl
     145      //
     146      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     147                  | System.Windows.Forms.AnchorStyles.Left)
     148                  | System.Windows.Forms.AnchorStyles.Right)));
     149      this.tabControl.Controls.Add(this.usersTabPage);
     150      this.tabControl.Controls.Add(this.dataTabPage);
     151      this.tabControl.Location = new System.Drawing.Point(0, 162);
     152      this.tabControl.Name = "tabControl";
     153      this.tabControl.SelectedIndex = 0;
     154      this.tabControl.Size = new System.Drawing.Size(633, 292);
     155      this.tabControl.TabIndex = 9;
     156      //
     157      // usersTabPage
     158      //
     159      this.usersTabPage.Controls.Add(this.storeUsersButton);
     160      this.usersTabPage.Controls.Add(this.refreshUsersButton);
     161      this.usersTabPage.Controls.Add(this.usersListBox);
     162      this.usersTabPage.Location = new System.Drawing.Point(4, 22);
     163      this.usersTabPage.Name = "usersTabPage";
     164      this.usersTabPage.Padding = new System.Windows.Forms.Padding(3);
     165      this.usersTabPage.Size = new System.Drawing.Size(625, 266);
     166      this.usersTabPage.TabIndex = 0;
     167      this.usersTabPage.Text = "Authorized Users";
     168      this.usersTabPage.UseVisualStyleBackColor = true;
     169      //
     170      // storeUsersButton
     171      //
     172      this.storeUsersButton.Location = new System.Drawing.Point(86, 6);
     173      this.storeUsersButton.Name = "storeUsersButton";
     174      this.storeUsersButton.Size = new System.Drawing.Size(75, 23);
     175      this.storeUsersButton.TabIndex = 1;
     176      this.storeUsersButton.Text = "&Store";
     177      this.toolTip.SetToolTip(this.storeUsersButton, "Store Authorized Users");
     178      this.storeUsersButton.UseVisualStyleBackColor = true;
     179      this.storeUsersButton.Click += new System.EventHandler(this.storeUsersButton_Click);
     180      //
     181      // refreshUsersButton
     182      //
     183      this.refreshUsersButton.Location = new System.Drawing.Point(6, 6);
     184      this.refreshUsersButton.Name = "refreshUsersButton";
     185      this.refreshUsersButton.Size = new System.Drawing.Size(75, 23);
     186      this.refreshUsersButton.TabIndex = 0;
     187      this.refreshUsersButton.Text = "&Refresh";
     188      this.toolTip.SetToolTip(this.refreshUsersButton, "Refresh Authorized Users");
     189      this.refreshUsersButton.UseVisualStyleBackColor = true;
     190      this.refreshUsersButton.Click += new System.EventHandler(this.refreshUsersButton_Click);
     191      //
     192      // dataTabPage
     193      //
     194      this.dataTabPage.Controls.Add(this.dataTypeComboBox);
     195      this.dataTabPage.Controls.Add(this.openFileButton);
     196      this.dataTabPage.Controls.Add(this.fileTextBox);
     197      this.dataTabPage.Controls.Add(this.storeDataButton);
     198      this.dataTabPage.Controls.Add(this.dataTypeLabel);
     199      this.dataTabPage.Controls.Add(this.fileLabel);
     200      this.dataTabPage.Location = new System.Drawing.Point(4, 22);
     201      this.dataTabPage.Name = "dataTabPage";
     202      this.dataTabPage.Padding = new System.Windows.Forms.Padding(3);
     203      this.dataTabPage.Size = new System.Drawing.Size(625, 266);
     204      this.dataTabPage.TabIndex = 1;
     205      this.dataTabPage.Text = "Serialized Algorithm";
     206      this.dataTabPage.UseVisualStyleBackColor = true;
     207      //
     208      // fileLabel
     209      //
     210      this.fileLabel.AutoSize = true;
     211      this.fileLabel.Location = new System.Drawing.Point(6, 38);
     212      this.fileLabel.Name = "fileLabel";
     213      this.fileLabel.Size = new System.Drawing.Size(26, 13);
     214      this.fileLabel.TabIndex = 1;
     215      this.fileLabel.Text = "&File:";
     216      //
     217      // storeDataButton
     218      //
     219      this.storeDataButton.Enabled = false;
     220      this.storeDataButton.Location = new System.Drawing.Point(6, 6);
     221      this.storeDataButton.Name = "storeDataButton";
     222      this.storeDataButton.Size = new System.Drawing.Size(75, 23);
     223      this.storeDataButton.TabIndex = 0;
     224      this.storeDataButton.Text = "&Store";
     225      this.toolTip.SetToolTip(this.storeDataButton, "Store Serialized Algorithm");
     226      this.storeDataButton.UseVisualStyleBackColor = true;
     227      this.storeDataButton.Click += new System.EventHandler(this.storeDataButton_Click);
     228      //
     229      // fileTextBox
     230      //
     231      this.fileTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     232                  | System.Windows.Forms.AnchorStyles.Right)));
     233      this.fileTextBox.Location = new System.Drawing.Point(69, 35);
     234      this.fileTextBox.Name = "fileTextBox";
     235      this.fileTextBox.ReadOnly = true;
     236      this.fileTextBox.Size = new System.Drawing.Size(520, 20);
     237      this.fileTextBox.TabIndex = 2;
     238      //
     239      // openFileButton
     240      //
     241      this.openFileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     242      this.openFileButton.Location = new System.Drawing.Point(595, 32);
     243      this.openFileButton.Name = "openFileButton";
     244      this.openFileButton.Size = new System.Drawing.Size(24, 24);
     245      this.openFileButton.TabIndex = 3;
     246      this.openFileButton.Text = "...";
     247      this.openFileButton.UseVisualStyleBackColor = true;
     248      this.openFileButton.Click += new System.EventHandler(this.openFileButton_Click);
     249      //
     250      // openFileDialog
     251      //
     252      this.openFileDialog.FileName = "algorithm";
     253      this.openFileDialog.Filter = "All Files (*.*)|*.*";
     254      this.openFileDialog.Title = "Select Algorithm File";
     255      //
     256      // dataTypeLabel
     257      //
     258      this.dataTypeLabel.AutoSize = true;
     259      this.dataTypeLabel.Location = new System.Drawing.Point(6, 64);
     260      this.dataTypeLabel.Name = "dataTypeLabel";
     261      this.dataTypeLabel.Size = new System.Drawing.Size(57, 13);
     262      this.dataTypeLabel.TabIndex = 4;
     263      this.dataTypeLabel.Text = "&DataType:";
     264      //
     265      // dataTypeComboBox
     266      //
     267      this.dataTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     268                  | System.Windows.Forms.AnchorStyles.Right)));
     269      this.dataTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     270      this.dataTypeComboBox.FormattingEnabled = true;
     271      this.dataTypeComboBox.Location = new System.Drawing.Point(69, 61);
     272      this.dataTypeComboBox.Name = "dataTypeComboBox";
     273      this.dataTypeComboBox.Size = new System.Drawing.Size(550, 21);
     274      this.dataTypeComboBox.TabIndex = 5;
     275      this.dataTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.dataTypeComboBox_SelectedIndexChanged);
     276      //
    115277      // AlgorithmView
    116278      //
    117279      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     280      this.Controls.Add(this.tabControl);
    118281      this.Controls.Add(this.platformComboBox);
    119282      this.Controls.Add(this.platformLabel);
     
    121284      this.Controls.Add(this.algorithmClassLabel);
    122285      this.Name = "AlgorithmView";
    123       this.Size = new System.Drawing.Size(335, 275);
    124       this.Controls.SetChildIndex(this.modifiedPictureBox, 0);
     286      this.Size = new System.Drawing.Size(633, 454);
    125287      this.Controls.SetChildIndex(this.algorithmClassLabel, 0);
    126288      this.Controls.SetChildIndex(this.algorithmClassComboBox, 0);
    127289      this.Controls.SetChildIndex(this.platformLabel, 0);
    128290      this.Controls.SetChildIndex(this.platformComboBox, 0);
     291      this.Controls.SetChildIndex(this.tabControl, 0);
     292      this.Controls.SetChildIndex(this.modifiedPictureBox, 0);
    129293      this.Controls.SetChildIndex(this.storeButton, 0);
    130294      this.Controls.SetChildIndex(this.nameTextBox, 0);
     
    133297      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
    134298      ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit();
     299      this.tabControl.ResumeLayout(false);
     300      this.usersTabPage.ResumeLayout(false);
     301      this.dataTabPage.ResumeLayout(false);
     302      this.dataTabPage.PerformLayout();
    135303      this.ResumeLayout(false);
    136304      this.PerformLayout();
     
    144312    private System.Windows.Forms.Label algorithmClassLabel;
    145313    private System.Windows.Forms.ComboBox algorithmClassComboBox;
     314    private System.Windows.Forms.ListBox usersListBox;
     315    private System.Windows.Forms.TabControl tabControl;
     316    private System.Windows.Forms.TabPage usersTabPage;
     317    private System.Windows.Forms.Button storeUsersButton;
     318    private System.Windows.Forms.Button refreshUsersButton;
     319    private System.Windows.Forms.TabPage dataTabPage;
     320    private System.Windows.Forms.ComboBox dataTypeComboBox;
     321    private System.Windows.Forms.Button openFileButton;
     322    private System.Windows.Forms.TextBox fileTextBox;
     323    private System.Windows.Forms.Button storeDataButton;
     324    private System.Windows.Forms.Label dataTypeLabel;
     325    private System.Windows.Forms.Label fileLabel;
     326    private System.Windows.Forms.OpenFileDialog openFileDialog;
    146327
    147328  }
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.cs

    r4441 r4466  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
    2224using System.Linq;
    2325using System.Windows.Forms;
    2426using HeuristicLab.MainForm;
    2527using HeuristicLab.MainForm.WindowsForms;
     28using System.IO;
    2629
    2730namespace HeuristicLab.Clients.OKB {
     
    4245      platformComboBox.DataSource = Administrator.Instance.Platforms.ToList();
    4346      algorithmClassComboBox.DataSource = Administrator.Instance.AlgorithmClasses.ToList();
     47      dataTypeComboBox.DataSource = Administrator.Instance.DataTypes.ToList();
    4448    }
    4549
     
    6266        algorithmClassComboBox.SelectedItem = Administrator.Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId);
    6367      }
     68      usersListBox.DataSource = null;
     69      fileTextBox.Text = "";
     70      dataTypeComboBox.SelectedIndex = -1;
    6471    }
    6572
     
    6875      platformComboBox.Enabled = Content != null;
    6976      algorithmClassComboBox.Enabled = Content != null;
     77      refreshUsersButton.Enabled = Content != null;
     78      storeUsersButton.Enabled = usersListBox.DataSource != null;
     79      usersListBox.Enabled = usersListBox.DataSource != null;
     80      storeDataButton.Enabled = !string.IsNullOrEmpty(fileTextBox.Text) && dataTypeComboBox.SelectedIndex != -1;
    7081    }
    7182
     
    93104      }
    94105    }
     106
     107    private void refreshUsersButton_Click(object sender, System.EventArgs e) {
     108      Guid[] ids = Administrator.Instance.GetAlgorithmUsers(Content.Id);
     109      if (ids != null) {
     110        List<User> users = Administrator.Instance.Users.ToList();
     111        usersListBox.DataSource = users;
     112        usersListBox.DisplayMember = "Name";
     113        usersListBox.SelectedItems.Clear();
     114        foreach (Guid id in ids)
     115          usersListBox.SelectedItems.Add(users.First(u => u.Id == id));
     116        usersListBox.Enabled = true;
     117        storeUsersButton.Enabled = false;
     118      }
     119    }
     120    private void storeUsersButton_Click(object sender, System.EventArgs e) {
     121      if (Administrator.Instance.StoreAlgorithmUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray()))
     122        storeUsersButton.Enabled = false;
     123    }
     124    private void usersListBox_SelectedIndexChanged(object sender, EventArgs e) {
     125      storeUsersButton.Enabled = true;
     126    }
     127
     128    private void storeDataButton_Click(object sender, EventArgs e) {
     129      AlgorithmData data = new AlgorithmData();
     130      data.AlgorithmId = Content.Id;
     131      data.DataTypeId = ((DataType)dataTypeComboBox.SelectedItem).Id;
     132
     133      using (FileStream stream = new FileStream(fileTextBox.Text, FileMode.Open, FileAccess.Read)) {
     134        byte[] bytes = new byte[stream.Length];
     135        stream.Read(bytes, 0, bytes.Length);
     136        stream.Close();
     137        data.Data = bytes;
     138      }
     139
     140      if (Administrator.Instance.StoreAlgorithmData(data))
     141        storeDataButton.Enabled = false;
     142    }
     143    private void openFileButton_Click(object sender, EventArgs e) {
     144      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
     145        fileTextBox.Text = openFileDialog.FileName;
     146        storeDataButton.Enabled = true;
     147      }
     148    }
     149    private void dataTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     150      storeDataButton.Enabled = !string.IsNullOrEmpty(fileTextBox.Text);
     151    }
    95152  }
    96153}
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/app.config

    r4456 r4466  
    55            <wsHttpBinding>
    66                <binding name="WSHttpBinding_IAdminService" closeTimeout="00:01:00"
     7                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
     8                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
     9                    maxBufferPoolSize="524288" maxReceivedMessageSize="200000000"
     10                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
     11                    allowCookies="false">
     12                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="200000000"
     13                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     14                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
     15                        enabled="false" />
     16                    <security mode="Message">
     17                        <transport clientCredentialType="Windows" proxyCredentialType="None"
     18                            realm="" />
     19                        <message clientCredentialType="UserName" negotiateServiceCredential="true"
     20                            algorithmSuite="Default" />
     21                    </security>
     22                </binding>
     23                <binding name="WSHttpBinding_IAuthenticationService" closeTimeout="00:01:00"
    724                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    825                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
     
    3148                </identity>
    3249            </endpoint>
     50            <endpoint address="http://localhost:8732/Design_Time_Addresses/OKB-3.3/AuthenticationService"
     51                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAuthenticationService"
     52                contract="HeuristicLab.Clients.OKB.IAuthenticationService"
     53                name="WSHttpBinding_IAuthenticationService">
     54                <identity>
     55                    <certificate encodedValue="AwAAAAEAAAAUAAAAD/AlkYJw/OUhl6D/9w8mjJBh39kgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhAdEzTisaf2sEZxrqYZfYtCMAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMDgyMDIyMzIwOFoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPkfCSLRX8/4F+Z4ys43yZ4MMzjB44cMakPz4Nri+mEB5n2z/0GFatCYzkI2f/nniWqVrBYjHkjsZy2EZioHu4wa99c1XEGJnFNDuNn6ESkfEyhyF4+OqKGnpK9HNrw7OWMuqn2oOh0iFd9fl6FTAm+Y0p3LP+38BuYzpCniqqdwIDAQABo0kwRzBFBgNVHQEEPjA8gBDvi8Rgio9v+mr58TiAvqF5oRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghAdEzTisaf2sEZxrqYZfYtCMAkGBSsOAwIdBQADgYEANdGlvHKeUptfNu9I0wgA5qjmVB+JDldOAkrfM0R+4IcVQ06y5K7P07uxQAV7+rhnDLgLyFJunUHgzbfjsjFy7vjwtoieXA5j0AYlm4AHR7dHt4HVgkIMYt8XOCqMw5jjFX91xJ89tC7mM9zYR48N9T5QSeMGo+f+JzybeLWxnNs=" />
     56                </identity>
     57            </endpoint>
    3358        </client>
    3459    </system.serviceModel>
Note: See TracChangeset for help on using the changeset viewer.