Explorar el Código

Update code format

SenGao hace 3 semanas
padre
commit
077c91b404

+ 1 - 1
Tools/PLCIOPointTool/App.xaml.cs

@@ -16,7 +16,7 @@ public partial class App : PrismApplication
     {
         //Services
         containerRegistry.RegisterSingleton<IOutputService, OutputService>();
-        containerRegistry.RegisterSingleton<ILog,LogService>();
+        containerRegistry.RegisterSingleton<ILog, LogService>();
         containerRegistry.RegisterSingleton<ICommunicator, PLCCommunicator>();
     }
 }

+ 3 - 4
Tools/PLCIOPointTool/Services/PLCCommunicator.cs

@@ -1,7 +1,6 @@
 using AdsCommunicatorNet8;
 using Log;
 using ProtocalGeneral;
-using TwinCAT.TypeSystem;
 
 namespace PLCIOPointTool.Services;
 
@@ -53,13 +52,13 @@ public class PLCCommunicator : ICommunicator, ITcpConnectNority, IDisposable
 
     public void GetValue(string symbolName, ValueType valueType)
     {
-        if(string.IsNullOrWhiteSpace(symbolName))
+        if (string.IsNullOrWhiteSpace(symbolName))
         {
             _log?.Error("Symbol name can not be null");
             return;
         }
 
-        if (!_isConnected) 
+        if (!_isConnected)
         {
             _log?.Error("Client is in disconnected");
             return;
@@ -108,7 +107,7 @@ public class PLCCommunicator : ICommunicator, ITcpConnectNority, IDisposable
 
     public void SetValue(string symbolName, string inputValue, ValueType valueType)
     {
-        if(string.IsNullOrWhiteSpace(symbolName)|| string.IsNullOrWhiteSpace(inputValue))
+        if (string.IsNullOrWhiteSpace(symbolName) || string.IsNullOrWhiteSpace(inputValue))
         {
             _log?.Error("Symbol name or input value can not be null");
             return;

+ 2 - 2
Tools/PLCIOPointTool/ViewModels/OutputBarViewModel.cs

@@ -12,7 +12,7 @@ public partial class OutputBarViewModel : ObservableObject, IDisposable
 
     [ObservableProperty]
     private ObservableCollection<string> _outputs;
-    
+
     public OutputBarViewModel(IOutputService outputService)
     {
         _outputService = outputService;
@@ -25,7 +25,7 @@ public partial class OutputBarViewModel : ObservableObject, IDisposable
     {
         App.Current.Dispatcher.BeginInvoke(() =>
         {
-            if(Outputs.Count>=50)
+            if (Outputs.Count >= 50)
             {
                 Outputs.RemoveAt(Outputs.Count - 1);
             }

+ 2 - 2
Tools/PLCIOPointTool/ViewModels/WorkAreaViewModel.cs

@@ -71,11 +71,11 @@ public partial class WorkAreaViewModel : ObservableObject, IDisposable
     [RelayCommand(CanExecute = nameof(IsConnected))]
     private void Read()
     {
-        if(string.IsNullOrWhiteSpace(ReadSymbolName) || ReadValueTypeIndex < 0)
+        if (string.IsNullOrWhiteSpace(ReadSymbolName) || ReadValueTypeIndex < 0)
         {
             return;
         }
-        Task.Run(() => 
+        Task.Run(() =>
         {
             _communicator.GetValue(ReadSymbolName, (ValueType)ReadValueTypeIndex);
         });