This repository has been archived by the owner on Feb 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from TcOpenGroup/feature/pkml
TcoElements refactoring TcoDi and TcoDo, build-tests fixies
- Loading branch information
Showing
26 changed files
with
305 additions
and
94 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
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,38 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows; | ||
using System.Windows.Media; | ||
using Vortex.Presentation.Wpf.Converters; | ||
|
||
namespace TcoCore | ||
{ | ||
/// <summary> | ||
/// Will convert boolean values to Brusheh which represent wheter signal is on, or off | ||
/// Using the MaterialDesignXaml toolkit http://materialdesigninxaml.net/ and it's color palette | ||
/// | ||
/// Signal On is the Accent color from the palette, signal off si Dark color. | ||
/// https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/MainDemo.Wpf/Palette.xaml | ||
/// </summary> | ||
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("SecondaryHueMidBrush") ?? Brushes.GreenYellow; | ||
} | ||
else | ||
{ | ||
return Application.Current.TryFindResource("PrimaryHueDarkBrush") ?? 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
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
27 changes: 27 additions & 0 deletions
27
src/TcoElements/src/Wpf/TcoElements.Wpf/Digital/TcoDiServiceView.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.TcoDiServiceView" | ||
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:TcoDi/> | ||
</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/TcoDiServiceView.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 TcoDiServiceView.xaml | ||
/// </summary> | ||
public partial class TcoDiServiceView : UserControl | ||
{ | ||
public TcoDiServiceView() | ||
{ | ||
if (DesignerProperties.GetIsInDesignMode(this)) | ||
{ | ||
this.DataContext = new TcoDi(); | ||
} | ||
|
||
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
Oops, something went wrong.