Changeset 4549
- Timestamp:
- 10/04/10 04:17:26 (14 years ago)
- Location:
- branches/OKB/HeuristicLab.Clients.OKB-3.3
- Files:
-
- 13 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB/HeuristicLab.Clients.OKB-3.3/AdministratorMenuItem.cs
r4548 r4549 37 37 38 38 public override void Execute() { 39 MainFormManager.MainForm.ShowContent(OKB .Instance);39 MainFormManager.MainForm.ShowContent(OKBClient.Instance); 40 40 } 41 41 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/HeuristicLab.Clients.OKB-3.3.csproj
r4548 r4549 77 77 <ItemGroup> 78 78 <Compile Include="AdministratorMenuItem.cs" /> 79 <Compile Include="OKB .cs" />79 <Compile Include="OKBClient.cs" /> 80 80 <Compile Include="OKBExperiment.cs" /> 81 81 <Compile Include="HeuristicLabClientsOKBPlugin.cs" /> … … 204 204 <None Include="HeuristicLabClientsOKBPlugin.cs.frame" /> 205 205 </ItemGroup> 206 <ItemGroup> 207 <EmbeddedResource Include="Views\OKBExperimentView.resx"> 208 <DependentUpon>OKBExperimentView.cs</DependentUpon> 209 </EmbeddedResource> 210 </ItemGroup> 206 211 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 207 212 <PropertyGroup> -
branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBClient.cs
r4548 r4549 30 30 31 31 namespace HeuristicLab.Clients.OKB { 32 [Item("OKB ", "OKB front-end.")]33 public sealed class OKB : IContent {34 private static OKB instance;35 public static OKB Instance {32 [Item("OKBClient", "Client for accessing the OKB.")] 33 public sealed class OKBClient : IContent { 34 private static OKBClient instance; 35 public static OKBClient Instance { 36 36 get { 37 if (instance == null) instance = new OKB ();37 if (instance == null) instance = new OKBClient(); 38 38 return instance; 39 39 } … … 71 71 #endregion 72 72 73 private OKB() { } 73 private OKBClient() { 74 platforms = new ItemCollection<Platform>(); 75 platforms.ItemsRemoved += new CollectionItemsChangedEventHandler<Platform>(platforms_ItemsRemoved); 76 dataTypes = new ItemCollection<DataType>(); 77 dataTypes.ItemsRemoved += new CollectionItemsChangedEventHandler<DataType>(dataTypes_ItemsRemoved); 78 algorithmClasses = new ItemCollection<AlgorithmClass>(); 79 algorithmClasses.ItemsRemoved += new CollectionItemsChangedEventHandler<AlgorithmClass>(algorithmClasses_ItemsRemoved); 80 algorithms = new ItemCollection<Algorithm>(); 81 algorithms.ItemsRemoved += new CollectionItemsChangedEventHandler<Algorithm>(algorithms_ItemsRemoved); 82 problemClasses = new ItemCollection<ProblemClass>(); 83 problemClasses.ItemsRemoved += new CollectionItemsChangedEventHandler<ProblemClass>(problemClasses_ItemsRemoved); 84 problems = new ItemCollection<Problem>(); 85 problems.ItemsRemoved += new CollectionItemsChangedEventHandler<Problem>(problems_ItemsRemoved); 86 } 74 87 75 88 #region Refresh 76 89 public void Refresh() { 77 90 OnRefreshing(); 78 if (platforms == null) { 79 platforms = new ItemCollection<Platform>(); 80 platforms.ItemsRemoved += new CollectionItemsChangedEventHandler<Platform>(platforms_ItemsRemoved); 81 } 91 82 92 platforms.Clear(); 83 if (dataTypes == null) {84 dataTypes = new ItemCollection<DataType>();85 dataTypes.ItemsRemoved += new CollectionItemsChangedEventHandler<DataType>(dataTypes_ItemsRemoved);86 }87 93 dataTypes.Clear(); 88 if (algorithmClasses == null) {89 algorithmClasses = new ItemCollection<AlgorithmClass>();90 algorithmClasses.ItemsRemoved += new CollectionItemsChangedEventHandler<AlgorithmClass>(algorithmClasses_ItemsRemoved);91 }92 94 algorithmClasses.Clear(); 93 if (algorithms == null) {94 algorithms = new ItemCollection<Algorithm>();95 algorithms.ItemsRemoved += new CollectionItemsChangedEventHandler<Algorithm>(algorithms_ItemsRemoved);96 }97 95 algorithms.Clear(); 98 if (problemClasses == null) {99 problemClasses = new ItemCollection<ProblemClass>();100 problemClasses.ItemsRemoved += new CollectionItemsChangedEventHandler<ProblemClass>(problemClasses_ItemsRemoved);101 }102 96 problemClasses.Clear(); 103 if (problems == null) {104 problems = new ItemCollection<Problem>();105 problems.ItemsRemoved += new CollectionItemsChangedEventHandler<Problem>(problems_ItemsRemoved);106 }107 97 problems.Clear(); 108 98 -
branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBExperiment.cs
r4548 r4549 20 20 #endregion 21 21 22 using System; 23 using System.Drawing; 24 using System.IO; 25 using HeuristicLab.Common; 22 26 using HeuristicLab.Core; 23 27 using HeuristicLab.Optimization; 24 using HeuristicLab. Common;25 using System.Drawing;28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Persistence.Default.Xml; 26 30 27 31 namespace HeuristicLab.Clients.OKB { 32 [Item("OKB Experiment", "...")] 28 33 [Creatable("OKB")] 29 [ Item("OKB Experiment", "...")]34 [StorableClass] 30 35 public sealed class OKBExperiment : NamedItem, IOptimizer, IStorableContent { 31 36 public string Filename { get; set; } … … 33 38 public override Image ItemImage { 34 39 get { 35 if (ExecutionState == ExecutionState.Prepared) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePrepared; 36 else if (ExecutionState == ExecutionState.Started) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStarted; 37 else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutablePaused; 38 else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VS2008ImageLibrary.ExecutableStopped; 40 if (Algorithm != null) return Algorithm.ItemImage; 39 41 else return HeuristicLab.Common.Resources.VS2008ImageLibrary.Event; 40 42 } 41 43 } 42 44 43 public override bool CanChangeName { 44 get { return false; } 45 } 46 public override bool CanChangeDescription { 47 get { return false; } 48 } 49 45 [Storable] 46 private long AlgorithmId { get; set; } 47 [Storable] 50 48 private IAlgorithm algorithm; 51 49 private IAlgorithm Algorithm { 52 50 get { return algorithm; } 53 set { algorithm = value; } 54 } 51 set { 52 DeregisterAlgorithmEvents(); 53 algorithm = value; 54 RegisterAlgorithmEvents(); 55 algorithm.Problem = Problem; 56 OnChanged(); 57 } 58 } 59 private long ProblemId { get; set; } 55 60 private IProblem problem; 56 p rivateIProblem Problem {61 public IProblem Problem { 57 62 get { return problem; } 58 set { problem = value; } 59 } 60 61 public void LoadAlgorithm(long algorithmId) { 62 63 } 64 public void LoadProblem(long problemId) { 65 66 } 67 68 69 70 #region IOptimizer Members 71 63 private set { 64 problem = value; 65 if (Algorithm != null) Algorithm.Problem = problem; 66 OnChanged(); 67 } 68 } 69 70 public IKeyedItemCollection<string, IParameter> Parameters { 71 get { 72 if (Algorithm != null) return Algorithm.Parameters; 73 else return null; 74 } 75 } 76 public ResultCollection Results { 77 get { 78 if (Algorithm != null) return Algorithm.Results; 79 else return null; 80 } 81 } 82 public RunCollection Runs { 83 get { 84 if (Algorithm != null) return Algorithm.Runs; 85 else return null; 86 } 87 } 88 public ExecutionState ExecutionState { 89 get { 90 if (Algorithm != null) return Algorithm.ExecutionState; 91 else return ExecutionState.Stopped; 92 } 93 } 94 public TimeSpan ExecutionTime { 95 get { 96 if (Algorithm != null) return Algorithm.ExecutionTime; 97 else return TimeSpan.Zero; 98 } 99 } 100 101 public OKBExperiment() 102 : base() { 103 name = ItemName; 104 description = ItemDescription; 105 } 106 [StorableConstructor] 107 private OKBExperiment(bool deserializing) : base(deserializing) { } 108 109 public void LoadAlgorithm(long id) { 110 AlgorithmId = id; 111 AlgorithmData algorithmData = OKBClient.Instance.GetAlgorithmData(id); 112 113 using (MemoryStream stream = new MemoryStream(algorithmData.Data)) { 114 Algorithm = XmlParser.Deserialize<IAlgorithm>(stream); 115 } 116 } 117 public void LoadProblem(long id) { 118 ProblemId = id; 119 ProblemData problemData = OKBClient.Instance.GetProblemData(id); 120 121 using (MemoryStream stream = new MemoryStream(problemData.Data)) { 122 Problem = XmlParser.Deserialize<IProblem>(stream); 123 } 124 } 125 126 public void Pause() { 127 Algorithm.Pause(); 128 } 72 129 public void Prepare(bool clearRuns) { 73 throw new System.NotImplementedException(); 74 } 75 76 public RunCollection Runs { 77 get { throw new System.NotImplementedException(); } 78 } 79 80 #endregion 81 82 #region IExecutable Members 83 84 public event System.EventHandler<EventArgs<System.Exception>> ExceptionOccurred; 85 86 public ExecutionState ExecutionState { 87 get { throw new System.NotImplementedException(); } 88 } 89 90 public event System.EventHandler ExecutionStateChanged; 91 92 public System.TimeSpan ExecutionTime { 93 get { throw new System.NotImplementedException(); } 94 } 95 96 public event System.EventHandler ExecutionTimeChanged; 97 98 public void Pause() { 99 throw new System.NotImplementedException(); 100 } 101 102 public event System.EventHandler Paused; 103 130 if (Algorithm != null) Algorithm.Prepare(clearRuns); 131 } 104 132 public void Prepare() { 105 throw new System.NotImplementedException(); 106 } 107 108 public event System.EventHandler Prepared; 109 133 Algorithm.Prepare(); 134 } 110 135 public void Start() { 111 throw new System.NotImplementedException(); 112 } 113 114 public event System.EventHandler Started; 115 136 Algorithm.Start(); 137 } 116 138 public void Stop() { 117 throw new System.NotImplementedException(); 118 } 119 120 public event System.EventHandler Stopped; 121 139 Algorithm.Stop(); 140 } 141 142 #region Events 143 public event EventHandler Changed; 144 private void OnChanged() { 145 EventHandler handler = Changed; 146 if (handler != null) handler(this, EventArgs.Empty); 147 } 148 public event EventHandler<EventArgs<Exception>> ExceptionOccurred; 149 private void OnExceptionOccurred(Exception exception) { 150 EventHandler<EventArgs<Exception>> handler = ExceptionOccurred; 151 if (handler != null) handler(this, new EventArgs<Exception>(exception)); 152 } 153 public event EventHandler ExecutionStateChanged; 154 private void OnExecutionStateChanged() { 155 EventHandler handler = ExecutionStateChanged; 156 if (handler != null) handler(this, EventArgs.Empty); 157 } 158 public event EventHandler ExecutionTimeChanged; 159 private void OnExecutionTimeChanged() { 160 EventHandler handler = ExecutionTimeChanged; 161 if (handler != null) handler(this, EventArgs.Empty); 162 } 163 public event EventHandler Prepared; 164 private void OnPrepared() { 165 EventHandler handler = Prepared; 166 if (handler != null) handler(this, EventArgs.Empty); 167 } 168 public event EventHandler Started; 169 private void OnStarted() { 170 EventHandler handler = Started; 171 if (handler != null) handler(this, EventArgs.Empty); 172 } 173 public event EventHandler Paused; 174 private void OnPaused() { 175 EventHandler handler = Paused; 176 if (handler != null) handler(this, EventArgs.Empty); 177 } 178 public event EventHandler Stopped; 179 private void OnStopped() { 180 EventHandler handler = Stopped; 181 if (handler != null) handler(this, EventArgs.Empty); 182 } 183 184 private void RegisterAlgorithmEvents() { 185 if (Algorithm != null) { 186 Algorithm.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Algorithm_ExceptionOccurred); 187 Algorithm.ExecutionStateChanged += new EventHandler(Algorithm_ExecutionStateChanged); 188 Algorithm.ExecutionTimeChanged += new EventHandler(Algorithm_ExecutionTimeChanged); 189 Algorithm.ItemImageChanged += new EventHandler(Algorithm_ItemImageChanged); 190 Algorithm.Paused += new EventHandler(Algorithm_Paused); 191 Algorithm.Prepared += new EventHandler(Algorithm_Prepared); 192 Algorithm.Started += new EventHandler(Algorithm_Started); 193 Algorithm.Stopped += new EventHandler(Algorithm_Stopped); 194 } 195 } 196 private void DeregisterAlgorithmEvents() { 197 if (Algorithm != null) { 198 Algorithm.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Algorithm_ExceptionOccurred); 199 Algorithm.ExecutionStateChanged -= new EventHandler(Algorithm_ExecutionStateChanged); 200 Algorithm.ExecutionTimeChanged -= new EventHandler(Algorithm_ExecutionTimeChanged); 201 Algorithm.ItemImageChanged -= new EventHandler(Algorithm_ItemImageChanged); 202 Algorithm.Paused -= new EventHandler(Algorithm_Paused); 203 Algorithm.Prepared -= new EventHandler(Algorithm_Prepared); 204 Algorithm.Started -= new EventHandler(Algorithm_Started); 205 Algorithm.Stopped -= new EventHandler(Algorithm_Stopped); 206 } 207 } 208 private void Algorithm_ExceptionOccurred(object sender, EventArgs<Exception> e) { 209 OnExceptionOccurred(e.Value); 210 } 211 private void Algorithm_ExecutionStateChanged(object sender, EventArgs e) { 212 OnExecutionStateChanged(); 213 } 214 private void Algorithm_ExecutionTimeChanged(object sender, EventArgs e) { 215 OnExecutionTimeChanged(); 216 } 217 private void Algorithm_ItemImageChanged(object sender, EventArgs e) { 218 OnItemImageChanged(); 219 } 220 private void Algorithm_Paused(object sender, EventArgs e) { 221 OnPaused(); 222 } 223 private void Algorithm_Prepared(object sender, EventArgs e) { 224 OnPrepared(); 225 } 226 private void Algorithm_Started(object sender, EventArgs e) { 227 OnStarted(); 228 } 229 private void Algorithm_Stopped(object sender, EventArgs e) { 230 OnStopped(); 231 } 122 232 #endregion 123 233 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/OKBItem.cs
r4548 r4549 86 86 87 87 public void Store() { 88 if (OKB .Instance.Store(this))88 if (OKBClient.Instance.Store(this)) 89 89 Modified = false; 90 90 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AdministratorView.cs
r4548 r4549 27 27 namespace HeuristicLab.Clients.OKB { 28 28 [View("OKB Administrator")] 29 [Content(typeof(OKB ), true)]29 [Content(typeof(OKBClient), true)] 30 30 public sealed partial class AdministratorView : AsynchronousContentView { 31 public new OKB Content {32 get { return (OKB )base.Content; }31 public new OKBClient Content { 32 get { return (OKBClient)base.Content; } 33 33 set { base.Content = value; } 34 34 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmDataView.cs
r4548 r4549 60 60 protected override void OnInitialized(System.EventArgs e) { 61 61 base.OnInitialized(e); 62 dataTypeComboBox.DataSource = OKB .Instance.DataTypes.ToList();62 dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.ToList(); 63 63 dataTypeComboBox.SelectedIndex = -1; 64 64 } … … 80 80 noViewAvailableLabel.Visible = false; 81 81 } else { 82 dataTypeComboBox.SelectedItem = OKB .Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);82 dataTypeComboBox.SelectedItem = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId); 83 83 84 84 using (MemoryStream stream = new MemoryStream(Content.Data)) { … … 111 111 switch (e.PropertyName) { 112 112 case "DataTypeId": 113 dataTypeComboBox.SelectedItem = OKB .Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);113 dataTypeComboBox.SelectedItem = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId); 114 114 break; 115 115 } … … 119 119 BeginAsyncCall(); 120 120 var call = new Action(delegate() { 121 AlgorithmData data = OKB .Instance.GetAlgorithmData(AlgorithmId);121 AlgorithmData data = OKBClient.Instance.GetAlgorithmData(AlgorithmId); 122 122 Content = data; 123 123 }); … … 142 142 } 143 143 } 144 OKB .Instance.UpdateAlgorithmData(Content);144 OKBClient.Instance.UpdateAlgorithmData(Content); 145 145 } 146 146 private void newDataButton_Click(object sender, EventArgs e) { … … 153 153 if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId }; 154 154 viewHost.Content = (IContent)dialog.TypeSelector.CreateInstanceOfSelectedType(); 155 DataType dataType = OKB .Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);155 DataType dataType = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName); 156 156 if (dataType == null) { 157 157 dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" }; 158 dataType.PlatformId = OKB .Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;158 dataType.PlatformId = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id; 159 159 dataType.Store(); 160 OKB .Instance.DataTypes.Add(dataType);161 dataTypeComboBox.DataSource = OKB .Instance.DataTypes.OrderBy(d => d.Name).ToList();160 OKBClient.Instance.DataTypes.Add(dataType); 161 dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.OrderBy(d => d.Name).ToList(); 162 162 } 163 163 dataTypeComboBox.SelectedItem = dataType; … … 185 185 viewHost.Content = algorithm; 186 186 noViewAvailableLabel.Visible = false; 187 DataType dataType = OKB .Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);187 DataType dataType = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName); 188 188 if (dataType == null) { 189 189 dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" }; 190 dataType.PlatformId = OKB .Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;190 dataType.PlatformId = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id; 191 191 dataType.Store(); 192 OKB .Instance.DataTypes.Add(dataType);193 dataTypeComboBox.DataSource = OKB .Instance.DataTypes.OrderBy(d => d.Name).ToList();192 OKBClient.Instance.DataTypes.Add(dataType); 193 dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.OrderBy(d => d.Name).ToList(); 194 194 } 195 195 dataTypeComboBox.SelectedItem = dataType; -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.cs
r4548 r4549 42 42 protected override void OnInitialized(System.EventArgs e) { 43 43 base.OnInitialized(e); 44 platformComboBox.DataSource = OKB .Instance.Platforms.ToList();45 algorithmClassComboBox.DataSource = OKB .Instance.AlgorithmClasses.ToList();44 platformComboBox.DataSource = OKBClient.Instance.Platforms.ToList(); 45 algorithmClassComboBox.DataSource = OKBClient.Instance.AlgorithmClasses.ToList(); 46 46 } 47 47 … … 53 53 algorithmDataView.AlgorithmId = 0; 54 54 } else { 55 platformComboBox.SelectedItem = OKB .Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);56 algorithmClassComboBox.SelectedItem = OKB .Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId);55 platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId); 56 algorithmClassComboBox.SelectedItem = OKBClient.Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId); 57 57 algorithmDataView.AlgorithmId = Content.Id; 58 58 } … … 77 77 break; 78 78 case "PlatformId": 79 platformComboBox.SelectedItem = OKB .Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);79 platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId); 80 80 break; 81 81 case "AlgorithmClassId": 82 algorithmClassComboBox.SelectedItem = OKB .Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId);82 algorithmClassComboBox.SelectedItem = OKBClient.Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId); 83 83 break; 84 84 } … … 99 99 100 100 private void refreshUsersButton_Click(object sender, System.EventArgs e) { 101 Guid[] ids = OKB .Instance.GetAlgorithmUsers(Content.Id);101 Guid[] ids = OKBClient.Instance.GetAlgorithmUsers(Content.Id); 102 102 if (ids != null) { 103 List<User> users = OKB .Instance.Users.ToList();103 List<User> users = OKBClient.Instance.Users.ToList(); 104 104 usersListBox.DataSource = users; 105 105 usersListBox.DisplayMember = "Name"; … … 112 112 } 113 113 private void storeUsersButton_Click(object sender, System.EventArgs e) { 114 if (OKB .Instance.UpdateAlgorithmUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray()))114 if (OKBClient.Instance.UpdateAlgorithmUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray())) 115 115 storeUsersButton.Enabled = false; 116 116 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/DataTypeView.cs
r4548 r4549 41 41 protected override void OnInitialized(System.EventArgs e) { 42 42 base.OnInitialized(e); 43 platformComboBox.DataSource = OKB .Instance.Platforms.ToList();43 platformComboBox.DataSource = OKBClient.Instance.Platforms.ToList(); 44 44 } 45 45 … … 57 57 nameTextBox.Text = Content.Name; 58 58 sqlNameComboBox.Text = Content.SqlName; 59 platformComboBox.SelectedItem = OKB .Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);59 platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId); 60 60 Caption = Content.Name; 61 61 } … … 80 80 break; 81 81 case "PlatformId": 82 platformComboBox.SelectedItem = OKB .Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);82 platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId); 83 83 break; 84 84 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBExperimentView.Designer.cs
r4548 r4549 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.algorithmLabel = new System.Windows.Forms.Label(); 48 this.problemLabel = new System.Windows.Forms.Label(); 49 this.algorithmComboBox = new System.Windows.Forms.ComboBox(); 50 this.problemComboBox = new System.Windows.Forms.ComboBox(); 51 this.refreshButton = new System.Windows.Forms.Button(); 52 this.startButton = new System.Windows.Forms.Button(); 53 this.pauseButton = new System.Windows.Forms.Button(); 54 this.stopButton = new System.Windows.Forms.Button(); 55 this.prepareButton = new System.Windows.Forms.Button(); 56 this.executionTimeLabel = new System.Windows.Forms.Label(); 57 this.executionTimeTextBox = new System.Windows.Forms.TextBox(); 58 this.tabControl = new System.Windows.Forms.TabControl(); 59 this.problemTabPage = new System.Windows.Forms.TabPage(); 60 this.parametersTabPage = new System.Windows.Forms.TabPage(); 61 this.resultsTabPage = new System.Windows.Forms.TabPage(); 62 this.runsTabPage = new System.Windows.Forms.TabPage(); 63 this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 64 this.parametersViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 65 this.resultsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 66 this.runsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 47 67 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 68 this.tabControl.SuspendLayout(); 69 this.problemTabPage.SuspendLayout(); 70 this.parametersTabPage.SuspendLayout(); 71 this.resultsTabPage.SuspendLayout(); 72 this.runsTabPage.SuspendLayout(); 48 73 this.SuspendLayout(); 49 74 // … … 52 77 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 53 78 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 54 this.nameTextBox.Size = new System.Drawing.Size( 463, 20);79 this.nameTextBox.Size = new System.Drawing.Size(638, 20); 55 80 // 56 81 // descriptionTextBox 57 82 // 58 this.descriptionTextBox.Size = new System.Drawing.Size(463, 20); 83 this.descriptionTextBox.Size = new System.Drawing.Size(638, 20); 84 // 85 // algorithmLabel 86 // 87 this.algorithmLabel.AutoSize = true; 88 this.algorithmLabel.Location = new System.Drawing.Point(3, 111); 89 this.algorithmLabel.Name = "algorithmLabel"; 90 this.algorithmLabel.Size = new System.Drawing.Size(53, 13); 91 this.algorithmLabel.TabIndex = 5; 92 this.algorithmLabel.Text = "&Algorithm:"; 93 // 94 // problemLabel 95 // 96 this.problemLabel.AutoSize = true; 97 this.problemLabel.Location = new System.Drawing.Point(3, 138); 98 this.problemLabel.Name = "problemLabel"; 99 this.problemLabel.Size = new System.Drawing.Size(48, 13); 100 this.problemLabel.TabIndex = 7; 101 this.problemLabel.Text = "&Problem:"; 102 // 103 // algorithmComboBox 104 // 105 this.algorithmComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 106 | System.Windows.Forms.AnchorStyles.Right))); 107 this.algorithmComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 108 this.algorithmComboBox.FormattingEnabled = true; 109 this.algorithmComboBox.Location = new System.Drawing.Point(72, 108); 110 this.algorithmComboBox.Name = "algorithmComboBox"; 111 this.algorithmComboBox.Size = new System.Drawing.Size(638, 21); 112 this.algorithmComboBox.TabIndex = 6; 113 this.algorithmComboBox.SelectedValueChanged += new System.EventHandler(this.algorithmComboBox_SelectedValueChanged); 114 // 115 // problemComboBox 116 // 117 this.problemComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 118 | System.Windows.Forms.AnchorStyles.Right))); 119 this.problemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 120 this.problemComboBox.FormattingEnabled = true; 121 this.problemComboBox.Location = new System.Drawing.Point(72, 135); 122 this.problemComboBox.Name = "problemComboBox"; 123 this.problemComboBox.Size = new System.Drawing.Size(638, 21); 124 this.problemComboBox.TabIndex = 8; 125 this.problemComboBox.SelectedValueChanged += new System.EventHandler(this.problemComboBox_SelectedValueChanged); 126 // 127 // refreshButton 128 // 129 this.refreshButton.Location = new System.Drawing.Point(0, 79); 130 this.refreshButton.Name = "refreshButton"; 131 this.refreshButton.Size = new System.Drawing.Size(75, 23); 132 this.refreshButton.TabIndex = 4; 133 this.refreshButton.Text = "&Refresh"; 134 this.refreshButton.UseVisualStyleBackColor = true; 135 this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); 136 // 137 // startButton 138 // 139 this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 140 this.startButton.Location = new System.Drawing.Point(81, 476); 141 this.startButton.Name = "startButton"; 142 this.startButton.Size = new System.Drawing.Size(75, 23); 143 this.startButton.TabIndex = 11; 144 this.startButton.Text = "Start"; 145 this.startButton.UseVisualStyleBackColor = true; 146 this.startButton.Click += new System.EventHandler(this.startButton_Click); 147 // 148 // pauseButton 149 // 150 this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 151 this.pauseButton.Location = new System.Drawing.Point(162, 476); 152 this.pauseButton.Name = "pauseButton"; 153 this.pauseButton.Size = new System.Drawing.Size(75, 23); 154 this.pauseButton.TabIndex = 12; 155 this.pauseButton.Text = "Pause"; 156 this.pauseButton.UseVisualStyleBackColor = true; 157 this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click); 158 // 159 // stopButton 160 // 161 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 162 this.stopButton.Location = new System.Drawing.Point(243, 476); 163 this.stopButton.Name = "stopButton"; 164 this.stopButton.Size = new System.Drawing.Size(75, 23); 165 this.stopButton.TabIndex = 13; 166 this.stopButton.Text = "Stop"; 167 this.stopButton.UseVisualStyleBackColor = true; 168 this.stopButton.Click += new System.EventHandler(this.stopButton_Click); 169 // 170 // prepareButton 171 // 172 this.prepareButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 173 this.prepareButton.Location = new System.Drawing.Point(0, 476); 174 this.prepareButton.Name = "prepareButton"; 175 this.prepareButton.Size = new System.Drawing.Size(75, 23); 176 this.prepareButton.TabIndex = 10; 177 this.prepareButton.Text = "Prepare"; 178 this.prepareButton.UseVisualStyleBackColor = true; 179 this.prepareButton.Click += new System.EventHandler(this.prepareButton_Click); 180 // 181 // executionTimeLabel 182 // 183 this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 184 this.executionTimeLabel.AutoSize = true; 185 this.executionTimeLabel.Location = new System.Drawing.Point(476, 482); 186 this.executionTimeLabel.Name = "executionTimeLabel"; 187 this.executionTimeLabel.Size = new System.Drawing.Size(83, 13); 188 this.executionTimeLabel.TabIndex = 14; 189 this.executionTimeLabel.Text = "&Execution Time:"; 190 // 191 // executionTimeTextBox 192 // 193 this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 194 this.executionTimeTextBox.Location = new System.Drawing.Point(565, 479); 195 this.executionTimeTextBox.Name = "executionTimeTextBox"; 196 this.executionTimeTextBox.ReadOnly = true; 197 this.executionTimeTextBox.Size = new System.Drawing.Size(145, 20); 198 this.executionTimeTextBox.TabIndex = 15; 199 // 200 // tabControl 201 // 202 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 203 | System.Windows.Forms.AnchorStyles.Left) 204 | System.Windows.Forms.AnchorStyles.Right))); 205 this.tabControl.Controls.Add(this.problemTabPage); 206 this.tabControl.Controls.Add(this.parametersTabPage); 207 this.tabControl.Controls.Add(this.resultsTabPage); 208 this.tabControl.Controls.Add(this.runsTabPage); 209 this.tabControl.Location = new System.Drawing.Point(0, 162); 210 this.tabControl.Name = "tabControl"; 211 this.tabControl.SelectedIndex = 0; 212 this.tabControl.Size = new System.Drawing.Size(710, 308); 213 this.tabControl.TabIndex = 9; 214 // 215 // problemTabPage 216 // 217 this.problemTabPage.Controls.Add(this.problemViewHost); 218 this.problemTabPage.Location = new System.Drawing.Point(4, 22); 219 this.problemTabPage.Name = "problemTabPage"; 220 this.problemTabPage.Padding = new System.Windows.Forms.Padding(3); 221 this.problemTabPage.Size = new System.Drawing.Size(702, 282); 222 this.problemTabPage.TabIndex = 0; 223 this.problemTabPage.Text = "Problem"; 224 this.problemTabPage.UseVisualStyleBackColor = true; 225 // 226 // parametersTabPage 227 // 228 this.parametersTabPage.Controls.Add(this.parametersViewHost); 229 this.parametersTabPage.Location = new System.Drawing.Point(4, 22); 230 this.parametersTabPage.Name = "parametersTabPage"; 231 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3); 232 this.parametersTabPage.Size = new System.Drawing.Size(702, 282); 233 this.parametersTabPage.TabIndex = 1; 234 this.parametersTabPage.Text = "Parameters"; 235 this.parametersTabPage.UseVisualStyleBackColor = true; 236 // 237 // resultsTabPage 238 // 239 this.resultsTabPage.Controls.Add(this.resultsViewHost); 240 this.resultsTabPage.Location = new System.Drawing.Point(4, 22); 241 this.resultsTabPage.Name = "resultsTabPage"; 242 this.resultsTabPage.Size = new System.Drawing.Size(702, 282); 243 this.resultsTabPage.TabIndex = 2; 244 this.resultsTabPage.Text = "Results"; 245 this.resultsTabPage.UseVisualStyleBackColor = true; 246 // 247 // runsTabPage 248 // 249 this.runsTabPage.Controls.Add(this.runsViewHost); 250 this.runsTabPage.Location = new System.Drawing.Point(4, 22); 251 this.runsTabPage.Name = "runsTabPage"; 252 this.runsTabPage.Size = new System.Drawing.Size(702, 282); 253 this.runsTabPage.TabIndex = 3; 254 this.runsTabPage.Text = "Runs"; 255 this.runsTabPage.UseVisualStyleBackColor = true; 256 // 257 // problemViewHost 258 // 259 this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 260 | System.Windows.Forms.AnchorStyles.Left) 261 | System.Windows.Forms.AnchorStyles.Right))); 262 this.problemViewHost.Caption = "View"; 263 this.problemViewHost.Content = null; 264 this.problemViewHost.Location = new System.Drawing.Point(6, 6); 265 this.problemViewHost.Name = "problemViewHost"; 266 this.problemViewHost.ReadOnly = false; 267 this.problemViewHost.Size = new System.Drawing.Size(690, 270); 268 this.problemViewHost.TabIndex = 0; 269 this.problemViewHost.ViewType = null; 270 // 271 // parametersViewHost 272 // 273 this.parametersViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 274 | System.Windows.Forms.AnchorStyles.Left) 275 | System.Windows.Forms.AnchorStyles.Right))); 276 this.parametersViewHost.Caption = "View"; 277 this.parametersViewHost.Content = null; 278 this.parametersViewHost.Location = new System.Drawing.Point(6, 6); 279 this.parametersViewHost.Name = "parametersViewHost"; 280 this.parametersViewHost.ReadOnly = false; 281 this.parametersViewHost.Size = new System.Drawing.Size(690, 270); 282 this.parametersViewHost.TabIndex = 1; 283 this.parametersViewHost.ViewType = null; 284 // 285 // resultsViewHost 286 // 287 this.resultsViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 288 | System.Windows.Forms.AnchorStyles.Left) 289 | System.Windows.Forms.AnchorStyles.Right))); 290 this.resultsViewHost.Caption = "View"; 291 this.resultsViewHost.Content = null; 292 this.resultsViewHost.Location = new System.Drawing.Point(6, 6); 293 this.resultsViewHost.Name = "resultsViewHost"; 294 this.resultsViewHost.ReadOnly = false; 295 this.resultsViewHost.Size = new System.Drawing.Size(690, 270); 296 this.resultsViewHost.TabIndex = 1; 297 this.resultsViewHost.ViewType = null; 298 // 299 // runsViewHost 300 // 301 this.runsViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 302 | System.Windows.Forms.AnchorStyles.Left) 303 | System.Windows.Forms.AnchorStyles.Right))); 304 this.runsViewHost.Caption = "View"; 305 this.runsViewHost.Content = null; 306 this.runsViewHost.Location = new System.Drawing.Point(6, 6); 307 this.runsViewHost.Name = "runsViewHost"; 308 this.runsViewHost.ReadOnly = false; 309 this.runsViewHost.Size = new System.Drawing.Size(690, 270); 310 this.runsViewHost.TabIndex = 1; 311 this.runsViewHost.ViewType = null; 59 312 // 60 313 // OKBExperimentView … … 62 315 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 63 316 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 317 this.Controls.Add(this.algorithmComboBox); 318 this.Controls.Add(this.problemComboBox); 319 this.Controls.Add(this.algorithmLabel); 320 this.Controls.Add(this.problemLabel); 321 this.Controls.Add(this.tabControl); 322 this.Controls.Add(this.refreshButton); 323 this.Controls.Add(this.prepareButton); 324 this.Controls.Add(this.startButton); 325 this.Controls.Add(this.executionTimeTextBox); 326 this.Controls.Add(this.pauseButton); 327 this.Controls.Add(this.stopButton); 328 this.Controls.Add(this.executionTimeLabel); 64 329 this.Name = "OKBExperimentView"; 65 this.Size = new System.Drawing.Size(535, 388); 330 this.Size = new System.Drawing.Size(710, 499); 331 this.Controls.SetChildIndex(this.executionTimeLabel, 0); 332 this.Controls.SetChildIndex(this.stopButton, 0); 333 this.Controls.SetChildIndex(this.pauseButton, 0); 334 this.Controls.SetChildIndex(this.executionTimeTextBox, 0); 335 this.Controls.SetChildIndex(this.startButton, 0); 336 this.Controls.SetChildIndex(this.prepareButton, 0); 337 this.Controls.SetChildIndex(this.refreshButton, 0); 338 this.Controls.SetChildIndex(this.tabControl, 0); 339 this.Controls.SetChildIndex(this.problemLabel, 0); 340 this.Controls.SetChildIndex(this.algorithmLabel, 0); 341 this.Controls.SetChildIndex(this.problemComboBox, 0); 342 this.Controls.SetChildIndex(this.algorithmComboBox, 0); 343 this.Controls.SetChildIndex(this.nameLabel, 0); 344 this.Controls.SetChildIndex(this.descriptionLabel, 0); 345 this.Controls.SetChildIndex(this.nameTextBox, 0); 346 this.Controls.SetChildIndex(this.descriptionTextBox, 0); 66 347 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 348 this.tabControl.ResumeLayout(false); 349 this.problemTabPage.ResumeLayout(false); 350 this.parametersTabPage.ResumeLayout(false); 351 this.resultsTabPage.ResumeLayout(false); 352 this.runsTabPage.ResumeLayout(false); 67 353 this.ResumeLayout(false); 68 354 this.PerformLayout(); … … 72 358 #endregion 73 359 360 private System.Windows.Forms.Label algorithmLabel; 361 private System.Windows.Forms.Label problemLabel; 362 private System.Windows.Forms.ComboBox algorithmComboBox; 363 private System.Windows.Forms.ComboBox problemComboBox; 364 private System.Windows.Forms.Button refreshButton; 365 private System.Windows.Forms.Button startButton; 366 private System.Windows.Forms.Button pauseButton; 367 private System.Windows.Forms.Button stopButton; 368 private System.Windows.Forms.Button prepareButton; 369 private System.Windows.Forms.Label executionTimeLabel; 370 private System.Windows.Forms.TextBox executionTimeTextBox; 371 private System.Windows.Forms.TabControl tabControl; 372 private System.Windows.Forms.TabPage problemTabPage; 373 private System.Windows.Forms.TabPage parametersTabPage; 374 private MainForm.WindowsForms.ViewHost problemViewHost; 375 private MainForm.WindowsForms.ViewHost parametersViewHost; 376 private System.Windows.Forms.TabPage resultsTabPage; 377 private MainForm.WindowsForms.ViewHost resultsViewHost; 378 private System.Windows.Forms.TabPage runsTabPage; 379 private MainForm.WindowsForms.ViewHost runsViewHost; 380 74 381 75 382 -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBExperimentView.cs
r4548 r4549 20 20 #endregion 21 21 22 using System; 23 using System.Linq; 22 24 using System.Windows.Forms; 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 23 27 using HeuristicLab.Core.Views; 24 28 using HeuristicLab.MainForm; 25 29 using HeuristicLab.MainForm.WindowsForms; 30 using HeuristicLab.PluginInfrastructure; 26 31 27 32 namespace HeuristicLab.Clients.OKB { 28 33 [View("OKBItem View")] 29 34 [Content(typeof(OKBExperiment), true)] 30 public partial class OKBExperimentView : NamedItemView {35 public sealed partial class OKBExperimentView : NamedItemView { 31 36 public new OKBExperiment Content { 32 37 get { return (OKBExperiment)base.Content; } … … 38 43 } 39 44 45 protected override void OnInitialized(System.EventArgs e) { 46 base.OnInitialized(e); 47 OKBClient.Instance.Refreshing += new EventHandler(OKBClient_Refreshing); 48 OKBClient.Instance.Refreshed += new EventHandler(OKBClient_Refreshed); 49 PopulateComboBoxes(); 50 } 51 40 52 protected override void DeregisterContentEvents() { 41 // ... 53 Content.Changed -= new EventHandler(Content_Changed); 54 Content.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred); 55 Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged); 56 Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged); 57 Content.Prepared -= new EventHandler(Content_Prepared); 58 Content.Started -= new EventHandler(Content_Started); 59 Content.Paused -= new EventHandler(Content_Paused); 60 Content.Stopped -= new EventHandler(Content_Stopped); 42 61 base.DeregisterContentEvents(); 43 62 } 44 63 protected override void RegisterContentEvents() { 45 64 base.RegisterContentEvents(); 46 // ... 47 } 48 65 Content.Changed += new EventHandler(Content_Changed); 66 Content.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred); 67 Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged); 68 Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged); 69 Content.Prepared += new EventHandler(Content_Prepared); 70 Content.Started += new EventHandler(Content_Started); 71 Content.Paused += new EventHandler(Content_Paused); 72 Content.Stopped += new EventHandler(Content_Stopped); 73 } 74 75 protected override void OnContentChanged() { 76 base.OnContentChanged(); 77 if (Content == null) { 78 problemViewHost.Content = null; 79 parametersViewHost.Content = null; 80 resultsViewHost.Content = null; 81 runsViewHost.Content = null; 82 executionTimeTextBox.Text = "-"; 83 } else { 84 problemViewHost.Content = Content.Problem; 85 parametersViewHost.Content = Content.Parameters; 86 resultsViewHost.Content = Content.Results; 87 runsViewHost.Content = Content.Runs; 88 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 89 } 90 } 49 91 protected override void SetEnabledStateOfControls() { 50 92 base.SetEnabledStateOfControls(); 51 // ... 52 } 93 executionTimeTextBox.Enabled = Content != null; 94 SetEnabledStateOfExecutableButtons(); 95 } 96 97 private void PopulateComboBoxes() { 98 Platform platform = OKBClient.Instance.Platforms.FirstOrDefault(x => x.Name == "HeuristicLab 3.3"); 99 if (platform != null) { 100 algorithmComboBox.DataSource = OKBClient.Instance.Algorithms.Where(x => x.PlatformId == platform.Id).ToList(); 101 algorithmComboBox.DisplayMember = "Name"; 102 problemComboBox.DataSource = OKBClient.Instance.Problems.Where(x => x.PlatformId == platform.Id).ToList(); 103 problemComboBox.DisplayMember = "Name"; 104 } 105 } 106 107 protected override void OnClosed(FormClosedEventArgs e) { 108 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop(); 109 base.OnClosed(e); 110 } 111 112 private void OKBClient_Refreshing(object sender, EventArgs e) { 113 if (InvokeRequired) { 114 Invoke(new EventHandler(OKBClient_Refreshing), sender, e); 115 } else { 116 Cursor = Cursors.AppStarting; 117 Enabled = false; 118 } 119 } 120 private void OKBClient_Refreshed(object sender, EventArgs e) { 121 if (InvokeRequired) { 122 Invoke(new EventHandler(OKBClient_Refreshed), sender, e); 123 } else { 124 PopulateComboBoxes(); 125 Enabled = true; 126 Cursor = Cursors.Default; 127 } 128 } 129 130 #region Content Events 131 private void Content_Changed(object sender, EventArgs e) { 132 OnContentChanged(); 133 SetEnabledStateOfControls(); 134 } 135 private void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) { 136 if (InvokeRequired) 137 Invoke(new EventHandler<EventArgs<Exception>>(Content_ExceptionOccurred), sender, e); 138 else 139 ErrorHandling.ShowErrorDialog(this, e.Value); 140 } 141 private void Content_ExecutionStateChanged(object sender, EventArgs e) { 142 if (InvokeRequired) 143 Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e); 144 else 145 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = prepareButton.Enabled = false; 146 } 147 private void Content_ExecutionTimeChanged(object sender, EventArgs e) { 148 if (InvokeRequired) 149 Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e); 150 else 151 executionTimeTextBox.Text = Content == null ? "-" : Content.ExecutionTime.ToString(); 152 } 153 private void Content_Prepared(object sender, EventArgs e) { 154 if (InvokeRequired) 155 Invoke(new EventHandler(Content_Prepared), sender, e); 156 else { 157 ReadOnly = Locked = false; 158 SetEnabledStateOfExecutableButtons(); 159 } 160 } 161 private void Content_Started(object sender, EventArgs e) { 162 if (InvokeRequired) 163 Invoke(new EventHandler(Content_Started), sender, e); 164 else { 165 ReadOnly = Locked = true; 166 SetEnabledStateOfExecutableButtons(); 167 } 168 } 169 private void Content_Paused(object sender, EventArgs e) { 170 if (InvokeRequired) 171 Invoke(new EventHandler(Content_Paused), sender, e); 172 else { 173 ReadOnly = Locked = false; 174 SetEnabledStateOfExecutableButtons(); 175 } 176 } 177 private void Content_Stopped(object sender, EventArgs e) { 178 if (InvokeRequired) 179 Invoke(new EventHandler(Content_Stopped), sender, e); 180 else { 181 ReadOnly = Locked = false; 182 SetEnabledStateOfExecutableButtons(); 183 } 184 } 185 #endregion 186 187 #region Control Events 188 private void refreshButton_Click(object sender, System.EventArgs e) { 189 OKBClient.Instance.Refresh(); 190 } 191 private void algorithmComboBox_SelectedValueChanged(object sender, System.EventArgs e) { 192 Algorithm algorithm = algorithmComboBox.SelectedValue as Algorithm; 193 if ((algorithm != null) && (Content != null)) { 194 Content.LoadAlgorithm(algorithm.Id); 195 } 196 } 197 private void problemComboBox_SelectedValueChanged(object sender, System.EventArgs e) { 198 Problem problem = problemComboBox.SelectedValue as Problem; 199 if ((problem != null) && (Content != null)) { 200 Content.LoadProblem(problem.Id); 201 } 202 } 203 private void prepareButton_Click(object sender, EventArgs e) { 204 Content.Prepare(false); 205 } 206 private void startButton_Click(object sender, EventArgs e) { 207 Content.Start(); 208 } 209 private void pauseButton_Click(object sender, EventArgs e) { 210 Content.Pause(); 211 } 212 private void stopButton_Click(object sender, EventArgs e) { 213 Content.Stop(); 214 } 215 #endregion 216 217 #region Helpers 218 private void SetEnabledStateOfExecutableButtons() { 219 if (Content == null) { 220 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = prepareButton.Enabled = false; 221 } else { 222 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 223 pauseButton.Enabled = Content.ExecutionState == ExecutionState.Started; 224 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 225 prepareButton.Enabled = Content.ExecutionState != ExecutionState.Started; 226 } 227 } 228 #endregion 53 229 } 54 230 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/ProblemDataView.cs
r4548 r4549 60 60 protected override void OnInitialized(System.EventArgs e) { 61 61 base.OnInitialized(e); 62 dataTypeComboBox.DataSource = OKB .Instance.DataTypes.ToList();62 dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.ToList(); 63 63 dataTypeComboBox.SelectedIndex = -1; 64 64 } … … 80 80 noViewAvailableLabel.Visible = false; 81 81 } else { 82 dataTypeComboBox.SelectedItem = OKB .Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);82 dataTypeComboBox.SelectedItem = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId); 83 83 84 84 using (MemoryStream stream = new MemoryStream(Content.Data)) { … … 111 111 switch (e.PropertyName) { 112 112 case "DataTypeId": 113 dataTypeComboBox.SelectedItem = OKB .Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId);113 dataTypeComboBox.SelectedItem = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId); 114 114 break; 115 115 } … … 119 119 BeginAsyncCall(); 120 120 var call = new Action(delegate() { 121 ProblemData data = OKB .Instance.GetProblemData(ProblemId);121 ProblemData data = OKBClient.Instance.GetProblemData(ProblemId); 122 122 Content = data; 123 123 }); … … 141 141 } 142 142 } 143 OKB .Instance.UpdateProblemData(Content);143 OKBClient.Instance.UpdateProblemData(Content); 144 144 } 145 145 private void newDataButton_Click(object sender, EventArgs e) { … … 152 152 if (Content == null) Content = new ProblemData { ProblemId = ProblemId }; 153 153 viewHost.Content = (IContent)dialog.TypeSelector.CreateInstanceOfSelectedType(); 154 DataType dataType = OKB .Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);154 DataType dataType = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName); 155 155 if (dataType == null) { 156 156 dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" }; 157 dataType.PlatformId = OKB .Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;157 dataType.PlatformId = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id; 158 158 dataType.Store(); 159 OKB .Instance.DataTypes.Add(dataType);160 dataTypeComboBox.DataSource = OKB .Instance.DataTypes.OrderBy(d => d.Name).ToList();159 OKBClient.Instance.DataTypes.Add(dataType); 160 dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.OrderBy(d => d.Name).ToList(); 161 161 } 162 162 dataTypeComboBox.SelectedItem = dataType; … … 184 184 viewHost.Content = problem; 185 185 noViewAvailableLabel.Visible = false; 186 DataType dataType = OKB .Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName);186 DataType dataType = OKBClient.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName); 187 187 if (dataType == null) { 188 188 dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" }; 189 dataType.PlatformId = OKB .Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id;189 dataType.PlatformId = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id; 190 190 dataType.Store(); 191 OKB .Instance.DataTypes.Add(dataType);192 dataTypeComboBox.DataSource = OKB .Instance.DataTypes.OrderBy(d => d.Name).ToList();191 OKBClient.Instance.DataTypes.Add(dataType); 192 dataTypeComboBox.DataSource = OKBClient.Instance.DataTypes.OrderBy(d => d.Name).ToList(); 193 193 } 194 194 dataTypeComboBox.SelectedItem = dataType; -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/ProblemView.cs
r4548 r4549 42 42 protected override void OnInitialized(System.EventArgs e) { 43 43 base.OnInitialized(e); 44 platformComboBox.DataSource = OKB .Instance.Platforms.ToList();45 problemClassComboBox.DataSource = OKB .Instance.ProblemClasses.ToList();44 platformComboBox.DataSource = OKBClient.Instance.Platforms.ToList(); 45 problemClassComboBox.DataSource = OKBClient.Instance.ProblemClasses.ToList(); 46 46 } 47 47 … … 53 53 problemDataView.ProblemId = 0; 54 54 } else { 55 platformComboBox.SelectedItem = OKB .Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);56 problemClassComboBox.SelectedItem = OKB .Instance.ProblemClasses.FirstOrDefault(a => a.Id == Content.ProblemClassId);55 platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId); 56 problemClassComboBox.SelectedItem = OKBClient.Instance.ProblemClasses.FirstOrDefault(a => a.Id == Content.ProblemClassId); 57 57 problemDataView.ProblemId = Content.Id; 58 58 } … … 77 77 break; 78 78 case "PlatformId": 79 platformComboBox.SelectedItem = OKB .Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId);79 platformComboBox.SelectedItem = OKBClient.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId); 80 80 break; 81 81 case "ProblemClassId": 82 problemClassComboBox.SelectedItem = OKB .Instance.ProblemClasses.FirstOrDefault(a => a.Id == Content.ProblemClassId);82 problemClassComboBox.SelectedItem = OKBClient.Instance.ProblemClasses.FirstOrDefault(a => a.Id == Content.ProblemClassId); 83 83 break; 84 84 } … … 99 99 100 100 private void refreshUsersButton_Click(object sender, System.EventArgs e) { 101 Guid[] ids = OKB .Instance.GetProblemUsers(Content.Id);101 Guid[] ids = OKBClient.Instance.GetProblemUsers(Content.Id); 102 102 if (ids != null) { 103 List<User> users = OKB .Instance.Users.ToList();103 List<User> users = OKBClient.Instance.Users.ToList(); 104 104 usersListBox.DataSource = users; 105 105 usersListBox.DisplayMember = "Name"; … … 112 112 } 113 113 private void storeUsersButton_Click(object sender, System.EventArgs e) { 114 if (OKB .Instance.UpdateProblemUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray()))114 if (OKBClient.Instance.UpdateProblemUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray())) 115 115 storeUsersButton.Enabled = false; 116 116 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/app.config
r4548 r4549 7 7 openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 8 8 bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 9 maxBufferPoolSize="524288" maxReceivedMessageSize=" 65536"9 maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" 10 10 messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 11 11 allowCookies="false"> 12 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength=" 16384"12 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="200000000" 13 13 maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 14 14 <reliableSession ordered="true" inactivityTimeout="00:10:00"
Note: See TracChangeset
for help on using the changeset viewer.