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

View File

@ -24,7 +24,7 @@
<StackPanel>
<xctk:PropertyGrid MinWidth="300" x:Name="PanelEdicion" AutoGenerateProperties="True"
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>
<ToolBar>
@ -35,6 +35,13 @@
<TextBlock Text="Conectar" />
</StackPanel>
</Button>
<Button Command="{Binding ResetAlarmButtonCommand}" ToolTip="Reset Alarm"
>
<StackPanel>
<Image Source="Icons/reset.png" Width="24" Height="24" />
<TextBlock Text="Reset" />
</StackPanel>
</Button>
</ToolBar>
</ToolBarTray>
</StackPanel>

View File

@ -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)