Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11734 for trunk


Ignore:
Timestamp:
01/07/15 10:29:08 (10 years ago)
Author:
jkarder
Message:

#2262:

  • only IDeepCloneables can be dropped on the VariableStoreView
  • renamed CSharpScript.Execute to CSharpScript.ExecuteAsync
Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Scripting.Views/3.3/CSharpScriptView.cs

    r11657 r11734  
    111111        if (Compile()) {
    112112          outputTextBox.Clear();
    113           Content.Execute();
     113          Content.ExecuteAsync();
    114114          Running = true;
    115115        }
     
    123123            if (Compile()) {
    124124              outputTextBox.Clear();
    125               Content.Execute();
     125              Content.ExecuteAsync();
    126126              Running = true;
    127127            }
  • trunk/sources/HeuristicLab.Scripting.Views/3.3/VariableStoreView.cs

    r11721 r11734  
    241241    }
    242242    protected virtual void variableListView_DragEnter(object sender, DragEventArgs e) {
    243       validDragOperation = !Locked && !ReadOnly && e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null;
     243      validDragOperation = !Locked && !ReadOnly;
     244
     245      object item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     246      if (item is KeyValuePair<string, object>) {
     247        var variable = (KeyValuePair<string, object>)item;
     248        validDragOperation &= variable.Value is IDeepCloneable;
     249      } else {
     250        validDragOperation &= item is IDeepCloneable;
     251      }
    244252    }
    245253    protected virtual void variableListView_DragOver(object sender, DragEventArgs e) {
    246254      e.Effect = DragDropEffects.None;
    247255      if (validDragOperation) {
    248         if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     256        if (e.AllowedEffect.HasFlag(DragDropEffects.Copy))
     257          e.Effect = DragDropEffects.Copy;
    249258      }
    250259    }
     
    269278
    270279      var cloneable = item as IDeepCloneable;
    271       if (cloneable != null) item = cloneable.Clone();
    272 
    273       Content.Add(variableName, item);
     280      if (cloneable == null) return;
     281
     282      var clonedItem = cloneable.Clone();
     283      Content.Add(variableName, clonedItem);
    274284
    275285      var listViewItem = variableListView.FindItemWithText(variableName);
  • trunk/sources/HeuristicLab.Scripting/3.3/CSharpScript.cs

    r11721 r11734  
    9595
    9696    private Thread scriptThread;
    97     public virtual void Execute() {
     97    public virtual void ExecuteAsync() {
    9898      if (compiledScript == null) return;
    9999      scriptThread = new Thread(() => {
Note: See TracChangeset for help on using the changeset viewer.