Changeset 4466 for branches/OKB
- Timestamp:
- 09/22/10 05:54:13 (14 years ago)
- 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 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using HeuristicLab.Clients.Common; … … 51 52 get { return algorithms; } 52 53 } 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 } 53 62 54 63 private Administrator() { } … … 71 80 } 72 81 algorithms.Clear(); 82 if (dataTypes == null) { 83 dataTypes = new ItemCollection<DataType>(); 84 dataTypes.ItemsRemoved += new CollectionItemsChangedEventHandler<DataType>(dataTypes_ItemsRemoved); 85 } 86 dataTypes.Clear(); 73 87 74 88 var call = new Func<Exception>(delegate() { 75 89 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); 79 95 return null; 80 96 } … … 98 114 else if (item is Algorithm) 99 115 CallAdminService(s => s.StoreAlgorithm((Algorithm)item)); 116 else if (item is DataType) 117 CallAdminService(s => s.StoreDataType((DataType)item)); 100 118 return true; 101 119 } 102 120 catch (Exception ex) { 103 121 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); 104 153 return false; 105 154 } … … 144 193 } 145 194 } 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 } 146 204 147 205 #region Helpers … … 174 232 } 175 233 } 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 } 176 248 #endregion 177 249 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/HeuristicLab.Clients.OKB-3.3.csproj
r4456 r4466 77 77 <Compile Include="HeuristicLabClientsOKBPlugin.cs" /> 78 78 <Compile Include="Properties\AssemblyInfo.cs" /> 79 <Compile Include="ServiceClients\AdminServiceClient.cs" /> 79 80 <Compile Include="ServiceClients\Algorithm.cs"> 80 81 <SubType>Code</SubType> … … 83 84 <SubType>Code</SubType> 84 85 </Compile> 86 <Compile Include="ServiceClients\AuthenticationServiceClient.cs" /> 87 <Compile Include="ServiceClients\DataType.cs" /> 85 88 <Compile Include="ServiceClients\NamedOKBItem.cs" /> 86 89 <Compile Include="ServiceClients\Platform.cs" /> … … 94 97 <SubType>Code</SubType> 95 98 </Compile> 96 <Compile Include="ServiceClients\ServiceClients.cs" />97 99 <Compile Include="Views\AdministratorView.cs"> 98 100 <SubType>UserControl</SubType> … … 118 120 <Compile Include="Views\AlgorithmView.Designer.cs"> 119 121 <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> 120 134 </Compile> 121 135 <Compile Include="Views\PlatformCollectionView.cs"> … … 146 160 <None Include="HeuristicLabClientsOKBPlugin.cs.frame" /> 147 161 </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> 148 170 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 149 171 <PropertyGroup> -
branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/GenerateServiceClients.cmd
r4456 r4466 1 1 echo off 2 3 echo. 4 echo ******************************************************************************************* 5 echo Generating AdminService client 6 echo. 7 2 8 svcutil.exe ^ 3 9 http://localhost:8732/Design_Time_Addresses/OKB-3.3/AdminService/mex ^ 4 /out: ServiceClients^10 /out:AdminServiceClient ^ 5 11 /namespace:*,HeuristicLab.Clients.OKB ^ 6 12 /targetClientVersion:Version35 ^ 7 13 /enableDataBinding ^ 8 /reference:"C:\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll" ^9 /collectionType:HeuristicLab.Core.ItemCollection`1 ^10 14 /config:..\app.config 11 15 12 16 echo. 13 echo -------------------------------------------------------------------------------------- 14 echo ATTENTION!!! 17 echo --------------------------------------------------------------------------------------- 18 echo !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! 19 echo. 15 20 echo Following modifications have to be done manually in generated data contracts: 16 21 echo * Remove method "protected void RaisePropertyChanged(string propertyName)" in OKBItem 17 echo -------------------------------------------------------------------------------------- 22 echo. 23 echo !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! ATTENTION !!! 24 echo --------------------------------------------------------------------------------------- 25 echo. 26 echo Generation of AdminService client finished. 27 echo ******************************************************************************************* 28 echo. 29 echo. 30 echo ******************************************************************************************* 31 echo Generating AuthenticationService client 32 echo. 33 34 svcutil.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 43 echo. 44 echo Generation of AuthenticationService client finished. 45 echo ******************************************************************************************* 18 46 echo. 19 47 -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AdministratorView.Designer.cs
r4441 r4466 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AdministratorView)); 48 49 this.tabControl = new System.Windows.Forms.TabControl(); 49 50 this.platformsTabPage = new System.Windows.Forms.TabPage(); … … 53 54 this.algorithmsTabPage = new System.Windows.Forms.TabPage(); 54 55 this.algorithmCollectionView = new HeuristicLab.Clients.OKB.AlgorithmCollectionView(); 56 this.dataTypesTabPage = new System.Windows.Forms.TabPage(); 55 57 this.refreshButton = new System.Windows.Forms.Button(); 56 58 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 59 this.dataTypeCollectionView = new HeuristicLab.Clients.OKB.DataTypeCollectionView(); 57 60 this.tabControl.SuspendLayout(); 58 61 this.platformsTabPage.SuspendLayout(); 59 62 this.algorithmClassesTabPage.SuspendLayout(); 60 63 this.algorithmsTabPage.SuspendLayout(); 64 this.dataTypesTabPage.SuspendLayout(); 61 65 this.SuspendLayout(); 62 66 // … … 69 73 this.tabControl.Controls.Add(this.algorithmClassesTabPage); 70 74 this.tabControl.Controls.Add(this.algorithmsTabPage); 75 this.tabControl.Controls.Add(this.dataTypesTabPage); 71 76 this.tabControl.Location = new System.Drawing.Point(0, 29); 72 77 this.tabControl.Name = "tabControl"; … … 147 152 this.algorithmCollectionView.TabIndex = 0; 148 153 // 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 // 149 165 // refreshButton 150 166 // 151 this.refreshButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Refresh;167 this.refreshButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshButton.Image"))); 152 168 this.refreshButton.Location = new System.Drawing.Point(0, 0); 153 169 this.refreshButton.Name = "refreshButton"; … … 157 173 this.refreshButton.UseVisualStyleBackColor = true; 158 174 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; 159 188 // 160 189 // AdministratorView … … 170 199 this.algorithmClassesTabPage.ResumeLayout(false); 171 200 this.algorithmsTabPage.ResumeLayout(false); 201 this.dataTypesTabPage.ResumeLayout(false); 172 202 this.ResumeLayout(false); 173 203 … … 185 215 private System.Windows.Forms.TabPage platformsTabPage; 186 216 private PlatformCollectionView platformCollectionView; 217 private System.Windows.Forms.TabPage dataTypesTabPage; 218 private DataTypeCollectionView dataTypeCollectionView; 187 219 188 220 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AdministratorView.cs
r4441 r4466 56 56 algorithmClassCollectionView.Content = null; 57 57 algorithmCollectionView.Content = null; 58 dataTypeCollectionView.Content = null; 58 59 } else { 59 60 platformCollectionView.Content = Content.Platforms; 60 61 algorithmClassCollectionView.Content = Content.AlgorithmClasses; 61 62 algorithmCollectionView.Content = Content.Algorithms; 63 dataTypeCollectionView.Content = Content.DataTypes; 62 64 } 63 65 } … … 69 71 algorithmClassCollectionView.Enabled = Content != null; 70 72 algorithmCollectionView.Enabled = Content != null; 73 dataTypeCollectionView.Enabled = Content != null; 71 74 } 72 75 … … 87 90 algorithmClassCollectionView.Content = Content.AlgorithmClasses; 88 91 algorithmCollectionView.Content = Content.Algorithms; 92 dataTypeCollectionView.Content = Content.DataTypes; 89 93 refreshButton.Enabled = true; 90 94 tabControl.Enabled = true; -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.Designer.cs
r4441 r4466 49 49 this.algorithmClassLabel = new System.Windows.Forms.Label(); 50 50 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(); 51 64 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit(); 65 this.tabControl.SuspendLayout(); 66 this.usersTabPage.SuspendLayout(); 67 this.dataTabPage.SuspendLayout(); 52 68 this.SuspendLayout(); 53 69 // … … 55 71 // 56 72 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); 58 74 // 59 75 // descriptionTextBox 60 76 // 61 77 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); 63 79 // 64 80 // storeButton … … 68 84 // modifiedPictureBox 69 85 // 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); 72 87 // 73 88 // platformLabel … … 88 103 this.platformComboBox.Location = new System.Drawing.Point(90, 81); 89 104 this.platformComboBox.Name = "platformComboBox"; 90 this.platformComboBox.Size = new System.Drawing.Size( 197, 21);105 this.platformComboBox.Size = new System.Drawing.Size(495, 21); 91 106 this.platformComboBox.TabIndex = 6; 92 107 this.platformComboBox.SelectedValueChanged += new System.EventHandler(this.platformComboBox_SelectedValueChanged); … … 109 124 this.algorithmClassComboBox.Location = new System.Drawing.Point(90, 108); 110 125 this.algorithmClassComboBox.Name = "algorithmClassComboBox"; 111 this.algorithmClassComboBox.Size = new System.Drawing.Size( 197, 21);126 this.algorithmClassComboBox.Size = new System.Drawing.Size(495, 21); 112 127 this.algorithmClassComboBox.TabIndex = 8; 113 128 this.algorithmClassComboBox.SelectedValueChanged += new System.EventHandler(this.algorithmClassComboBox_SelectedValueChanged); 114 129 // 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 // 115 277 // AlgorithmView 116 278 // 117 279 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 280 this.Controls.Add(this.tabControl); 118 281 this.Controls.Add(this.platformComboBox); 119 282 this.Controls.Add(this.platformLabel); … … 121 284 this.Controls.Add(this.algorithmClassLabel); 122 285 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); 125 287 this.Controls.SetChildIndex(this.algorithmClassLabel, 0); 126 288 this.Controls.SetChildIndex(this.algorithmClassComboBox, 0); 127 289 this.Controls.SetChildIndex(this.platformLabel, 0); 128 290 this.Controls.SetChildIndex(this.platformComboBox, 0); 291 this.Controls.SetChildIndex(this.tabControl, 0); 292 this.Controls.SetChildIndex(this.modifiedPictureBox, 0); 129 293 this.Controls.SetChildIndex(this.storeButton, 0); 130 294 this.Controls.SetChildIndex(this.nameTextBox, 0); … … 133 297 this.Controls.SetChildIndex(this.descriptionTextBox, 0); 134 298 ((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(); 135 303 this.ResumeLayout(false); 136 304 this.PerformLayout(); … … 144 312 private System.Windows.Forms.Label algorithmClassLabel; 145 313 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; 146 327 147 328 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.cs
r4441 r4466 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 22 24 using System.Linq; 23 25 using System.Windows.Forms; 24 26 using HeuristicLab.MainForm; 25 27 using HeuristicLab.MainForm.WindowsForms; 28 using System.IO; 26 29 27 30 namespace HeuristicLab.Clients.OKB { … … 42 45 platformComboBox.DataSource = Administrator.Instance.Platforms.ToList(); 43 46 algorithmClassComboBox.DataSource = Administrator.Instance.AlgorithmClasses.ToList(); 47 dataTypeComboBox.DataSource = Administrator.Instance.DataTypes.ToList(); 44 48 } 45 49 … … 62 66 algorithmClassComboBox.SelectedItem = Administrator.Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId); 63 67 } 68 usersListBox.DataSource = null; 69 fileTextBox.Text = ""; 70 dataTypeComboBox.SelectedIndex = -1; 64 71 } 65 72 … … 68 75 platformComboBox.Enabled = Content != null; 69 76 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; 70 81 } 71 82 … … 93 104 } 94 105 } 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 } 95 152 } 96 153 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/app.config
r4456 r4466 5 5 <wsHttpBinding> 6 6 <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" 7 24 openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 8 25 bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" … … 31 48 </identity> 32 49 </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> 33 58 </client> 34 59 </system.serviceModel>
Note: See TracChangeset
for help on using the changeset viewer.