Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/18/14 03:25:58 (10 years ago)
Author:
swagner
Message:

#2205: Worked on optimization networks

Location:
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/AlgorithmServiceNodeView.Designer.cs

    r11463 r11481  
    214214    protected MainForm.WindowsForms.ViewHost templateViewHost;
    215215    protected System.Windows.Forms.TabPage runsTabPage;
    216     private Optimization.Views.RunCollectionView runCollectionView;
     216    protected Optimization.Views.RunCollectionView runCollectionView;
    217217
    218218
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/ClientNodeView.Designer.cs

    r11468 r11481  
    7474      this.portCollectionView.ReadOnly = false;
    7575      this.portCollectionView.ShowDetails = true;
    76       this.portCollectionView.Size = new System.Drawing.Size(625, 416);
     76      this.portCollectionView.Size = new System.Drawing.Size(625, 424);
    7777      this.portCollectionView.TabIndex = 0;
    7878      //
     
    8585      this.tabControl.Controls.Add(this.portsTabPage);
    8686      this.tabControl.Controls.Add(this.serviceCallsTabPage);
    87       this.tabControl.Location = new System.Drawing.Point(0, 63);
     87      this.tabControl.Location = new System.Drawing.Point(0, 26);
    8888      this.tabControl.Name = "tabControl";
    8989      this.tabControl.SelectedIndex = 0;
    90       this.tabControl.Size = new System.Drawing.Size(645, 454);
    91       this.tabControl.TabIndex = 5;
     90      this.tabControl.Size = new System.Drawing.Size(645, 462);
     91      this.tabControl.TabIndex = 3;
    9292      //
    9393      // portsTabPage
     
    9797      this.portsTabPage.Name = "portsTabPage";
    9898      this.portsTabPage.Padding = new System.Windows.Forms.Padding(3);
    99       this.portsTabPage.Size = new System.Drawing.Size(637, 428);
     99      this.portsTabPage.Size = new System.Drawing.Size(637, 436);
    100100      this.portsTabPage.TabIndex = 0;
    101101      this.portsTabPage.Text = "Ports";
     
    128128      // callServicesButton
    129129      //
    130       this.callServicesButton.Location = new System.Drawing.Point(69, 26);
     130      this.callServicesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     131      this.callServicesButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;
     132      this.callServicesButton.Location = new System.Drawing.Point(0, 494);
    131133      this.callServicesButton.Name = "callServicesButton";
    132       this.callServicesButton.Size = new System.Drawing.Size(101, 23);
    133       this.callServicesButton.TabIndex = 3;
    134       this.callServicesButton.Text = "&Call Services";
     134      this.callServicesButton.Size = new System.Drawing.Size(23, 23);
     135      this.callServicesButton.TabIndex = 4;
    135136      this.callServicesButton.UseVisualStyleBackColor = true;
    136137      this.callServicesButton.Click += new System.EventHandler(this.callServicesButton_Click);
     
    138139      // cancelServicesButton
    139140      //
    140       this.cancelServicesButton.Location = new System.Drawing.Point(176, 26);
     141      this.cancelServicesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     142      this.cancelServicesButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Stop;
     143      this.cancelServicesButton.Location = new System.Drawing.Point(29, 494);
    141144      this.cancelServicesButton.Name = "cancelServicesButton";
    142       this.cancelServicesButton.Size = new System.Drawing.Size(101, 23);
    143       this.cancelServicesButton.TabIndex = 4;
    144       this.cancelServicesButton.Text = "&Cancel Services";
     145      this.cancelServicesButton.Size = new System.Drawing.Size(23, 23);
     146      this.cancelServicesButton.TabIndex = 5;
    145147      this.cancelServicesButton.UseVisualStyleBackColor = true;
    146148      this.cancelServicesButton.Click += new System.EventHandler(this.cancelServicesButton_Click);
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/ClientNodeView.cs

    r11468 r11481  
    2121
    2222using HeuristicLab.MainForm;
     23using HeuristicLab.PluginInfrastructure;
    2324using System;
    2425using System.Threading;
     
    3031  [Content(typeof(IClientNode), false)]
    3132  public partial class ClientNodeView : EntityView {
    32     protected CancellationTokenSource tokenSource = new CancellationTokenSource();
     33    protected CancellationTokenSource tokenSource;
     34    protected int openCalls = 0;
    3335
    3436    public new IClientNode Content {
     
    4345    protected override void OnContentChanged() {
    4446      base.OnContentChanged();
     47
     48      if (tokenSource != null) tokenSource.Cancel();
     49
    4550      if (Content == null) {
     51        tokenSource = null;
    4652        portCollectionView.Content = null;
    4753        serviceParameterCollectionCollectionView.Content = null;
    4854      } else {
     55        tokenSource = new CancellationTokenSource();
    4956        portCollectionView.Content = Content.Ports;
    5057        serviceParameterCollectionCollectionView.Content = Content.Calls;
     
    5562      base.SetEnabledStateOfControls();
    5663      callServicesButton.Enabled = Content != null && !ReadOnly;
     64      cancelServicesButton.Enabled = Content != null && !ReadOnly && openCalls > 0;
    5765      portCollectionView.Enabled = Content != null && !ReadOnly;
    5866      serviceParameterCollectionCollectionView.Enabled = Content != null && !ReadOnly;
     
    6068
    6169    protected virtual void callServicesButton_Click(object sender, EventArgs e) {
    62       Content.CallServicesAsync(tokenSource.Token);
     70      openCalls++;
     71      cancelServicesButton.Enabled = Content != null && !ReadOnly && openCalls > 0;
     72      Content.CallServicesAsync(tokenSource.Token).ContinueWith(t => {
     73        Invoke(new Action(() => {
     74          openCalls--;
     75          cancelServicesButton.Enabled = Content != null && !ReadOnly && openCalls > 0;
     76
     77          try {
     78            t.Wait();
     79          }
     80          catch (Exception ex) {
     81            ErrorHandling.ShowErrorDialog(this, ex);
     82          }
     83        }));
     84      });
    6385    }
    6486    protected virtual void cancelServicesButton_Click(object sender, EventArgs e) {
    6587      tokenSource.Cancel();
     88      tokenSource = new CancellationTokenSource();
    6689    }
    6790  }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/ClientPortView.Designer.cs

    r11454 r11481  
    3434    /// </summary>
    3535    private void InitializeComponent() {
    36       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ClientPortView));
    3736      this.servicePortGroupBox = new System.Windows.Forms.GroupBox();
    3837      this.setServicePortButton = new System.Windows.Forms.Button();
    3938      this.clearServicePortButton = new System.Windows.Forms.Button();
    4039      this.servicePortView = new HeuristicLab.Optimization.Networks.Views.PortView();
     40      this.cloneServicePortParametersButton = new System.Windows.Forms.Button();
    4141      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    4242      this.servicePortGroupBox.SuspendLayout();
     
    107107      this.servicePortView.DragOver += new System.Windows.Forms.DragEventHandler(this.servicePortView_DragEnterOver);
    108108      //
     109      // cloneServicePortParametersButton
     110      //
     111      this.cloneServicePortParametersButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Clone;
     112      this.cloneServicePortParametersButton.Location = new System.Drawing.Point(156, 101);
     113      this.cloneServicePortParametersButton.Name = "cloneServicePortParametersButton";
     114      this.cloneServicePortParametersButton.Size = new System.Drawing.Size(24, 24);
     115      this.cloneServicePortParametersButton.TabIndex = 5;
     116      this.toolTip.SetToolTip(this.cloneServicePortParametersButton, "Clone Parameters from Service Port");
     117      this.cloneServicePortParametersButton.UseVisualStyleBackColor = true;
     118      this.cloneServicePortParametersButton.Click += new System.EventHandler(this.cloneServicePortParametersButton_Click);
     119      //
    109120      // ClientPortView
    110121      //
    111122      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     123      this.Controls.Add(this.cloneServicePortParametersButton);
    112124      this.Controls.Add(this.servicePortGroupBox);
    113125      this.Name = "ClientPortView";
     
    117129      this.Controls.SetChildIndex(this.infoLabel, 0);
    118130      this.Controls.SetChildIndex(this.servicePortGroupBox, 0);
     131      this.Controls.SetChildIndex(this.cloneServicePortParametersButton, 0);
    119132      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    120133      this.servicePortGroupBox.ResumeLayout(false);
     
    130143    protected System.Windows.Forms.Button clearServicePortButton;
    131144    protected System.Windows.Forms.Button setServicePortButton;
     145    protected System.Windows.Forms.Button cloneServicePortParametersButton;
    132146
    133147
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/ClientPortView.cs

    r11454 r11481  
    7171      setServicePortButton.Enabled = Content != null && !ReadOnly;
    7272      clearServicePortButton.Enabled = Content != null && Content.ServicePort != null && !ReadOnly;
     73      cloneServicePortParametersButton.Enabled = Content != null && Content.ServicePort != null && !ReadOnly;
    7374    }
    7475
     
    7879      else {
    7980        clearServicePortButton.Enabled = Content.ServicePort != null && !ReadOnly;
     81        cloneServicePortParametersButton.Enabled = Content.ServicePort != null && !ReadOnly;
    8082        servicePortView.Content = Content.ServicePort;
    8183      }
     
    133135      }
    134136    }
     137    protected virtual void cloneServicePortParametersButton_Click(object sender, EventArgs e) {
     138      Content.CloneServicePortParameters();
     139    }
    135140  }
    136141}
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/ServiceParameterView.Designer.cs

    r11454 r11481  
    2727    private System.ComponentModel.IContainer components = null;
    2828
    29     /// <summary>
    30     /// Clean up any resources being used.
    31     /// </summary>
    32     /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    33     protected override void Dispose(bool disposing) {
    34       if (disposing) {
    35         if (components != null) components.Dispose();
    36       }
    37       base.Dispose(disposing);
    38     }
    39 
    4029    #region Component Designer generated code
    4130
     
    4635    private void InitializeComponent() {
    4736      this.valueGroupBox = new System.Windows.Forms.GroupBox();
     37      this.clearValueButton = new System.Windows.Forms.Button();
     38      this.setValueButton = new System.Windows.Forms.Button();
    4839      this.valuePanel = new System.Windows.Forms.Panel();
    4940      this.valueViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     
    6758            | System.Windows.Forms.AnchorStyles.Left)
    6859            | System.Windows.Forms.AnchorStyles.Right)));
     60      this.valueGroupBox.Controls.Add(this.clearValueButton);
     61      this.valueGroupBox.Controls.Add(this.setValueButton);
    6962      this.valueGroupBox.Controls.Add(this.valuePanel);
    7063      this.valueGroupBox.Location = new System.Drawing.Point(0, 79);
     
    7568      this.valueGroupBox.Text = "Value";
    7669      //
     70      // clearValueButton
     71      //
     72      this.clearValueButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Remove;
     73      this.clearValueButton.Location = new System.Drawing.Point(35, 19);
     74      this.clearValueButton.Name = "clearValueButton";
     75      this.clearValueButton.Size = new System.Drawing.Size(23, 23);
     76      this.clearValueButton.TabIndex = 1;
     77      this.clearValueButton.UseVisualStyleBackColor = true;
     78      this.clearValueButton.Click += new System.EventHandler(this.clearValueButton_Click);
     79      //
     80      // setValueButton
     81      //
     82      this.setValueButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Edit;
     83      this.setValueButton.Location = new System.Drawing.Point(6, 19);
     84      this.setValueButton.Name = "setValueButton";
     85      this.setValueButton.Size = new System.Drawing.Size(23, 23);
     86      this.setValueButton.TabIndex = 0;
     87      this.setValueButton.UseVisualStyleBackColor = true;
     88      this.setValueButton.Click += new System.EventHandler(this.setValueButton_Click);
     89      //
    7790      // valuePanel
    7891      //
     92      this.valuePanel.AllowDrop = true;
    7993      this.valuePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    8094            | System.Windows.Forms.AnchorStyles.Left)
    8195            | System.Windows.Forms.AnchorStyles.Right)));
    8296      this.valuePanel.Controls.Add(this.valueViewHost);
    83       this.valuePanel.Location = new System.Drawing.Point(6, 19);
     97      this.valuePanel.Location = new System.Drawing.Point(6, 48);
    8498      this.valuePanel.Name = "valuePanel";
    85       this.valuePanel.Size = new System.Drawing.Size(633, 413);
     99      this.valuePanel.Size = new System.Drawing.Size(633, 384);
    86100      this.valuePanel.TabIndex = 0;
     101      this.valuePanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragDrop);
     102      this.valuePanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver);
     103      this.valuePanel.DragOver += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver);
    87104      //
    88105      // valueViewHost
     
    95112      this.valueViewHost.Name = "valueViewHost";
    96113      this.valueViewHost.ReadOnly = false;
    97       this.valueViewHost.Size = new System.Drawing.Size(633, 413);
     114      this.valueViewHost.Size = new System.Drawing.Size(633, 384);
    98115      this.valueViewHost.TabIndex = 0;
    99116      this.valueViewHost.ViewsLabelVisible = true;
     
    175192    protected System.Windows.Forms.TextBox dataTypeTextBox;
    176193    protected System.Windows.Forms.ComboBox typeComboBox;
     194    protected System.Windows.Forms.Button setValueButton;
     195    protected System.Windows.Forms.Button clearValueButton;
    177196
    178197
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/ServiceParameterView.cs

    r11454 r11481  
    2121
    2222using HeuristicLab.Common;
     23using HeuristicLab.Core;
    2324using HeuristicLab.Core.Views;
    2425using HeuristicLab.MainForm;
     26using HeuristicLab.PluginInfrastructure;
    2527using System;
    2628using System.Windows.Forms;
     
    3234  [Content(typeof(IServiceParameter), false)]
    3335  public partial class ServiceParameterView : EntityView {
     36    protected TypeSelectorDialog typeSelectorDialog;
     37
    3438    public new IServiceParameter Content {
    3539      get { return (IServiceParameter)base.Content; }
     
    3943    public ServiceParameterView() {
    4044      InitializeComponent();
     45    }
     46
     47    protected override void Dispose(bool disposing) {
     48      if (disposing) {
     49        if (typeSelectorDialog != null) typeSelectorDialog.Dispose();
     50        if (components != null) components.Dispose();
     51      }
     52      base.Dispose(disposing);
    4153    }
    4254
     
    6375        typeComboBox.SelectedIndex = Content.Type == ServiceParameterType.Input ? 0 : 1;
    6476        valueViewHost.ViewType = null;
    65         valueViewHost.Content = Content.Value as IContent;
     77        valueViewHost.Content = Content.Value;
    6678      }
    6779    }
     
    7183      dataTypeTextBox.Enabled = Content != null;
    7284      typeComboBox.Enabled = Content != null && !ReadOnly;
    73       valueGroupBox.Enabled = (Content as IContent) != null;
     85      valueGroupBox.Enabled = Content != null;
     86      setValueButton.Enabled = Content != null && !ReadOnly;
     87      clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;
    7488    }
    7589    protected virtual void Content_TypeChanged(object sender, EventArgs e) {
     
    8498        Invoke(new EventHandler(Content_ValueChanged), sender, e);
    8599      else {
     100        clearValueButton.Enabled = Content.Value != null;
    86101        valueViewHost.ViewType = null;
    87         valueViewHost.Content = Content.Value as IContent;
     102        valueViewHost.Content = Content.Value;
    88103      }
    89104    }
     
    92107      Content.Type = typeComboBox.SelectedIndex == 0 ? ServiceParameterType.Input : ServiceParameterType.Output;
    93108    }
     109
     110    protected virtual void setValueButton_Click(object sender, EventArgs e) {
     111      if (typeSelectorDialog == null) {
     112        typeSelectorDialog = new TypeSelectorDialog();
     113        typeSelectorDialog.Caption = "Select Value";
     114        typeSelectorDialog.TypeSelector.Configure(Content.DataType, false, true);
     115      }
     116      if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
     117        try {
     118          Content.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
     119        }
     120        catch (Exception ex) {
     121          ErrorHandling.ShowErrorDialog(this, ex);
     122        }
     123      }
     124    }
     125    protected virtual void clearValueButton_Click(object sender, EventArgs e) {
     126      Content.Value = null;
     127    }
     128    protected virtual void valuePanel_DragEnterOver(object sender, DragEventArgs e) {
     129      e.Effect = DragDropEffects.None;
     130      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IItem)) {
     131        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
     132        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     133        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     134        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
     135        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
     136      }
     137    }
     138    protected virtual void valuePanel_DragDrop(object sender, DragEventArgs e) {
     139      if (e.Effect != DragDropEffects.None) {
     140        IItem item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IItem;
     141        if (e.Effect.HasFlag(DragDropEffects.Copy)) item = (IItem)item.Clone();
     142        Content.Value = item;
     143      }
     144    }
    94145  }
    95146}
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/ValuePortView.cs

    r11421 r11481  
    2020#endregion
    2121
    22 using HeuristicLab.Common;
    23 using HeuristicLab.Core.Views;
    2422using HeuristicLab.MainForm;
    2523using System;
     
    5755      } else {
    5856        valueViewHost.ViewType = null;
    59         valueViewHost.Content = Content.Value as IContent;
     57        valueViewHost.Content = Content.Value;
    6058      }
    6159    }
     
    6361    protected override void SetEnabledStateOfControls() {
    6462      base.SetEnabledStateOfControls();
    65       valueGroupBox.Enabled = (Content as IContent) != null;
     63      valueGroupBox.Enabled = Content != null;
    6664    }
    6765    protected virtual void Content_ValueChanged(object sender, System.EventArgs e) {
     
    7068      else {
    7169        valueViewHost.ViewType = null;
    72         valueViewHost.Content = Content.Value as IContent;
     70        valueViewHost.Content = Content.Value;
    7371      }
    7472    }
Note: See TracChangeset for help on using the changeset viewer.