Changeset 3407 for trunk/sources/HeuristicLab.Core.Views/3.3
- Timestamp:
- 04/19/10 03:28:16 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Core.Views/3.3
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs
r3362 r3407 279 279 } 280 280 281 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) 282 AddItem((T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType()); 281 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 282 try { 283 AddItem((T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType()); 284 } 285 catch (Exception ex) { 286 Auxiliary.ShowErrorMessageBox(ex); 287 } 288 } 283 289 } 284 290 private void sortAscendingButton_Click(object sender, EventArgs e) { -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.Designer.cs
r3362 r3407 36 36 protected override void Dispose(bool disposing) { 37 37 if (disposing) { 38 if (typeSelectorDialog != null) typeSelectorDialog.Dispose(); 38 39 foreach (ListViewItem listViewItem in itemsListView.Items) { 39 40 T item = listViewItem.Tag as T; -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs
r3393 r3407 36 36 [Content(typeof(IItemArray<>), false)] 37 37 public partial class ItemArrayView<T> : AsynchronousContentView where T : class, IItem { 38 protected TypeSelectorDialog typeSelectorDialog; 39 38 40 /// <summary> 39 41 /// Gets or sets the scope whose variables to represent visually. … … 128 130 129 131 protected virtual T CreateItem() { 130 try { 131 return (T)Activator.CreateInstance(typeof(T)); 132 } 133 catch (Exception ex) { 134 Auxiliary.ShowErrorMessageBox(ex); 135 return null; 136 } 132 if (typeSelectorDialog == null) { 133 typeSelectorDialog = new TypeSelectorDialog(); 134 typeSelectorDialog.Caption = "Select Item"; 135 typeSelectorDialog.TypeSelector.Caption = "Available Items"; 136 typeSelectorDialog.TypeSelector.Configure(typeof(T), false, false); 137 } 138 139 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 140 try { 141 return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 142 } 143 catch (Exception ex) { 144 Auxiliary.ShowErrorMessageBox(ex); 145 } 146 } 147 return null; 137 148 } 138 149 protected virtual ListViewItem CreateListViewItem(T item) { -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.Designer.cs
r3362 r3407 37 37 protected override void Dispose(bool disposing) { 38 38 if (disposing) { 39 if (typeSelectorDialog != null) typeSelectorDialog.Dispose(); 39 40 foreach (ListViewItem item in itemsListView.Items) { 40 41 ((T)item.Tag).ItemImageChanged -= new EventHandler(Item_ItemImageChanged); -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r3393 r3407 33 33 [Content(typeof(IItemCollection<>), false)] 34 34 public partial class ItemCollectionView<T> : AsynchronousContentView where T : class, IItem { 35 protected TypeSelectorDialog typeSelectorDialog; 36 35 37 public new IItemCollection<T> Content { 36 38 get { return (IItemCollection<T>)base.Content; } … … 103 105 104 106 protected virtual T CreateItem() { 105 try { 106 return (T)Activator.CreateInstance(typeof(T)); 107 } catch(Exception ex) { 108 Auxiliary.ShowErrorMessageBox(ex); 109 return null; 110 } 107 if (typeSelectorDialog == null) { 108 typeSelectorDialog = new TypeSelectorDialog(); 109 typeSelectorDialog.Caption = "Select Item"; 110 typeSelectorDialog.TypeSelector.Caption = "Available Items"; 111 typeSelectorDialog.TypeSelector.Configure(typeof(T), false, false); 112 } 113 114 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 115 try { 116 return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 117 } 118 catch (Exception ex) { 119 Auxiliary.ShowErrorMessageBox(ex); 120 } 121 } 122 return null; 111 123 } 112 124 protected virtual ListViewItem CreateListViewItem(T item) { -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.Designer.cs
r3362 r3407 36 36 protected override void Dispose(bool disposing) { 37 37 if (disposing) { 38 if (typeSelectorDialog != null) typeSelectorDialog.Dispose(); 38 39 foreach (ListViewItem item in itemsListView.Items) { 39 40 ((T)item.Tag).ItemImageChanged -= new EventHandler(Item_ItemImageChanged); -
trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs
r3393 r3407 36 36 [Content(typeof(IItemList<>), false)] 37 37 public partial class ItemListView<T> : AsynchronousContentView where T : class, IItem { 38 protected TypeSelectorDialog typeSelectorDialog; 39 38 40 /// <summary> 39 41 /// Gets or sets the scope whose variables to represent visually. … … 131 133 132 134 protected virtual T CreateItem() { 133 try { 134 return (T)Activator.CreateInstance(typeof(T)); 135 } 136 catch (Exception ex) { 137 Auxiliary.ShowErrorMessageBox(ex); 138 return null; 139 } 135 if (typeSelectorDialog == null) { 136 typeSelectorDialog = new TypeSelectorDialog(); 137 typeSelectorDialog.Caption = "Select Item"; 138 typeSelectorDialog.TypeSelector.Caption = "Available Items"; 139 typeSelectorDialog.TypeSelector.Configure(typeof(T), false, false); 140 } 141 142 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 143 try { 144 return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 145 } 146 catch (Exception ex) { 147 Auxiliary.ShowErrorMessageBox(ex); 148 } 149 } 150 return null; 140 151 } 141 152 protected virtual ListViewItem CreateListViewItem(T item) { -
trunk/sources/HeuristicLab.Core.Views/3.3/OperatorCollectionView.Designer.cs
r2655 r3407 1 namespace HeuristicLab.Core.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Core.Views { 2 23 partial class OperatorCollectionView { 3 24 /// <summary> … … 12 33 protected override void Dispose(bool disposing) { 13 34 if (disposing) { 14 if (typeSelectorDialog != null) typeSelectorDialog.Dispose();15 35 if (components != null) components.Dispose(); 16 36 } -
trunk/sources/HeuristicLab.Core.Views/3.3/OperatorCollectionView.cs
r3393 r3407 1 using System.Windows.Forms; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 23 using System.Windows.Forms; 2 24 using HeuristicLab.Collections; 3 25 using HeuristicLab.MainForm; … … 8 30 [Content(typeof(IItemCollection<IOperator>), false)] 9 31 public partial class OperatorCollectionView : ItemCollectionView<IOperator> { 10 protected TypeSelectorDialog typeSelectorDialog;11 12 32 /// <summary> 13 33 /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View". … … 32 52 if (typeSelectorDialog == null) { 33 53 typeSelectorDialog = new TypeSelectorDialog(); 54 typeSelectorDialog.Caption = "Select Operator"; 34 55 typeSelectorDialog.TypeSelector.Caption = "Available Operators"; 35 56 typeSelectorDialog.TypeSelector.Configure(typeof(IOperator), false, false); 36 57 } 37 58 38 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) 39 return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 40 else 41 return null; 59 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 60 try { 61 return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 62 } 63 catch (Exception ex) { 64 Auxiliary.ShowErrorMessageBox(ex); 65 } 66 } 67 return null; 42 68 } 43 69 } -
trunk/sources/HeuristicLab.Core.Views/3.3/OperatorListView.Designer.cs
r2655 r3407 1 namespace HeuristicLab.Core.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Core.Views { 2 23 partial class OperatorListView { 3 24 /// <summary> … … 12 33 protected override void Dispose(bool disposing) { 13 34 if (disposing) { 14 if (typeSelectorDialog != null) typeSelectorDialog.Dispose();15 35 if (components != null) components.Dispose(); 16 36 } -
trunk/sources/HeuristicLab.Core.Views/3.3/OperatorListView.cs
r3393 r3407 20 20 #endregion 21 21 22 using System; 22 23 using System.Windows.Forms; 23 24 using HeuristicLab.Collections; … … 29 30 [Content(typeof(IItemList<IOperator>), false)] 30 31 public partial class OperatorListView : ItemListView<IOperator> { 31 protected TypeSelectorDialog typeSelectorDialog;32 33 32 /// <summary> 34 33 /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View". … … 53 52 if (typeSelectorDialog == null) { 54 53 typeSelectorDialog = new TypeSelectorDialog(); 54 typeSelectorDialog.Caption = "Select Operator"; 55 55 typeSelectorDialog.TypeSelector.Caption = "Available Operators"; 56 56 typeSelectorDialog.TypeSelector.Configure(typeof(IOperator), false, false); 57 57 } 58 58 59 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) 60 return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 61 else 62 return null; 59 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 60 try { 61 return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 62 } 63 catch (Exception ex) { 64 Auxiliary.ShowErrorMessageBox(ex); 65 } 66 } 67 return null; 63 68 } 64 69 } -
trunk/sources/HeuristicLab.Core.Views/3.3/OperatorSetView.Designer.cs
r2655 r3407 1 namespace HeuristicLab.Core.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Core.Views { 2 23 partial class OperatorSetView { 3 24 /// <summary> … … 12 33 protected override void Dispose(bool disposing) { 13 34 if (disposing) { 14 if (typeSelectorDialog != null) typeSelectorDialog.Dispose();15 35 if (components != null) components.Dispose(); 16 36 } -
trunk/sources/HeuristicLab.Core.Views/3.3/OperatorSetView.cs
r3393 r3407 1 using System.Windows.Forms; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 23 using System.Windows.Forms; 2 24 using HeuristicLab.Collections; 3 25 using HeuristicLab.MainForm; … … 8 30 [Content(typeof(IItemSet<IOperator>), false)] 9 31 public partial class OperatorSetView : ItemSetView<IOperator> { 10 protected TypeSelectorDialog typeSelectorDialog;11 12 32 /// <summary> 13 33 /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View". … … 32 52 if (typeSelectorDialog == null) { 33 53 typeSelectorDialog = new TypeSelectorDialog(); 54 typeSelectorDialog.Caption = "Select Operator"; 34 55 typeSelectorDialog.TypeSelector.Caption = "Available Operators"; 35 56 typeSelectorDialog.TypeSelector.Configure(typeof(IOperator), false, false); 36 57 } 37 58 38 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) 39 return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 40 else 41 return null; 59 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 60 try { 61 return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 62 } 63 catch (Exception ex) { 64 Auxiliary.ShowErrorMessageBox(ex); 65 } 66 } 67 return null; 42 68 } 43 69 } -
trunk/sources/HeuristicLab.Core.Views/3.3/OperatorTreeView.cs
r3393 r3407 24 24 using System.ComponentModel; 25 25 using System.Drawing; 26 using System.Linq; 26 27 using System.Windows.Forms; 27 28 using HeuristicLab.Collections; … … 35 36 [Content(typeof(IOperator), false)] 36 37 public sealed partial class OperatorTreeView : ItemView { 37 private Dictionary<IValueParameter <IOperator>, List<TreeNode>> opParamNodeTable;38 private Dictionary<IValueParameter, List<TreeNode>> opParamNodeTable; 38 39 private Dictionary<IOperator, List<TreeNode>> operatorNodeTable; 39 40 private Dictionary<IKeyedItemCollection<string, IParameter>, IOperator> parametersOperatorTable; … … 66 67 InitializeComponent(); 67 68 graphTreeView.Sorted = true; 68 opParamNodeTable = new Dictionary<IValueParameter <IOperator>, List<TreeNode>>();69 opParamNodeTable = new Dictionary<IValueParameter, List<TreeNode>>(); 69 70 operatorNodeTable = new Dictionary<IOperator, List<TreeNode>>(); 70 71 parametersOperatorTable = new Dictionary<IKeyedItemCollection<string, IParameter>, IOperator>(); … … 116 117 117 118 #region TreeNode Management 118 private TreeNode CreateTreeNode(IValueParameter <IOperator>opParam) {119 private TreeNode CreateTreeNode(IValueParameter opParam) { 119 120 TreeNode node = new TreeNode(); 120 121 node.Text = opParam.Name + ": "; … … 127 128 opParamNodeTable[opParam].Add(node); 128 129 129 FillTreeNode(node, opParam.Value);130 FillTreeNode(node, (IOperator)opParam.Value); 130 131 return node; 131 132 } … … 162 163 else node.ForeColor = graphTreeView.ForeColor; 163 164 164 foreach (I Parameter param in op.Parameters) {165 if ( param is IValueParameter<IOperator>)165 foreach (IValueParameter param in op.Parameters.OfType<IValueParameter>()) { 166 if (typeof(IOperator).IsAssignableFrom(param.DataType)) 166 167 node.Nodes.Add(new TreeNode()); 167 168 } … … 199 200 ClearTreeNode(node); 200 201 201 IValueParameter <IOperator>opParam = GetOperatorParameterTag(node);202 IValueParameter opParam = GetOperatorParameterTag(node); 202 203 if (opParam != null) { 203 204 opParamNodeTable[opParam].Remove(node); … … 211 212 } 212 213 private void AddParameterNodes(IOperator op, IEnumerable<IParameter> parameters) { 213 foreach (IParameter param in parameters) { 214 IValueParameter<IOperator> opParam = param as IValueParameter<IOperator>; 215 if (opParam != null) { 214 foreach (IValueParameter param in parameters.OfType<IValueParameter>()) { 215 if (typeof(IOperator).IsAssignableFrom(param.DataType)) { 216 216 foreach (TreeNode node in operatorNodeTable[op]) 217 node.Nodes.Add(CreateTreeNode( opParam));217 node.Nodes.Add(CreateTreeNode(param)); 218 218 } 219 219 } 220 220 } 221 221 private void RemoveParameterNodes(IEnumerable<IParameter> parameters) { 222 foreach (IParameter param in parameters) { 223 IValueParameter<IOperator> opParam = param as IValueParameter<IOperator>; 224 if (opParam != null) { 225 while (opParamNodeTable.ContainsKey(opParam)) 226 RemoveTreeNode(opParamNodeTable[opParam][0]); 222 foreach (IValueParameter param in parameters.OfType<IValueParameter>()) { 223 if (typeof(IOperator).IsAssignableFrom(param.DataType)) { 224 while (opParamNodeTable.ContainsKey(param)) 225 RemoveTreeNode(opParamNodeTable[param][0]); 227 226 } 228 227 } … … 235 234 Invoke(new EventHandler(opParam_ValueChanged), sender, e); 236 235 else { 237 IValueParameter <IOperator> opParam = (IValueParameter<IOperator>)sender;236 IValueParameter opParam = (IValueParameter)sender; 238 237 foreach (TreeNode node in opParamNodeTable[opParam].ToArray()) 239 238 ClearTreeNode(node); 240 239 foreach (TreeNode node in opParamNodeTable[opParam]) { 241 240 node.Text = opParam.Name + ": "; 242 FillTreeNode(node, opParam.Value);241 FillTreeNode(node, (IOperator)opParam.Value); 243 242 } 244 243 } … … 265 264 IOperator op = (IOperator)sender; 266 265 foreach (TreeNode node in operatorNodeTable[op]) { 267 IValueParameter <IOperator>opParam = GetOperatorParameterTag(node);266 IValueParameter opParam = GetOperatorParameterTag(node); 268 267 if (opParam == null) 269 268 node.Text = op.Name + " (" + op.ItemName + ")"; … … 330 329 node.Nodes.Clear(); 331 330 IOperator op = GetOperatorTag(node); 332 foreach (IParameter param in op.Parameters) { 333 IValueParameter<IOperator> opParam = param as IValueParameter<IOperator>; 334 if (opParam != null) node.Nodes.Add(CreateTreeNode(opParam)); 331 foreach (IValueParameter param in op.Parameters.OfType<IValueParameter>()) { 332 if (typeof(IOperator).IsAssignableFrom(param.DataType)) node.Nodes.Add(CreateTreeNode(param)); 335 333 } 336 334 } … … 343 341 private void graphTreeView_KeyDown(object sender, KeyEventArgs e) { 344 342 if (!ReadOnly && (e.KeyCode == Keys.Delete) && (graphTreeView.SelectedNode != null)) { 345 IValueParameter <IOperator>opParam = GetOperatorParameterTag(graphTreeView.SelectedNode);343 IValueParameter opParam = GetOperatorParameterTag(graphTreeView.SelectedNode); 346 344 if (opParam != null) opParam.Value = null; 347 345 } … … 371 369 private void graphTreeView_ItemDrag(object sender, ItemDragEventArgs e) { 372 370 TreeNode node = (TreeNode)e.Item; 373 IValueParameter <IOperator>opParam = GetOperatorParameterTag(node);371 IValueParameter opParam = GetOperatorParameterTag(node); 374 372 IOperator op = GetOperatorTag(node); 375 373 DataObject data = new DataObject(); … … 404 402 if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) op = (IOperator)op.Clone(); 405 403 TreeNode node = graphTreeView.GetNodeAt(graphTreeView.PointToClient(new Point(e.X, e.Y))); 406 IValueParameter <IOperator>opParam = GetOperatorParameterTag(node);404 IValueParameter opParam = GetOperatorParameterTag(node); 407 405 opParam.Value = op; 408 406 } … … 436 434 } 437 435 438 private IValueParameter <IOperator>GetOperatorParameterTag(TreeNode node) {436 private IValueParameter GetOperatorParameterTag(TreeNode node) { 439 437 if (node.Tag != null) 440 return ((Tuple<IValueParameter <IOperator>, IOperator>)node.Tag).Item1;438 return ((Tuple<IValueParameter, IOperator>)node.Tag).Item1; 441 439 else 442 440 return null; 443 441 } 444 private void SetOperatorParameterTag(TreeNode node, IValueParameter <IOperator>opParam) {442 private void SetOperatorParameterTag(TreeNode node, IValueParameter opParam) { 445 443 if (node.Tag == null) 446 node.Tag = new Tuple<IValueParameter <IOperator>, IOperator>(opParam, null);444 node.Tag = new Tuple<IValueParameter, IOperator>(opParam, null); 447 445 else 448 ((Tuple<IValueParameter <IOperator>, IOperator>)node.Tag).Item1 = opParam;446 ((Tuple<IValueParameter, IOperator>)node.Tag).Item1 = opParam; 449 447 } 450 448 private IOperator GetOperatorTag(TreeNode node) { 451 449 if (node.Tag != null) 452 return ((Tuple<IValueParameter <IOperator>, IOperator>)node.Tag).Item2;450 return ((Tuple<IValueParameter, IOperator>)node.Tag).Item2; 453 451 else 454 452 return null; … … 456 454 private void SetOperatorTag(TreeNode node, IOperator op) { 457 455 if (node.Tag == null) 458 node.Tag = new Tuple<IValueParameter <IOperator>, IOperator>(null, op);456 node.Tag = new Tuple<IValueParameter, IOperator>(null, op); 459 457 else 460 ((Tuple<IValueParameter <IOperator>, IOperator>)node.Tag).Item2 = op;458 ((Tuple<IValueParameter, IOperator>)node.Tag).Item2 = op; 461 459 } 462 460 -
trunk/sources/HeuristicLab.Core.Views/3.3/ParameterCollectionView.cs
r3393 r3407 55 55 if (createParameterDialog.ShowDialog(this) == DialogResult.OK) { 56 56 IParameter param = createParameterDialog.Parameter; 57 if ( Content.ContainsKey(param.Name))57 if ((param != null) && Content.ContainsKey(param.Name)) 58 58 param = (IParameter)Activator.CreateInstance(param.GetType(), GetUniqueName(param.Name), param.Description); 59 59 return param; 60 } else61 60 } 61 return null; 62 62 } 63 63 } -
trunk/sources/HeuristicLab.Core.Views/3.3/ValueParameterCollectionView.cs
r3393 r3407 58 58 if (createParameterDialog.ShowDialog(this) == DialogResult.OK) { 59 59 IValueParameter param = (IValueParameter)createParameterDialog.Parameter; 60 if ( Content.ContainsKey(param.Name))60 if ((param != null) && Content.ContainsKey(param.Name)) 61 61 param = (IValueParameter)Activator.CreateInstance(param.GetType(), GetUniqueName(param.Name), param.Description); 62 62 return param; 63 } else64 63 } 64 return null; 65 65 } 66 66 } -
trunk/sources/HeuristicLab.Core.Views/3.3/VariableView.cs
r3362 r3407 123 123 if (typeSelectorDialog == null) { 124 124 typeSelectorDialog = new TypeSelectorDialog(); 125 typeSelectorDialog.Caption = "Select Value Type";125 typeSelectorDialog.Caption = "Select Value"; 126 126 typeSelectorDialog.TypeSelector.Configure(typeof(IItem), false, false); 127 127 } 128 128 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 129 Content.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 129 try { 130 Content.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 131 } 132 catch (Exception ex) { 133 Auxiliary.ShowErrorMessageBox(ex); 134 } 130 135 } 131 136 }
Note: See TracChangeset
for help on using the changeset viewer.