diff --git a/Icons/reset.png b/Icons/reset.png new file mode 100644 index 0000000..80ae1c8 Binary files /dev/null and b/Icons/reset.png differ diff --git a/LibS7Adv.csproj b/LibS7Adv.csproj index 2bbcb22..cf75ace 100644 --- a/LibS7Adv.csproj +++ b/LibS7Adv.csproj @@ -9,6 +9,7 @@ + @@ -25,6 +26,7 @@ + diff --git a/PLCControl.xaml b/PLCControl.xaml index c5dad9f..1138a72 100644 --- a/PLCControl.xaml +++ b/PLCControl.xaml @@ -24,7 +24,7 @@ + ShowSortOptions="False" ForceCursor="True" Margin="5,5,5,5" NameColumnWidth="100" /> @@ -35,6 +35,13 @@ + diff --git a/PLCViewModel.cs b/PLCViewModel.cs index 101e5bf..a73942e 100644 --- a/PLCViewModel.cs +++ b/PLCViewModel.cs @@ -5,10 +5,11 @@ using Newtonsoft.Json; using System.Text.RegularExpressions; using System.ComponentModel; using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; namespace LibS7Adv { - [DisplayName("PLC Advanced Setup")] + [DisplayName("PLC Advanced Setup:")] public partial class PlcData : ObservableObject { [ObservableProperty] @@ -24,16 +25,20 @@ namespace LibS7Adv [ObservableProperty] [property: Description("CPU Info")] [property: Category("Status:")] + [property: ReadOnly(true)] string cpuTime; [ObservableProperty] + [property: Display(Name = "Status")] [property: Description("CPU Status")] [property: Category("Status:")] + [property: ReadOnly(true)] string connectionStatus; [ObservableProperty] [property: Description("API Error")] [property: Category("Status:")] + [property: ReadOnly(true)] string lastError; } @@ -63,6 +68,13 @@ namespace LibS7Adv [property: JsonIgnore] bool isConnected; + [RelayCommand] + [property: JsonIgnore] + public void ResetAlarmButton() + { + PlcData.LastError = ""; + } + [RelayCommand] [property: JsonIgnore] public void ConnectButton() @@ -75,6 +87,8 @@ namespace LibS7Adv public void Connect() { + if (IsConnected) + return; try { // Implementa la conexión utilizando PLCModel @@ -175,7 +189,7 @@ namespace LibS7Adv else if (tag.tagType == EDataType.Bool) { if (tag.areaType == EArea.Input) - Instance?.OutputArea.WriteBit(tag.word_offset, tag.bit, Value); + Instance?.InputArea.WriteBit(tag.word_offset, tag.bit, Value); if (tag.areaType == EArea.Output) Instance?.OutputArea.WriteBit(tag.word_offset, tag.bit, Value); if (tag.areaType == EArea.Marker)