diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views')
3 files changed, 128 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index cdfef3b0d..1ef6928f5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -1987,7 +1987,8 @@ </Style.Triggers> </Style> </Grid.Style> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="40">MONITORING</TextBlock> + + <local:MonitoringView Margin="50 0 0 0" /> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml new file mode 100644 index 000000000..bd78ef13e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml @@ -0,0 +1,76 @@ +<UserControl x:Class="Tango.MachineStudio.Developer.Views.MonitoringView" + 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:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" + xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" + xmlns:controls="clr-namespace:Tango.MachineStudio.Developer.Controls" + xmlns:global="clr-namespace:Tango.MachineStudio.Developer" + xmlns:observables="clr-namespace:Tango.Integration.Observables;assembly=Tango.Integration" + xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" + mc:Ignorable="d" + d:DesignHeight="600" d:DesignWidth="1280" Background="White" d:DataContext="{d:DesignInstance Type=vm:MonitoringViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MonitoringViewVM}"> + <Grid> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="230"/> + </Grid.ColumnDefinitions> + + <Grid dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}" dragAndDrop:DragAndDropService.Drop="OnDropAvailableIO"> + <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> + <ItemsControl ItemsSource="{Binding Controllers}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel IsItemsHost="True" Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type vm:IOVM}"> + <Grid Margin="10" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"> + <StackPanel> + <TextBlock Text="{Binding IO.Description}" Width="180" TextAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="10" HorizontalAlignment="Center"></TextBlock> + <Viewbox Stretch="Fill" Width="180" Height="100"> + <controls:IOMonitorControl Foreground="Gainsboro" FontFamily="{StaticResource digital-7}" Value="{Binding Value,Mode=OneWay}" /> + </Viewbox> + </StackPanel> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </ScrollViewer> + </Grid> + + <Grid Grid.Column="1"> + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> + <Image Source="../Images/graphs.png" Width="42"></Image> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Foreground="DimGray" FontSize="16" FontWeight="SemiBold">AVAILABLE IO'S</TextBlock> + </StackPanel> + + <Grid> + <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> + <ItemsControl ItemsSource="{Binding AvailableControllers}"> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type vm:IOVM}"> + <Grid IsHitTestVisible="True" Background="Transparent" Margin="10" Opacity="0.4" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"> + <StackPanel IsHitTestVisible="False"> + <TextBlock Text="{Binding IO.Description}" Width="180" TextAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="10" HorizontalAlignment="Center"></TextBlock> + <Viewbox Stretch="Fill" Width="180" Height="100" IsHitTestVisible="False"> + <controls:IOMonitorControl Foreground="Gainsboro" FontFamily="{StaticResource digital-7}" IsHitTestVisible="False" /> + </Viewbox> + </StackPanel> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </ScrollViewer> + </Grid> + </DockPanel> + </Grid> + </Grid> + <dragAndDrop:DraggingSurface x:Name="draggingSurface" IsHitTestVisible="False" /> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs new file mode 100644 index 000000000..0d649237e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs @@ -0,0 +1,50 @@ +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.DragAndDrop; +using Tango.MachineStudio.Developer.ViewModels; + +namespace Tango.MachineStudio.Developer.Views +{ + /// <summary> + /// Interaction logic for MonitoringView.xaml + /// </summary> + public partial class MonitoringView : UserControl + { + private MonitoringViewVM _vm; + + public DraggingSurface DraggingSurface + { + get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } + set { SetValue(DraggingSurfaceProperty, value); } + } + public static readonly DependencyProperty DraggingSurfaceProperty = + DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(MonitoringView), new PropertyMetadata(null)); + + public MonitoringView() + { + InitializeComponent(); + DraggingSurface = draggingSurface; + this.Loaded += (x, y) => + { + _vm = this.DataContext as MonitoringViewVM; + }; + } + + private void OnDropAvailableIO(object sender, DropEventArgs e) + { + _vm.OnDropAvailableIO(e.Draggable.DataContext as IOVM); + } + } +} |
