- Timestamp:
- 09/07/12 11:01:10 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/ProblemDataView.Designer.cs
r8578 r8593 27 27 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 28 28 this.SuspendLayout(); 29 // 30 // parameterCollectionView 31 // 32 this.parameterCollectionView.AllowDrop = true; 33 this.parameterCollectionView.DragDrop += new System.Windows.Forms.DragEventHandler(this.parameterCollectionView_DragDrop); 34 this.parameterCollectionView.DragEnter += new System.Windows.Forms.DragEventHandler(this.parameterCollectionView_DragEnterOver); 35 this.parameterCollectionView.DragOver += new System.Windows.Forms.DragEventHandler(this.parameterCollectionView_DragEnterOver); 29 36 // 30 37 // nameTextBox -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/ProblemDataView.cs
r8578 r8593 20 20 #endregion 21 21 22 using System; 23 using System.Linq; 24 using System.Text; 22 25 using System.Windows.Forms; 26 using HeuristicLab.Core; 23 27 using HeuristicLab.Core.Views; 28 using HeuristicLab.Data; 24 29 using HeuristicLab.MainForm; 25 30 using HeuristicLab.MainForm.WindowsForms; … … 39 44 } 40 45 41 pr ivatevoid FeatureCorrelationButton_Click(object sender, System.EventArgs e) {46 protected void FeatureCorrelationButton_Click(object sender, System.EventArgs e) { 42 47 ViewHost viewHost = new ViewHost(); 43 48 viewHost.Content = (DataAnalysisProblemData)this.Content.Clone(); … … 45 50 viewHost.Show(); 46 51 } 52 53 protected void parameterCollectionView_DragDrop(object sender, DragEventArgs e) { 54 if (e.Effect != DragDropEffects.None) { 55 var stringValueList = (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IFixedValueParameter).Value as ICheckedItemList<StringValue>; 56 SetInputVariables(stringValueList); 57 } 58 } 59 60 private void SetInputVariables(ICheckedItemList<StringValue> stringValueList) { 61 var inputVariables = Content.InputVariables; 62 var stringValues = stringValueList.Select(x => x.Value); 63 var notContainedVariables = inputVariables.Where(x => !stringValues.Contains(x.Value)); 64 65 if (notContainedVariables.Count() != 0) { 66 StringBuilder strBuilder = new StringBuilder(); 67 foreach (var variable in notContainedVariables) { 68 strBuilder.Append(variable.Value + ", "); 69 } 70 strBuilder.Remove(strBuilder.Length - 2, 2); 71 MessageBox.Show(String.Format("There was an error while changing the input variables. The following input " + 72 "variables have not been contained {0}", strBuilder.ToString()), "Error while changing the input variables", 73 MessageBoxButtons.OK, MessageBoxIcon.Warning); 74 } else { 75 var checkedItems = stringValueList.CheckedItems.Select(x => x.Value.Value); 76 var setChecked = inputVariables.Where(x => checkedItems.Contains(x.Value)); 77 foreach (var variable in inputVariables) { 78 if (setChecked.Contains(variable) && !inputVariables.ItemChecked(variable)) { 79 inputVariables.SetItemCheckedState(variable, true); 80 } else if (!setChecked.Contains(variable) && inputVariables.ItemChecked(variable)) { 81 inputVariables.SetItemCheckedState(variable, false); 82 } 83 } 84 } 85 } 86 87 protected void parameterCollectionView_DragEnterOver(object sender, DragEventArgs e) { 88 e.Effect = DragDropEffects.None; 89 if (ReadOnly) 90 return; 91 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) == null) 92 return; 93 94 var parameter = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IFixedValueParameter; 95 if (parameter == null) 96 return; 97 98 var stringValueList = parameter.Value as ICheckedItemList<StringValue>; 99 if (stringValueList == null) 100 return; 101 102 e.Effect = e.AllowedEffect; 103 } 47 104 } 48 105 }
Note: See TracChangeset
for help on using the changeset viewer.