Changeset 4553 for branches/OKB
- Timestamp:
- 10/05/10 01:14:31 (14 years ago)
- Location:
- branches/OKB/HeuristicLab.Clients.OKB-3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB/HeuristicLab.Clients.OKB-3.3/HeuristicLab.Clients.OKB-3.3.csproj
r4549 r4553 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>211 206 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 212 207 <PropertyGroup> -
branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBExperiment.cs
r4549 r4553 53 53 algorithm = value; 54 54 RegisterAlgorithmEvents(); 55 algorithm.Problem = Problem;55 if (algorithm != null) algorithm.Problem = Problem; 56 56 OnChanged(); 57 57 } 58 58 } 59 [Storable] 59 60 private long ProblemId { get; set; } 61 [Storable] 60 62 private IProblem problem; 61 63 public IProblem Problem { … … 68 70 } 69 71 72 public ExecutionState ExecutionState { 73 get { 74 if (Algorithm != null) return Algorithm.ExecutionState; 75 else return ExecutionState.Stopped; 76 } 77 } 78 public TimeSpan ExecutionTime { 79 get { 80 if (Algorithm != null) return Algorithm.ExecutionTime; 81 else return TimeSpan.Zero; 82 } 83 } 70 84 public IKeyedItemCollection<string, IParameter> Parameters { 71 85 get { … … 84 98 if (Algorithm != null) return Algorithm.Runs; 85 99 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 100 } 99 101 } … … 105 107 } 106 108 [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 } 109 private OKBExperiment(bool deserializing) 110 : base(deserializing) { 111 RegisterAlgorithmEvents(); 112 } 113 114 public void Load(Algorithm algorithm) { 115 if (algorithm == null) { 116 AlgorithmId = 0; 117 Algorithm = null; 118 } else { 119 AlgorithmId = algorithm.Id; 120 AlgorithmData algorithmData = OKBClient.Instance.GetAlgorithmData(algorithm.Id); 121 122 using (MemoryStream stream = new MemoryStream(algorithmData.Data)) { 123 Algorithm = XmlParser.Deserialize<IAlgorithm>(stream); 124 } 125 } 126 } 127 public void Load(Problem problem) { 128 if (problem == null) { 129 ProblemId = 0; 130 Problem = null; 131 } else { 132 ProblemId = problem.Id; 133 ProblemData problemData = OKBClient.Instance.GetProblemData(problem.Id); 134 135 using (MemoryStream stream = new MemoryStream(problemData.Data)) { 136 Problem = XmlParser.Deserialize<IProblem>(stream); 137 } 138 } 139 } 140 129 141 public void Prepare(bool clearRuns) { 130 142 if (Algorithm != null) Algorithm.Prepare(clearRuns); 131 143 } 132 144 public void Prepare() { 133 Algorithm.Prepare();145 if (Algorithm != null) Algorithm.Prepare(); 134 146 } 135 147 public void Start() { 136 Algorithm.Start(); 148 if (Algorithm != null) Algorithm.Start(); 149 } 150 public void Pause() { 151 if (Algorithm != null) Algorithm.Pause(); 137 152 } 138 153 public void Stop() { 139 Algorithm.Stop();154 if (Algorithm != null) Algorithm.Stop(); 140 155 } 141 156 -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBExperimentView.cs
r4549 r4553 91 91 protected override void SetEnabledStateOfControls() { 92 92 base.SetEnabledStateOfControls(); 93 algorithmComboBox.Enabled = (Content != null) && !ReadOnly && !Locked && (algorithmComboBox.Items.Count > 0); 94 problemComboBox.Enabled = (Content != null) && !ReadOnly && !Locked && (problemComboBox.Items.Count > 0); 95 tabControl.Enabled = Content != null; 93 96 executionTimeTextBox.Enabled = Content != null; 94 97 SetEnabledStateOfExecutableButtons(); … … 100 103 algorithmComboBox.DataSource = OKBClient.Instance.Algorithms.Where(x => x.PlatformId == platform.Id).ToList(); 101 104 algorithmComboBox.DisplayMember = "Name"; 105 algorithmComboBox.SelectedIndex = -1; 102 106 problemComboBox.DataSource = OKBClient.Instance.Problems.Where(x => x.PlatformId == platform.Id).ToList(); 103 107 problemComboBox.DisplayMember = "Name"; 108 problemComboBox.SelectedIndex = -1; 104 109 } 105 110 } … … 155 160 Invoke(new EventHandler(Content_Prepared), sender, e); 156 161 else { 162 resultsViewHost.Content = Content.Results; 157 163 ReadOnly = Locked = false; 158 164 SetEnabledStateOfExecutableButtons(); … … 191 197 private void algorithmComboBox_SelectedValueChanged(object sender, System.EventArgs e) { 192 198 Algorithm algorithm = algorithmComboBox.SelectedValue as Algorithm; 193 if ((algorithm != null) && (Content != null)) { 194 Content.LoadAlgorithm(algorithm.Id); 195 } 199 if (Content != null) Content.Load(algorithm); 196 200 } 197 201 private void problemComboBox_SelectedValueChanged(object sender, System.EventArgs e) { 198 202 Problem problem = problemComboBox.SelectedValue as Problem; 199 if ((problem != null) && (Content != null)) { 200 Content.LoadProblem(problem.Id); 201 } 203 if (Content != null) Content.Load(problem); 202 204 } 203 205 private void prepareButton_Click(object sender, EventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.