-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jozef Chmelar ml
committed
May 5, 2021
1 parent
3e94484
commit 5b2062f
Showing
14 changed files
with
158 additions
and
31 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/TcoCore/src/TcoCore.Wpf/Converters/SignalToBrushConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows; | ||
using System.Windows.Media; | ||
using Vortex.Presentation.Wpf.Converters; | ||
|
||
namespace TcoCore | ||
{ | ||
public class SignalToBrushConverter : BaseConverter | ||
{ | ||
public override object ToConvert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
try | ||
{ | ||
var signal = (bool)value; | ||
if (signal) | ||
{ | ||
return Application.Current.TryFindResource("SignalOnBrush") ?? Brushes.GreenYellow; | ||
} | ||
else | ||
{ | ||
return Application.Current.TryFindResource("SignalOffBrush") ?? Brushes.DimGray; | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
return Brushes.DarkGray; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/TcoElements/src/Wpf/TcoElements.Wpf/Digital/TcoDigitalSensorManualView.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<UserControl | ||
x:Class="TcoElements.TcoDigitalSensorManualView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:TcoElements="clr-namespace:TcoElements;assembly=TcoElementsConnector" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:TcoElements" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:tcoCore="clr-namespace:TcoCore;assembly=TcoCore.Wpf" | ||
d:DesignWidth="800" | ||
mc:Ignorable="d"> | ||
<d:UserControl.DataContext> | ||
<TcoElements:TcoDigitalSensor /> | ||
</d:UserControl.DataContext> | ||
<Grid Margin="5"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="0.6*" SharedSizeGroup="Name" /> | ||
<ColumnDefinition Width="0.4*" /> | ||
</Grid.ColumnDefinitions> | ||
<TextBlock Style="{DynamicResource MaterialDesignBody2TextBlock}" Text="{Binding ., Converter={tcoCore:NameOrSymbolConverter}}" /> | ||
<Border | ||
Grid.Column="1" | ||
Margin="5,0,5,0" | ||
Background="{Binding Signal.Cyclic, Converter={tcoCore:SignalToBrushConverter}}" | ||
CornerRadius="2" /> | ||
</Grid> | ||
</UserControl> |
22 changes: 22 additions & 0 deletions
22
src/TcoElements/src/Wpf/TcoElements.Wpf/Digital/TcoDigitalSensorManualView.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.ComponentModel; | ||
using System.Windows.Controls; | ||
|
||
namespace TcoElements | ||
{ | ||
/// <summary> | ||
/// Interaction logic for TcoDigitalSensorManualView.xaml | ||
/// </summary> | ||
public partial class TcoDigitalSensorManualView : UserControl | ||
{ | ||
public TcoDigitalSensorManualView() | ||
{ | ||
if (DesignerProperties.GetIsInDesignMode(this)) | ||
{ | ||
this.DataContext = new TcoDigitalSensor(); | ||
} | ||
|
||
InitializeComponent(); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ public partial class MainWindow : Window | |
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
|
||
} | ||
} | ||
} |
11 changes: 2 additions & 9 deletions
11
src/TcoElements/tests/Sandbox.TcoElements.Wpf/MainWindowViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
using TcoElements; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using Vortex.Connector; | ||
using Vortex.Connector.ValueTypes; | ||
using System.Linq; | ||
|
||
namespace Sandbox.TcoElements.Wpf | ||
{ | ||
{ | ||
public class MainWindowViewModel | ||
{ | ||
public MainWindowViewModel() | ||
{ | ||
|
||
} | ||
|
||
public TcoElementsTwinController TcoElementsPlc { get; } = Entry.TcoElementsPlc; | ||
public TcoElementsTests.TcoElementsTestsTwinController TcoElementsTestsPlc { get; } = TcoElementsTests.Entry.TcoElementsTests; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters