Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit f48c03a

Browse files
authored
Feature/topology (#487)
* sync * resourse files for examples added * SyncUnit view added * sync * Summary InfoData.State for the complete DataContext in TopologyRenderer + Simulation of the InfoData.State values * Sync unit coloured error state * Device coloured status added * Device state and Sync Unit state color changed to binding
1 parent 4b6341c commit f48c03a

File tree

325 files changed

+75755
-414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+75755
-414
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows;
4+
using System.Windows.Data;
5+
using System.Windows.Markup;
6+
using System.Windows.Media;
7+
8+
namespace TcoIo.Converters
9+
{
10+
public class SyncUnitErrorToBackground : MarkupExtension, IValueConverter
11+
{
12+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
13+
{
14+
if ((bool)value)
15+
{
16+
return TcoCore.Wpf.TcoColors.Error;
17+
}
18+
else
19+
{
20+
ResourceDictionary ColorResorce = new ResourceDictionary();
21+
ColorResorce.Source = new Uri("/TcOpen.Inxton.TcoIo.Wpf;component/diagnostics/ethercat/colors/colors.xaml", UriKind.RelativeOrAbsolute);
22+
return new SolidColorBrush((Color)ColorResorce["InxtonGrayLightColor"]);
23+
}
24+
}
25+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
26+
{
27+
return null;
28+
}
29+
public override object ProvideValue(IServiceProvider serviceProvider)
30+
{
31+
return this;
32+
}
33+
}
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows;
4+
using System.Windows.Data;
5+
using System.Windows.Markup;
6+
using System.Windows.Media;
7+
8+
namespace TcoIo.Converters
9+
{
10+
public class SyncUnitErrorToForeground : MarkupExtension, IValueConverter
11+
{
12+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
13+
{
14+
if ((bool)value)
15+
{
16+
return TcoCore.Wpf.TcoColors.OnError;
17+
}
18+
else
19+
{
20+
ResourceDictionary ColorResorce = new ResourceDictionary();
21+
ColorResorce.Source = new Uri("/TcOpen.Inxton.TcoIo.Wpf;component/diagnostics/ethercat/colors/colors.xaml", UriKind.RelativeOrAbsolute);
22+
return new SolidColorBrush((Color)ColorResorce["OnBackgroundColor"]);
23+
}
24+
}
25+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
26+
{
27+
return null;
28+
}
29+
public override object ProvideValue(IServiceProvider serviceProvider)
30+
{
31+
return this;
32+
}
33+
}
34+
}
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
<GroupBox
2-
x:Name="gbDescription"
1+
<UserControl
2+
x:Name="userControl"
33
x:Class="TcoIo.Diagnostics.EtherCAT.Display.AmsNetIdDisplay"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8-
Style="{DynamicResource MaterialFieldBox}"
98
FontWeight="Light"
109
mc:Ignorable="d">
11-
<GroupBox.Resources>
10+
<UserControl.Resources>
1211
<ResourceDictionary>
1312
<ResourceDictionary.MergedDictionaries>
1413
<ResourceDictionary Source="DefaultStyling.xaml" />
1514
</ResourceDictionary.MergedDictionaries>
1615
</ResourceDictionary>
17-
</GroupBox.Resources>
18-
<TextBox x:Name="tbValue" Text="{Binding _, Mode=OneWay}" IsReadOnly="True" FontWeight="DemiBold" Background="{StaticResource InxtonGrayLight}"/>
19-
</GroupBox>
16+
</UserControl.Resources>
17+
<GroupBox x:Name="gbDescription" Header="{Binding Description, Mode=OneWay}" FontWeight="Light">
18+
<TextBox x:Name="tbValue" Text="{Binding _, Mode=OneWay}" IsReadOnly="True" FontWeight="DemiBold" Background="Transparent">
19+
<TextBox.Resources>
20+
<Style TargetType="TextBox">
21+
<Setter Property="Foreground" Value="{Binding Foreground, ElementName=userControl, Mode=OneWay}"/>
22+
<Setter Property="BorderThickness" Value="0"/>
23+
</Style>
24+
</TextBox.Resources>
25+
</TextBox>
26+
</GroupBox>
27+
</UserControl>
2028

2129

src/TcoIo/src/Wpf/TcOpen.Inxton.TcoIo.Wpf/Diagnostics/EtherCAT/Display/AmsNetIdDisplay.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
using System.Windows;
1+
using System.ComponentModel;
2+
using System.Runtime.CompilerServices;
3+
using System.Windows;
24
using System.Windows.Controls;
35
using System.Windows.Data;
6+
using System.Windows.Media;
47
using TcoIo;
58

69
namespace TcoIo.Diagnostics.EtherCAT.Display
710
{
8-
public partial class AmsNetIdDisplay
11+
public partial class AmsNetIdDisplay
912
{
1013
public AmsNetIdDisplay()
1114
{
Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<Grid
2-
x:Name="gbDescription"
1+
<UserControl
2+
x:Name="userControl"
33
x:Class="TcoIo.Diagnostics.EtherCAT.Display.AmsNetIdDisplaySlim"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -9,18 +9,34 @@
99
d:DesignHeight="100"
1010
d:DesignWidth="200"
1111
mc:Ignorable="d">
12-
<Grid.Resources>
13-
<ResourceDictionary>
14-
<ResourceDictionary.MergedDictionaries>
15-
<ResourceDictionary Source="DefaultStyling.xaml" />
16-
</ResourceDictionary.MergedDictionaries>
17-
</ResourceDictionary>
18-
</Grid.Resources>
19-
<Grid.ColumnDefinitions>
20-
<ColumnDefinition Width="80" />
21-
<ColumnDefinition Width="Auto" />
22-
</Grid.ColumnDefinitions>
12+
<Grid>
13+
<Grid.Resources>
14+
<ResourceDictionary>
15+
<ResourceDictionary.MergedDictionaries>
16+
<ResourceDictionary Source="DefaultStyling.xaml" />
17+
</ResourceDictionary.MergedDictionaries>
18+
</ResourceDictionary>
19+
</Grid.Resources>
20+
<Grid.ColumnDefinitions>
21+
<ColumnDefinition Width="80" />
22+
<ColumnDefinition Width="Auto" />
23+
</Grid.ColumnDefinitions>
2324

24-
<TextBox Grid.Column="0" x:Name="tbDescription" Text="{Binding Description, Mode=OneWay}" IsReadOnly="True" BorderBrush="Transparent" FontWeight="Light" Background ="{StaticResource InxtonGrayLight}"/>
25-
<TextBox Grid.Column="1" x:Name="tbValue" Text="{Binding _, Mode=OneWay}" IsReadOnly="True" FontWeight="DemiBold" Background ="{StaticResource InxtonGrayLight}"/>
26-
</Grid>
25+
<TextBox Grid.Column="0" x:Name="tbDescription" Text="{Binding Description, Mode=OneWay}" IsReadOnly="True" BorderBrush="Transparent" FontWeight="Light" Background ="Transparent">
26+
<TextBox.Resources>
27+
<Style TargetType="TextBox">
28+
<Setter Property="Foreground" Value="{Binding Foreground, ElementName=userControl, Mode=OneWay}"/>
29+
<Setter Property="BorderThickness" Value="0"/>
30+
</Style>
31+
</TextBox.Resources>
32+
</TextBox>
33+
<TextBox Grid.Column="1" x:Name="tbValue" Text="{Binding _, Mode=OneWay}" IsReadOnly="True" FontWeight="DemiBold" Background ="Transparent">
34+
<TextBox.Resources>
35+
<Style TargetType="TextBox">
36+
<Setter Property="Foreground" Value="{Binding Foreground, ElementName=userControl, Mode=OneWay}"/>
37+
<Setter Property="BorderThickness" Value="0"/>
38+
</Style>
39+
</TextBox.Resources>
40+
</TextBox>
41+
</Grid>
42+
</UserControl>

src/TcoIo/src/Wpf/TcOpen.Inxton.TcoIo.Wpf/Diagnostics/EtherCAT/Display/AmsNetIdDisplaySlim.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
using System.Windows;
1+
using System.ComponentModel;
2+
using System.Runtime.CompilerServices;
3+
using System.Windows;
24
using System.Windows.Controls;
35
using System.Windows.Data;
6+
using System.Windows.Media;
47
using TcoIo;
58

69
namespace TcoIo.Diagnostics.EtherCAT.Display
710
{
8-
public partial class AmsNetIdDisplaySlim : Grid
11+
public partial class AmsNetIdDisplaySlim
912
{
1013
public AmsNetIdDisplaySlim()
1114
{
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1-
<GroupBox
2-
x:Name="gbDescription"
1+
<UserControl
2+
x:Name="userControl"
33
x:Class="TcoIo.Diagnostics.EtherCAT.Display.StringDisplay"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8-
Style="{DynamicResource MaterialFieldBox}"
9-
Header="{Binding Description, Mode=OneWay}"
10-
FontWeight="Light"
118
mc:Ignorable="d">
12-
<GroupBox.Resources>
9+
<UserControl.Resources>
1310
<ResourceDictionary>
1411
<ResourceDictionary.MergedDictionaries>
15-
<ResourceDictionary Source="DefaultStyling.xaml" />
12+
<ResourceDictionary Source="DefaultStyling.xaml"/>
1613
</ResourceDictionary.MergedDictionaries>
1714
</ResourceDictionary>
18-
</GroupBox.Resources>
19-
<TextBox x:Name="tbValue" Text="{Binding _, Mode=OneWay}" IsReadOnly="True" FontWeight="DemiBold" Background ="{StaticResource InxtonGrayLight}"/>
20-
</GroupBox>
15+
</UserControl.Resources>
16+
<GroupBox x:Name="gbDescription" Header="{Binding Description, Mode=OneWay}" FontWeight="Light">
17+
<TextBox x:Name="tbValue" Text="{Binding _, Mode=OneWay}" IsReadOnly="True" FontWeight="DemiBold" Background="Transparent" >
18+
<TextBox.Resources>
19+
<Style TargetType="TextBox">
20+
<Setter Property="Foreground" Value="{Binding Foreground, ElementName=userControl, Mode=OneWay}"/>
21+
<Setter Property="BorderThickness" Value="0"/>
22+
</Style>
23+
</TextBox.Resources>
24+
</TextBox>
25+
</GroupBox>
26+
</UserControl>
2127

2228

src/TcoIo/src/Wpf/TcOpen.Inxton.TcoIo.Wpf/Diagnostics/EtherCAT/Display/StringDisplay.xaml.cs

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
using System.Windows;
44
using System.Windows.Controls;
55
using System.Windows.Data;
6+
using System.Windows.Media;
7+
using TcoIo.Converters.Utilities;
8+
69

710
namespace TcoIo.Diagnostics.EtherCAT.Display
811
{
@@ -30,44 +33,26 @@ protected virtual void OnDescriptionChanged()
3033
{
3134
OnPropertyChanged("Description");
3235
}
33-
public StringDisplay()
34-
{
35-
InitializeComponent();
36-
DataContextChanged += DataContextChange;
37-
}
38-
private void DataContextChange(object sender, DependencyPropertyChangedEventArgs e)
36+
private void DescriptionChange(object sender, DependencyPropertyChangedEventArgs e)
3937
{
40-
Binding binding = tbValue.GetBindingExpression(TextBox.TextProperty).ParentBinding;
41-
42-
string formatString = DataContext as string;
38+
Binding binding = gbDescription.GetBindingExpression(GroupBox.HeaderProperty).ParentBinding;
39+
string formatString = Description as string;
4340
if (!string.IsNullOrEmpty(formatString))
4441
{
4542
Binding b = new Binding
4643
{
47-
Source = DataContext,
44+
Source = Description,
4845
Mode = binding.Mode,
4946
StringFormat = formatString
5047
};
51-
tbValue.SetBinding(TextBox.TextProperty, b);
48+
gbDescription.SetBinding(GroupBox.HeaderProperty, b);
5249
}
5350
else
5451
{
5552
dynamic dc;
5653
if (DataContext != null)
5754
{
5855
dc = DataContext;
59-
if (dc.Cyclic != null)
60-
{
61-
formatString = dc.Cyclic.ToString();
62-
Binding b = new Binding
63-
{
64-
Path = new PropertyPath("Cyclic"),
65-
Source = DataContext,
66-
Mode = binding.Mode,
67-
StringFormat = formatString
68-
};
69-
tbValue.SetBinding(TextBox.TextProperty, b);
70-
}
7156
if (dc.AttributeName != null)
7257
{
7358
formatString = dc.AttributeName;
@@ -84,26 +69,44 @@ private void DataContextChange(object sender, DependencyPropertyChangedEventArgs
8469
}
8570
}
8671

87-
private void DescriptionChange(object sender, DependencyPropertyChangedEventArgs e)
72+
public StringDisplay()
8873
{
89-
Binding binding = gbDescription.GetBindingExpression(GroupBox.HeaderProperty).ParentBinding;
90-
string formatString = Description as string;
74+
InitializeComponent();
75+
DataContextChanged += DataContextChange;
76+
}
77+
private void DataContextChange(object sender, DependencyPropertyChangedEventArgs e)
78+
{
79+
Binding binding = tbValue.GetBindingExpression(TextBox.TextProperty).ParentBinding;
80+
81+
string formatString = DataContext as string;
9182
if (!string.IsNullOrEmpty(formatString))
9283
{
9384
Binding b = new Binding
9485
{
95-
Source = Description,
86+
Source = DataContext,
9687
Mode = binding.Mode,
9788
StringFormat = formatString
9889
};
99-
gbDescription.SetBinding(GroupBox.HeaderProperty, b);
90+
tbValue.SetBinding(TextBox.TextProperty, b);
10091
}
10192
else
10293
{
10394
dynamic dc;
10495
if (DataContext != null)
10596
{
10697
dc = DataContext;
98+
if (dc.Cyclic != null)
99+
{
100+
formatString = dc.Cyclic.ToString();
101+
Binding b = new Binding
102+
{
103+
Path = new PropertyPath("Cyclic"),
104+
Source = DataContext,
105+
Mode = binding.Mode,
106+
StringFormat = formatString
107+
};
108+
tbValue.SetBinding(TextBox.TextProperty, b);
109+
}
107110
if (dc.AttributeName != null)
108111
{
109112
formatString = dc.AttributeName;

src/TcoIo/src/Wpf/TcOpen.Inxton.TcoIo.Wpf/Diagnostics/EtherCAT/Display/StringDisplaySlim.xaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<StackPanel
2-
x:Name="gbDescription"
1+
<UserControl
2+
x:Name="userControl"
33
x:Class="TcoIo.Diagnostics.EtherCAT.Display.StringDisplaySlim"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -18,7 +18,21 @@
1818
<ColumnDefinition Width="80"/>
1919
<ColumnDefinition Width="Auto" />
2020
</Grid.ColumnDefinitions>
21-
<TextBox Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="tbDescription" Margin="0" MaxWidth="80" Text="{Binding Description, Mode=OneWay}" IsReadOnly="True" FontWeight="Light" Background="Transparent" TargetUpdated="tbDescription_TargetUpdated"/>
22-
<TextBox Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="tbValue" Margin="0" Text="{Binding _, Mode=OneWay}" IsReadOnly="True" FontWeight="DemiBold" Background="Transparent" />
21+
<TextBox Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="tbDescription" Margin="0" MaxWidth="80" Text="{Binding Description, Mode=OneWay}" IsReadOnly="True" FontWeight="Light" Background="Transparent" TargetUpdated="tbDescription_TargetUpdated">
22+
<TextBox.Resources>
23+
<Style TargetType="TextBox">
24+
<Setter Property="Foreground" Value="{Binding Foreground, ElementName=userControl, Mode=OneWay}"/>
25+
<Setter Property="BorderThickness" Value="0"/>
26+
</Style>
27+
</TextBox.Resources>
28+
</TextBox>
29+
<TextBox Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="tbValue" Margin="0" Text="{Binding _, Mode=OneWay}" IsReadOnly="True" FontWeight="DemiBold" Background="Transparent">
30+
<TextBox.Resources>
31+
<Style TargetType="TextBox">
32+
<Setter Property="Foreground" Value="{Binding Foreground, ElementName=userControl, Mode=OneWay}"/>
33+
<Setter Property="BorderThickness" Value="0"/>
34+
</Style>
35+
</TextBox.Resources>
36+
</TextBox>
2337
</Grid>
24-
</StackPanel>
38+
</UserControl>

0 commit comments

Comments
 (0)