- Timestamp:
- 05/16/12 15:40:36 (12 years ago)
- Location:
- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/Views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/Views/OKBExperimentUploadView.Designer.cs
r7742 r7839 53 53 // dataGridView 54 54 // 55 this.dataGridView.AllowDrop = true; 55 56 this.dataGridView.AllowUserToAddRows = false; 56 57 this.dataGridView.AllowUserToDeleteRows = false; … … 75 76 this.dataGridView.TabIndex = 2; 76 77 this.dataGridView.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView_CellMouseClick); 78 this.dataGridView.DragDrop += new System.Windows.Forms.DragEventHandler(this.dataGridView_DragDrop); 79 this.dataGridView.DragEnter += new System.Windows.Forms.DragEventHandler(this.dataGridView_DragEnter); 77 80 // 78 81 // RunNameColumn … … 136 139 // OKBExperimentUploadView 137 140 // 141 this.AllowDrop = true; 138 142 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 139 143 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; -
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/Views/OKBExperimentUploadView.cs
r7742 r7839 35 35 namespace HeuristicLab.Clients.OKB.RunCreation { 36 36 [View("OKBExperimentUpload View")] 37 [Content(typeof(Experiment), false)]38 37 [Content(typeof(RunCollection), false)] 39 38 [Content(typeof(IOptimizer), false)] 40 39 public partial class OKBExperimentUploadView : ItemView { 41 public new I ItemContent {42 get { return base.Content; }40 public new IOptimizer Content { 41 get { return (IOptimizer)base.Content; } 43 42 set { 44 43 base.Content = value; … … 69 68 ClearRuns(); 70 69 } else { 71 if (Content is Experiment) { 72 runs.AddRange((Content as Experiment).Runs); 73 } else if (Content is RunCollection) { 74 runs.AddRange((Content as RunCollection)); 75 } else if (Content is IOptimizer) { 76 runs.AddRange((Content as IOptimizer).Runs); 77 } 78 70 AddRuns(Content); 79 71 DisplayRuns(); 72 } 73 } 74 75 private void AddRuns(IItem item) { 76 if (item is Experiment) { 77 runs.AddRange((item as Experiment).Runs); 78 } else if (item is RunCollection) { 79 runs.AddRange((item as RunCollection)); 80 } else if (item is IOptimizer) { 81 runs.AddRange((item as IOptimizer).Runs); 82 } else if (item is IRun) { 83 runs.Add(item as IRun); 80 84 } 81 85 } … … 124 128 cmbProblem.DisplayMember = "Name"; 125 129 130 dataGridView.Rows.Clear(); 126 131 foreach (IRun run in runs) { 127 132 int idx = dataGridView.Rows.Add(run.Name); … … 268 273 selectedProblem = null; 269 274 } 275 276 private void dataGridView_DragEnter(object sender, DragEventArgs e) { 277 e.Effect = DragDropEffects.None; 278 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun 279 || e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IOptimizer) { 280 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 281 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key 282 else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy; 283 else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move; 284 else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link; 285 } 286 } 287 288 private void dataGridView_DragDrop(object sender, DragEventArgs e) { 289 if (e.Effect != DragDropEffects.None) { 290 IItem optimizer = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IItem; 291 if (e.Effect.HasFlag(DragDropEffects.Copy)) optimizer = (IItem)optimizer.Clone(); 292 AddRuns(optimizer); 293 DisplayRuns(); 294 } 295 } 270 296 } 271 297 }
Note: See TracChangeset
for help on using the changeset viewer.