1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
<UserControl x:Class="Tango.MachineStudio.Stubs.Views.MainView"
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: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>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<!-- Accent and AppTheme setting -->
<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>
<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>
<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>
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<CheckBox x:Name="chkUseCurrentMachine" ToolTip="Use the currently connected machine to execute stubs" Margin="0 0 0 0" VerticalAlignment="Center" IsChecked="{Binding UseConnectedMachine}">Connected Machine</CheckBox>
<ComboBox Grid.Column="1" IsEnabled="{Binding ElementName=chkUseCurrentMachine,Path=IsChecked,Converter={StaticResource BooleanInverseConverter}}" Margin="10 0 0 0" BorderThickness="0" ItemsSource="{Binding Ports}" Height="35" SelectedItem="{Binding SelectedPort}"></ComboBox>
</Grid>
</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>
</UserControl>
|