- Timestamp:
- 11/28/12 11:03:38 (12 years ago)
- Location:
- branches/RuntimeOptimizer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.Designer.cs
r8956 r8961 38 38 this.timeLimitTextBox = new System.Windows.Forms.TextBox(); 39 39 this.label1 = new System.Windows.Forms.Label(); 40 this.snap ShotsTextBox = new System.Windows.Forms.TextBox();40 this.snapshotsTextBox = new System.Windows.Forms.TextBox(); 41 41 this.storeAlgorithmInEachSnapshotCheckBox = new System.Windows.Forms.CheckBox(); 42 42 this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl(); … … 61 61 // 62 62 this.startButton.Location = new System.Drawing.Point(0, 440); 63 this.startButton.TabIndex = 9; 63 64 this.toolTip.SetToolTip(this.startButton, "Start/Resume Optimizer"); 64 65 // 65 66 // executionTimeTextBox 66 67 // 67 this.executionTimeTextBox.Location = new System.Drawing.Point( 295, 444);68 this.executionTimeTextBox.Location = new System.Drawing.Point(412, 444); 68 69 // 69 70 // executionTimeLabel 70 71 // 71 this.executionTimeLabel.Location = new System.Drawing.Point( 206, 447);72 this.executionTimeLabel.Location = new System.Drawing.Point(323, 447); 72 73 // 73 74 // pauseButton 74 75 // 75 76 this.pauseButton.Location = new System.Drawing.Point(30, 440); 77 this.pauseButton.TabIndex = 10; 76 78 this.toolTip.SetToolTip(this.pauseButton, "Pause Optimizer"); 77 79 // … … 79 81 // 80 82 this.stopButton.Location = new System.Drawing.Point(60, 440); 83 this.stopButton.TabIndex = 11; 81 84 this.toolTip.SetToolTip(this.stopButton, "Stop Optimizer"); 82 85 // … … 84 87 // 85 88 this.resetButton.Location = new System.Drawing.Point(90, 440); 89 this.resetButton.TabIndex = 12; 86 90 this.toolTip.SetToolTip(this.resetButton, "Reset Optimizer"); 87 91 // … … 91 95 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 92 96 this.nameTextBox.Location = new System.Drawing.Point(69, 0); 93 this.nameTextBox.Size = new System.Drawing.Size(338, 20); 97 this.nameTextBox.Size = new System.Drawing.Size(455, 20); 98 // 99 // infoLabel 100 // 101 this.infoLabel.Location = new System.Drawing.Point(530, 3); 94 102 // 95 103 // timeLimitLabel … … 99 107 this.timeLimitLabel.Name = "timeLimitLabel"; 100 108 this.timeLimitLabel.Size = new System.Drawing.Size(53, 13); 101 this.timeLimitLabel.TabIndex = 16;109 this.timeLimitLabel.TabIndex = 3; 102 110 this.timeLimitLabel.Text = "Time limit:"; 103 111 // 104 112 // timeLimitTextBox 105 113 // 106 this.timeLimitTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 114 this.timeLimitTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 107 115 | System.Windows.Forms.AnchorStyles.Right))); 108 116 this.timeLimitTextBox.Location = new System.Drawing.Point(69, 26); 109 117 this.timeLimitTextBox.Name = "timeLimitTextBox"; 110 this.timeLimitTextBox.Size = new System.Drawing.Size( 338, 20);111 this.timeLimitTextBox.TabIndex = 17;118 this.timeLimitTextBox.Size = new System.Drawing.Size(455, 20); 119 this.timeLimitTextBox.TabIndex = 4; 112 120 this.timeLimitTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.timeLimitTextBox_Validating); 113 121 // … … 118 126 this.label1.Name = "label1"; 119 127 this.label1.Size = new System.Drawing.Size(60, 13); 120 this.label1.TabIndex = 16;128 this.label1.TabIndex = 5; 121 129 this.label1.Text = "Snapshots:"; 122 130 // 123 // snapShotsTextBox 124 // 125 this.snapShotsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 126 | System.Windows.Forms.AnchorStyles.Right))); 127 this.snapShotsTextBox.Location = new System.Drawing.Point(69, 52); 128 this.snapShotsTextBox.Name = "snapShotsTextBox"; 129 this.snapShotsTextBox.Size = new System.Drawing.Size(142, 20); 130 this.snapShotsTextBox.TabIndex = 17; 131 // snapshotsTextBox 132 // 133 this.snapshotsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 134 | System.Windows.Forms.AnchorStyles.Right))); 135 this.snapshotsTextBox.Location = new System.Drawing.Point(69, 52); 136 this.snapshotsTextBox.Name = "snapshotsTextBox"; 137 this.snapshotsTextBox.Size = new System.Drawing.Size(259, 20); 138 this.snapshotsTextBox.TabIndex = 6; 139 this.snapshotsTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.snapshotsTextBox_Validating); 131 140 // 132 141 // storeAlgorithmInEachSnapshotCheckBox … … 134 143 this.storeAlgorithmInEachSnapshotCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 135 144 this.storeAlgorithmInEachSnapshotCheckBox.AutoSize = true; 136 this.storeAlgorithmInEachSnapshotCheckBox.Location = new System.Drawing.Point( 223, 54);145 this.storeAlgorithmInEachSnapshotCheckBox.Location = new System.Drawing.Point(340, 54); 137 146 this.storeAlgorithmInEachSnapshotCheckBox.Name = "storeAlgorithmInEachSnapshotCheckBox"; 138 147 this.storeAlgorithmInEachSnapshotCheckBox.Size = new System.Drawing.Size(184, 17); 139 this.storeAlgorithmInEachSnapshotCheckBox.TabIndex = 18;148 this.storeAlgorithmInEachSnapshotCheckBox.TabIndex = 7; 140 149 this.storeAlgorithmInEachSnapshotCheckBox.Text = "Store Algorithm in Each Snapshot"; 141 150 this.storeAlgorithmInEachSnapshotCheckBox.UseVisualStyleBackColor = true; … … 145 154 // 146 155 this.tabControl.AllowDrop = true; 147 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 148 | System.Windows.Forms.AnchorStyles.Left) 156 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 157 | System.Windows.Forms.AnchorStyles.Left) 149 158 | System.Windows.Forms.AnchorStyles.Right))); 150 159 this.tabControl.Controls.Add(this.algorithmTabPage); … … 154 163 this.tabControl.Name = "tabControl"; 155 164 this.tabControl.SelectedIndex = 0; 156 this.tabControl.Size = new System.Drawing.Size( 429, 356);157 this.tabControl.TabIndex = 19;165 this.tabControl.Size = new System.Drawing.Size(546, 356); 166 this.tabControl.TabIndex = 8; 158 167 // 159 168 // algorithmTabPage … … 166 175 this.algorithmTabPage.Name = "algorithmTabPage"; 167 176 this.algorithmTabPage.Padding = new System.Windows.Forms.Padding(3); 168 this.algorithmTabPage.Size = new System.Drawing.Size( 421, 330);177 this.algorithmTabPage.Size = new System.Drawing.Size(538, 330); 169 178 this.algorithmTabPage.TabIndex = 1; 170 179 this.algorithmTabPage.Text = "Algorithm"; … … 176 185 // algorithmViewHost 177 186 // 178 this.algorithmViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 179 | System.Windows.Forms.AnchorStyles.Left) 187 this.algorithmViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 188 | System.Windows.Forms.AnchorStyles.Left) 180 189 | System.Windows.Forms.AnchorStyles.Right))); 181 190 this.algorithmViewHost.Caption = "View"; … … 185 194 this.algorithmViewHost.Name = "algorithmViewHost"; 186 195 this.algorithmViewHost.ReadOnly = false; 187 this.algorithmViewHost.Size = new System.Drawing.Size( 409, 288);188 this.algorithmViewHost.TabIndex = 3;196 this.algorithmViewHost.Size = new System.Drawing.Size(526, 288); 197 this.algorithmViewHost.TabIndex = 2; 189 198 this.algorithmViewHost.ViewsLabelVisible = true; 190 199 this.algorithmViewHost.ViewType = null; … … 192 201 // openAlgorithmButton 193 202 // 194 this.openAlgorithmButton.Image = ((System.Drawing.Image)(resources.GetObject("openAlgorithmButton.Image")));203 this.openAlgorithmButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Open; 195 204 this.openAlgorithmButton.Location = new System.Drawing.Point(36, 6); 196 205 this.openAlgorithmButton.Name = "openAlgorithmButton"; … … 203 212 // newAlgorithmButton 204 213 // 205 this.newAlgorithmButton.Image = ((System.Drawing.Image)(resources.GetObject("newAlgorithmButton.Image")));214 this.newAlgorithmButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.NewDocument; 206 215 this.newAlgorithmButton.Location = new System.Drawing.Point(6, 6); 207 216 this.newAlgorithmButton.Name = "newAlgorithmButton"; … … 218 227 this.snapshotsTabPage.Name = "snapshotsTabPage"; 219 228 this.snapshotsTabPage.Padding = new System.Windows.Forms.Padding(3); 220 this.snapshotsTabPage.Size = new System.Drawing.Size( 421, 330);229 this.snapshotsTabPage.Size = new System.Drawing.Size(538, 330); 221 230 this.snapshotsTabPage.TabIndex = 2; 222 231 this.snapshotsTabPage.Text = "Snapshots"; … … 225 234 // snapshotsView 226 235 // 227 this.snapshotsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 228 | System.Windows.Forms.AnchorStyles.Left) 236 this.snapshotsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 237 | System.Windows.Forms.AnchorStyles.Left) 229 238 | System.Windows.Forms.AnchorStyles.Right))); 230 239 this.snapshotsView.Caption = "RunCollection View"; … … 233 242 this.snapshotsView.Name = "snapshotsView"; 234 243 this.snapshotsView.ReadOnly = false; 235 this.snapshotsView.Size = new System.Drawing.Size( 409, 317);244 this.snapshotsView.Size = new System.Drawing.Size(526, 317); 236 245 this.snapshotsView.TabIndex = 0; 237 246 // … … 241 250 this.runsTabPage.Location = new System.Drawing.Point(4, 22); 242 251 this.runsTabPage.Name = "runsTabPage"; 243 this.runsTabPage.Size = new System.Drawing.Size( 421, 330);252 this.runsTabPage.Size = new System.Drawing.Size(538, 330); 244 253 this.runsTabPage.TabIndex = 3; 245 254 this.runsTabPage.Text = "Runs"; … … 248 257 // runsView 249 258 // 250 this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 251 | System.Windows.Forms.AnchorStyles.Left) 259 this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 260 | System.Windows.Forms.AnchorStyles.Left) 252 261 | System.Windows.Forms.AnchorStyles.Right))); 253 262 this.runsView.Caption = "RunCollection View"; … … 256 265 this.runsView.Name = "runsView"; 257 266 this.runsView.ReadOnly = false; 258 this.runsView.Size = new System.Drawing.Size( 409, 317);267 this.runsView.Size = new System.Drawing.Size(526, 317); 259 268 this.runsView.TabIndex = 1; 260 269 // … … 272 281 this.snapshotButton.Name = "snapshotButton"; 273 282 this.snapshotButton.Size = new System.Drawing.Size(24, 24); 274 this.snapshotButton.TabIndex = 20;283 this.snapshotButton.TabIndex = 13; 275 284 this.snapshotButton.Text = "Snapshot"; 276 285 this.snapshotButton.UseVisualStyleBackColor = true; … … 285 294 this.Controls.Add(this.timeLimitLabel); 286 295 this.Controls.Add(this.label1); 287 this.Controls.Add(this.snap ShotsTextBox);296 this.Controls.Add(this.snapshotsTextBox); 288 297 this.Controls.Add(this.storeAlgorithmInEachSnapshotCheckBox); 289 298 this.Name = "TimeLimitRunView"; 290 this.Size = new System.Drawing.Size( 432, 464);299 this.Size = new System.Drawing.Size(549, 464); 291 300 this.Controls.SetChildIndex(this.storeAlgorithmInEachSnapshotCheckBox, 0); 292 this.Controls.SetChildIndex(this.snap ShotsTextBox, 0);301 this.Controls.SetChildIndex(this.snapshotsTextBox, 0); 293 302 this.Controls.SetChildIndex(this.label1, 0); 294 303 this.Controls.SetChildIndex(this.timeLimitLabel, 0); … … 320 329 private System.Windows.Forms.TextBox timeLimitTextBox; 321 330 private System.Windows.Forms.Label label1; 322 private System.Windows.Forms.TextBox snap ShotsTextBox;331 private System.Windows.Forms.TextBox snapshotsTextBox; 323 332 private System.Windows.Forms.CheckBox storeAlgorithmInEachSnapshotCheckBox; 324 333 private MainForm.WindowsForms.DragOverTabControl tabControl; -
branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.cs
r8956 r8961 24 24 using System.Linq; 25 25 using System.Windows.Forms; 26 using HeuristicLab.Collections; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Common.Resources; … … 60 61 protected override void DeregisterContentEvents() { 61 62 Content.PropertyChanged -= Content_PropertyChanged; 63 Content.SnapshotTimes.ItemsAdded -= Content_SnapshotTimes_Changed; 64 Content.SnapshotTimes.ItemsMoved -= Content_SnapshotTimes_Changed; 65 Content.SnapshotTimes.ItemsRemoved -= Content_SnapshotTimes_Changed; 66 Content.SnapshotTimes.ItemsReplaced -= Content_SnapshotTimes_Changed; 67 Content.SnapshotTimes.CollectionReset -= Content_SnapshotTimes_Changed; 62 68 base.DeregisterContentEvents(); 63 69 } … … 65 71 base.RegisterContentEvents(); 66 72 Content.PropertyChanged += Content_PropertyChanged; 73 Content.SnapshotTimes.ItemsAdded += Content_SnapshotTimes_Changed; 74 Content.SnapshotTimes.ItemsMoved += Content_SnapshotTimes_Changed; 75 Content.SnapshotTimes.ItemsRemoved += Content_SnapshotTimes_Changed; 76 Content.SnapshotTimes.ItemsReplaced += Content_SnapshotTimes_Changed; 77 Content.SnapshotTimes.CollectionReset += Content_SnapshotTimes_Changed; 67 78 } 68 79 … … 73 84 if (Content == null) { 74 85 timeLimitTextBox.Text = FormatTimeSpan(TimeSpan.FromSeconds(60)); 75 snap ShotsTextBox.Text = String.Empty;86 snapshotsTextBox.Text = String.Empty; 76 87 storeAlgorithmInEachSnapshotCheckBox.Checked = false; 77 88 algorithmViewHost.Content = null; … … 80 91 } else { 81 92 timeLimitTextBox.Text = FormatTimeSpan(Content.MaximumExecutionTime); 82 snap ShotsTextBox.Text = String.Join(" ; ", Content.SnapshotTimes);93 snapshotsTextBox.Text = String.Join(" ; ", Content.SnapshotTimes.Select(x => FormatTimeSpan(x, true))); 83 94 storeAlgorithmInEachSnapshotCheckBox.Checked = Content.StoreAlgorithmInEachSnapshot; 84 95 algorithmViewHost.Content = Content.Algorithm; … … 92 103 base.SetEnabledStateOfControls(); 93 104 timeLimitTextBox.Enabled = Content != null && !ReadOnly; 94 snap ShotsTextBox.Enabled = Content != null && !ReadOnly;105 snapshotsTextBox.Enabled = Content != null && !ReadOnly; 95 106 storeAlgorithmInEachSnapshotCheckBox.Enabled = Content != null && !ReadOnly; 96 107 newAlgorithmButton.Enabled = Content != null && !ReadOnly; … … 128 139 } finally { SuppressEvents = false; } 129 140 break; 130 case "SnapshotTimes": break; 141 case "SnapshotTimes": 142 SuppressEvents = true; 143 try { 144 snapshotsTextBox.Text = string.Join(" ; ", Content.SnapshotTimes.Select(x => FormatTimeSpan(x, true))); 145 Content.SnapshotTimes.ItemsAdded += Content_SnapshotTimes_Changed; 146 Content.SnapshotTimes.ItemsMoved += Content_SnapshotTimes_Changed; 147 Content.SnapshotTimes.ItemsRemoved += Content_SnapshotTimes_Changed; 148 Content.SnapshotTimes.ItemsReplaced += Content_SnapshotTimes_Changed; 149 Content.SnapshotTimes.CollectionReset += Content_SnapshotTimes_Changed; 150 } finally { SuppressEvents = false; } 151 break; 131 152 case "StoreAlgorithmInEachSnapshot": 132 153 SuppressEvents = true; … … 154 175 break; 155 176 } 177 } 178 179 private void Content_SnapshotTimes_Changed(object sender, EventArgs e) { 180 SuppressEvents = true; 181 try { 182 snapshotsTextBox.Text = string.Join(" ; ", Content.SnapshotTimes.Select(x => FormatTimeSpan(x, true))); 183 } finally { SuppressEvents = false; } 156 184 } 157 185 #endregion … … 160 188 private void timeLimitTextBox_Validating(object sender, CancelEventArgs e) { 161 189 if (SuppressEvents) return; 162 double value; 163 var text = timeLimitTextBox.Text.Trim(); 164 var length = text.Length; 165 while (!double.TryParse(text.Substring(0, length), out value)) { 166 length--; 167 if (length <= 0) { 168 value = double.NaN; 169 break; 170 } 171 } 172 if (double.IsNaN(value)) { 190 TimeSpan ts; 191 if (!TryGetTimeSpanFromFormat(timeLimitTextBox.Text, out ts)) { 173 192 e.Cancel = true; 174 193 errorProvider.SetError(timeLimitTextBox, "Please enter a valid time span, e.g. 60, 20s, 45 seconds, 3h, 1 hour, 4 d, 2 days"); 175 194 } else { 176 TimeSpan ts;177 if (length < text.Length) {178 ts = GetTimeSpanFromFormat(value, text.Substring(length - 1, text.Length - (length - 1)).TrimStart());179 } else ts = TimeSpan.FromSeconds(value);180 195 Content.MaximumExecutionTime = ts; 181 196 e.Cancel = false; 182 197 errorProvider.SetError(timeLimitTextBox, String.Empty); 183 198 } 199 } 200 201 private void snapshotsTextBox_Validating(object sender, CancelEventArgs e) { 202 if (SuppressEvents) return; 203 e.Cancel = false; 204 errorProvider.SetError(timeLimitTextBox, String.Empty); 205 206 var tokens = snapshotsTextBox.Text.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); 207 208 var snapshotTimes = new ObservableList<TimeSpan>(); 209 foreach (var t in tokens) { 210 TimeSpan value; 211 if (!TryGetTimeSpanFromFormat(t, out value)) { 212 e.Cancel = true; 213 errorProvider.SetError(snapshotsTextBox, "Error parsing " + t + ", please provide a valid time span, e.g. 60, 20s, 45 seconds, 3h, 1 hour, 4 d, 2 days"); 214 return; 215 } else { 216 snapshotTimes.Add(value); 217 } 218 } 219 Content.SnapshotTimes = snapshotTimes; 184 220 } 185 221 … … 258 294 #endregion 259 295 260 private string FormatTimeSpan(TimeSpan ts) { 261 if (ts.TotalSeconds < 180) return ts.TotalSeconds + " seconds"; 262 if (ts.TotalMinutes < 180) return ts.TotalMinutes + " minutes"; 263 if (ts.TotalHours < 96) return ts.TotalHours + " hours"; 264 return ts.TotalDays + " days"; 265 } 266 267 private TimeSpan GetTimeSpanFromFormat(double value, string text) { 268 switch (text) { 269 case "d": 270 case "day": 271 case "days": return TimeSpan.FromDays(value); 272 case "h": 273 case "hour": 274 case "hours": return TimeSpan.FromHours(value); 275 case "min": 276 case "minute": 277 case "minutes": return TimeSpan.FromMinutes(value); 278 default: return TimeSpan.FromSeconds(value); 296 private string FormatTimeSpan(TimeSpan ts, bool abbrevUnit = false) { 297 if (ts.TotalSeconds < 180) return ts.TotalSeconds + (abbrevUnit ? "s" : " seconds"); 298 if (ts.TotalMinutes < 180) return ts.TotalMinutes + (abbrevUnit ? "min" : " minutes"); 299 if (ts.TotalHours < 96) return ts.TotalHours + (abbrevUnit ? "h" : " hours"); 300 return ts.TotalDays + (abbrevUnit ? "d" : " days"); 301 } 302 303 private bool TryGetTimeSpanFromFormat(string text, out TimeSpan result) { 304 double value; 305 text = text.Trim(); 306 var length = text.Length; 307 while (!double.TryParse(text.Substring(0, length), out value)) { 308 length--; 309 if (length <= 0) { 310 value = double.NaN; 311 break; 312 } 313 } 314 if (double.IsNaN(value)) { 315 result = TimeSpan.Zero; 316 return false; 317 } else { 318 var remaining = String.Empty; 319 if (length < text.Length) remaining = text.Substring(length, text.Length - length); 320 switch (remaining.Trim()) { 321 case "d": 322 case "day": 323 case "days": result = TimeSpan.FromDays(value); break; 324 case "h": 325 case "hour": 326 case "hours": result = TimeSpan.FromHours(value); break; 327 case "min": 328 case "minute": 329 case "minutes": result = TimeSpan.FromMinutes(value); break; 330 default: result = TimeSpan.FromSeconds(value); break; 331 } 332 return true; 279 333 } 280 334 } -
branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs
r8956 r8961 78 78 private int snapshotTimesIndex; 79 79 [Storable] 80 private ObservableList< double> snapshotTimes;81 public ObservableList< double> SnapshotTimes {80 private ObservableList<TimeSpan> snapshotTimes; 81 public ObservableList<TimeSpan> SnapshotTimes { 82 82 get { return snapshotTimes; } 83 83 set { … … 170 170 : base(original, cloner) { 171 171 maximumExecutionTime = original.maximumExecutionTime; 172 snapshotTimes = new ObservableList< double>(original.snapshotTimes);172 snapshotTimes = new ObservableList<TimeSpan>(original.snapshotTimes); 173 173 snapshotTimesIndex = original.snapshotTimesIndex; 174 174 snapshots = cloner.Clone(original.snapshots); … … 200 200 description = ItemDescription; 201 201 maximumExecutionTime = TimeSpan.FromMinutes(1); 202 snapshotTimes = new ObservableList< double>(new[] {203 TimeSpan.FromSeconds(5) .TotalMilliseconds,204 TimeSpan.FromSeconds(10) .TotalMilliseconds,205 TimeSpan.FromSeconds(30) .TotalMilliseconds});202 snapshotTimes = new ObservableList<TimeSpan>(new[] { 203 TimeSpan.FromSeconds(5), 204 TimeSpan.FromSeconds(10), 205 TimeSpan.FromSeconds(30) }); 206 206 snapshotTimesIndex = 0; 207 207 snapTimer = new Timer() { … … 223 223 description = ItemDescription; 224 224 maximumExecutionTime = TimeSpan.FromMinutes(1); 225 snapshotTimes = new ObservableList< double>(new[] {226 TimeSpan.FromSeconds(5) .TotalMilliseconds,227 TimeSpan.FromSeconds(10) .TotalMilliseconds,228 TimeSpan.FromSeconds(30) .TotalMilliseconds});225 snapshotTimes = new ObservableList<TimeSpan>(new[] { 226 TimeSpan.FromSeconds(5), 227 TimeSpan.FromSeconds(10), 228 TimeSpan.FromSeconds(30) }); 229 229 snapshotTimesIndex = 0; 230 230 snapTimer = new Timer() { … … 245 245 : base(name, description) { 246 246 maximumExecutionTime = TimeSpan.FromMinutes(1); 247 snapshotTimes = new ObservableList< double>(new[] {248 TimeSpan.FromSeconds(5) .TotalMilliseconds,249 TimeSpan.FromSeconds(10) .TotalMilliseconds,250 TimeSpan.FromSeconds(30) .TotalMilliseconds});247 snapshotTimes = new ObservableList<TimeSpan>(new[] { 248 TimeSpan.FromSeconds(5), 249 TimeSpan.FromSeconds(10), 250 TimeSpan.FromSeconds(30) }); 251 251 snapshotTimesIndex = 0; 252 252 snapTimer = new Timer() { … … 320 320 var execTime = ExecutionTime; 321 321 if (snapshotTimesIndex < SnapshotTimes.Count && 322 SnapshotTimes[snapshotTimesIndex] <= execTime .TotalMilliseconds) {322 SnapshotTimes[snapshotTimesIndex] <= execTime) { 323 323 DoSnapshot(); 324 324 snapshotTimesIndex++; … … 345 345 private void FindNextSnapshotTimeIndex(TimeSpan reference) { 346 346 var index = 0; 347 while (index < snapshotTimes.Count && (snapshotTimes[index] - reference.TotalMilliseconds) <= 0) {347 while (index < snapshotTimes.Count && snapshotTimes[index] <= reference) { 348 348 index++; 349 349 };
Note: See TracChangeset
for help on using the changeset viewer.