diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console')
4 files changed, 243 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleManager.cs new file mode 100644 index 000000000..0a737c526 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleManager.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; + +namespace Tango.MachineStudio.UI.Console +{ + public class ConsoleManager + { + public TangoIOC TangoIOC { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml new file mode 100644 index 000000000..90c07b1af --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml @@ -0,0 +1,113 @@ +<mahapps:MetroWindow x:Class="Tango.MachineStudio.UI.Console.ConsoleWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:views="clr-namespace:Tango.MachineStudio.UI.Views" + xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:console="clr-namespace:Tango.MachineStudio.UI.Console" + xmlns:local="clr-namespace:Tango.MachineStudio.UI.Console" + mc:Ignorable="d" + Title="Developer Console" Height="800" Width="1280" BorderThickness="1" BorderBrush="#ADADAD" d:DataContext="{d:DesignInstance Type=console:ConsoleWindowVM, IsDesignTimeCreatable=False}" DataContext="{Binding ConsoleWindowVM, Source={StaticResource Locator}}" Foreground="Gainsboro"> + + <Window.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" /> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Styles.xaml" /> + <ResourceDictionary> + <converters:StringEllipsisConverter x:Key="StringEllipsisConverter" /> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Window.Resources> + + <Grid> + <DockPanel> + <materialDesign:ColorZone Background="#2E2E2E" Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" + Mode="PrimaryMid" DockPanel.Dock="Top"> + <DockPanel> + <Grid> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Text="Machine Studio" VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36"/> + </StackPanel> + </Grid> + </DockPanel> + </materialDesign:ColorZone> + + <Grid> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Grid Grid.Row="1" x:Name="grid"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="467*"/> + <RowDefinition Height="5"/> + <RowDefinition Height="200*"/> + </Grid.RowDefinitions> + + <controls:ScriptEditorControl HighlightTypes="{Binding HighlightTypes}" IntellisenseTypes="{Binding IntellisenseTypes}"></controls:ScriptEditorControl> + + <GridSplitter Grid.Row="1" Background="#101010" Foreground="#202020" BorderBrush="#202020" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> + + + <TextBox x:Name="txtLog" FontFamily="Lucida Console" Background="Black" BorderThickness="0" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Padding="5" IsReadOnly="True" TextWrapping="Wrap" FontSize="11" Foreground="Gainsboro" Grid.Row="2"></TextBox> + </Grid> + </Grid> + </Grid> + + <Border HorizontalAlignment="Right" Margin="0 -1 10 0" VerticalAlignment="Top" Width="300" Height="40" Padding="5" CornerRadius="0 0 30 30" BorderThickness="1 0 1 1" BorderBrush="DimGray"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0"></ScaleTransform> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding NotificationProvider.HasTaskItems}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard HandoffBehavior="Compose"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" FillBehavior="HoldEnd" To="1" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard HandoffBehavior="Compose"> + <Storyboard> + <DoubleAnimation BeginTime="00:00:02" FillBehavior="HoldEnd" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" From="1" Duration="00:00:0.5"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Border.Background> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Color="#03A9F4"/> + <GradientStop Color="#0081BB" Offset="1"/> + </LinearGradientBrush> + </Border.Background> + + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20 0 0 0"> + <mahapps:ProgressRing Width="24" Height="24" Foreground="White"></mahapps:ProgressRing> + <TextBlock Text="{Binding NotificationProvider.CurrentTaskItem.Message,Converter={StaticResource StringEllipsisConverter},ConverterParameter=35}" Foreground="White" VerticalAlignment="Center" Margin="10 0 0 0" TextWrapping="Wrap"></TextBlock> + </StackPanel> + </Border> + </Grid> + </DockPanel> + </Grid> +</mahapps:MetroWindow> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml.cs new file mode 100644 index 000000000..459c3d119 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml.cs @@ -0,0 +1,28 @@ +using MahApps.Metro.Controls; +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.Shapes; + +namespace Tango.MachineStudio.UI.Console +{ + /// <summary> + /// Interaction logic for ConsoleWindow.xaml + /// </summary> + public partial class ConsoleWindow : MetroWindow + { + public ConsoleWindow() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs new file mode 100644 index 000000000..c88976948 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Threading; +using Tango.Core.Commands; +using Tango.MachineStudio.Common.Modules; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.Console +{ + public class ConsoleWindowVM : ViewModel + { + + /// <summary> + /// Gets or sets the additional highlight C# types. + /// </summary> + public ObservableCollection<KeyValuePair<String, Type>> HighlightTypes { get; set; } + + /// <summary> + /// Gets or sets the intellisense types. + /// </summary> + public ObservableCollection<KeyValuePair<String, Type>> IntellisenseTypes { get; set; } + + /// <summary> + /// Gets or sets the run command. + /// </summary> + public RelayCommand RunCommand { get; set; } + + /// <summary> + /// Gets or sets the stop command. + /// </summary> + public RelayCommand StopCommand { get; set; } + + /// <summary> + /// Gets or sets the clear command. + /// </summary> + public RelayCommand ClearCommand { get; set; } + + public ConsoleWindowVM(IStudioModuleLoader moduleLoader) + { + RunCommand = new RelayCommand(Run); + StopCommand = new RelayCommand(Stop); + + HighlightTypes = new ObservableCollection<KeyValuePair<string, Type>>(); + IntellisenseTypes = new ObservableCollection<KeyValuePair<string, Type>>(); + + IntellisenseTypes.Add(new KeyValuePair<string, Type>("consoleManager", typeof(ConsoleManager))); + + foreach (var moduleType in moduleLoader.UserModules.SelectMany(x => x.MainViewType.Assembly.GetTypes())) + { + if (!moduleType.FullName.Contains("<") && !moduleType.FullName.Contains(">")) + { + HighlightTypes.Add(new KeyValuePair<string, Type>(moduleType.FullName, moduleType)); + } + } + + HighlightTypes.Add(new KeyValuePair<string, Type>("Thread", typeof(Thread))); + HighlightTypes.Add(new KeyValuePair<string, Type>("DateTime", typeof(DateTime))); + HighlightTypes.Add(new KeyValuePair<string, Type>("TimeSpan", typeof(TimeSpan))); + HighlightTypes.Add(new KeyValuePair<string, Type>("Dispatcher", typeof(Dispatcher))); + HighlightTypes.Add(new KeyValuePair<string, Type>("Task", typeof(Task))); + HighlightTypes.Add(new KeyValuePair<string, Type>("List", typeof(IList<Object>))); + HighlightTypes.Add(new KeyValuePair<string, Type>("int", typeof(Int32))); + HighlightTypes.Add(new KeyValuePair<string, Type>("double", typeof(Double))); + HighlightTypes.Add(new KeyValuePair<string, Type>("String", typeof(String))); + HighlightTypes.Add(new KeyValuePair<string, Type>("string", typeof(String))); + + foreach (var item in HighlightTypes) + { + IntellisenseTypes.Add(item); + } + } + + private void Stop() + { + + } + + private void Run() + { + + } + } +} |
