Mejorada la implementacion de rotacion y redimensionado.

This commit is contained in:
Miguel 2024-06-28 19:47:08 +02:00
parent b3f5ebc53a
commit 81643249b9
4 changed files with 26 additions and 3 deletions

BIN
Icons/reset.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -9,6 +9,7 @@
<ItemGroup> <ItemGroup>
<None Remove="Icons\connect.png" /> <None Remove="Icons\connect.png" />
<None Remove="Icons\reset.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -25,6 +26,7 @@
<ItemGroup> <ItemGroup>
<Resource Include="Icons\connect.png" /> <Resource Include="Icons\connect.png" />
<Resource Include="Icons\reset.png" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -24,7 +24,7 @@
<StackPanel> <StackPanel>
<xctk:PropertyGrid MinWidth="300" x:Name="PanelEdicion" AutoGenerateProperties="True" <xctk:PropertyGrid MinWidth="300" x:Name="PanelEdicion" AutoGenerateProperties="True"
SelectedObject="{Binding PlcData}" ShowDescriptionByTooltip="True" ShowSearchBox="False" SelectedObject="{Binding PlcData}" ShowDescriptionByTooltip="True" ShowSearchBox="False"
ShowSortOptions="False" ForceCursor="True" Margin="5,5,5,5" /> ShowSortOptions="False" ForceCursor="True" Margin="5,5,5,5" NameColumnWidth="100" />
<ToolBarTray> <ToolBarTray>
<ToolBar> <ToolBar>
@ -35,6 +35,13 @@
<TextBlock Text="Conectar" /> <TextBlock Text="Conectar" />
</StackPanel> </StackPanel>
</Button> </Button>
<Button Command="{Binding ResetAlarmButtonCommand}" ToolTip="Reset Alarm"
>
<StackPanel>
<Image Source="Icons/reset.png" Width="24" Height="24" />
<TextBlock Text="Reset" />
</StackPanel>
</Button>
</ToolBar> </ToolBar>
</ToolBarTray> </ToolBarTray>
</StackPanel> </StackPanel>

View File

@ -5,10 +5,11 @@ using Newtonsoft.Json;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.ComponentModel; using System.ComponentModel;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
namespace LibS7Adv namespace LibS7Adv
{ {
[DisplayName("PLC Advanced Setup")] [DisplayName("PLC Advanced Setup:")]
public partial class PlcData : ObservableObject public partial class PlcData : ObservableObject
{ {
[ObservableProperty] [ObservableProperty]
@ -24,16 +25,20 @@ namespace LibS7Adv
[ObservableProperty] [ObservableProperty]
[property: Description("CPU Info")] [property: Description("CPU Info")]
[property: Category("Status:")] [property: Category("Status:")]
[property: ReadOnly(true)]
string cpuTime; string cpuTime;
[ObservableProperty] [ObservableProperty]
[property: Display(Name = "Status")]
[property: Description("CPU Status")] [property: Description("CPU Status")]
[property: Category("Status:")] [property: Category("Status:")]
[property: ReadOnly(true)]
string connectionStatus; string connectionStatus;
[ObservableProperty] [ObservableProperty]
[property: Description("API Error")] [property: Description("API Error")]
[property: Category("Status:")] [property: Category("Status:")]
[property: ReadOnly(true)]
string lastError; string lastError;
} }
@ -63,6 +68,13 @@ namespace LibS7Adv
[property: JsonIgnore] [property: JsonIgnore]
bool isConnected; bool isConnected;
[RelayCommand]
[property: JsonIgnore]
public void ResetAlarmButton()
{
PlcData.LastError = "";
}
[RelayCommand] [RelayCommand]
[property: JsonIgnore] [property: JsonIgnore]
public void ConnectButton() public void ConnectButton()
@ -75,6 +87,8 @@ namespace LibS7Adv
public void Connect() public void Connect()
{ {
if (IsConnected)
return;
try try
{ {
// Implementa la conexión utilizando PLCModel // Implementa la conexión utilizando PLCModel
@ -175,7 +189,7 @@ namespace LibS7Adv
else if (tag.tagType == EDataType.Bool) else if (tag.tagType == EDataType.Bool)
{ {
if (tag.areaType == EArea.Input) 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) if (tag.areaType == EArea.Output)
Instance?.OutputArea.WriteBit(tag.word_offset, tag.bit, Value); Instance?.OutputArea.WriteBit(tag.word_offset, tag.bit, Value);
if (tag.areaType == EArea.Marker) if (tag.areaType == EArea.Marker)