diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-03 12:16:21 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-03 12:16:21 +0300 |
| commit | bd1221e36ee3e493dc25bd32559f846519fe60d0 (patch) | |
| tree | e4462d6672223b1fb43ee017e256e13301cec9f2 /Software | |
| parent | 99cbacc067251a3841fc1aca99e029146ed11c15 (diff) | |
| download | Tango-bd1221e36ee3e493dc25bd32559f846519fe60d0.tar.gz Tango-bd1221e36ee3e493dc25bd32559f846519fe60d0.zip | |
Refactored RemoteSQL on procedures.
Fixed issue with generic types display on code editor.
Added line wrap toggle to procedure designer output.
Diffstat (limited to 'Software')
15 files changed, 377 insertions, 65 deletions
diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf Binary files differindex 944715183..07f93ca84 100644 --- a/Software/DB/PPC/Tango.mdf +++ b/Software/DB/PPC/Tango.mdf diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf Binary files differindex 47c6923db..fd01f6cba 100644 --- a/Software/DB/PPC/Tango_log.ldf +++ b/Software/DB/PPC/Tango_log.ldf diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/ViewModels/ProcedureDesignerViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/ViewModels/ProcedureDesignerViewVM.cs index 84f677087..68c8538b8 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/ViewModels/ProcedureDesignerViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/ViewModels/ProcedureDesignerViewVM.cs @@ -266,13 +266,7 @@ namespace Tango.FSE.Procedures.ViewModels ScriptEditor.LoadingSymbolsCompleted += ScriptEditor_LoadingSymbolsCompleted; ScriptEditor.UsingsLoadingStarted += ScriptEditor_UsingsLoadingStarted; ScriptEditor.UsingsLoadingCompleted += ScriptEditor_UsingsLoadingCompleted; - ScriptEditor.BlockedUsingsCache.Add("Tango.FSE.Procedures"); - ScriptEditor.BlockedUsingsCache.Add("Tango.PMR.Stubs"); - ScriptEditor.BlockedUsingsCache.Add("Tango.BL.Entities"); - ScriptEditor.BlockedUsingsCache.Add("Tango.BL.Enumerations"); - ScriptEditor.BlockedUsingsCache.Add("Tango.PMR.Diagnostics"); - ScriptEditor.BlockedUsingsCache.Add("Tango.FSE.Common.Connection"); - ScriptEditor.BlockedUsingsCache.Add("Tango.FSE.Common.Diagnostics"); + ScriptEditor.BlockedUsingsCache.Add("Tango"); OpenScripts = new ObservableCollection<Script>(); OpenScriptCommand = new RelayCommand<Script>(OpenScript); @@ -446,7 +440,7 @@ namespace Tango.FSE.Procedures.ViewModels { SymbolsLoadingProgress = e.Progress; - _symbolsTaskItem?.UpdateProgress(e.Progress.Message, e.Progress.Value, e.Progress.Maximum); + _symbolsTaskItem?.UpdateProgress(e.Progress.Message, e.Progress.Value, e.Progress.Maximum, e.Progress.IsIndeterminate); } private void ScriptEditor_UsingsLoadingStarted(object sender, EventArgs e) diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Views/ProcedureDesignerView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Views/ProcedureDesignerView.xaml index 214dc66ee..e122a1eca 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Views/ProcedureDesignerView.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Views/ProcedureDesignerView.xaml @@ -505,11 +505,29 @@ <DockPanel> <Grid DockPanel.Dock="Top" Height="28" Background="{StaticResource FSE_PrimaryBackgroundBrush}"> <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontFamily="{StaticResource hand}">Output</TextBlock> - <controls:IconButton Command="{Binding ClearOutputCommand}" Height="32" Cursor="Hand" ToolTip="Clear" Width="32" Icon="DeleteEmpty" Foreground="{StaticResource FSE_GrayBrush}" HorizontalAlignment="Right" VerticalAlignment="Center" /> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <ToggleButton x:Name="chkWrap" IsChecked="True" VerticalAlignment="Center" Style="{StaticResource MaterialDesignFlatPrimaryToggleButton}" Cursor="Hand" Foreground="{StaticResource FSE_GrayBrush}" ToolTip="Line Wrap" FocusVisualStyle="{x:Null}" Width="22" Height="22"> + <material:PackIcon Kind="Wrap" /> + </ToggleButton> + <controls:IconButton Margin="5 0 0 0" Command="{Binding ClearOutputCommand}" Height="32" Cursor="Hand" ToolTip="Clear" Width="32" Icon="DeleteEmpty" Foreground="{StaticResource FSE_GrayBrush}" VerticalAlignment="Center" /> + </StackPanel> <Rectangle VerticalAlignment="Bottom" Stroke="Black" StrokeThickness="2" /> </Grid> - <TextBox HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5" Style="{x:Null}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}" FontFamily="Consolas" components:TextController.Controller="{Binding Logger}" FontSize="{StaticResource FSE_SmallFontSize}" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" BorderThickness="0" AcceptsReturn="True" IsReadOnly="True" TextWrapping="Wrap" /> + <TextBox VerticalScrollBarVisibility="Auto" Padding="5" Foreground="{StaticResource FSE_PrimaryForegroundBrush}" FontFamily="Consolas" components:TextController.Controller="{Binding Logger}" FontSize="{StaticResource FSE_SmallFontSize}" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" BorderThickness="0" AcceptsReturn="True" IsReadOnly="True"> + <TextBox.Style> + <Style TargetType="TextBox"> + <Setter Property="TextWrapping" Value="Wrap"></Setter> + <Setter Property="HorizontalScrollBarVisibility" Value="Disabled"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=chkWrap,Path=IsChecked}" Value="False"> + <Setter Property="TextWrapping" Value="NoWrap"></Setter> + <Setter Property="HorizontalScrollBarVisibility" Value="Auto"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBox.Style> + </TextBox> </DockPanel> </TabItem> <TabItem> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/SQL/RemoteSqlCommandResult.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/SQL/RemoteSqlCommandResult.cs index b4714c1aa..34ab74a68 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/SQL/RemoteSqlCommandResult.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/SQL/RemoteSqlCommandResult.cs @@ -3,25 +3,26 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.PPC.Shared.SQL; namespace Tango.FSE.Common.SQL { public class RemoteSqlCommandResult { public int LocalAffectedRecords { get; set; } - public List<Dictionary<String, Object>> LocalRows { get; set; } + public RemoteSqlDataSet LocalDatSet { get; set; } public bool HasLocalError { get; set; } public String LocalError { get; set; } public int GlobalAffectedRecords { get; set; } - public List<Dictionary<String, Object>> GlobalRows { get; set; } + public RemoteSqlDataSet GLobalDataSet { get; set; } public bool HasGlobalError { get; set; } public String GlobalError { get; set; } public RemoteSqlCommandResult() { - LocalRows = new List<Dictionary<string, object>>(); - GlobalRows = new List<Dictionary<string, object>>(); + LocalDatSet = new RemoteSqlDataSet(); + GLobalDataSet = new RemoteSqlDataSet(); } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/SQL/DefaultRemoteSqlProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/SQL/DefaultRemoteSqlProvider.cs index 19750094e..7477dc7f4 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/SQL/DefaultRemoteSqlProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/SQL/DefaultRemoteSqlProvider.cs @@ -119,14 +119,13 @@ namespace Tango.FSE.UI.SQL }, new TransportRequestConfig() { Timeout = TimeSpan.FromSeconds(command.Timeout) }); result.LocalAffectedRecords = response.AffectedRecords; - result.LocalRows = response.Rows.ToList(); + result.LocalDatSet = response.DataSet; } catch (Exception ex) { LogManager.Log(ex, "Remote SQL command local execution failed."); result.HasLocalError = true; result.LocalError = ex.FlattenMessage(); - return result; } } @@ -140,31 +139,15 @@ namespace Tango.FSE.UI.SQL { using (SqlConnection connection = new SqlConnection(db.Database.Connection.ConnectionString)) { + connection.AccessToken = ObservablesContext.GetActualDataSource().AccessToken; + connection.Open(); + SqlCommand cmd = new SqlCommand(command.SQL, connection); cmd.CommandTimeout = command.Timeout; - connection.Open(); SqlDataReader reader = await cmd.ExecuteReaderAsync(); result.GlobalAffectedRecords = reader.RecordsAffected; - - try - { - while (reader.Read()) - { - Dictionary<String, Object> row = new Dictionary<string, object>(); - - for (int i = 0; i < reader.FieldCount; i++) - { - row[reader.GetName(i)] = reader.GetValue(i); - } - - result.GlobalRows.Add(row); - } - } - finally - { - reader.Close(); - } + result.GLobalDataSet = await RemoteSqlDataSet.Load(reader); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/SQL/DefaultRemoteSqlService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/SQL/DefaultRemoteSqlService.cs index 986c4d062..e5ac43d3f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/SQL/DefaultRemoteSqlService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/SQL/DefaultRemoteSqlService.cs @@ -27,7 +27,7 @@ namespace Tango.PPC.Common.SQL { this.ThrowIfDisabled(); - List<Dictionary<String, Object>> rows = new List<Dictionary<string, object>>(); + RemoteSqlDataSet dataSet = new RemoteSqlDataSet(); int affected = 0; using (ObservablesContext db = ObservablesContext.CreateDefault()) @@ -40,30 +40,13 @@ namespace Tango.PPC.Common.SQL SqlDataReader reader = command.ExecuteReader(); affected = reader.RecordsAffected; - try - { - while (reader.Read()) - { - Dictionary<String, Object> row = new Dictionary<string, object>(); - - for (int i = 0; i < reader.FieldCount; i++) - { - row[reader.GetName(i)] = reader.GetValue(i); - } - - rows.Add(row); - } - } - finally - { - reader.Close(); - } + dataSet = await RemoteSqlDataSet.Load(reader); } } await receiver.SendGenericResponse(new ExecuteSqlResponse() { - Rows = rows, + DataSet = dataSet, AffectedRecords = affected }, token); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlResponse.cs index 4166d8f82..2db90a336 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlResponse.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/ExecuteSqlResponse.cs @@ -9,11 +9,11 @@ namespace Tango.PPC.Shared.SQL public class ExecuteSqlResponse { public int AffectedRecords { get; set; } - public List<Dictionary<String,Object>> Rows { get; set; } + public RemoteSqlDataSet DataSet { get; set; } public ExecuteSqlResponse() { - Rows = new List<Dictionary<string, object>>(); + DataSet = new RemoteSqlDataSet(); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumn.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumn.cs new file mode 100644 index 000000000..328dbb492 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumn.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.SQL +{ + public class RemoteSqlColumn + { + public String Name { get; set; } + public int Index { get; set; } + + public RemoteSqlColumn() + { + + } + + public RemoteSqlColumn(String name) + { + Name = name; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs new file mode 100644 index 000000000..5358e047b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlColumnCollection.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.SQL +{ + public class RemoteSqlColumnCollection : Collection<RemoteSqlColumn> + { + private Dictionary<String, RemoteSqlColumn> _dictionary; + + public RemoteSqlColumnCollection() + { + _dictionary = new Dictionary<string, RemoteSqlColumn>(); + } + + protected override void InsertItem(int index, RemoteSqlColumn item) + { + item.Index = Count; + _dictionary.Add(item.Name, item); + base.InsertItem(index, item); + } + + protected override void RemoveItem(int index) + { + throw new NotSupportedException(); + } + + protected override void ClearItems() + { + _dictionary.Clear(); + base.ClearItems(); + } + + protected override void SetItem(int index, RemoteSqlColumn item) + { + throw new NotSupportedException(); + } + + public int GetIndexOf(String columnName) + { + return _dictionary[columnName].Index; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlDataSet.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlDataSet.cs new file mode 100644 index 000000000..089908e5a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlDataSet.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Shared.SQL +{ + public class RemoteSqlDataSet + { + public RemoteSqlColumnCollection Columns { get; set; } + + private ObservableCollection<RemoteSqlRow> _rows; + public ObservableCollection<RemoteSqlRow> Rows + { + get { return _rows; } + set { _rows = value; OnRowsChanged(); } + } + + public RemoteSqlDataSet() + { + Columns = new RemoteSqlColumnCollection(); + Rows = new ObservableCollection<RemoteSqlRow>(); + } + + private void OnRowsChanged() + { + if (Rows != null) + { + Rows.CollectionChanged -= Rows_CollectionChanged; + Rows.CollectionChanged += Rows_CollectionChanged; + + InitRows(); + } + } + + private void Rows_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + InitRows(); + } + + private void InitRows() + { + if (Rows != null) + { + foreach (var row in Rows.ToList()) + { + row.Init( + (key) => + { + return row.Values[Columns.GetIndexOf(key)]; + }, + (index) => + { + return row.Values[index]; + }); + } + } + } + + public static Task<RemoteSqlDataSet> Load(SqlDataReader reader) + { + return Task.Factory.StartNew<RemoteSqlDataSet>(() => + { + bool columnsRead = false; + RemoteSqlDataSet dataSet = new RemoteSqlDataSet(); + + try + { + while (reader.Read()) + { + RemoteSqlRow row = new RemoteSqlRow(); + + for (int i = 0; i < reader.FieldCount; i++) + { + if (!columnsRead) + { + dataSet.Columns.Add(new RemoteSqlColumn() + { + Name = reader.GetName(i) + }); + } + + row.Values.Add(reader.GetValue(i)); + } + + columnsRead = true; + dataSet.Rows.Add(row); + } + } + finally + { + reader.Close(); + } + + return dataSet; + }); + } + + public override string ToString() + { + return String.Join(", ", Columns.Select(x => x.Name)) + "\n" + String.Join(Environment.NewLine, Rows.Select(x => x.ToString())); + } + + public String ToTableString() + { + Dictionary<int, int> columnsMaxLength = new Dictionary<int, int>(); + + for (int i = 0; i < Columns.Count; i++) + { + columnsMaxLength.Add(i, Columns[i].Name.Length); + } + + foreach (var row in Rows) + { + for (int i = 0; i < row.Values.Count; i++) + { + int valueLength = row.Values[i].ToStringSafe().Length; + + if (valueLength > columnsMaxLength[i]) + { + columnsMaxLength[i] = valueLength; + } + } + } + + String str = String.Empty; + + for (int i = 0; i < Columns.Count; i++) + { + str += $"{Columns[i].Name.PadRight(columnsMaxLength[i])}{(i < Columns.Count - 1 ? " | " : "")}"; + } + + int width = str.Length; + str += Environment.NewLine + String.Empty.PadRight(width, '-'); + + foreach (var row in Rows) + { + str += Environment.NewLine; + + for (int i = 0; i < row.Values.Count; i++) + { + str += $"{row.Values[i].ToStringSafe().PadRight(columnsMaxLength[i])}{(i < Columns.Count - 1 ? " | " : "")}"; + } + } + + return str; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlRow.cs b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlRow.cs new file mode 100644 index 000000000..bf6b0ba0c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/SQL/RemoteSqlRow.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.PPC.Shared.SQL +{ + public class RemoteSqlRow + { + private Func<String, Object> _getFuncKey; + private Func<int, Object> _getFuncIndex; + + public List<Object> Values { get; set; } + + public RemoteSqlRow() + { + Values = new List<object>(); + } + + public Object Get(String columnName) + { + return _getFuncKey.Invoke(columnName); + } + + public Object Get(int columnIndex) + { + return _getFuncIndex.Invoke(columnIndex); + } + + public T Get<T>(String columnName) + { + var value = _getFuncKey.Invoke(columnName); + + if (typeof(T) != value.GetType()) + { + return (T)Convert.ChangeType(value, typeof(T)); + } + else + { + return (T)value; + } + } + + public T Get<T>(int columnIndex) + { + var value = _getFuncIndex.Invoke(columnIndex); + + if (typeof(T) != value.GetType()) + { + return (T)Convert.ChangeType(value, typeof(T)); + } + else + { + return (T)value; + } + } + + internal void Init(Func<String, Object> getFuncKey, Func<int, Object> getFuncIndex) + { + _getFuncKey = getFuncKey; + _getFuncIndex = getFuncIndex; + } + + public override string ToString() + { + return String.Join(", ", Values); + } + + public T Map<T>() where T : class, new() + { + var obj = Activator.CreateInstance<T>(); + Map<T>(obj); + return obj; + } + + public void Map<T>(T obj) where T : class + { + foreach (var prop in typeof(T).GetPropertiesWithAttribute<ColumnAttribute>()) + { + try + { + var columnName = prop.GetCustomAttribute<ColumnAttribute>().Name; + var value = Get(columnName).ToStringSafe(); + prop.SetValue(obj, Convert.ChangeType(value, prop.PropertyType)); + } + catch (Exception ex) + { + Debug.WriteLine(ex); + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj index c93aef159..10993399c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Shared/Tango.PPC.Shared.csproj @@ -33,6 +33,7 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> <Reference Include="Microsoft.CSharp" /> @@ -90,6 +91,10 @@ <Compile Include="RemoteUpgrade\StartRemoteApplicationUpgradeRequest.cs" /> <Compile Include="SQL\ExecuteSqlRequest.cs" /> <Compile Include="SQL\ExecuteSqlResponse.cs" /> + <Compile Include="SQL\RemoteSqlColumn.cs" /> + <Compile Include="SQL\RemoteSqlColumnCollection.cs" /> + <Compile Include="SQL\RemoteSqlDataSet.cs" /> + <Compile Include="SQL\RemoteSqlRow.cs" /> <Compile Include="Updates\GetUpdatesAndPackagesRequest.cs" /> <Compile Include="Updates\GetUpdatesAndPackagesResponse.cs" /> <Compile Include="Updates\PackageInstallation.cs" /> diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ExtensionMethods.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ExtensionMethods.cs index 1605ff281..d112c6141 100644 --- a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ExtensionMethods.cs +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ExtensionMethods.cs @@ -22,7 +22,7 @@ namespace Tango.Scripting.Editors { List<String> args = new List<string>(); - foreach (var lGenericArgument in type.GetGenericTypeDefinition().GetGenericArguments()) + foreach (var lGenericArgument in type.GetGenericArguments()) { args.Add(lGenericArgument.Name); } diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs index 3c27118e2..0e32af6ed 100644 --- a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs @@ -260,6 +260,12 @@ namespace Tango.Scripting.Editors }" }); + + snippets.Add(new SnippetCompletionItem() + { + Name = "cw", + Code = "context.WriteLine(\"\");" + }); } /// <summary> @@ -1493,7 +1499,7 @@ namespace Tango.Scripting.Editors knownType.LoadDocumentation(); } - if (!BlockedUsingsCache.Exists(x => x == use)) + if (!BlockedUsingsCache.Exists(x => use.StartsWith(x))) { Task.Factory.StartNew(() => { @@ -1501,14 +1507,14 @@ namespace Tango.Scripting.Editors File.WriteAllText(useFileName, json); }); } - - if (_isUsingsLoadingStarted) - { - UsingsLoadingCompleted?.Invoke(this, new EventArgs()); - } } } + if (_isUsingsLoadingStarted) + { + UsingsLoadingCompleted?.Invoke(this, new EventArgs()); + } + LoadingSymbolsCompleted?.Invoke(null, new EventArgs()); } } |
