diff options
Diffstat (limited to 'Software/Visual_Studio/Scripting')
5 files changed, 62 insertions, 6 deletions
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Project.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Project.cs index ddf61e124..ff7a3acc2 100644 --- a/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Project.cs +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Project.cs @@ -20,7 +20,19 @@ namespace Tango.Scripting.Basic { public class Project : ExtendedObject { - public String Name { get; set; } + private String _name; + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); } + } + + private String _description; + public String Description + { + get { return _description; } + set { _description = value; RaisePropertyChangedAuto(); } + } public ApartmentState ApartmentState { get; set; } @@ -79,7 +91,7 @@ namespace Tango.Scripting.Basic p.Scripts.Add(new Script() { - Name = "main.csx", + Name = name, IsEntryPoint = true, Code = code, }); diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/ProjectSession.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/ProjectSession.cs index a613f2bcc..565949402 100644 --- a/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/ProjectSession.cs +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/ProjectSession.cs @@ -9,6 +9,7 @@ namespace Tango.Scripting.Basic public class ProjectSession { private Action _abortAction; + private TaskCompletionSource<object> _completion; public event EventHandler<ProjectSessionStateChangedEventArgs> StateChanged; @@ -18,6 +19,7 @@ namespace Tango.Scripting.Basic public ProjectSession(Project project, Action abortAction) { + _completion = new TaskCompletionSource<object>(); Project = project; _abortAction = abortAction; } @@ -26,24 +28,27 @@ namespace Tango.Scripting.Basic { _abortAction(); State = ProjectSessionState.Aborted; + _completion.SetException(new OperationCanceledException("Project execution aborted.")); RaiseStateChanged(); } internal void Failed(Exception ex) { State = ProjectSessionState.Failed; + _completion.SetException(ex); RaiseStateChanged(null, ex); } internal void Completed(object returnValue) { State = ProjectSessionState.Completed; + _completion.SetResult(returnValue); RaiseStateChanged(returnValue, null); } private void RaiseStateChanged(object returnValue = null, Exception ex = null) { - StateChanged?.Invoke(this, + StateChanged?.Invoke(this, new ProjectSessionStateChangedEventArgs() { ReturnValue = returnValue, @@ -51,5 +56,10 @@ namespace Tango.Scripting.Basic Exception = ex }); } + + public Task<Object> WaitForCompletion() + { + return _completion.Task; + } } } diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/ReferenceAssembly.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/ReferenceAssembly.cs index 15ef49639..be66e026b 100644 --- a/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/ReferenceAssembly.cs +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/ReferenceAssembly.cs @@ -9,5 +9,10 @@ namespace Tango.Scripting.Basic public class ReferenceAssembly { public Type FromType { get; set; } + + public String Name + { + get { return FromType.Assembly.GetName().Name; } + } } } diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs index aab22912d..fce05636d 100644 --- a/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -15,6 +16,15 @@ namespace Tango.Scripting.Basic public String Code { get; set; } public bool IsEntryPoint { get; set; } + private bool _isSelected; + [JsonIgnore] + public bool IsSelected + { + get { return _isSelected; } + set { _isSelected = value; RaisePropertyChangedAuto(); } + } + + public static Script New(String file) { return new Script() @@ -23,5 +33,14 @@ namespace Tango.Scripting.Basic Code = System.IO.File.ReadAllText(file), }; } + + public static Script New(String name, String code) + { + return new Script() + { + Name = name, + Code = code, + }; + } } } diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/Utils.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/Utils.cs index f8cc7072d..2ead15d0d 100644 --- a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/Utils.cs +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/Utils.cs @@ -150,7 +150,12 @@ namespace Tango.Scripting.Editors.Intellisense var property = knownType.Properties[i]; var pDoc = docNodes.FirstOrDefault(x => x.Attributes["name"].InnerText.Contains(knownType.Type.Name + "." + property.Name)); - property.Summary = pDoc != null ? pDoc.SelectSingleNode("summary").InnerXml : "No documentation"; + + if (pDoc != null) + { + var summaryNode = pDoc.SelectSingleNode("summary"); + property.Summary = summaryNode != null ? summaryNode.InnerXml : "No documentation"; + } } } @@ -162,7 +167,12 @@ namespace Tango.Scripting.Editors.Intellisense { var field = knownType.Fields[i]; var pDoc = xmlDoc.SelectSingleNode("//member[starts-with(@name, '" + $"F:{knownType.Type.FullName}.{field.Name}" + "')]"); - field.Summary = pDoc != null ? pDoc.SelectSingleNode("summary").InnerXml : "No documentation"; + + if (pDoc != null) + { + var summaryNode = pDoc.SelectSingleNode("summary"); + field.Summary = summaryNode != null ? summaryNode.InnerXml : "No documentation"; + } } } } |
