• 17.07.2025, 09:36
  • Registrieren
  • Anmelden
  • Sie sind nicht angemeldet.

 

Lieber Besucher, herzlich willkommen bei: Aqua Computer Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

SverreMunthe

Full Member

Script to show image based on pressure

Montag, 28. November 2016, 00:13

Anyone know why this script doesn't work? The pressure is 0.04 bar (shown correctly under the image), but it shows the image for high pressure (above 0.8). It's the standard Aqualis script with a few modifications.

---
<UserControl
x:Name="this"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignHeight="50" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<!--Simpe databinding example-->
<!--1. set up connection for this item (ie. temperature sensor)-->
<!--2. bind values to your own usercontrol-->
<!--Binding example-->
<!--Content="{Binding ElementName=this, Path=DataContext.Value, FallbackValue=no data available}"-->

<!--default background-->
<Rectangle Grid.Row="0" Grid.RowSpan="1" Fill="#FF78949A" Opacity="1.0"/>
<Rectangle Grid.Row="1" Grid.RowSpan="1" Fill="#FFF0F0F0" Opacity="1.0"/>
<Rectangle Grid.Row="2" Grid.RowSpan="1" Fill="#FFF0F0F0" Opacity="1.0"/>

<!--Content: binding to source value: -->
<!--Content: ElementName=this -->
<!--Content: Path=DataContext.Value, for connetion to actual connected value -->
<Label
Content="{Binding ElementName=this, Path=DataContext.Value, FallbackValue=no data available}"
ContentStringFormat="Pressure: {0:#,#0.00} Bar"
Grid.Row="2"
Opacity="1.0"
Height="Auto"
Width="Auto"
Foreground="#FF000000"
FontSize="13"
FontFamily="Segoe UI"
FontWeight="Normal"
Margin="0,0,0,0"
Padding="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center" />

<!--Content: binding to source value: -->
<!--Content: ElementName=this -->
<!--Content: Path=DataContext.DataName, for connetion to actual connected value name -->
<Label
Content="{Binding ElementName=this, Path=DataContext.DataName, FallbackValue=no data available}"
Grid.Row="0"

Opacity="1.0"
Height="Auto"
Width="Auto"
Foreground="#FFEEEEEE"
FontSize="11"
FontFamily="Segoe UI"
FontWeight="Normal"
Margin="3,0,0,0"
Padding="0,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center" />

<Image
Grid.Row="1"
Opacity="1.0"
Height="Auto"
Width="Auto"
Margin="5,5,5,5"
Stretch="Uniform"
StretchDirection="Both" >
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Source" Value="D:/aquasuite/Content/images/Pressure_low.png" />

<Style.Triggers>
<DataTrigger
Value="True"
Binding="{Binding ElementName=this, Path=DataContext.Value, ConverterParameter=0.5, Converter={StaticResource CompareSmalerConverter}}">
<Setter Property="Source" Value="D:/aquasuite/Content/images/Pressure_low.png"/>
</DataTrigger>

<DataTrigger
Value="True"
Binding="{Binding ElementName=this, Path=DataContext.Value, ConverterParameter=0.5, Converter={StaticResource CompareGreaterEqualConverter}}">
<Setter Property="Source" Value="D:/aquasuite/Content/images/Pressure_medium.png"/>
</DataTrigger>

<DataTrigger
Value="True"
Binding="{Binding ElementName=this, Path=DataContext.Value, ConverterParameter=0.8, Converter={StaticResource CompareGreaterEqualConverter}}">
<Setter Property="Source" Value="D:/aquasuite/Content/images/Pressure_high.png"/>
</DataTrigger>

</Style.Triggers>
</Style>
</Image.Style>
</Image>





</Grid>
</UserControl>

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »SverreMunthe« (28. November 2016, 00:15)

sebastian

Administrator

Montag, 28. November 2016, 11:34

ConverterParameter=0.5, Converter={StaticResource CompareGreaterEqualConverter}}"
ConverterParameter=0.8, Converter={StaticResource CompareGreaterEqualConverter}}"
... you have to remove one of this conditions

SverreMunthe

Full Member

Montag, 28. November 2016, 12:37

ConverterParameter=0.5, Converter={StaticResource CompareGreaterEqualConverter}}"
ConverterParameter=0.8, Converter={StaticResource CompareGreaterEqualConverter}}"
... you have to remove one of this conditions


How do I make a test for 3 levels then?

Test 1: Is it low? (Lower than 0.5)
Test 2: Is it high? (Greater or Equal to 0.5)
Test 3: Is it higher still? (Greater or Equal to 0.8)

This part of the script is identical to the Aqualis fill-level script that comes with Aquasuite.

sebastian

Administrator

Montag, 28. November 2016, 12:47

you have to start your compare with the highest value

SverreMunthe

Full Member

Montag, 28. November 2016, 14:43

you have to start your compare with the highest value


What is the number in ConverterParameter? I want to measure something (pressure) that has to be lower than 0.1 (low), higher than or equal to 0.1 (medium) and higher or equal to 0.25 (high). Do I just enter these numbers? That doesn't seem to work for values lower than 1 (0.9, 0.8 etc.). ?(

I'm to old to learn new languages. I know Cobol, Fortran, C, Basic, Pascal, Turbo Pascal, Visual Basic even a strange language called Omnis7 and probably more, but these script languages are to far removed from what I'm used to. :cursing:

SverreMunthe

Full Member

Montag, 28. November 2016, 14:46

Another thing. Editing a script directly in the item (display) doesn't show lines below the screen, ie. the part of the script you have to scroll down to see. Is this a known bug, or am I doing something wrong?

Shoggy

Sven - Admin

Montag, 28. November 2016, 15:11

I can confirm that. Must be new. Sebastian has already left the office. He will take a look at this tomorrow.

SverreMunthe

Full Member

Montag, 28. November 2016, 15:13

I can confirm that. Must be new. Sebastian has already left the office. He will take a look at this tomorrow.


I've had this since 2012, so I'm not sure if it's a bug.

Shoggy

Sven - Admin

Montag, 28. November 2016, 15:30

I can not remember that I have seen this problem in older versions.

SverreMunthe

Full Member

Montag, 28. November 2016, 16:01

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »SverreMunthe« (28. November 2016, 16:03)

Shoggy

Sven - Admin

Montag, 28. November 2016, 16:20

Hehe, they can not help you because for them it is just a random code fragment. They do not know that this is part of a software that does already process a lot of other stuff in the background.

SverreMunthe

Full Member

Montag, 28. November 2016, 17:10

Hehe, they can not help you because for them it is just a random code fragment. They do not know that this is part of a software that does already process a lot of other stuff in the background.


Guess I have to wait for Sebastian. :)

We_Stay_Chillin

Newbie

RE: Script to show image based on pressure

Donnerstag, 15. Mai 2025, 07:05

This is the code that I use to display my current Aquasuite Profile via an icon. You could adjust the values, images, and positionings and add anything else you'd like to incorporate for your use case. :thumbup:

<UserControl

x:Name="this"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

mc:Ignorable="d"

d:DesignHeight="50"

d:DesignWidth="300">

<Grid>

<!--Loads an image-->

<!--Source: path or url to image-->

<Image

Opacity="1.0"

Height="Auto"

Width="Auto"

Margin="0,2.5,0,2.5"

Stretch="Uniform"

StretchDirection="Both">

<Image.Style>

<Style

TargetType="{x:Type Image}">

<Setter

Property="Source"

Value="C:\Users\Gaige\Documents\Aquasuite\Profile 1 (desktop-128).png" />

<Style.Triggers>

<DataTrigger

Value="True"

Binding="{Binding ElementName=this, Path=DataContext.Value, ConverterParameter=1, Converter={StaticResource CompareSmallerConverter}}">

<Setter

Property="Source"

Value="C:\Users\Gaige\Documents\Aquasuite\Profile 1 (desktop-128).png" />

</DataTrigger>

<DataTrigger

Value="True"

Binding="{Binding ElementName=this, Path=DataContext.Value, ConverterParameter=2, Converter={StaticResource CompareGreaterEqualConverter}}">

<Setter

Property="Source"

Value="C:\Users\Gaige\Documents\Aquasuite\Profile 2 (joystick-128).png" />

</DataTrigger>

<DataTrigger

Value="True"

Binding="{Binding ElementName=this, Path=DataContext.Value, ConverterParameter=3, Converter={StaticResource CompareGreaterEqualConverter}}">

<Setter

Property="Source"

Value="C:\Users\Gaige\Documents\Aquasuite\Profile 3 (speedometer-128).png" />

</DataTrigger>

</Style.Triggers>

</Style>

</Image.Style>

</Image>

</Grid>

</UserControl>

Speedy-VI

Senior Member

RE: RE: Script to show image based on pressure

Donnerstag, 15. Mai 2025, 19:07

This is the code that I use to display my current Aquasuite Profile via an icon. You could adjust the values, images, and positionings and add anything else you'd like to incorporate for your use case
This is interesting. Could you provide this code in an attached txt file? Some of the characters are showing up in the forum post as a smiley with sunglasses. I have had this problem before where certain combinations of punctuation characters get interpreted as an emoji. All the text color commands also make it difficult to separate out the actual XML code Thanks

Ähnliche Themen