diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls')
2 files changed, 224 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/IOMonitorControl.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/IOMonitorControl.xaml new file mode 100644 index 000000000..c40e69d98 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/IOMonitorControl.xaml @@ -0,0 +1,115 @@ +<UserControl x:Class="Tango.MachineStudio.Developer.Controls.IOMonitorControl" + 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" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Controls" + mc:Ignorable="d" + d:DesignHeight="120" d:DesignWidth="200" Width="200" Height="120" Background="White"> + + <UserControl.Resources> + + </UserControl.Resources> + + <Grid Margin="5"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="30"/> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="30"/> + </Grid.ColumnDefinitions> + + <Grid Grid.Column="1" Grid.Row="1"> + <Border BorderThickness="1" BorderBrush="#878787" CornerRadius="5"> + <Border.Background> + <ImageBrush ImageSource="../Images/black-screen.jpg" /> + </Border.Background> + + <TextBlock TextAlignment="Center" VerticalAlignment="Center" FontSize="50" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Value,FallbackValue='0000'}"></TextBlock> + </Border> + </Grid> + + <Grid Grid.Row="1"> + <Border BorderBrush="Gainsboro" BorderThickness="1 1 0 1" Margin="0 10" CornerRadius="5 0 0 5" PreviewMouseDown="OnBackwardPressed" PreviewMouseUp="OnBackwardReleased"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush EndPoint="1,0"> + <GradientStop Color="#515151" Offset="1" /> + <GradientStop Color="#FFEEEEEE" Offset="0"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Style.Triggers> + <EventTrigger RoutedEvent="PreviewMouseDown"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFCECECE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + <EventTrigger RoutedEvent="PreviewMouseUp"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFEEEEEE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </Style.Triggers> + </Style> + </Border.Style> + + <Viewbox Stretch="Fill" Margin="-10 10"> + <materialDesign:PackIcon Kind="ChevronLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + </Viewbox> + </Border> + </Grid> + + <Grid Grid.Row="1" Grid.Column="2"> + <Border BorderBrush="Gainsboro" BorderThickness="0 1 1 1" Margin="0 10" CornerRadius="0 10 10 0" PreviewMouseDown="OnForwardPressed" PreviewMouseUp="OnForwardReleased"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush EndPoint="1,0"> + <GradientStop Color="#515151" Offset="0" /> + <GradientStop Color="#FFEEEEEE" Offset="1"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Style.Triggers> + <EventTrigger RoutedEvent="PreviewMouseDown"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFCECECE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + <EventTrigger RoutedEvent="PreviewMouseUp"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFEEEEEE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </Style.Triggers> + </Style> + </Border.Style> + + <Viewbox Stretch="Fill" Margin="-10 10"> + <materialDesign:PackIcon Kind="ChevronRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + </Viewbox> + </Border> + </Grid> + + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/IOMonitorControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/IOMonitorControl.xaml.cs new file mode 100644 index 000000000..bc408958d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/IOMonitorControl.xaml.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Core.Commands; + +namespace Tango.MachineStudio.Developer.Controls +{ + /// <summary> + /// Interaction logic for IOMonitorControl.xaml + /// </summary> + public partial class IOMonitorControl : UserControl + { + public ICommand ForwardPressedCommand + { + get { return (ICommand)GetValue(ForwardPressedCommandProperty); } + set { SetValue(ForwardPressedCommandProperty, value); } + } + public static readonly DependencyProperty ForwardPressedCommandProperty = + DependencyProperty.Register("ForwardPressedCommand", typeof(ICommand), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public ICommand ForwardReleasedCommand + { + get { return (ICommand)GetValue(ForwardReleasedCommandProperty); } + set { SetValue(ForwardReleasedCommandProperty, value); } + } + public static readonly DependencyProperty ForwardReleasedCommandProperty = + DependencyProperty.Register("ForwardReleasedCommand", typeof(ICommand), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public ICommand BackwardPressedCommand + { + get { return (ICommand)GetValue(BackwardPressedCommandProperty); } + set { SetValue(BackwardPressedCommandProperty, value); } + } + public static readonly DependencyProperty BackwardPressedCommandProperty = + DependencyProperty.Register("BackwardPressedCommand", typeof(ICommand), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public ICommand BackwardReleasedCommand + { + get { return (ICommand)GetValue(BackwardReleasedCommandProperty); } + set { SetValue(BackwardReleasedCommandProperty, value); } + } + public static readonly DependencyProperty BackwardReleasedCommandProperty = + DependencyProperty.Register("BackwardReleasedCommand", typeof(ICommand), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public object CommandParameter + { + get { return (object)GetValue(CommandParameterProperty); } + set { SetValue(CommandParameterProperty, value); } + } + public static readonly DependencyProperty CommandParameterProperty = + DependencyProperty.Register("CommandParameter", typeof(object), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public String Value + { + get { return (String)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register("Value", typeof(String), typeof(IOMonitorControl), new PropertyMetadata("0000")); + + public IOMonitorControl() + { + InitializeComponent(); + } + + private void OnForwardPressed(object sender, MouseButtonEventArgs e) + { + if (ForwardPressedCommand != null) + { + ForwardPressedCommand.Execute(CommandParameter); + } + } + + private void OnForwardReleased(object sender, MouseButtonEventArgs e) + { + if (ForwardReleasedCommand != null) + { + ForwardReleasedCommand.Execute(CommandParameter); + } + } + + private void OnBackwardPressed(object sender, MouseButtonEventArgs e) + { + if (BackwardPressedCommand != null) + { + BackwardPressedCommand.Execute(CommandParameter); + } + } + + private void OnBackwardReleased(object sender, MouseButtonEventArgs e) + { + if (BackwardReleasedCommand != null) + { + BackwardReleasedCommand.Execute(CommandParameter); + } + } + } +} |
