1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System.Windows.Forms;
|
---|
23 | using HeuristicLab.MainForm;
|
---|
24 | using HeuristicLab.Clients.Common;
|
---|
25 | using HeuristicLab.Clients.OKB.OKBAdmin;
|
---|
26 | using System.ComponentModel;
|
---|
27 | using System.Collections.Generic;
|
---|
28 | using System.Data;
|
---|
29 | using System;
|
---|
30 |
|
---|
31 | namespace HeuristicLab.Clients.OKB {
|
---|
32 | [View("OKB Administration")]
|
---|
33 | public partial class AdministrationView : HeuristicLab.MainForm.WindowsForms.View {
|
---|
34 | List<AlgorithmClass> data;
|
---|
35 |
|
---|
36 | public AdministrationView() {
|
---|
37 | InitializeComponent();
|
---|
38 | }
|
---|
39 |
|
---|
40 | private void refreshButton_Click(object sender, System.EventArgs e) {
|
---|
41 | IAdminService adminService = ClientFactory.CreateClient<AdminServiceClient, IAdminService>();
|
---|
42 | data = adminService.GetAlgorithmClasses();
|
---|
43 | algorithmClassBindingSource.DataSource = data;
|
---|
44 | }
|
---|
45 |
|
---|
46 | private void saveButton_Click(object sender, System.EventArgs e) {
|
---|
47 | IAdminService adminService = ClientFactory.CreateClient<AdminServiceClient, IAdminService>();
|
---|
48 | }
|
---|
49 |
|
---|
50 | private void populateButton_Click(object sender, System.EventArgs e) {
|
---|
51 | IAdminService adminService = ClientFactory.CreateClient<AdminServiceClient, IAdminService>();
|
---|
52 | for (int i = 0; i < 100; i++)
|
---|
53 | adminService.AddAlgorithmClass(new AlgorithmClass() { Name = Guid.NewGuid().ToString() });
|
---|
54 | }
|
---|
55 |
|
---|
56 | private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
|
---|
57 | IAdminService adminService = ClientFactory.CreateClient<AdminServiceClient, IAdminService>();
|
---|
58 | adminService.UpdateAlgorithmClass(data[e.RowIndex]);
|
---|
59 | }
|
---|
60 |
|
---|
61 | private void dataGridView1_UserAddedRow(object sender, DataGridViewRowEventArgs e) {
|
---|
62 | IAdminService adminService = ClientFactory.CreateClient<AdminServiceClient, IAdminService>();
|
---|
63 | adminService.AddAlgorithmClass(new AlgorithmClass() {
|
---|
64 | Name = (string)e.Row.Cells["Name"].Value,
|
---|
65 | Description = (string)e.Row.Cells["Description"].Value
|
---|
66 | });
|
---|
67 | }
|
---|
68 |
|
---|
69 | private void dataGridView1_UserDeletedRow(object sender, DataGridViewRowEventArgs e) {
|
---|
70 | IAdminService adminService = ClientFactory.CreateClient<AdminServiceClient, IAdminService>();
|
---|
71 | adminService.DeleteAlgorithmClass((long)e.Row.Cells["Id"].Value);
|
---|
72 | }
|
---|
73 | }
|
---|
74 | }
|
---|