aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-03 16:36:54 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-03 16:36:54 +0300
commit856773f7eafb9d04500ede0cfae9c0e75231418b (patch)
treed1b4f9577b5a47dd10fa7243823fd1016de1418e /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views
parent94e4072838c235be4d48a4635e47204a39cdd78b (diff)
downloadTango-856773f7eafb9d04500ede0cfae9c0e75231418b.tar.gz
Tango-856773f7eafb9d04500ede0cfae9c0e75231418b.zip
Implemented StubsView & VM !!!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml325
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml.cs21
2 files changed, 5 insertions, 341 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml
index f1254db47..bac93bff3 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml
@@ -2,18 +2,16 @@
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:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:views="clr-namespace:Tango.MachineStudio.Stubs.Views"
- xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:global="clr-namespace:Tango.MachineStudio.Stubs"
+ xmlns:stubs="clr-namespace:Tango.Stubs.Views;assembly=Tango.Stubs"
+
xmlns:local="clr-namespace:Tango.MachineStudio.Stubs.Views"
- xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
- xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
mc:Ignorable="d"
d:DesignHeight="720" d:DesignWidth="1280" Background="#202020" Foreground="Gainsboro" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
- <UserControl.Resources>
+ <UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
@@ -28,324 +26,11 @@
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Styles.xaml" />
-
- <ResourceDictionary>
- <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter>
- <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter>
- <Style BasedOn="{StaticResource MetroTabItem}" TargetType="{x:Type TabItem}">
- <Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="True">
- <Setter Property="Background" Value="#007ACC"></Setter>
- </DataTrigger>
- </Style.Triggers>
- <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="12"></Setter>
- <Setter Property="HeaderTemplate">
- <Setter.Value>
- <DataTemplate>
- <Border>
- <StackPanel Orientation="Horizontal">
- <mahapps:ProgressRing Width="5" Height="5" Margin="0 0 5 0" Foreground="White" Visibility="{Binding IsRunning,Converter={StaticResource BooleanToVisibilityConverter}}"></mahapps:ProgressRing>
- <TextBlock Text="{Binding Title}" ToolTip="{Binding File}" Foreground="Gainsboro" VerticalAlignment="Center"></TextBlock>
- <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CloseTabCommand}" CommandParameter="{Binding}" Margin="5 0 0 0" Cursor="Hand" Width="24" Height="24" VerticalAlignment="Center" Style="{DynamicResource MetroCircleButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0">
- <StackPanel Orientation="Horizontal">
- <fa:ImageAwesome Width="10" Height="10" Icon="Close" Foreground="Gainsboro"></fa:ImageAwesome>
- </StackPanel>
- </Button>
- </StackPanel>
- </Border>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="ContentTemplate">
- <Setter.Value>
- <DataTemplate>
- <Grid Background="#181818">
- <controls:ScriptEditorControl Text="{Binding Code,Mode=TwoWay}" InsertSnippetCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.InsertSnippetCommand,Mode=TwoWay}" SaveCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SaveCommand}" HighlightTypes="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.HighlightTypes}" RunCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RunCommand}" StopCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StopCommand}" />
- </Grid>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
- <UserControl.Style>
- <Style TargetType="UserControl">
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsRunning}" Value="True">
- <Setter Property="Cursor" Value="AppStarting"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </UserControl.Style>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="1*"/>
- </Grid.RowDefinitions>
-
- <Grid>
- <Menu IsMainMenu="True" BorderThickness="0" Height="30" Padding="0 10 0 0">
- <MenuItem Header="File">
- <MenuItem Header="New" Command="{Binding NewCommand}">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="FileOutline" Width="12" Foreground="Gainsboro" Margin="2" />
- </MenuItem.Icon>
- </MenuItem>
- <Separator/>
- <MenuItem Header="Open" MinWidth="150" Command="{Binding OpenCommand}">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="FolderOutline" Width="12" Foreground="Gainsboro" Margin="2" />
- </MenuItem.Icon>
- </MenuItem>
- <Separator/>
- <MenuItem Header="Save" Command="{Binding SaveCommand}">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="Save" Width="12" Foreground="Gainsboro" Margin="2" />
- </MenuItem.Icon>
- </MenuItem>
- <MenuItem Header="Save as" Command="{Binding SaveAsCommand}">
- <MenuItem.Icon>
- <Grid>
- <fa:ImageAwesome Icon="Save" Width="10" Foreground="Gainsboro" Margin="2" />
- <fa:ImageAwesome Icon="Save" Width="10" Foreground="Gainsboro" Margin="2 -5 -5 2" />
- </Grid>
- </MenuItem.Icon>
- </MenuItem>
- <Separator/>
- <MenuItem Header="Exit" Command="{Binding ExitCommand}">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="SignOut" Width="12" Foreground="Gainsboro" Margin="2" />
- </MenuItem.Icon>
- </MenuItem>
- </MenuItem>
- <MenuItem Header="Edit">
- <MenuItem Header="Cut" MinWidth="150" Command="Cut">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="Cut" Width="12" Foreground="Gainsboro" Margin="2" />
- </MenuItem.Icon>
- </MenuItem>
- <Separator/>
- <MenuItem Header="Copy" Command="Copy">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="Copy" Width="12" Foreground="Gainsboro" Margin="2" />
- </MenuItem.Icon>
- </MenuItem>
- <MenuItem Header="Paste" Command="Paste">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="Paste" Width="12" Foreground="Gainsboro" Margin="2" />
- </MenuItem.Icon>
- </MenuItem>
- <Separator/>
- <MenuItem Header="Undo" Command="Undo">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="Undo" Width="12" Foreground="Gainsboro" Margin="2" />
- </MenuItem.Icon>
- </MenuItem>
- <MenuItem Header="Redo" Command="Redo">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="Repeat" Width="12" Foreground="Gainsboro" Margin="2" />
- </MenuItem.Icon>
- </MenuItem>
- </MenuItem>
- <MenuItem Header="Build">
- <MenuItem Header="Run (F5)" MinWidth="150" Command="{Binding RunCommand}" >
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="Play" Width="12" Margin="2">
- <fa:ImageAwesome.Style>
- <Style TargetType="fa:ImageAwesome">
- <Setter Property="Foreground" Value="#8DD28A"></Setter>
- <Style.Triggers>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Foreground" Value="Gray"></Setter>
- </Trigger>
- </Style.Triggers>
- </Style>
- </fa:ImageAwesome.Style>
- </fa:ImageAwesome>
- </MenuItem.Icon>
- </MenuItem>
- <MenuItem Header="Stop" Command="{Binding StopCommand}" IsEnabled="False">
- <MenuItem.Icon>
- <fa:ImageAwesome Icon="Stop" Width="12" Margin="2">
- <fa:ImageAwesome.Style>
- <Style TargetType="fa:ImageAwesome">
- <Setter Property="Foreground" Value="#F38B76"></Setter>
- <Style.Triggers>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Foreground" Value="Gray"></Setter>
- </Trigger>
- </Style.Triggers>
- </Style>
- </fa:ImageAwesome.Style>
- </fa:ImageAwesome>
- </MenuItem.Icon>
- </MenuItem>
- </MenuItem>
- </Menu>
- </Grid>
-
- <Grid Grid.Row="2">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="1*"/>
- <ColumnDefinition Width="250"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="1*"/>
- <RowDefinition Height="5"/>
- <RowDefinition Height="0.5*"/>
- </Grid.RowDefinitions>
-
- <Grid>
- <TabControl x:Name="tabControl" Margin="5" ItemsSource="{Binding CodeTabs}" SelectedItem="{Binding SelectedCodeTab}">
- <TabControl.Resources>
- <Style BasedOn="{StaticResource MetroTabItem}" TargetType="{x:Type TabItem}">
- <Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="True">
- <Setter Property="Background" Value="#007ACC"></Setter>
- </DataTrigger>
- </Style.Triggers>
- <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="12"></Setter>
- <Setter Property="HeaderTemplate">
- <Setter.Value>
- <DataTemplate>
- <Border>
- <StackPanel Orientation="Horizontal">
- <mahapps:ProgressRing Width="5" Height="5" Margin="0 0 5 0" Foreground="White" Visibility="{Binding IsRunning,Converter={StaticResource BooleanToVisibilityConverter}}"></mahapps:ProgressRing>
- <TextBlock Text="{Binding Title}" ToolTip="{Binding File}" Foreground="Gainsboro" VerticalAlignment="Center"></TextBlock>
- <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CloseTabCommand}" CommandParameter="{Binding}" Margin="5 0 0 0" Cursor="Hand" Width="24" Height="24" VerticalAlignment="Center" Style="{DynamicResource MetroCircleButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0">
- <StackPanel Orientation="Horizontal">
- <fa:ImageAwesome Width="10" Height="10" Icon="Close" Foreground="Gainsboro"></fa:ImageAwesome>
- </StackPanel>
- </Button>
- </StackPanel>
- </Border>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="ContentTemplate">
- <Setter.Value>
- <DataTemplate>
- <Grid Background="#181818">
- <controls:ScriptEditorControl Text="{Binding Code,Mode=TwoWay}" InsertSnippetCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.InsertSnippetCommand,Mode=TwoWay}" SaveCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SaveCommand}" HighlightTypes="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.HighlightTypes}" RunCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RunCommand}" StopCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StopCommand}" />
- </Grid>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </TabControl.Resources>
- </TabControl>
- <Grid HorizontalAlignment="Right" Margin="0 45 40 0" VerticalAlignment="Top" Visibility="{Binding IsRunning,Converter={StaticResource BooleanToVisibilityConverter}}">
- <StackPanel Orientation="Horizontal">
- <mahapps:ProgressRing Foreground="#007ACC" Width="20" Height="20"></mahapps:ProgressRing>
- <TextBlock Text="Running..." FontStyle="Italic" Margin="10 0 0 0" FontSize="14" VerticalAlignment="Center"></TextBlock>
- </StackPanel>
- </Grid>
- </Grid>
-
- <Grid Grid.Column="1" Grid.RowSpan="3">
- <Grid VerticalAlignment="Bottom" Height="25" Background="#007ACC">
-
- </Grid>
- <DockPanel>
- <GroupBox Header="COMMUNICATION PORT" VerticalAlignment="Top" DockPanel.Dock="Top" Margin="0 2 0 0">
- <StackPanel>
- <StackPanel Orientation="Horizontal">
- <ToggleButton Margin="5" Style="{StaticResource MaterialDesignSwitchToggleButton}" Height="35" HorizontalAlignment="Left" x:Name="chkUseCurrentMachine" ToolTip="Use the currently connected machine to execute stubs" IsChecked="{Binding UseConnectedMachine}"></ToggleButton>
- <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Use Connected Machine</TextBlock>
- </StackPanel>
- <ComboBox Margin="5" IsEnabled="{Binding ElementName=chkUseCurrentMachine,Path=IsChecked,Converter={StaticResource BooleanInverseConverter}}" BorderThickness="0" ItemsSource="{Binding Ports}" Height="35" SelectedItem="{Binding SelectedPort}"></ComboBox>
- </StackPanel>
- </GroupBox>
-
- <GroupBox Header="CONNECTION" DockPanel.Dock="Bottom" VerticalAlignment="Bottom" Margin="0 10 0 25">
- <StackPanel>
- <Button IsEnabled="{Binding ElementName=chkUseCurrentMachine,Path=IsChecked,Converter={StaticResource BooleanInverseConverter}}" Height="50" MinWidth="100" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding ToggleConnectionCommand}">
- <Button.Style>
- <Style TargetType="Button" BasedOn="{StaticResource AccentedSquareButtonStyle}">
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsConnected}" Value="False">
- <Setter Property="Content">
- <Setter.Value>
- <StackPanel Orientation="Horizontal">
- <fa:ImageAwesome Icon="Link" Width="16"></fa:ImageAwesome>
- <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">CONNECT</TextBlock>
- </StackPanel>
- </Setter.Value>
- </Setter>
- </DataTrigger>
- <DataTrigger Binding="{Binding IsConnected}" Value="True">
- <Setter Property="Content">
- <Setter.Value>
- <StackPanel Orientation="Horizontal">
- <fa:ImageAwesome Icon="Unlink" Width="16"></fa:ImageAwesome>
- <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">DISCONNECT</TextBlock>
- </StackPanel>
- </Setter.Value>
- </Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Button.Style>
- </Button>
- </StackPanel>
- </GroupBox>
-
- <GroupBox Header="STUB SNIPPETS" Margin="0 10 0 0">
- <Grid>
- <ListBox BorderThickness="0" ItemsSource="{Binding StubSnippets}" HorizontalContentAlignment="Stretch" SelectedItem="{Binding SelectedStubSnippet}">
- <ListBox.ItemContainerStyle>
- <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
- <Setter Property="Padding" Value="0"></Setter>
- <Setter Property="Margin" Value="0 2 0 2"></Setter>
- <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
- </Style>
- </ListBox.ItemContainerStyle>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Border BorderThickness="1" BorderBrush="#007ACC" Padding="8" Background="Transparent">
- <Border.InputBindings>
- <MouseBinding Gesture="LeftDoubleClick" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StubSnippetSelectedCommand}"/>
- </Border.InputBindings>
- <Grid>
- <fa:ImageAwesome Icon="ArrowLeft" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5 0 0 0" Foreground="#007ACC" Width="16" Height="16"></fa:ImageAwesome>
- <TextBlock VerticalAlignment="Center" FontSize="11" HorizontalAlignment="Center" Text="{Binding Name}"></TextBlock>
- </Grid>
- </Border>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
- </GroupBox>
- </DockPanel>
- </Grid>
-
- <GridSplitter Margin="5 0 5 0" Grid.Row="1" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Center">
- <GridSplitter.Background>
- <LinearGradientBrush>
- <GradientStop/>
- <GradientStop Color="#007ACC" Offset="0.5"/>
- <GradientStop Offset="1"/>
- </LinearGradientBrush>
- </GridSplitter.Background>
- </GridSplitter>
-
- <Grid Grid.Row="2">
- <Grid.RowDefinitions>
- <RowDefinition Height="1*"/>
- <RowDefinition Height="25"/>
- </Grid.RowDefinitions>
- <GroupBox Header="Response">
- <Grid Background="#151515">
- <TextBox x:Name="txtLog" FontFamily="Lucida Console" TextChanged="TextBox_TextChanged" Background="Transparent" Text="{Binding Log}" BorderThickness="0" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Padding="5" IsReadOnly="True" TextWrapping="Wrap" FontSize="11" Foreground="Gainsboro"></TextBox>
- </Grid>
- </GroupBox>
- <StatusBar Background="#007ACC" Grid.Row="1">
- <TextBlock Text="{Binding Status}"></TextBlock>
- </StatusBar>
- </Grid>
- </Grid>
+ <Grid>
+ <stubs:StubsView DataContext="{Binding StubsViewVM}" />
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml.cs
index 2d099ef16..238772f07 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/Views/MainView.xaml.cs
@@ -26,27 +26,6 @@ namespace Tango.MachineStudio.Stubs.Views
public MainView() : base()
{
InitializeComponent();
- this.Loaded += MainView_Loaded;
- }
-
- private void MainView_Loaded(object sender, RoutedEventArgs e)
- {
- //ServiceLocator.Current.GetInstance<MainViewVM>().CodeTabs.RemoveAt(0);
- }
-
- //Auto scroll to bottom of response log each time it is changed.
- private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
- {
- Task.Factory.StartNew(() =>
- {
- Thread.Sleep(50);
-
- this.Dispatcher.Invoke(() =>
- {
- txtLog.SelectionStart = txtLog.Text.Length;
- txtLog.ScrollToEnd();
- });
- });
}
}
}