Ignore:
Timestamp:
01/21/15 10:12:08 (6 years ago)
Author:
jkarder
Message:

#2077: merged r11700:11806 back to trunk

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Scripting.Views/3.3/HeuristicLab.Scripting.Views-3.3.csproj

    r11623 r11807  
    118118  </ItemGroup>
    119119  <ItemGroup>
    120     <ProjectReference Include="..\..\HeuristicLab.CodeEditor\3.3\HeuristicLab.CodeEditor-3.3.csproj">
    121       <Project>{489cfe09-fdf7-4c89-bab5-bd09cadd61ad}</Project>
    122       <Name>HeuristicLab.CodeEditor-3.3</Name>
    123       <Private>False</Private>
     120    <ProjectReference Include="..\..\HeuristicLab.CodeEditor\3.4\HeuristicLab.CodeEditor-3.4.csproj">
     121      <Project>{c38691ae-ecb4-489a-a05d-b035554e0168}</Project>
     122      <Name>HeuristicLab.CodeEditor-3.4</Name>
    124123    </ProjectReference>
    125124    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
  • trunk/sources/HeuristicLab.Scripting.Views/3.3/Plugin.cs.frame

    r11174 r11807  
    2525  [Plugin("HeuristicLab.Scripting.Views", "3.3.10.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Scripting.Views-3.3.dll", PluginFileType.Assembly)]
    27   [PluginDependency("HeuristicLab.CodeEditor", "3.3")]
     27  [PluginDependency("HeuristicLab.CodeEditor", "3.4")]
    2828  [PluginDependency("HeuristicLab.Collections", "3.3")]
    2929  [PluginDependency("HeuristicLab.Common", "3.3")]
  • trunk/sources/HeuristicLab.Scripting.Views/3.3/ScriptView.Designer.cs

    r11657 r11807  
    1919 */
    2020#endregion
     21
     22using System.Collections.Generic;
     23using System.Reflection;
     24using HeuristicLab.Common;
    2125
    2226namespace HeuristicLab.Scripting.Views {
     
    4650    private void InitializeComponent() {
    4751      this.components = new System.ComponentModel.Container();
    48       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScriptView));
    4952      this.compilationLabel = new System.Windows.Forms.Label();
    5053      this.imageList = new System.Windows.Forms.ImageList(this.components);
     
    214217      this.codeEditor.TabIndex = 0;
    215218      this.codeEditor.UserCode = "";
     219      this.codeEditor.AssembliesLoaded += new System.EventHandler<EventArgs<IEnumerable<Assembly>>>(this.codeEditor_AssembliesLoaded);
     220      this.codeEditor.AssembliesLoading += new System.EventHandler<EventArgs<IEnumerable<Assembly>>>(this.codeEditor_AssembliesLoading);
     221      this.codeEditor.AssembliesUnloaded += new System.EventHandler<EventArgs<IEnumerable<Assembly>>>(this.codeEditor_AssembliesUnloaded);
     222      this.codeEditor.AssembliesUnloading += new System.EventHandler<EventArgs<IEnumerable<Assembly>>>(this.codeEditor_AssembliesUnloading);
    216223      this.codeEditor.TextEditorTextChanged += new System.EventHandler(this.codeEditor_TextEditorTextChanged);
    217224      //
    218225      // splitContainer1
    219226      //
    220       this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    221             | System.Windows.Forms.AnchorStyles.Left) 
     227      this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     228            | System.Windows.Forms.AnchorStyles.Left)
    222229            | System.Windows.Forms.AnchorStyles.Right)));
    223230      this.splitContainer1.Location = new System.Drawing.Point(0, 56);
  • trunk/sources/HeuristicLab.Scripting.Views/3.3/ScriptView.cs

    r11657 r11807  
    2222using System;
    2323using System.CodeDom.Compiler;
     24using System.Collections.Generic;
    2425using System.Drawing;
    2526using System.Globalization;
    2627using System.Linq;
     28using System.Reflection;
    2729using System.Windows.Forms;
     30using HeuristicLab.Common;
    2831using HeuristicLab.Common.Resources;
    2932using HeuristicLab.Core.Views;
     
    3538  [Content(typeof(Script), true)]
    3639  public partial class ScriptView : NamedItemView {
     40    private const string AssembliesLoadingMessage = "Loading Assemblies";
     41    private const string AssembliesUnloadingMessage = "Unloading Assemblies";
     42    private const int SilentAssemblyLoadingOperationLimit = 10;
     43
    3744    #region Properties
    3845    public new Script Content {
     
    7380        codeEditor.UserCode = string.Empty;
    7481      } else {
    75         if (codeEditor.UserCode != Content.Code)
    76           codeEditor.UserCode = Content.Code;
    77         foreach (var asm in Content.GetAssemblies())
    78           codeEditor.AddAssembly(asm);
     82        codeEditor.UserCode = Content.Code;
     83        codeEditor.AddAssembliesAsync(Content.GetAssemblies());
    7984        if (Content.CompileErrors == null) {
    8085          compilationLabel.ForeColor = SystemColors.ControlDarkDark;
     
    131136        Locked = false;
    132137        codeEditor.Focus();
    133         OnContentChanged();
    134138      }
    135139    }
     
    157161      }
    158162
    159       codeEditor.ShowCompileErrors(Content.CompileErrors, ".cs");
     163      codeEditor.ShowCompileErrors(Content.CompileErrors);
    160164
    161165      AdjustErrorListViewColumnSizes();
     
    167171        ch.Width = -2;
    168172    }
     173
     174    #region ProgressView
     175    private bool progressViewCreated;
     176
     177    private void AddProgressView(string progressMessage) {
     178      var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     179      mainForm.AddOperationProgressToView(this, progressMessage);
     180      progressViewCreated = true;
     181    }
     182
     183    private void RemoveProgressView() {
     184      if (!progressViewCreated) return;
     185      var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     186      mainForm.RemoveOperationProgressFromView(this);
     187      progressViewCreated = false;
     188    }
     189    #endregion
    169190    #endregion
    170191
    171192    #region Event Handlers
    172193    private void Content_CodeChanged(object sender, EventArgs e) {
    173       if (InvokeRequired)
    174         Invoke(new EventHandler(Content_CodeChanged), sender, e);
     194      if (InvokeRequired) Invoke((Action<object, EventArgs>)Content_CodeChanged, sender, e);
    175195      else {
    176196        codeEditor.UserCode = Content.Code;
     
    196216    }
    197217    #endregion
     218
     219    private void codeEditor_AssembliesLoading(object sender, EventArgs<IEnumerable<Assembly>> e) {
     220      if (InvokeRequired) Invoke((Action<object, EventArgs<IEnumerable<Assembly>>>)codeEditor_AssembliesLoading, sender, e);
     221      else {
     222        int nrOfAssemblies = e.Value.Count();
     223        if (nrOfAssemblies > SilentAssemblyLoadingOperationLimit)
     224          AddProgressView(AssembliesLoadingMessage);
     225      }
     226    }
     227
     228    private void codeEditor_AssembliesLoaded(object sender, EventArgs<IEnumerable<Assembly>> e) {
     229      if (InvokeRequired) Invoke((Action<object, EventArgs<IEnumerable<Assembly>>>)codeEditor_AssembliesLoaded, sender, e);
     230      else {
     231        RemoveProgressView();
     232      }
     233    }
     234
     235    private void codeEditor_AssembliesUnloading(object sender, EventArgs<IEnumerable<Assembly>> e) {
     236      if (InvokeRequired) Invoke((Action<object, EventArgs<IEnumerable<Assembly>>>)codeEditor_AssembliesUnloading, sender, e);
     237      else {
     238        int nrOfAssemblies = e.Value.Count();
     239        if (nrOfAssemblies > SilentAssemblyLoadingOperationLimit)
     240          AddProgressView(AssembliesUnloadingMessage);
     241      }
     242    }
     243
     244    private void codeEditor_AssembliesUnloaded(object sender, EventArgs<IEnumerable<Assembly>> e) {
     245      if (InvokeRequired) Invoke((Action<object, EventArgs<IEnumerable<Assembly>>>)codeEditor_AssembliesUnloaded, sender, e);
     246      else {
     247        RemoveProgressView();
     248      }
     249    }
    198250  }
    199251}
Note: See TracChangeset for help on using the changeset viewer.