Changeset 3407
- Timestamp:
- 04/19/10 03:28:16 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 28 edited
- 3 moved
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 } -
trunk/sources/HeuristicLab.Core/3.3/OperatorGraph.cs
r3386 r3407 90 90 protected OperatorGraph(bool deserializing) : base(deserializing) { } 91 91 92 //mkommend: IMP ROTANT DO NOT REMOVE THIS PRIVATE EVENT92 //mkommend: IMPORTANT DO NOT REMOVE THIS PRIVATE EVENT 93 93 //needed to register OperatorGraph events in GraphVisualizationInfo 94 94 public event EventHandler DeserializationFinished; … … 144 144 var opParams = from o in Operators 145 145 from p in o.Parameters 146 where p is IValueParameter<IOperator> 147 where (((IValueParameter<IOperator>)p).Value != null) && (((IValueParameter<IOperator>)p).Value == op) 148 select (IValueParameter<IOperator>)p; 149 foreach (IValueParameter<IOperator> opParam in opParams) 146 where p is IValueParameter 147 where typeof(IOperator).IsAssignableFrom(((IValueParameter)p).DataType) 148 where (((IValueParameter)p).Value != null) && (((IValueParameter)p).Value == op) 149 select (IValueParameter)p; 150 foreach (IValueParameter opParam in opParams) 150 151 opParam.Value = null; 151 152 } 152 153 private void AddParameter(IParameter param) { 153 IValueParameter <IOperator> opParam = param as IValueParameter<IOperator>;154 if ( opParam != null) {155 RegisterOperatorParameterEvents( opParam);156 if ( opParam.Value != null) Operators.Add(opParam.Value);154 IValueParameter valueParam = param as IValueParameter; 155 if ((valueParam != null) && (typeof(IOperator).IsAssignableFrom(valueParam.DataType))) { 156 RegisterOperatorParameterEvents(valueParam); 157 if (valueParam.Value != null) Operators.Add((IOperator)valueParam.Value); 157 158 } 158 159 } 159 160 private void RemoveParameter(IParameter param) { 160 IValueParameter <IOperator> opParam = param as IValueParameter<IOperator>;161 if ( opParam != null) {162 DeregisterOperatorParameterEvents( opParam);161 IValueParameter valueParam = param as IValueParameter; 162 if ((valueParam != null) && (typeof(IOperator).IsAssignableFrom(valueParam.DataType))) { 163 DeregisterOperatorParameterEvents(valueParam); 163 164 } 164 165 } … … 171 172 foreach (IOperator op in operators) { 172 173 RegisterOperatorEvents(op); 173 foreach (IParameter param in op.Parameters) { 174 IValueParameter<IOperator> opParam = param as IValueParameter<IOperator>; 175 if (opParam != null) RegisterOperatorParameterEvents(opParam); 176 } 174 var opParams = from p in op.Parameters 175 where p is IValueParameter 176 where typeof(IOperator).IsAssignableFrom(((IValueParameter)p).DataType) 177 select (IValueParameter)p; 178 foreach (IValueParameter opParam in opParams) 179 RegisterOperatorParameterEvents(opParam); 177 180 } 178 181 } … … 190 193 op.Parameters.CollectionReset -= new CollectionItemsChangedEventHandler<IParameter>(Parameters_CollectionReset); 191 194 } 192 private void RegisterOperatorParameterEvents(IValueParameter <IOperator>opParam) {195 private void RegisterOperatorParameterEvents(IValueParameter opParam) { 193 196 opParam.ValueChanged += new EventHandler(opParam_ValueChanged); 194 197 } 195 private void DeregisterOperatorParameterEvents(IValueParameter <IOperator>opParam) {198 private void DeregisterOperatorParameterEvents(IValueParameter opParam) { 196 199 opParam.ValueChanged -= new EventHandler(opParam_ValueChanged); 197 200 } … … 234 237 } 235 238 private void opParam_ValueChanged(object sender, EventArgs e) { 236 IValueParameter <IOperator> opParam = (IValueParameter<IOperator>)sender;237 if (opParam.Value != null) Operators.Add( opParam.Value);239 IValueParameter opParam = (IValueParameter)sender; 240 if (opParam.Value != null) Operators.Add((IOperator)opParam.Value); 238 241 } 239 242 #endregion -
trunk/sources/HeuristicLab.Operators.Views/3.3/HeuristicLab.Operators.Views-3.3.csproj
r3384 r3407 92 92 </Compile> 93 93 <None Include="HeuristicLabOperatorsViewsPlugin.cs.frame" /> 94 <Compile Include="Multi pleCallsOperatorView.cs">94 <Compile Include="MultiOperatorView.cs"> 95 95 <SubType>UserControl</SubType> 96 96 </Compile> 97 <Compile Include="Multi pleCallsOperatorView.Designer.cs">98 <DependentUpon>Multi pleCallsOperatorView.cs</DependentUpon>97 <Compile Include="MultiOperatorView.Designer.cs"> 98 <DependentUpon>MultiOperatorView.cs</DependentUpon> 99 99 </Compile> 100 100 <Compile Include="OperatorView.cs"> -
trunk/sources/HeuristicLab.Operators.Views/3.3/MultiOperatorView.Designer.cs
r3401 r3407 21 21 22 22 namespace HeuristicLab.Operators.Views { 23 partial class Multi pleCallsOperatorView{23 partial class MultiOperatorView<T> { 24 24 /// <summary> 25 25 /// Required designer variable. … … 47 47 this.tabControl = new System.Windows.Forms.TabControl(); 48 48 this.operatorsTabPage = new System.Windows.Forms.TabPage(); 49 this.operatorListView = new HeuristicLab.Core.Views. OperatorListView();49 this.operatorListView = new HeuristicLab.Core.Views.ItemListView<T>(); 50 50 this.parametersTabPage = new System.Windows.Forms.TabPage(); 51 51 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); … … 147 147 this.breakpointLabel.Text = "&Breakpoint:"; 148 148 // 149 // Multi pleCallsOperatorView149 // MultiOperatorView 150 150 // 151 151 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); … … 154 154 this.Controls.Add(this.breakpointLabel); 155 155 this.Controls.Add(this.tabControl); 156 this.Name = "Multi pleCallsOperatorView";156 this.Name = "MultiOperatorView"; 157 157 this.Size = new System.Drawing.Size(486, 482); 158 158 this.Controls.SetChildIndex(this.tabControl, 0); … … 178 178 protected System.Windows.Forms.TabPage parametersTabPage; 179 179 protected HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView; 180 protected HeuristicLab.Core.Views. OperatorListViewoperatorListView;180 protected HeuristicLab.Core.Views.ItemListView<T> operatorListView; 181 181 protected System.Windows.Forms.CheckBox breakpointCheckBox; 182 182 protected System.Windows.Forms.Label breakpointLabel; -
trunk/sources/HeuristicLab.Operators.Views/3.3/MultiOperatorView.cs
r3401 r3407 30 30 /// The base class for visual representations of items. 31 31 /// </summary> 32 [View("Multi pleCallsOperator View")]33 [Content(typeof(Multi pleCallsOperator), true)]34 public partial class Multi pleCallsOperatorView : NamedItemView{35 public new Multi pleCallsOperatorContent {36 get { return (Multi pleCallsOperator)base.Content; }32 [View("MultiOperator View")] 33 [Content(typeof(MultiOperator<>), true)] 34 public partial class MultiOperatorView<T> : NamedItemView where T : class, IOperator { 35 public new MultiOperator<T> Content { 36 get { return (MultiOperator<T>)base.Content; } 37 37 set { base.Content = value; } 38 38 } … … 41 41 /// Initializes a new instance of <see cref="ItemBaseView"/>. 42 42 /// </summary> 43 public Multi pleCallsOperatorView() {43 public MultiOperatorView() { 44 44 InitializeComponent(); 45 45 } … … 48 48 /// </summary> 49 49 /// <param name="item">The item that should be displayed.</param> 50 public Multi pleCallsOperatorView(MultipleCallsOperatorcontent)50 public MultiOperatorView(MultiOperator<T> content) 51 51 : this() { 52 52 Content = content; -
trunk/sources/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj
r3404 r3407 91 91 <Compile Include="Assigner.cs" /> 92 92 <Compile Include="AlgorithmOperator.cs" /> 93 <Compile Include="Multi pleCallsOperator.cs" />93 <Compile Include="MultiOperator.cs" /> 94 94 <Compile Include="Operator.cs" /> 95 95 <Compile Include="Placeholder.cs" /> -
trunk/sources/HeuristicLab.Operators/3.3/MultiOperator.cs
r3401 r3407 31 31 namespace HeuristicLab.Operators { 32 32 /// <summary> 33 /// A base class for operators which apply multiple user-defined operators.33 /// A base class for operators which apply arbitrary many other operators of a specific type. 34 34 /// </summary> 35 [Item("Multi pleCallsOperator", "A base class for operators which apply multiple user-defined operators.")]35 [Item("MultiOperator<T>", "A base class for operators which apply arbitrary many other operators of a specific type.")] 36 36 [StorableClass] 37 public abstract class Multi pleCallsOperator : SingleSuccessorOperator {38 private List<IValueParameter< IOperator>> operatorParameters;37 public abstract class MultiOperator<T> : SingleSuccessorOperator where T : class, IOperator { 38 private List<IValueParameter<T>> operatorParameters; 39 39 40 40 [Storable] 41 private OperatorListoperators;42 public OperatorListOperators {41 private ItemList<T> operators; 42 public ItemList<T> Operators { 43 43 get { return operators; } 44 44 } 45 45 46 public Multi pleCallsOperator()46 public MultiOperator() 47 47 : base() { 48 operators = new OperatorList();48 operators = new ItemList<T>(); 49 49 Initialize(); 50 50 } 51 51 [StorableConstructor] 52 protected Multi pleCallsOperator(bool deserializing) : base(deserializing) { }52 protected MultiOperator(bool deserializing) : base(deserializing) { } 53 53 54 54 [StorableHook(HookType.AfterDeserialization)] 55 55 private void Initialize() { 56 56 if (operators != null) RegisterOperatorsEvents(); 57 operatorParameters = new List<IValueParameter< IOperator>>();57 operatorParameters = new List<IValueParameter<T>>(); 58 58 for (int i = 0; i < Operators.Count; i++) { 59 IValueParameter< IOperator> opParam = (IValueParameter<IOperator>)Parameters[i.ToString()];59 IValueParameter<T> opParam = (IValueParameter<T>)Parameters[i.ToString()]; 60 60 operatorParameters.Add(opParam); 61 61 opParam.ValueChanged += new EventHandler(opParam_ValueChanged); … … 64 64 65 65 public override IDeepCloneable Clone(Cloner cloner) { 66 Multi pleCallsOperator clone = (MultipleCallsOperator)base.Clone(cloner);67 clone.operators = ( OperatorList)cloner.Clone(operators);66 MultiOperator<T> clone = (MultiOperator<T>)base.Clone(cloner); 67 clone.operators = (ItemList<T>)cloner.Clone(operators); 68 68 clone.Initialize(); 69 69 return clone; … … 71 71 72 72 private void UpdateOperatorParameters() { 73 foreach (IValueParameter< IOperator> opParam in operatorParameters) {73 foreach (IValueParameter<T> opParam in operatorParameters) { 74 74 opParam.ValueChanged -= new EventHandler(opParam_ValueChanged); 75 75 Parameters.Remove(opParam.Name); … … 77 77 operatorParameters.Clear(); 78 78 for (int i = 0; i < Operators.Count; i++) { 79 IValueParameter< IOperator> opParam = new ValueParameter<IOperator>(i.ToString(), string.Empty, Operators[i]);79 IValueParameter<T> opParam = new ValueParameter<T>(i.ToString(), string.Empty, Operators[i]); 80 80 opParam.ValueChanged += new EventHandler(opParam_ValueChanged); 81 81 Parameters.Add(opParam); … … 86 86 #region Events 87 87 private void RegisterOperatorsEvents() { 88 operators.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_ItemsAdded);89 operators.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_ItemsRemoved);90 operators.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_ItemsReplaced);91 operators.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_ItemsMoved);92 operators.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_CollectionReset);88 operators.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_ItemsAdded); 89 operators.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_ItemsRemoved); 90 operators.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_ItemsReplaced); 91 operators.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_ItemsMoved); 92 operators.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_CollectionReset); 93 93 } 94 94 private void DeregisterOperatorsEvents() { 95 operators.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_ItemsAdded);96 operators.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_ItemsRemoved);97 operators.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_ItemsReplaced);98 operators.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_ItemsMoved);99 operators.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem< IOperator>>(operators_CollectionReset);95 operators.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_ItemsAdded); 96 operators.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_ItemsRemoved); 97 operators.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_ItemsReplaced); 98 operators.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_ItemsMoved); 99 operators.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(operators_CollectionReset); 100 100 } 101 private void operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem< IOperator>> e) {101 private void operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) { 102 102 UpdateOperatorParameters(); 103 103 } 104 private void operators_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem< IOperator>> e) {104 private void operators_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) { 105 105 UpdateOperatorParameters(); 106 106 } 107 private void operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem< IOperator>> e) {108 foreach (IndexedItem< IOperator> item in e.Items)107 private void operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) { 108 foreach (IndexedItem<T> item in e.Items) 109 109 operatorParameters[item.Index].Value = item.Value; 110 110 } 111 private void operators_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem< IOperator>> e) {112 foreach (IndexedItem< IOperator> item in e.Items)111 private void operators_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) { 112 foreach (IndexedItem<T> item in e.Items) 113 113 operatorParameters[item.Index].Value = item.Value; 114 114 } 115 private void operators_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem< IOperator>> e) {115 private void operators_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) { 116 116 UpdateOperatorParameters(); 117 117 } 118 118 private void opParam_ValueChanged(object sender, EventArgs e) { 119 IValueParameter< IOperator> opParam = (IValueParameter<IOperator>)sender;119 IValueParameter<T> opParam = (IValueParameter<T>)sender; 120 120 operators[operatorParameters.IndexOf(opParam)] = opParam.Value; 121 121 } -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesProcessor.cs
r3376 r3407 32 32 [Item("SubScopesProcessor", "An operator which contains multiple operators of which each is applied on one sub-scope of the current scope. The first operator is applied on the first sub-scope, the second on the second, and so on.")] 33 33 [StorableClass] 34 public sealed class SubScopesProcessor : Multi pleCallsOperator{34 public sealed class SubScopesProcessor : MultiOperator<IOperator> { 35 35 public ValueLookupParameter<BoolValue> ParallelParameter { 36 36 get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r3367 r3407 176 176 problemTypeSelectorDialog = new TypeSelectorDialog(); 177 177 problemTypeSelectorDialog.Caption = "Select Problem"; 178 problemTypeSelectorDialog.TypeSelector.Caption = "Available Problems"; 178 179 problemTypeSelectorDialog.TypeSelector.Configure(Content.ProblemType, false, false); 179 180 } 180 181 if (problemTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 181 Content.Problem = (IProblem)problemTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 182 try { 183 Content.Problem = (IProblem)problemTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 184 } 185 catch (Exception ex) { 186 Auxiliary.ShowErrorMessageBox(ex); 187 } 182 188 } 183 189 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs
r3367 r3407 166 166 algorithmTypeSelectorDialog = new TypeSelectorDialog(); 167 167 algorithmTypeSelectorDialog.Caption = "Select Algorithm"; 168 algorithmTypeSelectorDialog.TypeSelector.Caption = "Available Algorithms"; 168 169 algorithmTypeSelectorDialog.TypeSelector.Configure(typeof(IAlgorithm), false, false); 169 170 } 170 171 if (algorithmTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 171 Content.Algorithm = (IAlgorithm)algorithmTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 172 try { 173 Content.Algorithm = (IAlgorithm)algorithmTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 174 } 175 catch (Exception ex) { 176 Auxiliary.ShowErrorMessageBox(ex); 177 } 172 178 } 173 179 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/OptimizerListView.Designer.cs
r3274 r3407 33 33 protected override void Dispose(bool disposing) { 34 34 if (disposing) { 35 if (typeSelectorDialog != null) typeSelectorDialog.Dispose();36 35 if (components != null) components.Dispose(); 37 36 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/OptimizerListView.cs
r3393 r3407 20 20 #endregion 21 21 22 using System; 22 23 using System.Windows.Forms; 23 24 using HeuristicLab.Collections; … … 31 32 [Content(typeof(IItemList<IOptimizer>), false)] 32 33 public partial class OptimizerListView : ItemListView<IOptimizer> { 33 protected TypeSelectorDialog typeSelectorDialog;34 35 34 /// <summary> 36 35 /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View". … … 55 54 if (typeSelectorDialog == null) { 56 55 typeSelectorDialog = new TypeSelectorDialog(); 56 typeSelectorDialog.Caption = "Select Optimizer"; 57 57 typeSelectorDialog.TypeSelector.Caption = "Available Optimizers"; 58 58 typeSelectorDialog.TypeSelector.Configure(typeof(IOptimizer), false, false); 59 59 } 60 60 61 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) 62 return typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType() as IOptimizer; 63 else 64 return null; 61 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 62 try { 63 return (IOptimizer)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 64 } 65 catch (Exception ex) { 66 Auxiliary.ShowErrorMessageBox(ex); 67 } 68 } 69 return null; 65 70 } 66 71 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultCollectionView.cs
r3393 r3407 56 56 57 57 protected override IResult CreateItem() { 58 IResult item = new Result(); 59 if (Content.ContainsKey(item.Name)) 60 item = new Result(GetUniqueName(item.Name), typeof(IItem)); 61 return item; 58 return null; 62 59 } 63 60 } -
trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.cs
r3376 r3407 138 138 typeSelectorDialog.TypeSelector.Configure(Content.DataType, false, false); 139 139 } 140 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) 141 Content.Value = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 140 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 141 try { 142 Content.Value = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 143 } 144 catch (Exception ex) { 145 Auxiliary.ShowErrorMessageBox(ex); 146 } 147 } 142 148 } 143 149 protected virtual void clearValueButton_Click(object sender, EventArgs e) { -
trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs
r3376 r3407 126 126 typeSelectorDialog.TypeSelector.Configure(Content.DataType, false, false); 127 127 } 128 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) 129 Content.Value = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 128 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 129 try { 130 Content.Value = (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 131 } 132 catch (Exception ex) { 133 Auxiliary.ShowErrorMessageBox(ex); 134 } 135 } 130 136 } 131 137 protected virtual void setValueButton_Click(object sender, EventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.