Changeset 11412 for branches/OptimizationNetworks
- Timestamp:
- 10/03/14 02:20:19 (10 years ago)
- Location:
- branches/OptimizationNetworks
- Files:
-
- 6 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/AlgorithmNodeView.cs
r11409 r11412 27 27 28 28 namespace HeuristicLab.Optimization.Networks.Views { 29 [View("Algorithm 29 [View("AlgorithmNode View")] 30 30 [Content(typeof(AlgorithmNode), true)] 31 31 [Content(typeof(IAlgorithmNode), false)] … … 73 73 protected override void SetEnabledStateOfControls() { 74 74 base.SetEnabledStateOfControls(); 75 portCollectionView.Enabled = Content != null ;75 portCollectionView.Enabled = Content != null && !ReadOnly; 76 76 setAlgorithmButton.Enabled = Content != null && !ReadOnly; 77 77 clearAlgorithmButton.Enabled = Content != null && Content.Algorithm != null && !ReadOnly; … … 116 116 else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link; 117 117 } 118 119 118 } 120 119 protected virtual void algorithmPanel_DragDrop(object sender, DragEventArgs e) { -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/HeuristicLab.Optimization.Networks.Views-3.3.csproj
r11409 r11412 49 49 </ItemGroup> 50 50 <ItemGroup> 51 <Compile Include="VariablesNodeView.cs"> 52 <SubType>UserControl</SubType> 53 </Compile> 54 <Compile Include="VariablesNodeView.Designer.cs"> 55 <DependentUpon>VariablesNodeView.cs</DependentUpon> 56 </Compile> 51 57 <Compile Include="AlgorithmNodeView.cs"> 52 58 <SubType>UserControl</SubType> … … 54 60 <Compile Include="AlgorithmNodeView.Designer.cs"> 55 61 <DependentUpon>AlgorithmNodeView.cs</DependentUpon> 62 </Compile> 63 <Compile Include="InputPortView.cs"> 64 <SubType>UserControl</SubType> 65 </Compile> 66 <Compile Include="InputPortView.Designer.cs"> 67 <DependentUpon>InputPortView.cs</DependentUpon> 56 68 </Compile> 57 69 <Compile Include="PortView.cs"> -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/PortView.Designer.cs
r11409 r11412 21 21 22 22 namespace HeuristicLab.Optimization.Networks.Views { 23 partial class PortView <T>{23 partial class PortView { 24 24 /// <summary> 25 25 /// Required designer variable. -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/PortView.cs
r11409 r11412 20 20 #endregion 21 21 22 using HeuristicLab.Co re;22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core.Views; 24 24 using HeuristicLab.MainForm; … … 30 30 [Content(typeof(Port<>), true)] 31 31 [Content(typeof(IPort<>), false)] 32 public partial class PortView<T> : NamedItemView where T : class, IItem { 33 public new IPort<T> Content { 34 get { return (IPort<T>)base.Content; } 32 [Content(typeof(IPort), false)] 33 public partial class PortView : NamedItemView { 34 public new IPort Content { 35 get { return (IPort)base.Content; } 35 36 set { base.Content = value; } 36 37 } … … 56 57 } else { 57 58 valueViewHost.ViewType = null; 58 valueViewHost.Content = Content.Value ;59 valueViewHost.Content = Content.Value as IContent; 59 60 } 60 61 } … … 62 63 protected override void SetEnabledStateOfControls() { 63 64 base.SetEnabledStateOfControls(); 64 valueGroupBox.Enabled = Content!= null;65 valueGroupBox.Enabled = (Content as IContent) != null; 65 66 } 66 67 protected virtual void Content_ValueChanged(object sender, System.EventArgs e) { … … 69 70 else { 70 71 valueViewHost.ViewType = null; 71 valueViewHost.Content = Content.Value ;72 valueViewHost.Content = Content.Value as IContent; 72 73 73 74 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/AlgorithmNode.cs
r11409 r11412 83 83 if (algorithm.Parameters.TryGetValue(port.Name, out param)) { 84 84 IValueParameter p = param as IValueParameter; 85 if ( p != null) {85 if ((p != null) && (port.Value != null)) { 86 86 p.Value = (IItem)port.Value; 87 87 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/HeuristicLab.Optimization.Networks-3.3.csproj
r11406 r11412 48 48 </ItemGroup> 49 49 <ItemGroup> 50 <Compile Include="IVariablesNode.cs" /> 51 <Compile Include="VariablesNode.cs" /> 50 52 <Compile Include="EventArgs.cs" /> 51 53 <Compile Include="IInputOutputPort.cs" /> -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/IInputOutputPort.cs
r11406 r11412 26 26 public interface IInputOutputPort : IPort { 27 27 IOutputInputPort OutputInputPort { get; } 28 29 event EventHandler OutputInputPortChanged; 28 30 } 29 31 -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/IInputPort.cs
r11401 r11412 20 20 #endregion 21 21 22 using HeuristicLab.Core; 22 23 using System; 23 using HeuristicLab.Core;24 24 25 25 namespace HeuristicLab.Optimization.Networks { 26 26 public interface IInputPort : IPort { 27 IOutputPort OutputPort { get; } 27 IOutputPort OutputPort { get; set; } 28 29 event EventHandler OutputPortChanged; 28 30 } 29 31 -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/InputOutputPort.cs
r11406 r11412 82 82 83 83 protected void RegisterOutputInputPortEvents() { 84 outputInputPort.ValueSent += OutputInputPort_ValueSent; 84 if (outputInputPort != null) { 85 outputInputPort.ValueSent += OutputInputPort_ValueSent; 86 } 85 87 } 86 88 protected void DeregisterOutputInputPortEvents() { 87 outputInputPort.ValueSent -= OutputInputPort_ValueSent; 89 if (outputInputPort != null) { 90 outputInputPort.ValueSent -= OutputInputPort_ValueSent; 91 } 88 92 } 89 93 protected void OutputInputPort_ValueSent(object sender, OutputInputPortEventArgs<TIn, TOut> e) { -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/InputPort.cs
r11409 r11412 49 49 IOutputPort IInputPort.OutputPort { 50 50 get { return outputPort; } 51 set { 52 var val = value as IOutputPort<T>; 53 if ((value != null) && (val == null)) 54 throw new InvalidOperationException( 55 string.Format("Type mismatch. OutputPort is not a \"{0}\".", 56 typeof(IOutputPort<T>).GetPrettyName()) 57 ); 58 OutputPort = val; 59 } 51 60 } 52 61 … … 77 86 78 87 protected void RegisterOutputPortEvents() { 79 outputPort.ValueChanged += OutputPort_ValueChanged; 80 88 if (outputPort != null) { 89 outputPort.ValueChanged += OutputPort_ValueChanged; 90 } 81 91 } 82 92 protected void DeregisterOutputPortEvents() { 83 outputPort.ValueChanged -= OutputPort_ValueChanged; 93 if (outputPort != null) { 94 outputPort.ValueChanged -= OutputPort_ValueChanged; 95 } 84 96 } 85 97 protected void OutputPort_ValueChanged(object sender, EventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.