diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-03 12:14:39 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-03 12:14:39 +0300 |
| commit | a4955b69fbbec89a80418ed8e8271e56db61bf32 (patch) | |
| tree | 53ce5cf60f03b909e815475c1087ddcfad87af81 /Software/Visual_Studio/MachineStudio | |
| parent | 0f546e28ff310f93da65ec6a8e7fd53ae19c0988 (diff) | |
| parent | 251cf705409697f339828359b6770534116dca5f (diff) | |
| download | Tango-a4955b69fbbec89a80418ed8e8271e56db61bf32.tar.gz Tango-a4955b69fbbec89a80418ed8e8271e56db61bf32.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
86 files changed, 4622 insertions, 1034 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj index 7e8a9e126..18d51aa09 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj @@ -74,10 +74,14 @@ </Compile> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\CalibrationDataPointVM.cs" /> + <Compile Include="ViewModels\CalibrationDataViewVM.cs" /> <Compile Include="ViewModels\CalibrationDataVM.cs" /> <Compile Include="ViewModels\LiquidVolumeVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewModels\RgbVM.cs" /> + <Compile Include="Views\CalibrationDataView.xaml.cs"> + <DependentUpon>CalibrationDataView.xaml</DependentUpon> + </Compile> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> @@ -157,6 +161,10 @@ </ProjectReference> </ItemGroup> <ItemGroup> + <Page Include="Views\CalibrationDataView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\MainView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -179,7 +187,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs new file mode 100644 index 000000000..c9c83dde0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ColorLab.ViewModels +{ + public class CalibrationDataViewVM : ViewModel + { + private ObservableCollection<CalibrationDataVM> _liquidsCalibrationData; + /// <summary> + /// Gets or sets the liquids calibration data. + /// </summary> + public ObservableCollection<CalibrationDataVM> LiquidsCalibrationData + { + get { return _liquidsCalibrationData; } + set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Initializes a new instance of the <see cref="CalibrationDataViewVM"/> class. + /// </summary> + public CalibrationDataViewVM() + { + LiquidsCalibrationData = new ObservableCollection<CalibrationDataVM>(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="CalibrationDataViewVM"/> class. + /// </summary> + /// <param name="liquidsCalibrationData">The liquids calibration data.</param> + public CalibrationDataViewVM(ObservableCollection<CalibrationDataVM> liquidsCalibrationData) + { + LiquidsCalibrationData = liquidsCalibrationData; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs index 02f496b1f..d0fa80a20 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -150,6 +150,13 @@ namespace Tango.MachineStudio.ColorLab.ViewModels set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); } } + private CalibrationDataViewVM _calibrationDataViewVM; + public CalibrationDataViewVM CalibrationDataViewVM + { + get { return _calibrationDataViewVM; } + set { _calibrationDataViewVM = value; RaisePropertyChangedAuto(); } + } + private RgbVM _sourceColor; /// <summary> /// Gets or sets the color of the source. @@ -566,6 +573,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels //RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active); LiquidsCalibrationData = new ObservableCollection<CalibrationDataVM>(); + CalibrationDataViewVM = new CalibrationDataViewVM(LiquidsCalibrationData); LiquidsCalibrationData.EnableCrossThreadOperations(); foreach (var idsPack in SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex)) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml new file mode 100644 index 000000000..28279bd50 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml @@ -0,0 +1,72 @@ +<UserControl x:Class="Tango.MachineStudio.ColorLab.Views.CalibrationDataView" + 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:global="clr-namespace:Tango.MachineStudio.ColorLab" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:vm="clr-namespace:Tango.MachineStudio.ColorLab.ViewModels" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:local="clr-namespace:Tango.MachineStudio.ColorLab.Views" + mc:Ignorable="d" + d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:CalibrationDataViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + <converters:ColorComponentToOpacityConverter x:Key="ColorComponentToOpacityConverter" /> + <converters:ColorToComponentsConverter x:Key="ColorToComponentsConverter" /> + </UserControl.Resources> + + <Grid> + <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding LiquidsCalibrationData}" IsEnabled="{Binding IsFree}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Rows="1" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + + <ItemsControl.ItemTemplate> + <DataTemplate> + <DockPanel Width="220"> + + <StackPanel DockPanel.Dock="Top"> + + <StackPanel DockPanel.Dock="Right" VerticalAlignment="Bottom" HorizontalAlignment="Right" Orientation="Horizontal" Margin="0 0 5 0"> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Import from excel" Width="30"> + <materialDesign:PackIcon Kind="Download" Foreground="Black" /> + </Button> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Export to excel" Width="30"> + <materialDesign:PackIcon Kind="Upload" Foreground="Black" /> + </Button> + </StackPanel> + <Border Padding="2" Margin="5" CornerRadius="3"> + <Border.Background> + <SolidColorBrush Opacity="0.4" Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </Border.Background> + <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" Foreground="Black"></TextBlock> + </Border> + </StackPanel> + + <Grid Margin="0 0 0 5"> + <DataGrid Background="#BBFFFFFF" AlternatingRowBackground="#CCE1E1E1" BorderThickness="1" BorderBrush="#202020" Margin="5 0" ItemsSource="{Binding CalibrationPoints}" CanUserResizeColumns="False" CanUserReorderColumns="False" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" CanUserSortColumns="False"> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="FlowDirection" Value="RightToLeft"></Setter> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTextColumn Header="#" Binding="{Binding Index}" Width="Auto" IsReadOnly="True" Foreground="DimGray" FontSize="11" /> + <mahapps:DataGridNumericUpDownColumn Header="X" Binding="{Binding X}" Minimum="0" Maximum="10000" HideUpDownButtons="True" Width="1*"/> + <mahapps:DataGridNumericUpDownColumn Header="Y" Binding="{Binding Y}" Minimum="0" Maximum="10000" HideUpDownButtons="True" Width="1*" /> + </DataGrid.Columns> + </DataGrid> + </Grid> + </DockPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs new file mode 100644 index 000000000..26100f16d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs @@ -0,0 +1,28 @@ +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; + +namespace Tango.MachineStudio.ColorLab.Views +{ + /// <summary> + /// Interaction logic for CalibrationDataView.xaml + /// </summary> + public partial class CalibrationDataView : UserControl + { + public CalibrationDataView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml index 78eaf04e8..4e8703a6e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml @@ -360,44 +360,8 @@ <TextBlock FontSize="20" Margin="0 20 0 0" TextAlignment="Center">CALIBRATION DATA</TextBlock> </Grid> - <Grid Margin="0 20 0 0"> - <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding LiquidsCalibrationData}" IsEnabled="{Binding IsFree}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <UniformGrid Rows="1" /> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - - <ItemsControl.ItemTemplate> - <DataTemplate> - <DockPanel> - <Border Padding="2" Margin="5" CornerRadius="3" DockPanel.Dock="Top"> - <Border.Background> - <SolidColorBrush Opacity="0.4" Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> - </Border.Background> - <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" Foreground="Black"></TextBlock> - </Border> - - <Grid Margin="0 0 0 5"> - <DataGrid Background="#BBFFFFFF" AlternatingRowBackground="#CCE1E1E1" BorderThickness="1" BorderBrush="#202020" Margin="5 0" ItemsSource="{Binding CalibrationPoints}" CanUserResizeColumns="False" CanUserReorderColumns="False" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" CanUserSortColumns="True"> - <DataGrid.CellStyle> - <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> - <Setter Property="BorderThickness" Value="0"/> - <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> - <Setter Property="FlowDirection" Value="RightToLeft"></Setter> - </Style> - </DataGrid.CellStyle> - <DataGrid.Columns> - <DataGridTextColumn Header="#" Binding="{Binding Index}" Width="Auto" IsReadOnly="True" Foreground="DimGray" FontSize="11" /> - <mahapps:DataGridNumericUpDownColumn Header="X" Binding="{Binding X}" Minimum="0" Maximum="10000" HideUpDownButtons="True" Width="1*"/> - <mahapps:DataGridNumericUpDownColumn Header="Y" Binding="{Binding Y}" Minimum="0" Maximum="10000" HideUpDownButtons="True" Width="1*" /> - </DataGrid.Columns> - </DataGrid> - </Grid> - </DockPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + <Grid Margin="0 20 0 0" IsEnabled="{Binding IsFree}"> + <local:CalibrationDataView DataContext="{Binding CalibrationDataViewVM}"></local:CalibrationDataView> </Grid> </DockPanel> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs new file mode 100644 index 000000000..e59141e7f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/LiquidVolumesToLubricantLiquidVolume.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL; +using Tango.BL.Enumerations; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class LiquidVolumesToLubricantLiquidVolume : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + IEnumerable<LiquidVolume> liquid_volumes = value as IEnumerable<LiquidVolume>; + return liquid_volumes.SingleOrDefault(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.Lubricant.ToInt32()); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index dc96f7112..cbaec81eb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -102,6 +102,7 @@ <Compile Include="Converters\InkVolumeToLiquidRmlFactor.cs" /> <Compile Include="Converters\JobProgressToPositionConverter.cs" /> <Compile Include="Converters\JobToColumnDefinitionsConverter.cs" /> + <Compile Include="Converters\LiquidVolumesToLubricantLiquidVolume.cs" /> <Compile Include="Converters\MillisecondsToTimeSpanConverter.cs" /> <Compile Include="Converters\ObjectsNotEqualToBooleanConveter.cs" /> <Compile Include="Converters\OneToPercentConverter.cs" /> @@ -359,7 +360,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index e04b1539a..6c3e31325 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -657,6 +657,12 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Gets or sets to running job command. /// </summary> public RelayCommand ToRunningJobCommand { get; set; } + + /// <summary> + /// Gets or sets the reset process parameters command. + /// </summary> + public RelayCommand ResetProcessParametersCommand { get; set; } + #endregion #region Constructors @@ -713,6 +719,7 @@ namespace Tango.MachineStudio.Developer.ViewModels ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null && CanWork); DisplayJobEmbroideryFileCommand = new RelayCommand<Job>(DisplayJobEmbroideryFile, () => CanWork); ReloadMachinesCommand = new RelayCommand(() => LoadMachine(), () => CanWork && SelectedMachine != null); + ResetProcessParametersCommand = new RelayCommand(ResetProcessParameters); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; @@ -1491,6 +1498,29 @@ namespace Tango.MachineStudio.Developer.ViewModels CanWork = true; } + /// <summary> + /// Resets the process parameters. + /// </summary> + private async void ResetProcessParameters() + { + if (_notification.ShowQuestion("This will reset the process parameters. Are you sure?")) + { + using (_notification.PushTaskItem("Resetting process parameters...")) + { + try + { + await ApplicationManager.ConnectedMachine.UploadProcessParameters(new ProcessParametersTable()); + _notification.ShowInfo("Heaters are turned off."); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error resetting process parameters."); + _notification.ShowError("Error resetting process parameters." + Environment.NewLine + ex.Message); + } + } + } + } + #endregion #region Active Job Management @@ -1575,6 +1605,11 @@ namespace Tango.MachineStudio.Developer.ViewModels SegmentsCollectionView = CollectionViewSource.GetDefaultView(ActiveJob.Segments); SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); + foreach (var segment in ActiveJob.Segments) + { + SetSegmentBrushStopsLiquidVolumes(segment); + } + SelectedSegment = _selectedSegment; UIHelper.DoEvents(); @@ -1810,7 +1845,7 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.LogFormat("Adding new segment to job {0}...", ActiveJob.Name); Segment seg = new Segment(); seg.Job = ActiveJob; - seg.Name = "Untitled Segment"; + seg.Name = "SEGMENT"; seg.Length = 10; if (ActiveJob.Segments.Count > 0) @@ -1878,7 +1913,9 @@ namespace Tango.MachineStudio.Developer.ViewModels newJob.Machine = SelectedMachine; SelectedMachine.Jobs.Add(newJob); - newJob.AddSolidSegment(); + var segment = newJob.AddSolidSegment(); + segment.BrushStops[0].SetAllDispensingStepDivisions(BL.Dispensing.DispenserStepDivisions.D8); + LogManager.Log("Saving selected machine to database..."); await SelectedMachine.SaveAsync(_machineDbContext); SelectedMachineJob = newJob; @@ -1933,6 +1970,7 @@ namespace Tango.MachineStudio.Developer.ViewModels stop.Segment = SelectedSegment; stop.ColorSpace = ColorSpaces.FirstOrDefault(); stop.Color = Colors.Black; + stop.SetAllDispensingStepDivisions(BL.Dispensing.DispenserStepDivisions.D8); stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML, SelectedProcessParametersTable); SelectedSegment.BrushStops.Add(stop); SelectedSegment.BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index ba7c80f5b..3f1f3b486 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -71,6 +71,8 @@ <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> <converters:IsNotConverter x:Key="IsNotConverter" /> <converters:ObjectToObjectTypeConverter x:Key="ObjectToObjectTypeConverter" /> + <converters:MathOperatorConverter x:Key="MathOperatorConverter" /> + <localConverters:LiquidVolumesToLubricantLiquidVolume x:Key="LiquidVolumesToLubricantLiquidVolume" /> <ObjectDataProvider x:Key="dispenserDivisions" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> @@ -351,11 +353,6 @@ </Polygon> <Border Height="100" Padding="5" IsHitTestVisible="False"> <Grid> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" FontStyle="Italic"> - <Run>#</Run> - <Run>SEGMENT</Run> - <Run Text="{Binding SegmentIndex}"></Run> - </TextBlock> <Rectangle VerticalAlignment="Bottom" Height="8"> <Rectangle.Fill> <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> @@ -369,6 +366,21 @@ </Grid> </Border> + <Grid Margin="20 10 10 10" TextElement.FontSize="16" TextElement.FontStyle="Italic" > + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="1*" /> + </Grid.ColumnDefinitions> + + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <TextBlock FontWeight="SemiBold">#</TextBlock> + <TextBlock FontWeight="SemiBold" Margin="5 0 0 0" Text="{Binding SegmentIndex}"></TextBlock> + </StackPanel> + + + <TextBox Grid.Column="1" VerticalAlignment="Center" Width="200" HorizontalContentAlignment="Center" Style="{x:Null}" BorderThickness="0" Background="Transparent" Text="{Binding Name}"></TextBox> + </Grid> + </Grid> </DataTemplate> </ListBox.ItemTemplate> @@ -729,16 +741,28 @@ </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> - <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> - <ContentControl.Foreground> - <SolidColorBrush Color="{Binding IdsPack.LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> - </ContentControl.Foreground> - <mahapps:NumericUpDown FontSize="{StaticResource NumbersFontSize}" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> - <mahapps:NumericUpDown.Resources> - <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> - </mahapps:NumericUpDown.Resources> - </mahapps:NumericUpDown> - </ContentControl> + <Border> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IdsPack.IdsPackFormula.Name}" Value="Lubricant"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Margin="10 0 0 0" Width="60" Height="60"> + <ContentControl.Foreground> + <SolidColorBrush Color="{Binding IdsPack.LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </ContentControl.Foreground> + <mahapps:NumericUpDown FontSize="{StaticResource NumbersFontSize}" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + </Border> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> @@ -749,7 +773,9 @@ </StackPanel> </StackPanel> - <TextBlock VerticalAlignment="Center" Margin="40 0 0 0" FontSize="16" FontStyle="Italic" Foreground="Gray"> + <materialDesign:PackIcon Kind="ChevronDoubleLeft" Margin="40 2 0 0" VerticalAlignment="Center" Foreground="Gray" /> + + <TextBlock VerticalAlignment="Center" FontSize="16" Margin="5 0 0 0" FontStyle="Italic" Foreground="Gray"> <Run>Total:</Run> <Run Text="{Binding TotalLiquidVolume,Mode=OneWay,StringFormat=0}"></Run><Run>%</Run> <Run>(</Run> @@ -757,6 +783,29 @@ <Run FontSize="12">nl</Run> <Run>)</Run> </TextBlock> + + <Border Margin="60 0 0 0" DataContext="{Binding LiquidVolumes,Converter={StaticResource LiquidVolumesToLubricantLiquidVolume}}" BorderBrush="#E6E6E6" BorderThickness="1 0 0 0"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Converter={StaticResource NullObjectToBooleanConverter}}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Margin="10 0 0 0" Width="55" Height="55"> + <ContentControl.Foreground> + <SolidColorBrush Color="{Binding IdsPack.LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </ContentControl.Foreground> + <mahapps:NumericUpDown Foreground="#515151" FontSize="20" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown.Resources> + <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + </ContentControl> + </Border> </StackPanel> </Setter.Value> </Setter> @@ -1001,7 +1050,7 @@ <DataGridTemplateColumn Header="IDX"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <TextBlock Text="{Binding IdsPack.PackIndex}" VerticalAlignment="Center" HorizontalAlignment="Center" /> + <TextBlock Text="{Binding IdsPack.PackIndex,Converter={StaticResource MathOperatorConverter},ConverterParameter='+1'}" VerticalAlignment="Center" HorizontalAlignment="Center" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> @@ -1009,7 +1058,7 @@ <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock VerticalAlignment="Center"> - <Run Text="{Binding IdsPack.DispenserType.NlPerPulse,StringFormat='0.00'}"></Run> + <Run Text="{Binding NanoliterPerStep,Mode=OneWay,StringFormat='0.00'}"></Run> <Run Text="(nl)" FontSize="9" Foreground="Gray"></Run> </TextBlock> </DataTemplate> @@ -1018,7 +1067,7 @@ <DataGridTemplateColumn Header="STEP"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <ComboBox ItemsSource="{Binding Source={StaticResource dispenserDivisions}}" SelectedItem="{Binding DispenserStepDivision,UpdateSourceTrigger=PropertyChanged}"> + <ComboBox ItemsSource="{Binding Source={StaticResource dispenserDivisions}}" SelectedItem="{Binding DispenserStepDivision,UpdateSourceTrigger=PropertyChanged}" BorderThickness="0"> <ComboBox.ItemContainerStyle> <Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}"> <Setter Property="Background" Value="#ECECEC"></Setter> @@ -1419,8 +1468,8 @@ <Grid Background="Transparent" Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnProcessParameterDropped" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=editors:ParameterizedEditor},Path=DraggingSurface}"> <ContentControl> <StackPanel> - <TextBlock IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}" FontSize="10"></TextBlock> - <mahapps:NumericUpDown FontSize="16" Minimum="0" Margin="0 0 5 0" HideUpDownButtons="True" HorizontalContentAlignment="Center" Maximum="10000" StringFormat="0.0" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}" FontSize="11"></TextBlock> + <mahapps:NumericUpDown FontSize="20" Minimum="0" Margin="0 0 5 0" HideUpDownButtons="True" HorizontalContentAlignment="Center" Maximum="10000" StringFormat="0.0" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}"></mahapps:NumericUpDown> </StackPanel> </ContentControl> </Grid> @@ -1471,6 +1520,11 @@ </ListBox> <StackPanel Margin="10 20" VerticalAlignment="Bottom" Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Height="40" Width="105" Command="{Binding ResetProcessParametersCommand}" Background="Transparent" BorderBrush="#202020" Foreground="#202020" Margin="0 2 10 0" ToolTip="Resets the current process parameters in the embedded device"> + <TextBlock TextWrapping="Wrap" TextAlignment="Center"> + RESET + </TextBlock> + </Button> <Button Height="40" Command="{Binding SaveProcessParametersCommand}" HorizontalAlignment="Left"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon VerticalAlignment="Center" Kind="ContentSave"></materialDesign:PackIcon> @@ -1519,7 +1573,7 @@ <Button Background="Transparent" Command="{Binding ToggleSideBarCommand}" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Right" VerticalAlignment="Center" Height="200" Width="50" Margin="0 0 -50 0"> <Border Background="#F1F1F1" CornerRadius="0 10 10 0" BorderThickness="0 1 1 1" BorderBrush="#383838"> <Grid> - <TextBlock Foreground="#FF7272" Text="CONFIGURATION" FontSize="16" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center" HorizontalAlignment="Center"> + <TextBlock Foreground="#FF7272" Text="PROCESS PARAMETERS" FontSize="16" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center" HorizontalAlignment="Center"> <TextBlock.LayoutTransform> <RotateTransform Angle="270"></RotateTransform> </TextBlock.LayoutTransform> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml index 11c60c1ef..fe04cead7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml @@ -14,15 +14,103 @@ <UserControl.Resources> <converters:DateTimeUTCToStringConverter x:Key="DateTimeUTCToStringConverter" /> </UserControl.Resources> - - <Grid> - <Grid Margin="40"> + + <Grid Margin="40"> + <Grid.RowDefinitions> + <RowDefinition Height="900*" MinHeight="50" /> + <RowDefinition Height="5"/> + <RowDefinition Height="743*" MinHeight="170"/> + </Grid.RowDefinitions> + + <Grid> <DockPanel> - <StackPanel Margin="0 20 0 0" Orientation="Horizontal" DockPanel.Dock="Top"> - <materialDesign:PackIcon Kind="Settings" Width="60" Height="60" /> - <TextBlock FontSize="30" FontWeight="SemiBold" VerticalAlignment="Center" Margin="10 0 0 0">Job Status</TextBlock> + <StackPanel Margin="0 0 0 0" Orientation="Horizontal" DockPanel.Dock="Top"> + <materialDesign:PackIcon Kind="Settings" Width="40" Height="40" /> + <TextBlock FontSize="30" FontWeight="SemiBold" VerticalAlignment="Center" Margin="10 0 0 0">Status</TextBlock> </StackPanel> + <DataGrid x:Name="gridSegments" SelectionMode="Single" SelectionChanged="DataGrid_SelectionChanged" SelectionUnit="FullRow" RowHeight="40" GridLinesVisibility="None" ItemsSource="{Binding RunningJobStatus.Segments}" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding RunningJobStatus.CurrentSegment}" Background="Transparent" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" IsReadOnly="True" AutoGenerateColumns="False"> + <DataGrid.RowStyle> + <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Foreground" Value="White"></Setter> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5"> + <GradientStop Color="#FFFF7A7A"/> + <GradientStop Color="Transparent" Offset="1"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="BorderBrush" Value="White"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.RowStyle> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="White"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTextColumn Width="Auto" Header="#" Binding="{Binding SegmentIndex}" /> + <DataGridTemplateColumn Header="Status"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <materialDesign:PackIcon VerticalAlignment="Center" HorizontalAlignment="Center"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Kind" Value="PauseCircle"></Setter> + <Setter Property="Foreground" Value="Gray"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Started}" Value="True"> + <Setter Property="Kind" Value="ClockFast"></Setter> + <Setter Property="Foreground" Value="White"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Completed}" Value="True"> + <Setter Property="Kind" Value="CheckCircle"></Setter> + <Setter Property="Foreground" Value="#29B31D"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Rectangle Width="80" Fill="{Binding SegmentBrush}" Stroke="Gray"></Rectangle> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}" /> + <DataGridTextColumn Header="Length" Binding="{Binding Length,StringFormat={}{0:F2} m}" /> + <DataGridTextColumn Header="Progress" Binding="{Binding Progress,StringFormat={}{0:F2} m}" /> + <DataGridTextColumn Header="Estimated Duration" Binding="{Binding EstimatedDuration,StringFormat='hh\\:mm\\:ss'}" /> + <DataGridTextColumn Header="Remaining Time" Binding="{Binding RemainingTime,StringFormat='hh\\:mm\\:ss'}" /> + </DataGrid.Columns> + </DataGrid> + </DockPanel> + </Grid> + <GridSplitter Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Height="5" Background="Black" /> + <Grid Grid.Row="2" Margin="0 40 0 0"> + <DockPanel> + <StackPanel Margin="0 0 0 0" Orientation="Horizontal" DockPanel.Dock="Top"> + <materialDesign:PackIcon Kind="Settings" Width="40" Height="40" /> + <TextBlock FontSize="30" FontWeight="SemiBold" VerticalAlignment="Center" Margin="10 0 0 0">Events</TextBlock> + </StackPanel> <Grid DockPanel.Dock="Bottom" Height="40"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 0 0"> <Button Command="{Binding BackToJobCommand}" Style="{StaticResource MaterialDesignFlatButton}" FontSize="16"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml.cs index 74ace554e..5579870f6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/RunningJobView.xaml.cs @@ -24,5 +24,13 @@ namespace Tango.MachineStudio.Developer.Views { InitializeComponent(); } + + private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (gridSegments.SelectedItem != null) + { + gridSegments.ScrollIntoView(gridSegments.SelectedItem); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_5q2jsctg_wpftmp.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_5q2jsctg_wpftmp.csproj new file mode 100644 index 000000000..1c2b96de8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging_5q2jsctg_wpftmp.csproj @@ -0,0 +1,227 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{1674F726-0E66-414F-B9FD-C6F20D7F07C7}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.MachineStudio.Logging</RootNamespace> + <AssemblyName>Tango.MachineStudio.Logging</AssemblyName> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\Machine Studio\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\Machine Studio\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="ControlledObservableCollection.cs" /> + <Compile Include="Controls\TimelineScrollViewer.cs" /> + <Compile Include="Controls\TimeRuler.cs" /> + <Compile Include="Converters\DateIsInListToBooleanConverter.cs" /> + <Compile Include="Converters\EventsToTimeRulerTicksConverter.cs" /> + <Compile Include="Converters\LogItemToMessageConverter.cs" /> + <Compile Include="Converters\MachineEventToXConverter.cs" /> + <Compile Include="Converters\SecondsToWidthConverter.cs" /> + <Compile Include="Converters\StringToFirstLineConverter.cs" /> + <Compile Include="Converters\TimeSpanToXConverter.cs" /> + <Compile Include="Helpers\TimelineHelper.cs" /> + <Compile Include="LoggingModule.cs" /> + <Compile Include="Navigation\LoggingNavigationManager.cs" /> + <Compile Include="Navigation\LoggingNavigationView.cs" /> + <Compile Include="Parsing\ApplicationLogFileParser.cs" /> + <Compile Include="Parsing\EmbeddedLogFileParser.cs" /> + <Compile Include="Parsing\ILogFileParser.cs" /> + <Compile Include="Parsing\LogFile.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\EmbeddedLogsViewVM.cs" /> + <Compile Include="ViewModels\ApplicationLogsViewVM.cs" /> + <Compile Include="ViewModels\EventDetailsViewVM.cs" /> + <Compile Include="ViewModels\HomeViewVM.cs" /> + <Compile Include="ViewModels\EventsViewVM.cs" /> + <Compile Include="ViewModels\LogDetailsViewVM.cs" /> + <Compile Include="ViewModels\TimelineEventGroup.cs" /> + <Compile Include="ViewModels\TimelineViewVM.cs" /> + <Compile Include="Views\EmbeddedLogDetailsView.xaml.cs"> + <DependentUpon>EmbeddedLogDetailsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\EmbeddedLogsView.xaml.cs"> + <DependentUpon>EmbeddedLogsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ApplicationLogDetailsView.xaml.cs"> + <DependentUpon>ApplicationLogDetailsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\EventDetailsView.xaml.cs"> + <DependentUpon>EventDetailsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\ApplicationLogsView.xaml.cs"> + <DependentUpon>ApplicationLogsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\EventsView.xaml.cs"> + <DependentUpon>EventsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\HomeView.xaml.cs"> + <DependentUpon>HomeView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\TimelineView.xaml.cs"> + <DependentUpon>TimelineView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\TimelineWrapperView.xaml.cs"> + <DependentUpon>TimelineWrapperView.xaml</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="App.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj"> + <Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project> + <Name>Tango.AutoComplete</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj"> + <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> + <Name>Tango.MachineStudio.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <ProjectExtensions> + <VisualStudio> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + </VisualStudio> + </ProjectExtensions> + <ItemGroup> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Microsoft.CSharp.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\mscorlib.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\PresentationCore.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\PresentationFramework.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.ComponentModel.DataAnnotations.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Core.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Data.DataSetExtensions.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Data.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Net.Http.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Xaml.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Xml.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Xml.Linq.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\SideChains\Tango.AutoComplete\bin\Debug\Tango.AutoComplete.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.BL.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Core.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Integration.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Logging.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\Build\Machine Studio\Debug\Tango.MachineStudio.Common.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.PMR.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Settings.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.SharedUI.dll" /> + <ReferencePath Include="D:\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Transport.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\WindowsBase.dll" /> + </ItemGroup> + <ItemGroup> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\EmbeddedLogDetailsView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\EmbeddedLogsView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\ApplicationLogDetailsView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\EventDetailsView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\ApplicationLogsView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\EventsView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\HomeView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\MainView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\TimelineView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\Views\TimelineWrapperView.g.cs" /> + <Compile Include="D:\Development\Tango\Software\Visual_Studio\MachineStudio\Modules\Tango.MachineStudio.Logging\obj\Debug\GeneratedInternalTypeHelper.g.cs" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml index e2dd7c5a9..1ea8d2a74 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -88,6 +88,17 @@ <materialDesign:PackIcon Kind="Minus" Width="24" Height="24"></materialDesign:PackIcon> </Button> + <UniformGrid Width="310" Canvas.Top="295" Canvas.Left="420" Rows="1" Columns="8" TextElement.FontSize="9"> + <TextBlock HorizontalAlignment="Center">1</TextBlock> + <TextBlock HorizontalAlignment="Center">2</TextBlock> + <TextBlock HorizontalAlignment="Center">3</TextBlock> + <TextBlock HorizontalAlignment="Center">4</TextBlock> + <TextBlock HorizontalAlignment="Center">5</TextBlock> + <TextBlock HorizontalAlignment="Center">6</TextBlock> + <TextBlock HorizontalAlignment="Center">7</TextBlock> + <TextBlock HorizontalAlignment="Center">8</TextBlock> + </UniformGrid> + <Grid x:Name="gridIds" Width="310" Height="195" Canvas.Top="314" Canvas.Left="420"> <ListBox ItemsSource="{Binding Configuration.IdsPacks}" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> <ListBox.ItemContainerStyle> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml index e12f85cdf..e25a64c5e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml @@ -158,6 +158,16 @@ <materialDesign:PackIcon Kind="Minus" Width="24" Height="24"></materialDesign:PackIcon> </Button> + <UniformGrid Width="310" Canvas.Top="295" Canvas.Left="420" Rows="1" Columns="8" TextElement.FontSize="9"> + <TextBlock HorizontalAlignment="Center">1</TextBlock> + <TextBlock HorizontalAlignment="Center">2</TextBlock> + <TextBlock HorizontalAlignment="Center">3</TextBlock> + <TextBlock HorizontalAlignment="Center">4</TextBlock> + <TextBlock HorizontalAlignment="Center">5</TextBlock> + <TextBlock HorizontalAlignment="Center">6</TextBlock> + <TextBlock HorizontalAlignment="Center">7</TextBlock> + <TextBlock HorizontalAlignment="Center">8</TextBlock> + </UniformGrid> <Grid x:Name="gridIds" Width="310" Height="195" Canvas.Top="314" Canvas.Left="420"> <ListBox ItemsSource="{Binding Configuration.IdsPacks}" SelectedItem="{Binding SelectedIds}" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> <ListBox.ItemContainerStyle> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config new file mode 100644 index 000000000..bd3d48f6d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/App.config @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + </configSections> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs new file mode 100644 index 000000000..7431f1ef1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.RML.Contracts +{ + public enum RmlNavigationView + { + RmlsView, + RmlView, + } + + public interface IMainView : IView + { + void NavigateTo(RmlNavigationView view); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg Binary files differnew file mode 100644 index 000000000..7999c88fd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/rml-module.jpg diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png Binary files differnew file mode 100644 index 000000000..36533fbeb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png Binary files differnew file mode 100644 index 000000000..86eb0b335 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..062f0ace5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Machine Studio RML Module")] +[assembly: AssemblyVersion("2.0.11.1737")] + +[assembly: ComVisible(false)] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs new file mode 100644 index 000000000..fb62b4ba4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.RML.Properties { + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.RML.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs new file mode 100644 index 000000000..30784c8b0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.MachineStudio.RML.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs new file mode 100644 index 000000000..fdd8cb124 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/RMLModule.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.MachineStudio.RML.Views; +using Tango.MachineStudio.Common; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.ColorLab +{ + [StudioModule(7)] + public class RMLModule : StudioModuleBase + { + public override string Name + { + get + { + return "RML"; + } + } + + public override string Description + { + get + { + return "Create and manage twine's recommended media list (RML). Configure RML's default calibration data and process parameters"; + } + } + + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/rml-module.jpg"); + } + } + + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + public override Permissions Permission + { + get + { + return Permissions.RunColorLabModule; + } + } + + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj new file mode 100644 index 000000000..99b0a3c19 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{D0186AC0-0FCF-4D3B-9619-54812B6E524B}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.MachineStudio.RML</RootNamespace> + <AssemblyName>Tango.MachineStudio.RML</AssemblyName> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\Machine Studio\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\Machine Studio\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignColors, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Data" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Contracts\IMainView.cs" /> + <Compile Include="RMLModule.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\RmlsView.xaml.cs"> + <DependentUpon>RmlsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\RmlView.xaml.cs"> + <DependentUpon>RmlView.xaml</DependentUpon> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="App.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.CSV\Tango.CSV.csproj"> + <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project> + <Name>Tango.CSV</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Documents\Tango.Documents.csproj"> + <Project>{ca87a608-7b17-4c98-88f2-42abee10f4c1}</Project> + <Name>Tango.Documents</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.DragAndDrop\Tango.DragAndDrop.csproj"> + <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> + <Name>Tango.DragAndDrop</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj"> + <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> + <Name>Tango.MachineStudio.Common</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.ColorLab\Tango.MachineStudio.ColorLab.csproj"> + <Project>{4d183aca-552b-4135-ae81-7c5a8e5fc3b1}</Project> + <Name>Tango.MachineStudio.ColorLab</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\rml-module.jpg" /> + </ItemGroup> + <ItemGroup> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\RmlsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\RmlView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\threads.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\thread_128px.png" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs new file mode 100644 index 000000000..9c2bf2c6b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModelLocator.cs @@ -0,0 +1,29 @@ +using Tango.Core.DI; +using Tango.MachineStudio.RML.ViewModels; +using Tango.MachineStudio.RML.Views; + +namespace Tango.MachineStudio.RML +{ + /// <summary> + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// </summary> + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + TangoIOC.Default.Register<MainViewVM>(); + } + + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance<MainViewVM>(); + } + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..b7e7859ac --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -0,0 +1,325 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.MachineStudio.ColorLab.ViewModels; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.RML.Contracts; + +namespace Tango.MachineStudio.RML.ViewModels +{ + public class MainViewVM : StudioViewModel<IMainView> + { + private INotificationProvider _notification; + + private ObservablesContext _rmls_context; + private ObservablesContext _active_context; + + private ObservableCollection<Rml> _rmls; + public ObservableCollection<Rml> Rmls + { + get { return _rmls; } + set { _rmls = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<MediaMaterial> _materials; + public ObservableCollection<MediaMaterial> Materials + { + get { return _materials; } + set { _materials = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<MediaColor> _colors; + public ObservableCollection<MediaColor> Colors + { + get { return _colors; } + set { _colors = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<MediaPurpos> _purposes; + public ObservableCollection<MediaPurpos> Purposes + { + get { return _purposes; } + set { _purposes = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<MediaCondition> _conditions; + public ObservableCollection<MediaCondition> Conditions + { + get { return _conditions; } + set { _conditions = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<LinearMassDensityUnit> _linearMassDensityUnits; + public ObservableCollection<LinearMassDensityUnit> LinearMassDensityUnits + { + get { return _linearMassDensityUnits; } + set { _linearMassDensityUnits = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<FiberShape> _fiberShapes; + public ObservableCollection<FiberShape> FiberShapes + { + get { return _fiberShapes; } + set { _fiberShapes = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<FiberSynth> _fiberSynths; + public ObservableCollection<FiberSynth> FiberSynths + { + get { return _fiberSynths; } + set { _fiberSynths = value; RaisePropertyChangedAuto(); } + } + + private Rml _selectedRML; + public Rml SelectedRML + { + get { return _selectedRML; } + set { _selectedRML = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private Rml _activeRML; + public Rml ActiveRML + { + get { return _activeRML; } + set { _activeRML = value; RaisePropertyChangedAuto(); } + } + + private CalibrationDataViewVM _calibrationDataViewVM; + public CalibrationDataViewVM CalibrationDataViewVM + { + get { return _calibrationDataViewVM; } + set { _calibrationDataViewVM = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<LiquidTypesRml> _liquidTypesRmls; + public ObservableCollection<LiquidTypesRml> LiquidTypesRmls + { + get { return _liquidTypesRmls; } + set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); } + } + + private ProcessParametersTablesGroup _activeProcessParametersGroup; + public ProcessParametersTablesGroup ActiveProcessParametersGroup + { + get { return _activeProcessParametersGroup; } + set { _activeProcessParametersGroup = value; RaisePropertyChangedAuto(); } + } + + private ICollectionView _activeProcessParametersTableView; + public ICollectionView ActiveProcessParametersTableView + { + get { return _activeProcessParametersTableView; } + set { _activeProcessParametersTableView = value; RaisePropertyChangedAuto(); } + } + + + /// <summary> + /// Gets or sets the manage RML command. + /// </summary> + public RelayCommand ManageRmlCommand { get; set; } + + /// <summary> + /// Gets or sets the add RML command. + /// </summary> + public RelayCommand AddRmlCommand { get; set; } + + /// <summary> + /// Gets or sets the remove RML command. + /// </summary> + public RelayCommand RemoveRmlCommand { get; set; } + + public RelayCommand AddProcessParametersTableCommand { get; set; } + + /// <summary> + /// Gets or sets the back to RMLS command. + /// </summary> + public RelayCommand BackToRmlsCommand { get; set; } + + public MainViewVM(INotificationProvider notificationProvider) + { + _notification = notificationProvider; + ManageRmlCommand = new RelayCommand(() => LoadActiveRML(SelectedRML.Guid), () => SelectedRML != null); + RemoveRmlCommand = new RelayCommand(RemoveSelectedRml); + AddRmlCommand = new RelayCommand(AddNewRml); + BackToRmlsCommand = new RelayCommand(BackToRmls); + AddProcessParametersTableCommand = new RelayCommand(AddProcessParametersTable); + } + + public override void OnApplicationReady() + { + LoadRmls(); + } + + private async void LoadRmls() + { + using (_rmls_context = ObservablesContext.CreateDefault()) + { + await Task.Factory.StartNew(() => + { + Rmls = _rmls_context.Rmls.ToList().ToObservableCollection(); + }); + } + } + + private async void LoadActiveRML(String guid) + { + using (_notification.PushTaskItem("Loading RML...")) + { + IsFree = false; + + if (_active_context != null) + { + _active_context.Dispose(); + } + + _active_context = ObservablesContext.CreateDefault(); + + LoadRmlProperties(); + + ActiveRML = await new RmlBuilder(_active_context) + .Set(guid) + .WithActiveParametersGroup() + .WithLiquidFactors() + .WithMediaProperties() + .BuildAsync(); + + ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); + ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables); + ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending)); + + CalibrationDataViewVM = new CalibrationDataViewVM(); + LiquidTypesRmls = ActiveRML.LiquidTypesRmls; + + foreach (var liquidTypeRml in LiquidTypesRmls) + { + CalibrationDataVM catVM = new CalibrationDataVM(); + catVM.Name = liquidTypeRml.LiquidType.Name; + catVM.Color = liquidTypeRml.LiquidType.Color; + + if (liquidTypeRml.DefaultCatData != null) + { + catVM.CalibrationPoints = liquidTypeRml.GetCalibrationData().CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection(); + } + + CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM); + } + + + View.NavigateTo(RmlNavigationView.RmlView); + + IsFree = true; + } + } + + private void LoadRmlProperties() + { + Materials = _active_context.MediaMaterials.ToObservableCollection(); + Colors = _active_context.MediaColors.ToObservableCollection(); + Purposes = _active_context.MediaPurposes.ToObservableCollection(); + Conditions = _active_context.MediaConditions.ToObservableCollection(); + LinearMassDensityUnits = _active_context.LinearMassDensityUnits.ToObservableCollection(); + FiberShapes = _active_context.FiberShapes.ToObservableCollection(); + FiberSynths = _active_context.FiberSynths.ToObservableCollection(); + } + + private async void AddNewRml() + { + var name = _notification.ShowTextInput("Please enter RML name", "Name"); + + if (!String.IsNullOrWhiteSpace(name)) + { + if (Rmls.ToList().Exists(x => x.Name == name)) + { + _notification.ShowError("The specified RML name already exists. Please select a different name."); + return; + } + + using (_notification.PushTaskItem("Creating new RML...")) + { + IsFree = false; + + if (_active_context != null) + { + _active_context.Dispose(); + } + + LoadRmlProperties(); + + Rml rml = new Rml(); + rml.Name = name; + rml.Manufacturer = "Twine"; + rml.Code = Rmls.Max(x => x.Code) + 1; + rml.MediaMaterial = Materials.FirstOrDefault(); + rml.MediaColor = Colors.FirstOrDefault(); + rml.MediaPurpose = Purposes.FirstOrDefault(); + rml.MediaCondition = Conditions.FirstOrDefault(); + rml.LinearMassDensityUnit = LinearMassDensityUnits.FirstOrDefault(); + rml.FiberShape = FiberShapes.FirstOrDefault(); + rml.FiberSynth = FiberSynths.FirstOrDefault(); + _active_context.Rmls.Add(rml); + await _active_context.SaveChangesAsync(); + LoadActiveRML(rml.Guid); + + IsFree = true; + } + } + } + + private void RemoveSelectedRml() + { + + } + + private void AddProcessParametersTable() + { + var name = _notification.ShowTextInput("Enter table name", "Name"); + + if (!String.IsNullOrWhiteSpace(name)) + { + _active_context.ProcessParametersTables.Add(new ProcessParametersTable() + { + ProcessParametersTablesGroup = ActiveProcessParametersGroup, + Name = name, + TableIndex = ActiveProcessParametersGroup.ProcessParametersTables.Max(x => x.TableIndex) + 1, + }); + } + } + + public void OnProcessParametersTableDropped(ProcessParametersTable dragged, ProcessParametersTable dropped) + { + if (dragged.TableIndex > dropped.TableIndex) + { + dragged.TableIndex = dropped.TableIndex - 1; + } + else + { + dragged.TableIndex = dropped.TableIndex + 1; + } + + int index = 0; + + foreach (var table in ActiveProcessParametersGroup.ProcessParametersTables.OrderBy(x => x.TableIndex)) + { + table.TableIndex = index++; + } + + ActiveProcessParametersTableView.Refresh(); + } + + private void BackToRmls() + { + View.NavigateTo(RmlNavigationView.RmlsView); + LoadRmls(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml new file mode 100644 index 000000000..ab5207722 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml @@ -0,0 +1,18 @@ +<UserControl x:Class="Tango.MachineStudio.RML.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:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.RML" + xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <Grid> + <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide"> + <local:RmlsView /> + <local:RmlView/> + </controls:NavigationControl> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs new file mode 100644 index 000000000..20ff4c076 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs @@ -0,0 +1,37 @@ +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.DI; +using Tango.MachineStudio.RML.Contracts; +using Tango.SharedUI; + +namespace Tango.MachineStudio.RML.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl, IMainView + { + public MainView() + { + InitializeComponent(); + TangoIOC.Default.Register<IMainView>(this); + } + + public void NavigateTo(RmlNavigationView view) + { + navigationControl.NavigateTo(view.ToString()); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml new file mode 100644 index 000000000..e77663de4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml @@ -0,0 +1,286 @@ +<UserControl x:Class="Tango.MachineStudio.RML.Views.RmlView" + 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:global="clr-namespace:Tango.MachineStudio.RML" + xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorLabViews="clr-namespace:Tango.MachineStudio.ColorLab.Views;assembly=Tango.MachineStudio.ColorLab" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" + xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + </UserControl.Resources> + + <Grid Margin="20"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <StackPanel Orientation="Horizontal"> + <Button Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Command="{Binding BackToRmlsCommand}"> + <materialDesign:PackIcon Kind="ArrowLeft" Width="50" Height="50" Foreground="#202020" ToolTip="Back to RML list" /> + </Button> + <TextBlock Text="{Binding ActiveRML.Name}" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="34"></TextBlock> + </StackPanel> + </Grid> + + <Grid DockPanel.Dock="Bottom"> + + </Grid> + + <Grid Margin="0 20"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="78*" MinWidth="100" /> + <ColumnDefinition Width="5"/> + <ColumnDefinition Width="357*" MinWidth="400" /> + </Grid.ColumnDefinitions> + <Grid> + <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch"> + <Grid> + <DockPanel> + <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">PROPERTIES</TextBlock> + <controls:TableGrid RowHeight="35" Margin="20 0"> + <TextBlock Text="Name:" ></TextBlock> + <TextBox Text="{Binding ActiveRML.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox> + + <TextBlock Text="Manufacturer:" ></TextBlock> + <TextBox Text="{Binding ActiveRML.Manufacturer}"></TextBox> + + <TextBlock Text="Material:" ></TextBlock> + <ComboBox ItemsSource="{Binding Materials}" SelectedItem="{Binding ActiveRML.MediaMaterial,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Color:" ></TextBlock> + <ComboBox ItemsSource="{Binding Colors}" SelectedItem="{Binding ActiveRML.MediaColor,Mode=TwoWay}"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <Rectangle Width="16" Height="16" VerticalAlignment="Center"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + + <TextBlock Text="Purpose:" ></TextBlock> + <ComboBox ItemsSource="{Binding Purposes}" SelectedItem="{Binding ActiveRML.MediaPurpose,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Condition:" ></TextBlock> + <ComboBox ItemsSource="{Binding Conditions}" SelectedItem="{Binding ActiveRML.MediaCondition,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Linear Mass Density Unit:" ></TextBlock> + <ComboBox ItemsSource="{Binding LinearMassDensityUnits}" SelectedItem="{Binding ActiveRML.LinearMassDensityUnit,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Fiber Shape:" ></TextBlock> + <ComboBox ItemsSource="{Binding FiberShapes}" SelectedItem="{Binding ActiveRML.FiberShape,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Fiber Syntheses:" ></TextBlock> + <ComboBox ItemsSource="{Binding FiberSynths}" SelectedItem="{Binding ActiveRML.FiberSynth,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + + <TextBlock Text="Fiber Size:" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.FiberSize,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Fibers Count:" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.NumberOfFibers,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Plies Per Fiber:" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.PliesPerFiber,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Plies Per Thread:" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.PliesPerThread,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Tensile Strength:" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.TensileStrength,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Elongation Break Percentage:" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.ElongationAtBreakPercentage,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Estimated Thread Diameter:" ></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding ActiveRML.EstimatedThreadDiameter,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Twisted:" ></TextBlock> + <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding ActiveRML.Twisted}" Style="{StaticResource MaterialDesignSwitchToggleButton}" /> + + <TextBlock Text="Air Entanglement:" ></TextBlock> + <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding ActiveRML.AirEntanglement}" Style="{StaticResource MaterialDesignSwitchToggleButton}" /> + + <TextBlock Text="Lubricant:" ></TextBlock> + <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding ActiveRML.Lubricant}" Style="{StaticResource MaterialDesignSwitchToggleButton}" /> + </controls:TableGrid> + </DockPanel> + </Grid> + </materialDesign:Card> + </Grid> + + <GridSplitter Grid.Column="1" HorizontalAlignment="Center" Width="5" VerticalAlignment="Stretch" /> + + <Grid Grid.Column="2"> + <Grid.RowDefinitions> + <RowDefinition Height="416*"/> + <RowDefinition Height="490"/> + </Grid.RowDefinitions> + + <Grid> + <DockPanel> + <Border DockPanel.Dock="Top" Background="#E9FFFFFF" Margin="20 0" Padding="5" CornerRadius="5"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> + <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">ACTIVE PROCESS GROUP</TextBlock> + <Button ToolTip="Add new table" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Width="30" HorizontalAlignment="Right" Padding="0" Command="{Binding AddProcessParametersTableCommand}"> + <materialDesign:PackIcon Kind="Plus" Foreground="#0AC30A" Width="24" Height="24" /> + </Button> + </Grid> + </Border> + <Grid> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 20"> + <ItemsControl ItemsSource="{Binding ActiveProcessParametersTableView}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <DockPanel> + <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" VerticalAlignment="Bottom" ToolTip="Remove table" Width="30" Margin="10 0 0 10"> + <materialDesign:PackIcon Kind="Delete" Width="24" Height="24" Foreground="#FF7D7D" /> + </Button> + + <Grid Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnProcessTableDropped"> + <Border Padding="5" BorderThickness="1" Margin="20 5 0 5" BorderBrush="#101010" Background="#B9FFFFFF"> + <Grid> + <DockPanel Width="300"> + <TextBox materialDesign:HintAssist.Hint="Table Name" DockPanel.Dock="Top" Text="{Binding Name}"></TextBox> + + <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5"> + <editors:ParameterizedEditor ParameterizedObject="{Binding}"> + <editors:ParameterizedEditor.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel IsItemsHost="True" /> + </ItemsPanelTemplate> + </editors:ParameterizedEditor.ItemsPanel> + <editors:ParameterizedEditor.DoubleTemplate> + <DataTemplate> + <DockPanel> + <TextBlock IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}" FontSize="11"></TextBlock> + <mahapps:NumericUpDown HorizontalAlignment="Right" Minimum="0" Margin="0 0 5 0" HideUpDownButtons="True" HorizontalContentAlignment="Right" Maximum="10000" StringFormat="0.0" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}"></mahapps:NumericUpDown> + </DockPanel> + </DataTemplate> + </editors:ParameterizedEditor.DoubleTemplate> + </editors:ParameterizedEditor> + </ScrollViewer> + </DockPanel> + </Grid> + </Border> + + <dragAndDrop:DragThumb Background="Transparent" Cursor="SizeAll" ToolTip="Drag and drop" Margin="0 3 -1 0" HorizontalAlignment="Right" VerticalAlignment="Top"> + <materialDesign:PackIcon HorizontalAlignment="Right" VerticalAlignment="Top" IsHitTestVisible="False" Kind="Drag" Width="32" Height="32" Background="Transparent" /> + </dragAndDrop:DragThumb> + </Grid> + </DockPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + + <dragAndDrop:DraggingSurface x:Name="draggingSurface" /> + </Grid> + </DockPanel> + </Grid> + + + <Grid Grid.Row="1"> + + <DockPanel> + + <ScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="120"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <Grid Margin="0 0 0 0"> + <DockPanel> + <Border DockPanel.Dock="Top" Background="#E9FFFFFF" Margin="20 0" Padding="5" CornerRadius="5"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> + <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">LIQUID FACTORS</TextBlock> + + <Button ToolTip="Add new liquid factor" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" VerticalAlignment="Bottom" Width="30" Padding="0"> + <materialDesign:PackIcon Kind="Plus" Foreground="#0AC30A" Width="24" Height="24" /> + </Button> + </Grid> + </Border> + <ItemsControl ItemsSource="{Binding LiquidTypesRmls}" Margin="0 10 0 0"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid IsItemsHost="True" Rows="1"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> + <Grid Margin="20 0 20 0"> + + <Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Delete liquid factor" Width="30"> + <materialDesign:PackIcon Kind="Delete" Foreground="#FF7D7D" /> + </Button> + + <StackPanel Margin="0 0 10 0"> + <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidType.Name}"></TextBlock> + <Grid Width="58" Height="48" Margin="0 5 0 0"> + <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> + <shapes:Hexagon.Fill> + <LinearGradientBrush Opacity="0.7" > + <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Color="White" Offset="1"/> + </LinearGradientBrush> + </shapes:Hexagon.Fill> + </shapes:Hexagon> + + <TextBox Style="{x:Null}" Background="Transparent" Foreground="Black" BorderThickness="0" Text="{Binding MaxNlPerCm}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontStyle="Italic"></TextBox> + </Grid> + </StackPanel> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </DockPanel> + </Grid> + + <Grid Grid.Row="2"> + <DockPanel> + + <Border DockPanel.Dock="Top" Background="#E9FFFFFF" Margin="20 0" Padding="5" CornerRadius="5"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">CALIBRATION DATA</TextBlock> + </Border> + + <colorLabViews:CalibrationDataView Margin="0 10 0 0" DataContext="{Binding CalibrationDataViewVM}" /> + </DockPanel> + </Grid> + </Grid> + </ScrollViewer> + </DockPanel> + </Grid> + </Grid> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs new file mode 100644 index 000000000..c1bc9ad4a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs @@ -0,0 +1,51 @@ +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.BL.Entities; +using Tango.DragAndDrop; +using Tango.MachineStudio.RML.ViewModels; + +namespace Tango.MachineStudio.RML.Views +{ + /// <summary> + /// Interaction logic for RmlView.xaml + /// </summary> + public partial class RmlView : UserControl + { + private MainViewVM _vm; + + public DraggingSurface DraggingSurface + { + get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } + set { SetValue(DraggingSurfaceProperty, value); } + } + public static readonly DependencyProperty DraggingSurfaceProperty = + DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(RmlView), new PropertyMetadata(null)); + + + public RmlView() + { + InitializeComponent(); + DraggingSurface = draggingSurface; + Loaded += (_, __) => { _vm = DataContext as MainViewVM; }; + } + + private void OnProcessTableDropped(object sender, DropEventArgs e) + { + ProcessParametersTable dragged = e.Draggable.DataContext as ProcessParametersTable; + ProcessParametersTable dropped = e.Droppable.DataContext as ProcessParametersTable; + _vm.OnProcessParametersTableDropped(dragged, dropped); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml new file mode 100644 index 000000000..b597c1dd2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -0,0 +1,65 @@ +<UserControl x:Class="Tango.MachineStudio.RML.Views.RmlsView" + 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:global="clr-namespace:Tango.MachineStudio.RML" + xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + <UserControl.Resources> + <converters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter" /> + </UserControl.Resources> + + <Grid> + <DockPanel Margin="100" MaxWidth="1200"> + <Grid DockPanel.Dock="Top"> + <Image Source="../Images/threads.png" Width="300" Margin="10" /> + </Grid> + <Grid DockPanel.Dock="Bottom"> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 0 0 0"> + <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#FF7575" BorderBrush="#FF7575" Command="{Binding RemoveRmlCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Delete" Width="20" Height="20" /> + <TextBlock Margin="5 0 0 0" FontSize="16">DELETE</TextBlock> + </StackPanel> + </Button> + <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#65C682" BorderBrush="#65C682" Command="{Binding AddRmlCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Plus" Width="20" Height="20" /> + <TextBlock Margin="5 0 0 0" FontSize="16">NEW RML</TextBlock> + </StackPanel> + </Button> + </StackPanel> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Margin="50 0 0 0" MinWidth="200" Height="60" Command="{Binding ManageRmlCommand}"> + <StackPanel Orientation="Horizontal"> + <TextBlock FontSize="18" VerticalAlignment="Center">MANAGE</TextBlock> + <materialDesign:PackIcon Margin="5 0 0 0" Kind="ChevronRight" Width="30" Height="30" /> + </StackPanel> + </Button> + </StackPanel> + </Grid> + <Grid> + <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}"> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTextColumn Header="NAME" Binding="{Binding Name}" Width="1*" /> + <DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="1*" /> + <DataGridTextColumn Header="MANUFACTURER" Binding="{Binding Manufacturer}" Width="1*" /> + </DataGrid.Columns> + </DataGrid> + </Grid> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml.cs new file mode 100644 index 000000000..66f52d8c8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml.cs @@ -0,0 +1,28 @@ +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; + +namespace Tango.MachineStudio.RML.Views +{ + /// <summary> + /// Interaction logic for RmlsView.xaml + /// </summary> + public partial class RmlsView : UserControl + { + public RmlsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config new file mode 100644 index 000000000..d8e0c7e97 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.0.0" targetFramework="net472" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net472" /> + <package id="MahApps.Metro" version="1.5.0" targetFramework="net472" /> + <package id="MaterialDesignColors" version="1.1.2" targetFramework="net472" /> + <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net472" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToTimeSpanConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToTimeSpanConverter.cs new file mode 100644 index 000000000..8098c6751 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToTimeSpanConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Technician.Converters +{ + public class SecondsToTimeSpanConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return TimeSpan.FromSeconds(System.Convert.ToDouble(value)); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml index e06d1f559..e5545ca61 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml @@ -2,13 +2,15 @@ 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:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" - mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:BlowerItem, IsDesignTimeCreatable=False}" Height="99.188" Width="163.459"> + mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:BlowerItem, IsDesignTimeCreatable=False}" Height="101.188" Width="352.459"> <UserControl.Resources> <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter> @@ -29,7 +31,65 @@ <!--Content--> <Grid> - <Image Source="../Images/blower-big.png"></Image> + <Viewbox Stretch="Uniform"> + <Border Width="352" Height="101" Background="#151515" CornerRadius="5" BorderThickness="1" BorderBrush="#434343" Padding="5"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="25"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <TextBlock FontFamily="digital-7" Text="Blower Controller" FontSize="16" Foreground="#7CC924" HorizontalAlignment="Left" Width="123"></TextBlock> + + <Grid Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="19*"/> + <ColumnDefinition Width="39*"/> + <ColumnDefinition Width="27*"/> + </Grid.ColumnDefinitions> + + <visuals:AnalogSwitch HorizontalAlignment="Left" Cursor="Hand" RenderTransformOrigin="0.5,0.5" IsChecked="{Binding IsActive,Mode=TwoWay}"> + <i:Interaction.Triggers> + <i:EventTrigger EventName="PreviewMouseUp"> + <i:InvokeCommandAction Command="{Binding ToggleActiveCommand}"></i:InvokeCommandAction> + </i:EventTrigger> + </i:Interaction.Triggers> + </visuals:AnalogSwitch> + + <Border Background="#202020" Margin="8" CornerRadius="3" Padding="5" Grid.Column="1"> + <Grid> + <mahapps:NumericUpDown Style="{x:Null}" InterceptMouseWheel="True" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Right" HideUpDownButtons="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HasDecimals="True" Minimum="0" Maximum="10000" Padding="0" Value="{Binding HardwareBlower.Voltage,FallbackValue='0.0',Mode=TwoWay}" VerticalAlignment="Center" FontSize="44" FontFamily="digital-7" Foreground="#FFD400" Margin="0 0 16 0"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"> + + </Style> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + <TextBlock ToolTip="Setting Value" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="9" Foreground="Gainsboro">MV</TextBlock> + </Grid> + </Border> + + <Button Style="{x:Null}" Grid.Column="2" Margin="8" Cursor="Hand" Command="{Binding SetCommand}"> + <Button.Template> + <ControlTemplate TargetType="Button"> + <Grid Background="#404040"> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="16" FontWeight="SemiBold">SET</TextBlock> + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="IsPressed" Value="True"> + <Setter Property="Opacity" Value="0.7"></Setter> + </Trigger> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Opacity" Value="0.5"></Setter> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Button.Template> + </Button> + </Grid> + </Grid> + </Border> + </Viewbox> <Border Margin="0 0 0 -23" VerticalAlignment="Bottom"> <TextBlock Text="{Binding HardwareBlowerType.Description}" FontSize="14" Foreground="DimGray" HorizontalAlignment="Center"></TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml index de604625d..999c03e78 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml @@ -8,8 +8,9 @@ xmlns:gauge="clr-namespace:Tango.CircularGauge;assembly=Tango.CircularGauge" xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" - mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:ControllerItem, IsDesignTimeCreatable=False}" Height="245.074" Width="321.75"> + mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:ControllerItem, IsDesignTimeCreatable=False}" Height="245.074" Width="500.75"> <UserControl.Resources> <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter> @@ -30,15 +31,17 @@ <!--Content--> <Grid ClipToBounds="False"> <Border> - <Viewbox> + <Viewbox Stretch="Uniform"> <Grid> <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*" /> - <ColumnDefinition Width="100" /> + <ColumnDefinition Width="269*" /> + <ColumnDefinition Width="240"/> + <ColumnDefinition Width="90" /> </Grid.ColumnDefinitions> <Grid> - <gauge:CircularGaugeControl + <Viewbox> + <gauge:CircularGaugeControl Margin="10" Radius="150" ScaleRadius="110" @@ -73,20 +76,62 @@ DialTextColor="Black" > - </gauge:CircularGaugeControl> + </gauge:CircularGaugeControl> + </Viewbox> </Grid> + <Grid Grid.Column="1" Margin="10 15"> + <Grid.RowDefinitions> + <RowDefinition Height="64*"/> + <RowDefinition Height="70*"/> + <RowDefinition Height="90*"/> + </Grid.RowDefinitions> + <Border Background="#202020" Margin="0 3 0 0" CornerRadius="3" Padding="5"> + <Grid> + <TextBlock Text="{Binding EffectiveValue,StringFormat=0.0,FallbackValue='0.0'}" Foreground="#FF6F78" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="44" FontFamily="digital-7" Margin="0 0 12 0"> + + </TextBlock> + <TextBlock HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="9" Foreground="Gainsboro">PV</TextBlock> + </Grid> + </Border> + + <Border Background="#202020" Grid.Row="1" Margin="0 10 0 0" CornerRadius="3" Padding="5"> + <Grid> + <mahapps:NumericUpDown Style="{x:Null}" InterceptMouseWheel="True" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Right" HideUpDownButtons="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" StringFormat="0.0" HasDecimals="True" Minimum="{Binding ElementName=fader,Path=Minimum}" Maximum="{Binding ElementName=fader,Path=Maximum}" Padding="0" Value="{Binding Value,Mode=TwoWay,StringFormat=0.0,FallbackValue=0.0}" VerticalAlignment="Center" FontSize="44" FontFamily="digital-7" Foreground="#FFD400" Margin="0 0 12 0"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"> + + </Style> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + <TextBlock HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="9" Foreground="Gainsboro">SV</TextBlock> + </Grid> + </Border> + + <Button Style="{x:Null}" Grid.Row="2" VerticalAlignment="Bottom" Height="60" Cursor="Hand" Command="{Binding SetCommand}"> + <Button.Template> + <ControlTemplate TargetType="Button"> + <Grid Background="#404040"> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="16" FontWeight="SemiBold">SET</TextBlock> + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="IsPressed" Value="True"> + <Setter Property="Opacity" Value="0.7"></Setter> + </Trigger> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Opacity" Value="0.5"></Setter> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Button.Template> + </Button> + </Grid> - <Grid Grid.Column="1" HorizontalAlignment="Right"> - <visuals:Fader x:Name="fader" FaderLightBrush="DodgerBlue" Margin="10" Minimum="{Binding TechController.Min}" Maximum="{Binding TechController.Max}" Value="{Binding Value,Delay=500}"> - - </visuals:Fader> - <TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="../Fonts/#digital-7" TextAlignment="Right" Margin="-80 10 0 0" FontSize="30" Text="{Binding ElementName=fader,Path=Value,StringFormat=0.0,FallbackValue=100}"> - <TextBlock.Foreground> - <SolidColorBrush Color="{Binding Color,FallbackValue=White}" /> - </TextBlock.Foreground> - </TextBlock> + <Grid Grid.Column="2" HorizontalAlignment="Right"> + <visuals:Fader x:Name="fader" FaderLightBrush="DodgerBlue" Margin="10" Minimum="{Binding TechController.Min}" Maximum="{Binding TechController.Max}" Value="{Binding Value,Mode=TwoWay}"> + + </visuals:Fader> </Grid> </Grid> </Viewbox> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml index 1fa1c6c48..630dddec7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml @@ -32,7 +32,7 @@ <Grid x:Key="gridDefault"> <Viewbox Stretch="Fill"> - <materialDesign:PackIcon Kind="Home" Margin="25 0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + <materialDesign:PackIcon Kind="Home" Margin="25 0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> </Viewbox> <Button Click="OnHomingStarted" Style="{StaticResource emptyButton}" Cursor="Hand" Background="Transparent" BorderThickness="0"></Button> @@ -45,205 +45,106 @@ <Grid> - <Grid Margin="5"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="20*"/> - <ColumnDefinition Width="100*"/> - <ColumnDefinition Width="20*"/> - </Grid.ColumnDefinitions> - - <Grid.RowDefinitions> - <RowDefinition Height="100*" /> - <RowDefinition Height="30*" /> - </Grid.RowDefinitions> + <Viewbox Stretch="Uniform"> + <Grid Margin="5" Width="400" Height="280"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="20*"/> + <ColumnDefinition Width="100*"/> + <ColumnDefinition Width="20*"/> + </Grid.ColumnDefinitions> - <Grid Grid.Column="1"> - <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="5"> - <Border.Background> - <ImageBrush ImageSource="../Images/black-screen.jpg" Opacity="0.1" /> - </Border.Background> + <Grid.RowDefinitions> + <RowDefinition Height="100*" /> + <RowDefinition Height="30*" /> + </Grid.RowDefinitions> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="63*"/> - <ColumnDefinition Width="88*"/> - </Grid.ColumnDefinitions> - <Image Source="../Images/dispenser-line.png" Grid.ColumnSpan="2" Stretch="Fill"></Image> + <Grid Grid.Column="1"> + <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="5" Background="#252525"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="63*"/> + <ColumnDefinition Width="88*"/> + </Grid.ColumnDefinitions> + <Image Source="../Images/dispenser-line.png" Grid.ColumnSpan="2" Stretch="Fill"></Image> - <Path RenderTransformOrigin="0.5,0.5" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" StrokeThickness="1" Stroke="#202020" Stretch="Uniform" Data="M728.4 312.2l-198.1-63.4c-0.5-5.9-1.6-11.6-3.4-17c8.4-2.8 17-5.9 25.7-9.2c78.8-29.7 124.3-63 135-98.8 c7.2-23.8-0.5-47.5-22.6-70.3c-17.5-18-56.2-44.9-57.8-46c-6.2-4.3-14.7-2.8-19.1 3.3L465.5 180.8c-3.2-0.4-6.4-0.6-9.6-0.6 c-2.2 0-4.5 0.1-6.7 0.3c-0.5-62.6-8.3-142.4-41.1-178.6c-12.7-14.1-28.3-21.2-46.1-21.2c0 0 0 0 0 0c-12.3 0-25.6 3.5-39.7 10.4 c-17.4 8.6-43.8 27.5-55.6 36.2c-3.5 2.6-5.7 4.2-6.1 4.5c-3.7 2.8-5.6 7.2-5.4 11.6c0.1 2.6 1 5.3 2.7 7.5l128.9 175.8 c-1.4 3.5-2.6 7.1-3.4 10.8c-42.1-13.7-94.9-27.4-138.4-27.4c-34.2 0-59.1 8.6-73.8 25.7c-13 15-17.7 35.8-14 61.7 c3.6 24.8 19.1 69.3 19.7 71.2c2 5.7 7.3 9.3 13 9.3c1.4 0 2.9-0.2 4.3-0.7L404 308.3c2.3 2.3 4.8 4.4 7.4 6.3 c-7.3 10-14.8 20.7-22.3 32c-46.3 70.4-63.5 124-51.1 159.3c8.2 23.5 28.3 38.2 59.6 43.6c16.2 2.8 41.8 3.4 60.4 3.4 c8.1 0 13.5-0.1 13.5-0.1c7.5-0.2 13.5-6.3 13.5-13.9L484 323.8c4.1-1.7 8.1-3.7 11.8-6.1c6.1 8.3 12.6 16.9 19.5 25.6 c52.2 65.4 97.5 98.6 134.8 98.6c17.6 0 42.4-7.5 61.3-43.3c11.7-22.2 25.4-67.3 25.9-69.2C739.5 322.2 735.5 314.5 728.4 312.2z M455.9 293c-21.1 0-38.3-17.1-38.3-38.3s17.1-38.3 38.3-38.3c21.1 0 38.3 17.1 38.3 38.3C494.2 275.9 477 293 455.9 293z"> - <Path.Fill> - <LinearGradientBrush> - <GradientStop Color="Black"/> - <GradientStop Color="{Binding Color}" Offset="0.8"/> - </LinearGradientBrush> - </Path.Fill> - <Path.RenderTransform> - <RotateTransform x:Name="propRotate" Angle="0" /> - </Path.RenderTransform> - </Path> - <!--<Image RenderTransformOrigin="0.5,0.5" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Source="../Images/prop.png" RenderOptions.BitmapScalingMode="Fant"> + <Path RenderTransformOrigin="0.5,0.5" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" StrokeThickness="1" Stroke="#202020" Stretch="Uniform" Data="M728.4 312.2l-198.1-63.4c-0.5-5.9-1.6-11.6-3.4-17c8.4-2.8 17-5.9 25.7-9.2c78.8-29.7 124.3-63 135-98.8 c7.2-23.8-0.5-47.5-22.6-70.3c-17.5-18-56.2-44.9-57.8-46c-6.2-4.3-14.7-2.8-19.1 3.3L465.5 180.8c-3.2-0.4-6.4-0.6-9.6-0.6 c-2.2 0-4.5 0.1-6.7 0.3c-0.5-62.6-8.3-142.4-41.1-178.6c-12.7-14.1-28.3-21.2-46.1-21.2c0 0 0 0 0 0c-12.3 0-25.6 3.5-39.7 10.4 c-17.4 8.6-43.8 27.5-55.6 36.2c-3.5 2.6-5.7 4.2-6.1 4.5c-3.7 2.8-5.6 7.2-5.4 11.6c0.1 2.6 1 5.3 2.7 7.5l128.9 175.8 c-1.4 3.5-2.6 7.1-3.4 10.8c-42.1-13.7-94.9-27.4-138.4-27.4c-34.2 0-59.1 8.6-73.8 25.7c-13 15-17.7 35.8-14 61.7 c3.6 24.8 19.1 69.3 19.7 71.2c2 5.7 7.3 9.3 13 9.3c1.4 0 2.9-0.2 4.3-0.7L404 308.3c2.3 2.3 4.8 4.4 7.4 6.3 c-7.3 10-14.8 20.7-22.3 32c-46.3 70.4-63.5 124-51.1 159.3c8.2 23.5 28.3 38.2 59.6 43.6c16.2 2.8 41.8 3.4 60.4 3.4 c8.1 0 13.5-0.1 13.5-0.1c7.5-0.2 13.5-6.3 13.5-13.9L484 323.8c4.1-1.7 8.1-3.7 11.8-6.1c6.1 8.3 12.6 16.9 19.5 25.6 c52.2 65.4 97.5 98.6 134.8 98.6c17.6 0 42.4-7.5 61.3-43.3c11.7-22.2 25.4-67.3 25.9-69.2C739.5 322.2 735.5 314.5 728.4 312.2z M455.9 293c-21.1 0-38.3-17.1-38.3-38.3s17.1-38.3 38.3-38.3c21.1 0 38.3 17.1 38.3 38.3C494.2 275.9 477 293 455.9 293z"> + <Path.Fill> + <LinearGradientBrush> + <GradientStop Color="Black"/> + <GradientStop Color="{Binding Color}" Offset="0.8"/> + </LinearGradientBrush> + </Path.Fill> + <Path.RenderTransform> + <RotateTransform x:Name="propRotate" Angle="0" /> + </Path.RenderTransform> + </Path> + <!--<Image RenderTransformOrigin="0.5,0.5" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Source="../Images/prop.png" RenderOptions.BitmapScalingMode="Fant"> <Image.RenderTransform> <RotateTransform x:Name="propRotate" Angle="0" /> </Image.RenderTransform> </Image>--> - - </Grid> - </Border> - <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -40 -80"> - <mahapps:NumericUpDown BorderThickness="0" Background="Transparent" HideUpDownButtons="True" HasDecimals="False" Minimum="0" Maximum="5000" StringFormat="0" Value="{Binding Speed,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=0,FallbackValue=5000}" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontSize="12" VerticalAlignment="Center" Foreground="Black" Margin="0 -10 0 0"></mahapps:NumericUpDown> - <visuals:Knob Width="50" Height="50" TicksHighlightBrush="Black" TicksWidth="2" Margin="0 5 0 0" TicksHeight="5" Minimum="0" Maximum="5000" Value="{Binding Speed,Mode=TwoWay}" /> - </StackPanel> - </Grid> - - <Grid> - <Border BorderBrush="Gray" Cursor="Hand" 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="#AAAAAA" 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> + </Grid> + </Border> + </Grid> - <Viewbox Stretch="Fill" Margin="-10 20"> - <materialDesign:PackIcon Kind="ChevronLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> - </Viewbox> - </Border> - </Grid> + <Grid> + <Border BorderBrush="Gray" Cursor="Hand" BorderThickness="1 1 0 1" Margin="0 10" CornerRadius="5 0 0 5" PreviewMouseDown="OnBackwardPressed" PreviewMouseUp="OnBackwardReleased" Style="{StaticResource TechWidgetBorderLeft}"> + <Viewbox Stretch="Fill" Margin="-10 20"> + <materialDesign:PackIcon Kind="ChevronLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> + </Viewbox> + </Border> + </Grid> - <Grid Grid.Column="2"> - <Border BorderBrush="Gray" Cursor="Hand" 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="#AAAAAA" 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> + <Grid Grid.Column="2"> + <Border BorderBrush="Gray" Cursor="Hand" BorderThickness="0 1 1 1" Margin="0 10" CornerRadius="0 10 10 0" PreviewMouseDown="OnForwardPressed" PreviewMouseUp="OnForwardReleased" Style="{StaticResource TechWidgetBorderRight}"> + <Viewbox Stretch="Fill" Margin="-10 20"> + <materialDesign:PackIcon Kind="ChevronRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> + </Viewbox> + </Border> + </Grid> - <Viewbox Stretch="Fill" Margin="-10 20"> - <materialDesign:PackIcon Kind="ChevronRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> - </Viewbox> - </Border> - </Grid> + <Grid Grid.Column="1" Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="20*"/> + <ColumnDefinition Width="115*"/> + <ColumnDefinition Width="20*"/> + </Grid.ColumnDefinitions> - <Grid Grid.Column="1" Grid.Row="1"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="20*"/> - <ColumnDefinition Width="115*"/> - <ColumnDefinition Width="20*"/> - </Grid.ColumnDefinitions> + <Grid Grid.Column="1"> + <Border BorderBrush="Gray" BorderThickness="1 0 1 1" CornerRadius="0 0 20 20" Style="{StaticResource TechWidgetBorderCenter}"> + <Grid> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content" Value="{StaticResource gridDefault}"> - <Grid Grid.Column="1"> - <Border BorderBrush="Gray" BorderThickness="1 0 1 1" CornerRadius="0 0 20 20"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="Background"> - <Setter.Value> - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> - <GradientStop Color="#979797" 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> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsHoming}" Value="True"> + <Setter Property="Content" Value="{StaticResource gridHoming}"> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> - <Grid> - <ContentControl> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="Content" Value="{StaticResource gridDefault}"> + </ContentControl> + </Grid> + </Border> + </Grid> + </Grid> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsHoming}" Value="True"> - <Setter Property="Content" Value="{StaticResource gridHoming}"> - </Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> - </Grid> - </Border> - </Grid> </Grid> + </Viewbox> - - </Grid> + <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -65 5"> + <Border Background="#202020" CornerRadius="3" Padding="3"> + <mahapps:NumericUpDown BorderThickness="0" Background="Transparent" HideUpDownButtons="True" HasDecimals="False" Minimum="0" Maximum="5000" StringFormat="0" Value="{Binding Speed,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=0,FallbackValue=5000}" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontSize="22" VerticalAlignment="Center" Foreground="#FF8585" FontFamily="digital-7"></mahapps:NumericUpDown> + </Border> + <visuals:Knob Width="50" Height="50" TicksHighlightBrush="#FF8585" KnobType="MetroDark" TicksWidth="2" Margin="0 5 0 0" TicksHeight="5" Minimum="0" Maximum="5000" Value="{Binding Speed,Mode=TwoWay}" /> + </StackPanel> <!--Content--> <Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml new file mode 100644 index 000000000..3ffeaaa77 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml @@ -0,0 +1,236 @@ +<local:ElementEditor x:Class="Tango.MachineStudio.Technician.Editors.HeaterElementEditor" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" + xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" + xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" + mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:HeaterItem, IsDesignTimeCreatable=False}" Height="284.188" Width="243.459"> + + <UserControl.Resources> + <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> + + <!--Theme--> + <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush> + <SolidColorBrush x:Key="CornersBrush" Color="Red"></SolidColorBrush> + </UserControl.Resources> + + <UserControl.RenderTransform> + <RotateTransform Angle="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=Angle}"></RotateTransform> + </UserControl.RenderTransform> + + <Grid> + + + <!--Content--> + <Grid> + + <Viewbox> + <Border CornerRadius="5" Background="#151515" BorderBrush="#3B3B3B" BorderThickness="1" Padding="15"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="16"/> + <RowDefinition Height="74"/> + <RowDefinition Height="63"/> + <RowDefinition Height="37"/> + <RowDefinition/> + </Grid.RowDefinitions> + + <Grid> + <TextBlock FontFamily="digital-7" Text="Heater Controller" FontSize="16" Foreground="#7CC924" HorizontalAlignment="Left" Width="123"></TextBlock> + <TextBlock HorizontalAlignment="Right" Text="TEMPERATURE" FontSize="9" VerticalAlignment="Bottom" Foreground="Gainsboro" Height="12" Width="58"></TextBlock> + </Grid> + + <Grid Grid.Row="1"> + <Border Background="#202020" Margin="0 3 0 0" CornerRadius="3" Padding="5"> + <Grid> + <TextBlock Text="{Binding HeaterState.CurrentValue,StringFormat=0.0,FallbackValue='0.0'}" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="80" FontFamily="digital-7" Margin="0 0 12 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Foreground" Value="#FF6F78"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HeaterState.IsInSetPoint}" Value="True"> + <Setter Property="Foreground" Value="#7CC924"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + <TextBlock ToolTip="Process Value" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="9" Foreground="Gainsboro">PV</TextBlock> + </Grid> + </Border> + </Grid> + + <Grid Grid.Row="2" Margin="0 5 0 0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="49"/> + <ColumnDefinition Width="162"/> + </Grid.ColumnDefinitions> + + <Image Source="../Images/temperature.png" Margin="0 10 20 10" RenderOptions.BitmapScalingMode="Fant"></Image> + + <Border Background="#202020" Margin="0 3 0 0" CornerRadius="3" Padding="5" Grid.Column="1"> + <Grid> + <mahapps:NumericUpDown Style="{x:Null}" InterceptMouseWheel="True" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Right" HideUpDownButtons="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HasDecimals="True" Minimum="0" Maximum="400" Padding="0" Value="{Binding SetPoint,FallbackValue='0.0',Mode=TwoWay}" VerticalAlignment="Center" FontSize="44" FontFamily="digital-7" Foreground="#FFD400" Margin="0 0 12 0"> + <mahapps:NumericUpDown.Resources> + <Style TargetType="TextBox"> + + </Style> + </mahapps:NumericUpDown.Resources> + </mahapps:NumericUpDown> + <TextBlock ToolTip="Setting Value" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="9" Foreground="Gainsboro">SV</TextBlock> + </Grid> + </Border> + </Grid> + + <Grid Grid.Row="3" Margin="0 5 0 0"> + <StackPanel Orientation="Horizontal" TextElement.Foreground="Gray" TextElement.FontSize="9"> + <StackPanel> + <TextBlock>ACTIVE</TextBlock> + <Ellipse Width="12" Height="12" Margin="0 4 0 0" Fill="#FF6262" Stroke="#526744"> + <Ellipse.Style> + <Style TargetType="Ellipse"> + <Setter Property="Opacity" Value="0.2"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HeaterState.IsActive}" Value="True"> + <Setter Property="Opacity" Value="1"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Ellipse.Style> + </Ellipse> + </StackPanel> + + <StackPanel Margin="10 0 0 0"> + <TextBlock>RAMP UP</TextBlock> + <Ellipse Width="12" Height="12" Margin="0 4 0 0" Fill="#FF8608" Stroke="#526744"> + <Ellipse.Style> + <Style TargetType="Ellipse"> + <Setter Property="Opacity" Value="0.2"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HeaterState.IsRampingUp}" Value="True"> + <Setter Property="Opacity" Value="1"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Ellipse.Style> + </Ellipse> + </StackPanel> + + <StackPanel Margin="10 0 0 0"> + <TextBlock>IN POINT</TextBlock> + <Ellipse Width="12" Height="12" Margin="0 4 0 0" Fill="#00C600" Stroke="#526744"> + <Ellipse.Style> + <Style TargetType="Ellipse"> + <Setter Property="Opacity" Value="0.2"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HeaterState.IsInSetPoint}" Value="True"> + <Setter Property="Opacity" Value="1"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Ellipse.Style> + </Ellipse> + </StackPanel> + </StackPanel> + </Grid> + + <Grid Grid.Row="4"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="36"/> + <ColumnDefinition Width="175"/> + </Grid.ColumnDefinitions> + + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="16" FontWeight="SemiBold">ITC</TextBlock> + + <Grid Grid.Column="1"> + <Button Style="{x:Null}" Width="60" Height="60" HorizontalAlignment="Right" Cursor="Hand" Command="{Binding SetCommand}"> + <Button.Template> + <ControlTemplate TargetType="Button"> + <Grid> + <Ellipse Stroke="#7C7C7C" Fill="#383838"></Ellipse> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="16" FontWeight="SemiBold">SET</TextBlock> + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="IsPressed" Value="True"> + <Setter Property="Opacity" Value="0.7"></Setter> + </Trigger> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Opacity" Value="0.5"></Setter> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Button.Template> + </Button> + </Grid> + </Grid> + </Grid> + </Border> + </Viewbox> + + <Border Margin="0 0 0 -23" VerticalAlignment="Bottom"> + <TextBlock Text="{Binding TechHeater.Description}" FontSize="14" Foreground="DimGray" HorizontalAlignment="Center"></TextBlock> + </Border> + </Grid> + <!--Content--> + + + <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" /> + <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" /> + </MultiDataTrigger.Conditions> + + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Grid> + <ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter> + + <Thumb Opacity="0" DragDelta="MoveDrag" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb HorizontalAlignment="Left" Cursor="SizeWE" Opacity="0" DragDelta="DragLeft" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb HorizontalAlignment="Right" Cursor="SizeWE" Opacity="0" DragDelta="DragRight" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb VerticalAlignment="Top" Cursor="SizeNS" Opacity="0" DragDelta="DragTop" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb VerticalAlignment="Bottom" Cursor="SizeNS" Opacity="0" DragDelta="DragBottom" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + + <Grid ClipToBounds="False" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 -20 0 0" Width="10" Height="10"> + <Ellipse Stroke="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" StrokeThickness="2"></Ellipse> + <Rectangle HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="0 10 0 -8" StrokeThickness="1" Stroke="Red"></Rectangle> + <Thumb Opacity="0" DragDelta="DragAngle" DragStarted="DragStarted" Cursor="Arrow" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-8 -8 0 0"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 2 0 0"></Border> + <Thumb Opacity="0" DragDelta="DragTopLeft" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 -8 -8 0"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 2 2 0"></Border> + <Thumb Opacity="0" DragDelta="DragTopRight" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -8 -8"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 0 2 2"></Border> + <Thumb Opacity="0" DragDelta="DragBottomRight" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="-8 0 0 -8"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 0 0 2"></Border> + <Thumb Opacity="0" DragDelta="DragBottomLeft" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb> + </Grid> + </Grid> + </Border> + </Grid> +</local:ElementEditor> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs new file mode 100644 index 000000000..37d0defe5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.BL.Entities; +using Tango.MachineStudio.Technician.TechItems; +using Tango.Core; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class HeaterElementEditor : ElementEditor + { + /// <summary> + /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class. + /// </summary> + public HeaterElementEditor() + : base() + { + InitializeComponent(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class. + /// </summary> + /// <param name="frameworkElement">The framework element.</param> + public HeaterElementEditor(HeaterItem heaterItem) + : this() + { + HeaterItem = heaterItem; + DataContext = HeaterItem; + } + + /// <summary> + /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class. + /// </summary> + /// <param name="frameworkElement">The framework element.</param> + /// <param name="bounds">The bounds.</param> + public HeaterElementEditor(HeaterItem heaterItem, Rect bounds) + : this(heaterItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private HeaterItem _heaterItem; + /// <summary> + /// Gets or sets the heater item. + /// </summary> + public HeaterItem HeaterItem + { + get { return _heaterItem; } + set { _heaterItem = value; RaisePropertyChanged(nameof(HeaterItem)); } + } + + + /// <summary> + /// Clones this instance. + /// </summary> + /// <returns></returns> + public override IElementEditor Clone() + { + try + { + var clonedItem = HeaterItem.Clone() as HeaterItem; + HeaterElementEditor cloned = new HeaterElementEditor(clonedItem); + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// <summary> + /// Gets the hosted element. + /// </summary> + [ParameterIgnore] + public override Object HostedElement + { + get { return HeaterItem; } + } + + private void Ellipse_GiveFeedback(object sender, GiveFeedbackEventArgs e) + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml new file mode 100644 index 000000000..ce9675103 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml @@ -0,0 +1,167 @@ +<local:ElementEditor x:Class="Tango.MachineStudio.Technician.Editors.MonitorRecorderElementEditor" + 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:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" + xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" + xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" + mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:MonitorRecorderItem, IsDesignTimeCreatable=False}" Height="113.188" Width="365.459"> + + <UserControl.Resources> + <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> + + <!--Theme--> + <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush> + <SolidColorBrush x:Key="CornersBrush" Color="Red"></SolidColorBrush> + </UserControl.Resources> + + <UserControl.RenderTransform> + <RotateTransform Angle="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=Angle}"></RotateTransform> + </UserControl.RenderTransform> + + <Grid> + + + <!--Content--> + <Grid> + <Viewbox Stretch="Uniform"> + <Border CornerRadius="5" Background="#151515" BorderThickness="1" BorderBrush="DimGray" Padding="5" Height="113.188" Width="365.459"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="27*"/> + <RowDefinition Height="47*"/> + <RowDefinition Height="27"/> + </Grid.RowDefinitions> + + <TextBlock Text="CSV RECORDER" Foreground="#FF8585" FontFamily="digital-7" FontSize="18" VerticalAlignment="Center" Margin="0,6,0,3" Height="18"></TextBlock> + + <DockPanel Grid.Row="1"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="47*"/> + <ColumnDefinition Width="48*"/> + </Grid.ColumnDefinitions> + + <StackPanel Orientation="Horizontal"> + <Button Command="{Binding ToggleRecordingCommand}" IsEnabled="{Binding IsRecording,Converter={StaticResource BooleanInverseConverter}}" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Height="Auto" VerticalAlignment="Center"> + <materialDesign:PackIcon Kind="Record" Width="48" Height="48" Foreground="#FF6767" /> + </Button> + <Button Command="{Binding TogglePauseCommand}" IsEnabled="{Binding IsRecording}" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Height="Auto" VerticalAlignment="Center"> + <materialDesign:PackIcon Width="48" Height="48" Foreground="Gainsboro"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Kind" Value="Pause"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsPaused}" Value="True"> + <Setter Property="Kind" Value="Play"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </Button> + <Button Command="{Binding ToggleRecordingCommand}" IsEnabled="{Binding IsRecording}" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Height="Auto" VerticalAlignment="Center"> + <materialDesign:PackIcon Kind="Stop" Width="48" Height="48" Foreground="#FFE9A0" /> + </Button> + </StackPanel> + </Grid> + + <Grid> + <TextBlock HorizontalAlignment="Center" Foreground="#FF6767" VerticalAlignment="Center" FontFamily="digital-7" FontSize="40" Text="{Binding RecordingTime,StringFormat=hh\\:mm\\:ss,TargetNullValue='00:00:00',FallbackValue='00:00:00'}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Opacity" Value="1"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsRecording}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard Name="blink"> + <Storyboard> + <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="Opacity" FillBehavior="Stop"> + <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" /> + <DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="1" /> + <DiscreteDoubleKeyFrame KeyTime="00:00:1" Value="1" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <RemoveStoryboard BeginStoryboardName="blink" /> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </Grid> + </DockPanel> + + <TextBlock Grid.Row="2" Foreground="Gray" VerticalAlignment="Center" Height="16" Margin="0,2,0,9"> + <Run Text="{Binding Monitors.SynchedSource.Count,Mode=OneWay}"></Run> + <Run>selected monitors to record</Run> + </TextBlock> + </Grid> + </Border> + </Viewbox> + </Grid> + <!--Content--> + + + <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" /> + <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" /> + </MultiDataTrigger.Conditions> + + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Grid> + <ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter> + + <Thumb Opacity="0" DragDelta="MoveDrag" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb HorizontalAlignment="Left" Cursor="SizeWE" Opacity="0" DragDelta="DragLeft" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb HorizontalAlignment="Right" Cursor="SizeWE" Opacity="0" DragDelta="DragRight" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb VerticalAlignment="Top" Cursor="SizeNS" Opacity="0" DragDelta="DragTop" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + <Thumb VerticalAlignment="Bottom" Cursor="SizeNS" Opacity="0" DragDelta="DragBottom" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb> + + <Grid ClipToBounds="False" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 -20 0 0" Width="10" Height="10"> + <Ellipse Stroke="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" StrokeThickness="2"></Ellipse> + <Rectangle HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="0 10 0 -8" StrokeThickness="1" Stroke="Red"></Rectangle> + <Thumb Opacity="0" DragDelta="DragAngle" DragStarted="DragStarted" Cursor="Arrow" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-8 -8 0 0"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 2 0 0"></Border> + <Thumb Opacity="0" DragDelta="DragTopLeft" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 -8 -8 0"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 2 2 0"></Border> + <Thumb Opacity="0" DragDelta="DragTopRight" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -8 -8"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 0 2 2"></Border> + <Thumb Opacity="0" DragDelta="DragBottomRight" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb> + </Grid> + + <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="-8 0 0 -8"> + <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 0 0 2"></Border> + <Thumb Opacity="0" DragDelta="DragBottomLeft" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb> + </Grid> + </Grid> + </Border> + </Grid> +</local:ElementEditor> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs new file mode 100644 index 000000000..213fa78e0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorRecorderElementEditor.xaml.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.BL.Entities; +using Tango.MachineStudio.Technician.TechItems; +using Tango.Core; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class MonitorRecorderElementEditor : ElementEditor + { + /// <summary> + /// Initializes a new instance of the <see cref="MonitorRecorderItem"/> class. + /// </summary> + public MonitorRecorderElementEditor() + : base() + { + InitializeComponent(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="MonitorRecorderItem"/> class. + /// </summary> + /// <param name="frameworkElement">The framework element.</param> + public MonitorRecorderElementEditor(MonitorRecorderItem monitorRecorderItem) + : this() + { + MonitorRecorderItem = monitorRecorderItem; + DataContext = MonitorRecorderItem; + } + + /// <summary> + /// Initializes a new instance of the <see cref="MonitorRecorderItem"/> class. + /// </summary> + /// <param name="frameworkElement">The framework element.</param> + /// <param name="bounds">The bounds.</param> + public MonitorRecorderElementEditor(MonitorRecorderItem monitorRecorderItem, Rect bounds) + : this(monitorRecorderItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private MonitorRecorderItem _monitorRecorderItem; + + public MonitorRecorderItem MonitorRecorderItem + { + get { return _monitorRecorderItem; } + set { _monitorRecorderItem = value; RaisePropertyChanged(nameof(MonitorRecorderItem)); } + } + + + /// <summary> + /// Clones this instance. + /// </summary> + /// <returns></returns> + public override IElementEditor Clone() + { + try + { + var clonedItem = MonitorRecorderItem.Clone() as MonitorRecorderItem; + MonitorRecorderElementEditor cloned = new MonitorRecorderElementEditor(clonedItem); + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// <summary> + /// Gets the hosted element. + /// </summary> + [ParameterIgnore] + public override Object HostedElement + { + get { return MonitorRecorderItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml index 80bfe8f96..25907fd8f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml @@ -34,7 +34,7 @@ <Grid x:Key="gridDefault"> <Viewbox Stretch="Fill"> - <materialDesign:PackIcon Kind="Home" Margin="25 0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + <materialDesign:PackIcon Kind="Home" Margin="25 0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> </Viewbox> <Button Click="OnHomingStarted" Style="{StaticResource emptyButton}" Background="Transparent" BorderThickness="0"></Button> @@ -47,192 +47,93 @@ <Grid> - <Grid Margin="5"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="20*"/> - <ColumnDefinition Width="100*"/> - <ColumnDefinition Width="20*"/> - </Grid.ColumnDefinitions> - - <Grid.RowDefinitions> - <RowDefinition Height="100*" /> - <RowDefinition Height="30*" /> - </Grid.RowDefinitions> - - <Grid Grid.Column="1"> - <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="5"> - <Border.Background> - <ImageBrush ImageSource="../Images/black-screen.jpg" Opacity="0.1" /> - </Border.Background> - - <Grid> - <Path RenderTransformOrigin="0.5,0.5" StrokeThickness="1" Stroke="#202020" Stretch="Uniform" Margin="10" Data="M500.633 211.454l-58.729-14.443c-3.53-11.133-8.071-21.929-13.55-32.256c8.818-14.678 27.349-45.571 27.349-45.571 c3.545-5.903 2.607-13.462-2.256-18.325l-42.422-42.422c-4.863-4.878-12.407-5.815-18.325-2.256L347.055 83.53 c-10.269-5.435-21.006-9.932-32.065-13.433l-14.443-58.729C298.876 4.688 292.885 0 286 0h-60 c-6.885 0-12.891 4.688-14.546 11.367c0 0-10.005 40.99-14.429 58.715c-11.792 3.735-23.188 8.584-34.043 14.502l-47.329-28.403 c-5.918-3.516-13.447-2.607-18.325 2.256l-42.422 42.422c-4.863 4.863-5.801 12.422-2.256 18.325l29.268 48.882 c-4.717 9.302-8.672 18.984-11.821 28.901l-58.729 14.487C4.688 213.124 0 219.115 0 226v60c0 6.885 4.688 12.891 11.367 14.546 l58.744 14.443c3.56 11.294 8.188 22.266 13.799 32.798l-26.191 43.652c-3.545 5.903-2.607 13.462 2.256 18.325l42.422 42.422 c4.849 4.849 12.407 5.771 18.325 2.256c0 0 29.37-17.607 43.755-26.221c10.415 5.552 21.313 10.137 32.549 13.696l14.429 58.715 C213.109 507.313 219.115 512 226 512h60c6.885 0 12.876-4.688 14.546-11.367l14.429-58.715 c11.558-3.662 22.69-8.394 33.281-14.136c14.78 8.862 44.443 26.66 44.443 26.66c5.903 3.53 13.462 2.622 18.325-2.256 l42.422-42.422c4.863-4.863 5.801-12.422 2.256-18.325l-26.968-44.927c5.317-10.093 9.727-20.654 13.169-31.523l58.729-14.443 C507.313 298.876 512 292.885 512 286v-60C512 219.115 507.313 213.124 500.633 211.454z M256 361c-57.891 0-105-47.109-105-105 s47.109-105 105-105s105 47.109 105 105S313.891 361 256 361z"> - <Path.Fill> - <LinearGradientBrush> - <GradientStop Color="Black"/> - <GradientStop Color="{Binding Color}" Offset="0.8"/> - </LinearGradientBrush> - </Path.Fill> - <Path.RenderTransform> - <RotateTransform x:Name="propRotate" Angle="0" /> - </Path.RenderTransform> - </Path> - - <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -40 -80"> - <mahapps:NumericUpDown BorderThickness="0" Background="Transparent" HideUpDownButtons="True" HasDecimals="False" Minimum="0" Maximum="5000" StringFormat="0" Value="{Binding Speed,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=0,FallbackValue=5000}" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontSize="12" VerticalAlignment="Center" Foreground="Black" Margin="0 -10 0 0"></mahapps:NumericUpDown> - <visuals:Knob Width="50" Height="50" TicksHighlightBrush="Black" TicksWidth="2" Margin="0 5 0 0" TicksHeight="5" Minimum="0" Maximum="5000" Value="{Binding Speed,Mode=TwoWay}" /> - </StackPanel> - </Grid> - </Border> - </Grid> - - <Grid> - <Border BorderBrush="Gray" 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="#AAAAAA" 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 20"> - <materialDesign:PackIcon Kind="ChevronLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> - </Viewbox> - </Border> - </Grid> - - <Grid Grid.Column="2"> - <Border BorderBrush="Gray" 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="#AAAAAA" 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 20"> - <materialDesign:PackIcon Kind="ChevronRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> - </Viewbox> - </Border> - </Grid> - - <Grid Grid.Column="1" Grid.Row="1" Visibility="{Binding HardwareMotorType.SupportsHoming,Converter={StaticResource BoolToVisibilityConverter}}"> + <Viewbox Stretch="Uniform"> + <Grid Margin="5" Width="400" Height="280"> <Grid.ColumnDefinitions> <ColumnDefinition Width="20*"/> - <ColumnDefinition Width="115*"/> + <ColumnDefinition Width="100*"/> <ColumnDefinition Width="20*"/> </Grid.ColumnDefinitions> - <Grid Grid.Column="1"> - <Border BorderBrush="Gray" BorderThickness="1 0 1 1" CornerRadius="0 0 20 20"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="Background"> - <Setter.Value> - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> - <GradientStop Color="#979797" 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> + <Grid.RowDefinitions> + <RowDefinition Height="100*" /> + <RowDefinition Height="30*" /> + </Grid.RowDefinitions> - <Grid> - <ContentControl> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="Content" Value="{StaticResource gridDefault}"> + <Grid Grid.Column="1"> + <Border BorderThickness="1" BorderBrush="#303030" CornerRadius="10" Background="#252525"> + <Grid Margin="20"> + <Path RenderTransformOrigin="0.5,0.5" StrokeThickness="1" Stroke="#202020" Stretch="Uniform" Margin="10" Data="M500.633 211.454l-58.729-14.443c-3.53-11.133-8.071-21.929-13.55-32.256c8.818-14.678 27.349-45.571 27.349-45.571 c3.545-5.903 2.607-13.462-2.256-18.325l-42.422-42.422c-4.863-4.878-12.407-5.815-18.325-2.256L347.055 83.53 c-10.269-5.435-21.006-9.932-32.065-13.433l-14.443-58.729C298.876 4.688 292.885 0 286 0h-60 c-6.885 0-12.891 4.688-14.546 11.367c0 0-10.005 40.99-14.429 58.715c-11.792 3.735-23.188 8.584-34.043 14.502l-47.329-28.403 c-5.918-3.516-13.447-2.607-18.325 2.256l-42.422 42.422c-4.863 4.863-5.801 12.422-2.256 18.325l29.268 48.882 c-4.717 9.302-8.672 18.984-11.821 28.901l-58.729 14.487C4.688 213.124 0 219.115 0 226v60c0 6.885 4.688 12.891 11.367 14.546 l58.744 14.443c3.56 11.294 8.188 22.266 13.799 32.798l-26.191 43.652c-3.545 5.903-2.607 13.462 2.256 18.325l42.422 42.422 c4.849 4.849 12.407 5.771 18.325 2.256c0 0 29.37-17.607 43.755-26.221c10.415 5.552 21.313 10.137 32.549 13.696l14.429 58.715 C213.109 507.313 219.115 512 226 512h60c6.885 0 12.876-4.688 14.546-11.367l14.429-58.715 c11.558-3.662 22.69-8.394 33.281-14.136c14.78 8.862 44.443 26.66 44.443 26.66c5.903 3.53 13.462 2.622 18.325-2.256 l42.422-42.422c4.863-4.863 5.801-12.422 2.256-18.325l-26.968-44.927c5.317-10.093 9.727-20.654 13.169-31.523l58.729-14.443 C507.313 298.876 512 292.885 512 286v-60C512 219.115 507.313 213.124 500.633 211.454z M256 361c-57.891 0-105-47.109-105-105 s47.109-105 105-105s105 47.109 105 105S313.891 361 256 361z"> + <Path.Fill> + <LinearGradientBrush> + <GradientStop Color="Black"/> + <GradientStop Color="{Binding Color}" Offset="0.8"/> + </LinearGradientBrush> + </Path.Fill> + <Path.RenderTransform> + <RotateTransform x:Name="propRotate" Angle="0" /> + </Path.RenderTransform> + </Path> + </Grid> + </Border> + </Grid> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsHoming}" Value="True"> - <Setter Property="Content" Value="{StaticResource gridHoming}"> - </Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> + <Grid> + <Border BorderBrush="Gray" BorderThickness="1 1 0 1" Margin="0 10" CornerRadius="5 0 0 5" PreviewMouseDown="OnBackwardPressed" PreviewMouseUp="OnBackwardReleased" Style="{StaticResource TechWidgetBorderLeft}"> + <Viewbox Stretch="Fill" Margin="-10 20"> + <materialDesign:PackIcon Kind="ChevronLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#E6E6E6" /> + </Viewbox> + </Border> + </Grid> - </ContentControl> - </Grid> + <Grid Grid.Column="2"> + <Border BorderBrush="Gray" BorderThickness="0 1 1 1" Margin="0 10" CornerRadius="0 10 10 0" PreviewMouseDown="OnForwardPressed" PreviewMouseUp="OnForwardReleased" Style="{StaticResource TechWidgetBorderRight}"> + <Viewbox Stretch="Fill" Margin="-10 20"> + <materialDesign:PackIcon Kind="ChevronRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> + </Viewbox> </Border> </Grid> + + <Grid Grid.Column="1" Grid.Row="1" Visibility="{Binding HardwareMotorType.SupportsHoming,Converter={StaticResource BoolToVisibilityConverter}}"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="20*"/> + <ColumnDefinition Width="115*"/> + <ColumnDefinition Width="20*"/> + </Grid.ColumnDefinitions> + + <Grid Grid.Column="1"> + <Border BorderBrush="Gray" BorderThickness="1 0 1 1" CornerRadius="0 0 20 20" Style="{StaticResource TechWidgetBorderCenter}"> + <Grid> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content" Value="{StaticResource gridDefault}"> + + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsHoming}" Value="True"> + <Setter Property="Content" Value="{StaticResource gridHoming}"> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + + </ContentControl> + </Grid> + </Border> + </Grid> + </Grid> + </Grid> + </Viewbox> - </Grid> + <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -65 5"> + <Border Background="#202020" CornerRadius="3" Padding="3"> + <mahapps:NumericUpDown BorderThickness="0" Background="Transparent" HideUpDownButtons="True" HasDecimals="False" Minimum="0" Maximum="5000" StringFormat="0" Value="{Binding Speed,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=0,FallbackValue=5000}" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontSize="22" VerticalAlignment="Center" Foreground="#FF8585" FontFamily="digital-7"></mahapps:NumericUpDown> + </Border> + <visuals:Knob Width="50" Height="50" TicksHighlightBrush="#FF8585" KnobType="MetroDark" TicksWidth="2" Margin="0 5 0 0" TicksHeight="5" Minimum="0" Maximum="5000" Value="{Binding Speed,Mode=TwoWay}" /> + </StackPanel> <!--Content--> <Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml index 3adee13d6..ac07f1390 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml @@ -34,7 +34,7 @@ <Grid x:Key="gridDefault"> <Viewbox Stretch="Fill"> - <materialDesign:PackIcon Kind="Home" Margin="25 0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + <materialDesign:PackIcon Kind="Home" Margin="25 0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> </Viewbox> <Button Click="OnHomingStarted" Style="{StaticResource emptyButton}" Background="Transparent" BorderThickness="0"></Button> @@ -47,178 +47,79 @@ <Grid> - <Grid Margin="5"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="20*"/> - <ColumnDefinition Width="100*"/> - <ColumnDefinition Width="20*"/> - </Grid.ColumnDefinitions> - - <Grid.RowDefinitions> - <RowDefinition Height="100*" /> - <RowDefinition Height="30*" /> - </Grid.RowDefinitions> - - <Grid Grid.Column="1"> - <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="5"> - <Border.Background> - <ImageBrush ImageSource="../Images/black-screen.jpg" Opacity="0.1" /> - </Border.Background> - - <Grid> - <Image x:Name="image" Margin="5" gif:ImageBehavior.AnimatedSource="../Images/motor-group.gif" RenderOptions.BitmapScalingMode="Fant" gif:ImageBehavior.AutoStart="False" gif:ImageBehavior.AnimateInDesignMode="True" gif:ImageBehavior.RepeatBehavior="Forever"></Image> - </Grid> - </Border> - </Grid> - - <Grid> - <Border BorderBrush="Gray" 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="#AAAAAA" 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 20"> - <materialDesign:PackIcon Kind="ChevronLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> - </Viewbox> - </Border> - </Grid> - - <Grid Grid.Column="2"> - <Border BorderBrush="Gray" 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="#AAAAAA" 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 20"> - <materialDesign:PackIcon Kind="ChevronRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> - </Viewbox> - </Border> - </Grid> - - <Grid Grid.Column="1" Grid.Row="1"> + <Viewbox Stretch="Uniform"> + <Grid Margin="5" Width="400" Height="280"> <Grid.ColumnDefinitions> <ColumnDefinition Width="20*"/> - <ColumnDefinition Width="115*"/> + <ColumnDefinition Width="100*"/> <ColumnDefinition Width="20*"/> </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="100*" /> + <RowDefinition Height="30*" /> + </Grid.RowDefinitions> + <Grid Grid.Column="1"> - <Border BorderBrush="Gray" BorderThickness="1 0 1 1" CornerRadius="0 0 20 20"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="Background"> - <Setter.Value> - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> - <GradientStop Color="#979797" 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> + <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="5" Background="#252525"> - <Grid> - <ContentControl> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="Content" Value="{StaticResource gridDefault}"> + <Grid Margin="40"> + <Image x:Name="image" Margin="5" gif:ImageBehavior.AnimatedSource="../Images/motor-group.gif" RenderOptions.BitmapScalingMode="Fant" gif:ImageBehavior.AutoStart="False" gif:ImageBehavior.AnimateInDesignMode="True" gif:ImageBehavior.RepeatBehavior="Forever"></Image> + </Grid> + </Border> + </Grid> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsHoming}" Value="True"> - <Setter Property="Content" Value="{StaticResource gridHoming}"> - </Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> + <Grid> + <Border BorderBrush="Gray" BorderThickness="1 1 0 1" Margin="0 10" CornerRadius="5 0 0 5" PreviewMouseDown="OnBackwardPressed" PreviewMouseUp="OnBackwardReleased" Style="{StaticResource TechWidgetBorderLeft}"> + <Viewbox Stretch="Fill" Margin="-10 20"> + <materialDesign:PackIcon Kind="ChevronLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> + </Viewbox> + </Border> + </Grid> - </ContentControl> - </Grid> + <Grid Grid.Column="2"> + <Border BorderBrush="Gray" BorderThickness="0 1 1 1" Margin="0 10" CornerRadius="0 10 10 0" PreviewMouseDown="OnForwardPressed" PreviewMouseUp="OnForwardReleased" Style="{StaticResource TechWidgetBorderRight}"> + <Viewbox Stretch="Fill" Margin="-10 20"> + <materialDesign:PackIcon Kind="ChevronRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> + </Viewbox> </Border> </Grid> - </Grid> + <Grid Grid.Column="1" Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="20*"/> + <ColumnDefinition Width="115*"/> + <ColumnDefinition Width="20*"/> + </Grid.ColumnDefinitions> - </Grid> + <Grid Grid.Column="1"> + <Border BorderBrush="Gray" BorderThickness="1 0 1 1" CornerRadius="0 0 20 20" Style="{StaticResource TechWidgetBorderCenter}"> + + <Grid> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content" Value="{StaticResource gridDefault}"> + + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsHoming}" Value="True"> + <Setter Property="Content" Value="{StaticResource gridHoming}"> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + + </ContentControl> + </Grid> + </Border> + </Grid> + </Grid> + + + </Grid> + </Viewbox> <!--Content--> <Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/TextElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/TextElementEditor.xaml index 33b0645ab..2d6c61c5e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/TextElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/TextElementEditor.xaml @@ -28,7 +28,7 @@ <!--Content--> <Grid> - <Viewbox Stretch="Fill"> + <Viewbox Stretch="Uniform"> <TextBox PreviewKeyDown="TextBox_PreviewKeyDown" Style="{x:Null}" BorderThickness="0" Background="Transparent" Text="{Binding Text,UpdateSourceTrigger=PropertyChanged}" CaretBrush="Transparent"> <TextBox.Foreground> <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml index 6e2315dc8..51de5dc95 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml @@ -56,9 +56,6 @@ <Grid Grid.Column="1"> <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="5"> - <Border.Background> - <ImageBrush ImageSource="../Images/black-screen.jpg" Opacity="0.1" /> - </Border.Background> <Grid> <Image x:Name="image" Margin="5" gif:ImageBehavior.AnimatedSource="../Images/cogs-small.gif" RenderOptions.BitmapScalingMode="Fant" gif:ImageBehavior.AutoStart="False" gif:ImageBehavior.AnimateInDesignMode="True" gif:ImageBehavior.RepeatBehavior="Forever"></Image> @@ -67,83 +64,19 @@ </Grid> <Grid> - <Border BorderBrush="Gray" 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="#AAAAAA" 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> + <Border BorderBrush="Gray" BorderThickness="1 1 0 1" Margin="0 10" CornerRadius="5 0 0 5" PreviewMouseDown="OnBackwardPressed" PreviewMouseUp="OnBackwardReleased" Style="{StaticResource TechWidgetBorderLeft}"> <Viewbox Stretch="Fill" Margin="-5 20"> - <materialDesign:PackIcon Kind="ChevronDoubleLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + <materialDesign:PackIcon Kind="ChevronDoubleLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> </Viewbox> </Border> </Grid> <Grid Grid.Column="2"> - <Border BorderBrush="Gray" 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="#AAAAAA" 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> + <Border BorderBrush="Gray" BorderThickness="0 1 1 1" Margin="0 10" CornerRadius="0 10 10 0" PreviewMouseDown="OnForwardPressed" PreviewMouseUp="OnForwardReleased" Style="{StaticResource TechWidgetBorderRight}"> <Viewbox Stretch="Fill" Margin="-5 20"> - <materialDesign:PackIcon Kind="ChevronDoubleRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + <materialDesign:PackIcon Kind="ChevronDoubleRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="Gainsboro" /> </Viewbox> </Border> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png Binary files differnew file mode 100644 index 000000000..5f03ac6bd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/csv.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/heater-controller.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/heater-controller.png Binary files differnew file mode 100644 index 000000000..71d6698ec --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/heater-controller.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/temperature.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/temperature.png Binary files differnew file mode 100644 index 000000000..0bd30c002 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/temperature.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs index e9471fa74..ad3ea1352 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/MultiTechRecordingData.cs @@ -11,11 +11,11 @@ using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Models { - public class MultiTechRecordingData<T> : TechRecordingData<T, MultiTechRecordingValue> where T : TechItem + public class MultiTechRecordingData : TechRecordingData<MultiTechRecordingValue> { public int ChannelCount { get; set; } - public MultiTechRecordingData(T techItem, int channel_count) : base(techItem) + public MultiTechRecordingData(String name, int channel_count, String fileName) : base(name, fileName) { ChannelCount = channel_count; Init(); @@ -54,7 +54,7 @@ namespace Tango.MachineStudio.Technician.Models protected override List<string> GetColumnNames() { - return Enumerable.Range(1, ChannelCount).Select(x => TechItem.TechName + " " + x).ToList(); + return Enumerable.Range(1, ChannelCount).Select(x => Name + " " + x).ToList(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs index 7aa9a2b3f..8b480bbf3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/SingleTechRecordingData.cs @@ -7,9 +7,9 @@ using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Models { - public class SingleTechRecordingData<T> : TechRecordingData<T, SingleTechRecordingValue> where T : TechItem + public class SingleTechRecordingData : TechRecordingData<SingleTechRecordingValue> { - public SingleTechRecordingData(T techItem) : base(techItem) + public SingleTechRecordingData(String name, String fileName) : base(name, fileName) { Init(); } @@ -35,7 +35,7 @@ namespace Tango.MachineStudio.Technician.Models protected override List<string> GetColumnNames() { - return new List<string>() { TechItem.TechName }; + return new List<string>() { Name }; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs index 8024a1375..7b6439dbf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Models/TechRecordingData.cs @@ -11,7 +11,7 @@ using Tango.MachineStudio.Technician.TechItems; namespace Tango.MachineStudio.Technician.Models { - public abstract class TechRecordingData<T, TValue> : ExtendedObject, IDisposable where T : TechItem where TValue : TechRecordingValue + public abstract class TechRecordingData<TValue> : ExtendedObject, IDisposable where TValue : TechRecordingValue { protected bool _initialized; @@ -20,16 +20,18 @@ namespace Tango.MachineStudio.Technician.Models public CsvFile<TValue> CsvFile { get; set; } - public TemporaryFile TemporaryFile { get; set; } + public String File { get; set; } - public T TechItem { get; set; } + public String Name { get; set; } - public TechRecordingData(T techItem) + public Object Tag { get; set; } + + public TechRecordingData(String name, String fileName) { + File = fileName; _start_time = DateTime.Now; _last_time = DateTime.Now; - TechItem = techItem; - TemporaryFile = TemporaryManager.CreateFile(".csv"); + Name = name; } protected void Init() @@ -37,20 +39,13 @@ namespace Tango.MachineStudio.Technician.Models CsvDefinition definition = new CsvDefinition(); definition.Columns = new List<String>() { "Time" }.Concat(GetColumnNames()); - CsvFile = new CsvFile<TValue>(new CsvDestination(TemporaryFile), definition); + CsvFile = new CsvFile<TValue>(new CsvDestination(File), definition); _initialized = true; } - public void Save(String fileName) - { - CsvFile.Dispose(); - File.Copy(TemporaryFile.Path, fileName, true); - } - public void Dispose() { CsvFile.Dispose(); - TemporaryFile.Delete(); } protected abstract List<String> GetColumnNames(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProject.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProject.cs index 700e04f7d..2e7ba6cf7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProject.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProject.cs @@ -10,11 +10,18 @@ namespace Tango.MachineStudio.Technician.Project { public class MachineTechViewProject { + +#warning This is legacy and should be removed public List<TechItem> Items { get; set; } + public List<MachineTechViewProjectTab> Tabs { get; set; } + + public int SelectedTabIndex { get; set; } + public MachineTechViewProject() { Items = new List<TechItem>(); + Tabs = new List<MachineTechViewProjectTab>(); } public void Save(String fileName) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProjectTab.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProjectTab.cs new file mode 100644 index 000000000..c86e1ae55 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Project/MachineTechViewProjectTab.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Technician.TechItems; + +namespace Tango.MachineStudio.Technician.Project +{ + public class MachineTechViewProjectTab + { + public String Name { get; set; } + public List<TechItem> Items { get; set; } + + public MachineTechViewProjectTab() + { + Items = new List<TechItem>(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml new file mode 100644 index 000000000..416428a0e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml @@ -0,0 +1,35 @@ +<UserControl x:Class="Tango.MachineStudio.Technician.PropertiesTemplates.HeaterTemplate" + 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:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" + xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" + mc:Ignorable="d" + d:DesignHeight="500" d:DesignWidth="200" d:DataContext="{d:DesignInstance Type=items:HeaterItem, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <sharedConverters:DoubleToIntConverter x:Key="DoubleToIntConverter" /> + + <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="mahApps:ControlsHelper.HeaderFontSize" Value="14" /> + <Setter Property="Margin" Value="2" /> + </Style> + </UserControl.Resources> + + <Grid> + <StackPanel> + <GroupBox Header="BLOWER"> + <StackPanel> + <TextBlock FontSize="10">Selected Heater</TextBlock> + <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechHeaters}" SelectedItem="{Binding TechHeater,Mode=TwoWay}" DisplayMemberPath="Description" /> + </StackPanel> + </GroupBox> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml.cs new file mode 100644 index 000000000..011c41ddc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/HeaterTemplate.xaml.cs @@ -0,0 +1,28 @@ +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; + +namespace Tango.MachineStudio.Technician.PropertiesTemplates +{ + /// <summary> + /// Interaction logic for MonitorTemplate.xaml + /// </summary> + public partial class HeaterTemplate : UserControl + { + public HeaterTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml new file mode 100644 index 000000000..023191656 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml @@ -0,0 +1,42 @@ +<UserControl x:Class="Tango.MachineStudio.Technician.PropertiesTemplates.MonitorRecorderTemplate" + 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:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" + xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" + mc:Ignorable="d" + d:DesignHeight="500" d:DesignWidth="200" d:DataContext="{d:DesignInstance Type=items:MonitorRecorderItem, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <sharedConverters:DoubleToIntConverter x:Key="DoubleToIntConverter" /> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> + + <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="mahApps:ControlsHelper.HeaderFontSize" Value="14" /> + <Setter Property="Margin" Value="2" /> + </Style> + </UserControl.Resources> + + <Grid> + <StackPanel> + <GroupBox Header="Selected Monitors" IsEnabled="{Binding IsRecording,Converter={StaticResource BooleanInverseConverter}}"> + <ItemsControl ItemsSource="{Binding Monitors}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <CheckBox IsChecked="{Binding IsSelected}" VerticalAlignment="Center" /> + <TextBlock Text="{Binding Data.Description}" VerticalAlignment="Center"></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </GroupBox> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml.cs new file mode 100644 index 000000000..011e108cb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorRecorderTemplate.xaml.cs @@ -0,0 +1,28 @@ +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; + +namespace Tango.MachineStudio.Technician.PropertiesTemplates +{ + /// <summary> + /// Interaction logic for MonitorTemplate.xaml + /// </summary> + public partial class MonitorRecorderTemplate : UserControl + { + public MonitorRecorderTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 73039bc4b..d937ca15b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -52,6 +52,15 @@ <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> </Reference> + <Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.0\lib\Microsoft.WindowsAPICodePack.dll</HintPath> + </Reference> + <Reference Include="Microsoft.WindowsAPICodePack.Shell, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll</HintPath> + </Reference> + <Reference Include="Microsoft.WindowsAPICodePack.ShellExtensions, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> @@ -97,9 +106,16 @@ <Compile Include="Converters\MonitorsToMultiChannleMonitorsConverter.cs" /> <Compile Include="Converters\MonitorsToSingleChannleMonitorsConverter.cs" /> <Compile Include="Converters\SecondsToGraphPointsConverter.cs" /> + <Compile Include="Converters\SecondsToTimeSpanConverter.cs" /> <Compile Include="Converters\TechIosToDigitalInsConverter.cs" /> <Compile Include="Converters\TechIosToDigitalOutsConverter.cs" /> <Compile Include="Converters\TransitionLinkConverter.cs" /> + <Compile Include="Editors\MonitorRecorderElementEditor.xaml.cs"> + <DependentUpon>MonitorRecorderElementEditor.xaml</DependentUpon> + </Compile> + <Compile Include="Editors\HeaterElementEditor.xaml.cs"> + <DependentUpon>HeaterElementEditor.xaml</DependentUpon> + </Compile> <Compile Include="Editors\TextElementEditor.xaml.cs"> <DependentUpon>TextElementEditor.xaml</DependentUpon> </Compile> @@ -168,6 +184,13 @@ <Compile Include="Models\TechRecordingData.cs" /> <Compile Include="Models\TechRecordingValue.cs" /> <Compile Include="Project\MachineTechViewProject.cs" /> + <Compile Include="Project\MachineTechViewProjectTab.cs" /> + <Compile Include="PropertiesTemplates\MonitorRecorderTemplate.xaml.cs"> + <DependentUpon>MonitorRecorderTemplate.xaml</DependentUpon> + </Compile> + <Compile Include="PropertiesTemplates\HeaterTemplate.xaml.cs"> + <DependentUpon>HeaterTemplate.xaml</DependentUpon> + </Compile> <Compile Include="PropertiesTemplates\TextTemplate.xaml.cs"> <DependentUpon>TextTemplate.xaml</DependentUpon> </Compile> @@ -233,8 +256,10 @@ <Compile Include="TechItems\ControllerItem.cs" /> <Compile Include="TechItems\DigitalInItem.cs" /> <Compile Include="TechItems\DigitalOutItem.cs" /> + <Compile Include="TechItems\HeaterItem.cs" /> <Compile Include="TechItems\JobRunnerItem.cs" /> <Compile Include="TechItems\MeterItem.cs" /> + <Compile Include="TechItems\MonitorRecorderItem.cs" /> <Compile Include="TechItems\MotorActionType.cs" /> <Compile Include="TechItems\DispenserItem.cs" /> <Compile Include="TechItems\DancerItem.cs" /> @@ -254,10 +279,19 @@ <Compile Include="TechnicianModule.cs" /> <Compile Include="TechnicianModuleSettings.cs" /> <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\MachineTechTabVM.cs" /> <Compile Include="ViewModels\MachineTechViewVM.cs" /> <Compile Include="Views\MachineTechView.xaml.cs"> <DependentUpon>MachineTechView.xaml</DependentUpon> </Compile> + <Page Include="Editors\MonitorRecorderElementEditor.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Editors\HeaterElementEditor.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Editors\TextElementEditor.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -338,6 +372,14 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="PropertiesTemplates\MonitorRecorderTemplate.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="PropertiesTemplates\HeaterTemplate.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="PropertiesTemplates\TextTemplate.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -634,6 +676,15 @@ <ItemGroup> <Resource Include="Images\text.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\heater-controller.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\temperature.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\csv.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs index 6b532204e..f581988f7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs @@ -7,6 +7,7 @@ using System.Windows.Media; using System.Xml.Serialization; using Tango.BL; using Tango.BL.Entities; +using Tango.Core.Commands; using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems @@ -18,6 +19,8 @@ namespace Tango.MachineStudio.Technician.TechItems [TechItem(16)] public class BlowerItem : TechItem { + public event EventHandler<bool> SetCommandClicked; + private static List<HardwareBlower> _BlowerConfigurations; /// <summary> /// Gets or sets the Blower configurations. @@ -68,6 +71,36 @@ namespace Tango.MachineStudio.Technician.TechItems set { _hardwareBlower = value; RaisePropertyChangedAuto(); } } + private bool _isActive; + [XmlIgnore] + public bool IsActive + { + get { return _isActive; } + set { _isActive = value; RaisePropertyChangedAuto(); } + } + + private bool _effectiveActive; + [XmlIgnore] + public bool EffectiveActive + { + get { return _effectiveActive; } + set + { + _effectiveActive = value; + RaisePropertyChangedAuto(); + IsActive = _effectiveActive; + } + } + + /// <summary> + /// Gets or sets the set command. + /// </summary> + [XmlIgnore] + public RelayCommand SetCommand { get; set; } + + [XmlIgnore] + public RelayCommand ToggleActiveCommand { get; set; } + /// <summary> /// Initializes a new instance of the <see cref="BlowerItem"/> class. /// </summary> @@ -78,6 +111,13 @@ namespace Tango.MachineStudio.Technician.TechItems Image = ResourceHelper.GetImageFromResources("Images/blower.png"); Color = Colors.White; HardwareBlower = new HardwareBlower(); + + SetCommand = new RelayCommand(() => { SetCommandClicked?.Invoke(this, _isActive); }); + + ToggleActiveCommand = new RelayCommand(() => + { + SetCommandClicked?.Invoke(this, _isActive); + }); } /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs index 8a9cba883..2d8763f74 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows.Media; using System.Xml.Serialization; using Tango.BL.Entities; +using Tango.Core.Commands; using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems @@ -17,10 +18,7 @@ namespace Tango.MachineStudio.Technician.TechItems [TechItem(10)] public class ControllerItem : TechItem { - /// <summary> - /// Occurs when the controller value has changed. - /// </summary> - public event EventHandler<double> ValueChanged; + public event EventHandler SetCommandClicked; private TechController _techController; /// <summary> @@ -56,7 +54,6 @@ namespace Tango.MachineStudio.Technician.TechItems set { _value = value; RaisePropertyChangedAuto(); - ValueChanged?.Invoke(this, _value); } } @@ -120,6 +117,12 @@ namespace Tango.MachineStudio.Technician.TechItems public bool IsSetToDefault { get; set; } /// <summary> + /// Gets or sets the set command. + /// </summary> + [XmlIgnore] + public RelayCommand SetCommand { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="ControllerItem"/> class. /// </summary> public ControllerItem() : base() @@ -130,6 +133,8 @@ namespace Tango.MachineStudio.Technician.TechItems Color = Colors.DodgerBlue; LastUpdateTime = DateTime.Now; UpdateInterval = 10; + + SetCommand = new RelayCommand(() => { SetCommandClicked?.Invoke(this, new EventArgs()); }); } /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs new file mode 100644 index 000000000..e91c3f185 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Xml.Serialization; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.PMR.Diagnostics; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// <summary> + /// Represents a heater controller. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Technician.TechItems.TechItem" /> + [TechItem(10)] + public class HeaterItem : TechItem + { + public event Action SetCommandClicked; + + private TechHeater _techHeater; + /// <summary> + /// Gets or sets the db tech monitor. + /// </summary> + [XmlIgnore] + public TechHeater TechHeater + { + get { return _techHeater; } + set { _techHeater = value; RaisePropertyChangedAuto(); TechName = _techHeater != null ? _techHeater.Description : null; ItemGuid = value != null ? value.Guid : null; } + } + + /// <summary> + /// Gets or sets the set command. + /// </summary> + [XmlIgnore] + public RelayCommand SetCommand { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="HeaterItem"/> class. + /// </summary> + public HeaterItem() : base() + { + Name = "Heater Controller"; + Color = Colors.White; + Description = "Heater Controller"; + Image = ResourceHelper.GetImageFromResources("Images/heater-controller.png"); + SetCommand = new RelayCommand(() => { SetCommandClicked?.Invoke(); }, (x) => HeaterState.CurrentValue != SetPoint); + HeaterState = new HeaterState(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="HeaterItem"/> class. + /// </summary> + /// <param name="TechHeater">The db tech monitor.</param> + public HeaterItem(TechHeater techHeater) : this() + { + TechHeater = techHeater; + } + + private HeaterState _heaterState; + /// <summary> + /// Gets or sets the state of the heater. + /// </summary> + public HeaterState HeaterState + { + get { return _heaterState; } + set + { + _heaterState = value; + RaisePropertyChangedAuto(); + + InvokeUI(() => + { + SetCommand.RaiseCanExecuteChanged(); + }); + } + } + + private double _setPoint; + /// <summary> + /// Gets or sets the set point. + /// </summary> + public double SetPoint + { + get { return _setPoint; } + set { _setPoint = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Clones this instance. + /// </summary> + /// <returns></returns> + public override TechItem Clone() + { + HeaterItem cloned = base.Clone() as HeaterItem; + cloned.TechHeater = TechHeater; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs new file mode 100644 index 000000000..e2b62092d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorRecorderItem.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Threading; +using System.Xml.Serialization; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.SharedUI.Components; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + [TechItem(25)] + public class MonitorRecorderItem : TechItem + { + private DispatcherTimer _timer; + private DateTime _recording_start_time; + + public event Action RecordingStarted; + public event Action RecordingStopped; + + /// <summary> + /// Gets or sets the monitors. + /// </summary> + [XmlIgnore] + public SelectedObjectCollection<TechMonitor> Monitors { get; set; } + + private bool _isRecording; + /// <summary> + /// Gets or sets a value indicating whether this instance is recording. + /// </summary> + [XmlIgnore] + public bool IsRecording + { + get { return _isRecording; } + set { _isRecording = value; RaisePropertyChangedAuto(); } + } + + private TimeSpan _recordingTime; + [XmlIgnore] + public TimeSpan RecordingTime + { + get { return _recordingTime; } + set { _recordingTime = value; RaisePropertyChangedAuto(); } + } + + private bool _isPaused; + [XmlIgnore] + public bool IsPaused + { + get { return _isPaused; } + set { _isPaused = value; RaisePropertyChangedAuto(); } + } + + + /// <summary> + /// Gets or sets the toggle recording command. + /// </summary> + [XmlIgnore] + public RelayCommand ToggleRecordingCommand { get; set; } + + [XmlIgnore] + public RelayCommand TogglePauseCommand { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="MonitorRecorderItem"/> class. + /// </summary> + public MonitorRecorderItem() : base() + { + _timer = new DispatcherTimer(); + _timer.Tick += _timer_Tick; + _timer.Interval = TimeSpan.FromSeconds(1); + + Monitors = new SelectedObjectCollection<TechMonitor>(Adapter.TechMonitors.ToObservableCollection(), new ObservableCollection<TechMonitor>()); + Name = "CSV Recorder"; + Description = "Record multiple monitors to a CSV file"; + Image = ResourceHelper.GetImageFromResources("Images/csv.png"); + Color = Colors.White; + + ToggleRecordingCommand = new RelayCommand(ToggleRecording); + TogglePauseCommand = new RelayCommand(() => { IsPaused = !IsPaused; }); + } + + public MonitorRecorderItem(object dummy) : this() + { + + } + + private void _timer_Tick(object sender, EventArgs e) + { + RecordingTime = DateTime.Now - _recording_start_time; + } + + private void ToggleRecording() + { + if (!IsRecording) + { + RecordingStarted?.Invoke(); + } + else + { + RecordingStopped?.Invoke(); + } + } + + public void StartRecording() + { + _recording_start_time = DateTime.Now; + IsRecording = true; + IsPaused = false; + _timer.Start(); + } + + public void StopRecording() + { + _timer.Stop(); + IsPaused = false; + IsRecording = false; + RecordingTime = TimeSpan.FromSeconds(0); + } + + public List<TechMonitor> GetSelectedMonitors() + { + return Monitors.SynchedSource.ToList(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index 5a3bd0327..a935ee5a6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -191,20 +191,28 @@ namespace Tango.MachineStudio.Technician.TechItems { if (!IsRecording) { - _recording_start_time = DateTime.Now; - IsRecording = true; - _timer.Start(); RecordingStarted?.Invoke(); } else { - _timer.Stop(); - IsRecording = false; - RecordingTime = TimeSpan.FromSeconds(0); RecordingStopped?.Invoke(); } } + public void StartRecording() + { + _recording_start_time = DateTime.Now; + IsRecording = true; + _timer.Start(); + } + + public void StopRecording() + { + _timer.Stop(); + IsRecording = false; + RecordingTime = TimeSpan.FromSeconds(0); + } + /// <summary> /// Initializes a new instance of the <see cref="MultiGraphItem"/> class. /// </summary> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index aa404b215..87d971233 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -184,20 +184,28 @@ namespace Tango.MachineStudio.Technician.TechItems { if (!IsRecording) { - _recording_start_time = DateTime.Now; - IsRecording = true; - _timer.Start(); RecordingStarted?.Invoke(); } else { - _timer.Stop(); - IsRecording = false; - RecordingTime = TimeSpan.FromSeconds(0); RecordingStopped?.Invoke(); } } + public void StartRecording() + { + _recording_start_time = DateTime.Now; + IsRecording = true; + _timer.Start(); + } + + public void StopRecording() + { + _timer.Stop(); + IsRecording = false; + RecordingTime = TimeSpan.FromSeconds(0); + } + /// <summary> /// Initializes a new instance of the <see cref="SingleGraphItem"/> class. /// </summary> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs index 04b6c1fab..6fa00ae0a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs @@ -39,6 +39,8 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlInclude(typeof(ProcessParametersItem))] [XmlInclude(typeof(JobRunnerItem))] [XmlInclude(typeof(TextItem))] + [XmlInclude(typeof(HeaterItem))] + [XmlInclude(typeof(MonitorRecorderItem))] public abstract class TechItem : ExtendedObject { /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechTabVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechTabVM.cs new file mode 100644 index 000000000..4e04a078c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechTabVM.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Editors; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Technician.ViewModels +{ + public class MachineTechTabVM : ViewModel + { + private ElementsEditor _editor; + + public ElementsEditor Editor + { + get { return _editor; } + set { _editor = value; RaisePropertyChangedAuto(); } + } + + private String _name; + /// <summary> + /// Gets or sets the name. + /// </summary> + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); } + } + + private bool _isSelected; + /// <summary> + /// Gets or sets a value indicating whether this instance is selected. + /// </summary> + public bool IsSelected + { + get { return _isSelected; } + set { _isSelected = value; RaisePropertyChangedAuto(); } + } + + + private ObservableCollection<IElementEditor> _elements; + /// <summary> + /// Gets or sets the visual elements. + /// </summary> + public ObservableCollection<IElementEditor> Elements + { + get { return _elements; } + set { _elements = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Initializes a new instance of the <see cref="MachineTechTabVM"/> class. + /// </summary> + public MachineTechTabVM() + { + Name = "untitled"; + Elements = new ObservableCollection<IElementEditor>(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 6575bd53c..2ca5aa43b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -33,6 +33,8 @@ using Tango.MachineStudio.Common; using Tango.Core.Commands; using Tango.MachineStudio.Technician.Helpers; using Tango.MachineStudio.Technician.Models; +using Tango.Logging; +using Microsoft.WindowsAPICodePack.Dialogs; namespace Tango.MachineStudio.Technician.ViewModels { @@ -55,20 +57,46 @@ namespace Tango.MachineStudio.Technician.ViewModels private const int MIN_DIAGNOSTICS_UPDATE_MILI = 500; private TechnicianModuleSettings _settings; - private List<SingleTechRecordingData<SingleGraphItem>> _single_graphs_recordings; - private List<MultiTechRecordingData<MultiGraphItem>> _multi_graph_recordings; + private List<SingleTechRecordingData> _single_graphs_recordings; + private List<MultiTechRecordingData> _multi_graph_recordings; + private List<SingleTechRecordingData> _single_monitors_recordings; + private List<MultiTechRecordingData> _multi_monitors_recordings; #region Properties - private ObservableCollection<IElementEditor> _elements; + private ObservableCollection<MachineTechTabVM> _tabs; /// <summary> - /// Gets or sets the visual elements. + /// Gets or sets the elements tabs. /// </summary> - public ObservableCollection<IElementEditor> Elements + public ObservableCollection<MachineTechTabVM> Tabs { - get { return _elements; } - set { _elements = value; RaisePropertyChangedAuto(); } + get { return _tabs; } + set { _tabs = value; RaisePropertyChangedAuto(); } + } + + private MachineTechTabVM _selectedTab; + /// <summary> + /// Gets or sets the selected tab. + /// </summary> + public MachineTechTabVM SelectedTab + { + get { return _selectedTab; } + set + { + _selectedTab = value; + RaisePropertyChangedAuto(); + + foreach (var tab in Tabs.Where(x => x != _selectedTab)) + { + tab.IsSelected = false; + } + + if (_selectedTab != null) + { + _selectedTab.IsSelected = true; + } + } } private ObservableCollection<TechItem> _availableTechItems; @@ -210,8 +238,30 @@ namespace Tango.MachineStudio.Technician.ViewModels /// </summary> public RelayCommand ResetHardwareConfigurationCommand { get; set; } + /// <summary> + /// Gets or sets the update graphs duration command. + /// </summary> public RelayCommand UpdateGraphsDurationCommand { get; set; } + /// <summary> + /// Gets or sets the add tab command. + /// </summary> + public RelayCommand AddTabCommand { get; set; } + + /// <summary> + /// Gets or sets the remove tab command. + /// </summary> + public RelayCommand<MachineTechTabVM> RemoveTabCommand { get; set; } + + /// <summary> + /// Gets or sets the new project command. + /// </summary> + public RelayCommand NewProjectCommand { get; set; } + + /// <summary> + /// Gets or sets the rename tab command. + /// </summary> + public RelayCommand RenameTabCommand { get; set; } #endregion #region Constructors @@ -223,10 +273,17 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <param name="notificationProvider">The notification provider.</param> public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IEventLogger eventLogger) { + Tabs = new ObservableCollection<MachineTechTabVM>(); + Tabs.Add(new MachineTechTabVM() { IsSelected = true, Name = "Untitled" }); + SelectedTab = Tabs.First(); + _settings = SettingsManager.Default.GetOrCreate<TechnicianModuleSettings>(); - _single_graphs_recordings = new List<SingleTechRecordingData<SingleGraphItem>>(); - _multi_graph_recordings = new List<MultiTechRecordingData<MultiGraphItem>>(); + _single_graphs_recordings = new List<SingleTechRecordingData>(); + _multi_graph_recordings = new List<MultiTechRecordingData>(); + + _single_monitors_recordings = new List<SingleTechRecordingData>(); + _multi_monitors_recordings = new List<MultiTechRecordingData>(); GraphsDurationSeconds = _settings.GraphsDuration; TempGraphsDurationSeconds = GraphsDurationSeconds; @@ -242,7 +299,6 @@ namespace Tango.MachineStudio.Technician.ViewModels ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; Adapter = ObservablesStaticCollections.Instance; - Elements = new ObservableCollection<IElementEditor>(); OpenProjectCommand = new RelayCommand(OpenProject); SaveAsProjectCommand = new RelayCommand(SaveAsProject); @@ -274,6 +330,11 @@ namespace Tango.MachineStudio.Technician.ViewModels _settings.GraphsDuration = GraphsDurationSeconds; ClearAllGraphs(); }); + + AddTabCommand = new RelayCommand(() => AddNewTab()); + RemoveTabCommand = new RelayCommand<MachineTechTabVM>(RemoveTab); + NewProjectCommand = new RelayCommand(CreateNewProject); + RenameTabCommand = new RelayCommand(RenameTab); } #endregion @@ -322,10 +383,35 @@ namespace Tango.MachineStudio.Technician.ViewModels CurrentDiagnosticsResponseSize = data.CalculateSize(); } + foreach (var sr in _single_monitors_recordings) + { + var techMonitor = (sr.Tag as TechMonitor); + + var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == techMonitor.Name); + + if (prop != null) + { + var points = GetDataArray(techMonitor, prop.GetValue(data.Monitors)); + sr.PushData(points); + } + } + + foreach (var mr in _multi_monitors_recordings) + { + var techMonitor = (mr.Tag as TechMonitor); + + var prop = _diagnoticsMonitorsDataProperties.SingleOrDefault(x => x.Name == techMonitor.Name); + + if (prop != null) + { + var points = GetDataMatrix(techMonitor, prop.GetValue(data.Monitors)); + mr.PushData(points); + } + } lock (_elementsLock) { - var elements = Elements.ToList(); + var elements = Tabs.SelectMany(x => x.Elements).ToList(); foreach (var item in elements.Select(x => x.HostedElement as TechItem)) { @@ -380,7 +466,7 @@ namespace Tango.MachineStudio.Technician.ViewModels controller.PushData(points); - var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.TechItem == graphItem); + var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == graphItem); if (_graph_recording != null) { _graph_recording.PushData(points); @@ -414,7 +500,7 @@ namespace Tango.MachineStudio.Technician.ViewModels controller.PushData(points); - var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.TechItem == graphItem); + var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == graphItem); if (_graph_recording != null) { _graph_recording.PushData(points); @@ -444,6 +530,26 @@ namespace Tango.MachineStudio.Technician.ViewModels digitalInItem.Value = digitalPin.Value; } } + else if (item.GetType() == typeof(HeaterItem)) + { + HeaterItem heaterItem = item as HeaterItem; + + var heaterState = data.HeatersStates.SingleOrDefault(x => x.HeaterType == (HeaterType)heaterItem.TechHeater.Code); + + if (heaterState != null) + { + heaterItem.HeaterState = heaterState; + } + } + else if (item.GetType() == typeof(BlowerItem)) + { + BlowerItem blowerItem = item as BlowerItem; + + if (data.Monitors.BlowerVoltage.Count > 0) + { + blowerItem.EffectiveActive = data.Monitors.BlowerVoltage.Last() > 0; + } + } else if (item.GetType() == typeof(ControllerItem)) { ControllerItem controllerItem = item as ControllerItem; @@ -557,6 +663,11 @@ namespace Tango.MachineStudio.Technician.ViewModels { CreateElement<MeterElementEditor, MeterItem, TechMonitor>(bounds, Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault()); } + else if (item is HeaterItem) + { + var editor = CreateElement<HeaterElementEditor, HeaterItem, TechHeater>(bounds, Adapter.TechHeaters.FirstOrDefault()); + InitTechHeater(editor.HeaterItem); + } else if (item is SingleGraphItem) { var editor = CreateElement<SingleGraphElementEditor, SingleGraphItem, TechMonitor>(bounds, Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault()); @@ -619,7 +730,8 @@ namespace Tango.MachineStudio.Technician.ViewModels } else if (item is BlowerItem) { - CreateElement<BlowerElementEditor, BlowerItem, HardwareBlowerType>(bounds, Adapter.HardwareBlowerTypes.FirstOrDefault()); + var editor = CreateElement<BlowerElementEditor, BlowerItem, HardwareBlowerType>(bounds, Adapter.HardwareBlowerTypes.FirstOrDefault()); + InitBlowerItem(editor.BlowerItem); } else if (item is BreakSensorItem) { @@ -639,6 +751,11 @@ namespace Tango.MachineStudio.Technician.ViewModels { CreateElement<TextElementEditor, TextItem, object>(bounds, null); } + else if (item is MonitorRecorderItem) + { + var editor = CreateElement<MonitorRecorderElementEditor, MonitorRecorderItem, object>(bounds, null); + InitMonitorRecorderItem(editor.MonitorRecorderItem); + } } /// <summary> @@ -654,7 +771,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { TechItem item = Activator.CreateInstance(typeof(Tech), new object[] { value }) as TechItem; IElementEditor editor = Activator.CreateInstance(typeof(Editor), new object[] { ((Tech)item), bounds }) as IElementEditor; - Elements.Add(editor); + SelectedTab.Elements.Add(editor); return (Editor)editor; } @@ -667,7 +784,7 @@ namespace Tango.MachineStudio.Technician.ViewModels private Editor CreateElement<Editor>(TechItem item) where Editor : IElementEditor { IElementEditor editor = Activator.CreateInstance(typeof(Editor), new object[] { item, item.GetBounds() }) as IElementEditor; - Elements.Add(editor); + SelectedTab.Elements.Add(editor); return (Editor)editor; } @@ -682,6 +799,11 @@ namespace Tango.MachineStudio.Technician.ViewModels (item as MonitorItem).TechMonitor = Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault(x => x.Guid == item.ItemGuid); CreateElement<MonitorElementEditor>(item); } + else if (item is HeaterItem) + { + (item as HeaterItem).TechHeater = Adapter.TechHeaters.FirstOrDefault(x => x.Guid == item.ItemGuid); + CreateElement<HeaterElementEditor>(item); + } else if (item is MeterItem) { (item as MeterItem).TechMonitor = Adapter.TechMonitors.Where(x => !x.MultiChannel).FirstOrDefault(x => x.Guid == item.ItemGuid); @@ -761,7 +883,8 @@ namespace Tango.MachineStudio.Technician.ViewModels else if (item is BlowerItem) { (item as BlowerItem).HardwareBlowerType = Adapter.HardwareBlowerTypes.FirstOrDefault(x => x.Guid == item.ItemGuid); - CreateElement<BlowerElementEditor>(item); + var editor = CreateElement<BlowerElementEditor>(item); + InitBlowerItem(editor.BlowerItem); } else if (item is BreakSensorItem) { @@ -782,6 +905,10 @@ namespace Tango.MachineStudio.Technician.ViewModels { CreateElement<TextElementEditor>(item); } + else if (item is MonitorRecorderItem) + { + CreateElement<MonitorRecorderElementEditor>(item); + } } /// <summary> @@ -794,20 +921,24 @@ namespace Tango.MachineStudio.Technician.ViewModels { if (element.HostedElement is SingleGraphItem) { - var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.TechItem == element.HostedElement); + var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == element.HostedElement); if (_graph_recording != null) { + (_graph_recording.Tag as SingleGraphItem).StopRecording(); _single_graphs_recordings.Remove(_graph_recording); + _graph_recording.Dispose(); } } else if (element.HostedElement is MultiGraphItem) { - var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.TechItem == element.HostedElement); + var _graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == element.HostedElement); if (_graph_recording != null) { + (_graph_recording.Tag as MultiGraphItem).StopRecording(); _multi_graph_recordings.Remove(_graph_recording); + _graph_recording.Dispose(); } } } @@ -894,6 +1025,92 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Init Tech Items + private void InitMonitorRecorderItem(MonitorRecorderItem item) + { + item.RecordingStarted += () => + { + CommonOpenFileDialog dlg = new CommonOpenFileDialog(); + dlg.Title = "Select a folder to place all CSV files."; + dlg.IsFolderPicker = true; + if (dlg.ShowDialog() == CommonFileDialogResult.Ok) + { + foreach (var monitor in item.GetSelectedMonitors()) + { + if (!monitor.MultiChannel) + { + _single_monitors_recordings.Add(new SingleTechRecordingData(monitor.Name, dlg.FileName + "\\" + monitor.Description + ".csv") { Tag = monitor }); + } + else + { + _multi_monitors_recordings.Add(new MultiTechRecordingData(monitor.Name, monitor.ChannelCount, dlg.FileName + "\\" + monitor.Description + ".csv") { Tag = monitor }); + } + item.StartRecording(); + } + } + }; + + item.RecordingStopped += () => + { + item.StopRecording(); + + foreach (var sr in _single_monitors_recordings) + { + sr.Dispose(); + } + + _single_monitors_recordings.Clear(); + + foreach (var mr in _multi_monitors_recordings) + { + mr.Dispose(); + } + + _multi_monitors_recordings.Clear(); + }; + } + + /// <summary> + /// Initializes the blower item. + /// </summary> + /// <param name="item">The blower item.</param> + private void InitBlowerItem(BlowerItem item) + { + item.SetCommandClicked += async (_, isActive) => + { + try + { + CheckMachineOperator(); + await MachineOperator.SetBlowerState((PMR.Hardware.HardwareBlowerType)item.HardwareBlower.HardwareBlowerType.Code, isActive, item.HardwareBlower.Voltage); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error executing SetBlowerState command for blower {item.HardwareBlower.HardwareBlowerType.Name}."); + _eventLogger.Log(ex, $"Error executing SetBlowerState command for blower {item.HardwareBlower.HardwareBlowerType.Name}."); + } + }; + } + + /// <summary> + /// Initializes the tech heater. + /// </summary> + /// <param name="item">The item.</param> + private void InitTechHeater(HeaterItem item) + { + item.SetCommandClicked += async () => + { + try + { + CheckMachineOperator(); + await MachineOperator.SetHeaterState((HeaterType)item.TechHeater.Code, item.SetPoint); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error executing SetHeaterState command for heater {item.TechHeater.Name}."); + _eventLogger.Log(ex, $"Error executing SetHeaterState command for heater {item.TechHeater.Name}."); + } + }; + } + /// <summary> /// Initializes the motor item. /// </summary> @@ -1093,29 +1310,30 @@ namespace Tango.MachineStudio.Technician.ViewModels item.RecordingStarted += () => { - _single_graphs_recordings.Add(new SingleTechRecordingData<SingleGraphItem>(item)); + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Save graph data as csv file"; + dlg.Filter = "CSV Files|*.csv"; + dlg.DefaultExt = ".csv"; + dlg.FileName = item.TechName; + if (dlg.ShowDialog().Value) + { + _single_graphs_recordings.Add(new SingleTechRecordingData(item.TechName, dlg.FileName) { Tag = item }); + item.StartRecording(); + } }; item.RecordingStopped += () => { try { - var graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.TechItem == item); + item.StopRecording(); + + var graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == item); if (graph_recording != null) { _single_graphs_recordings.Remove(graph_recording); - - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Title = "Save graph data as csv file"; - dlg.Filter = "CSV Files|*.csv"; - dlg.DefaultExt = ".csv"; - dlg.FileName = item.TechName; - if (dlg.ShowDialog().Value) - { - graph_recording.Save(dlg.FileName); - graph_recording.Dispose(); - } + graph_recording.Dispose(); } } catch (Exception ex) @@ -1153,29 +1371,30 @@ namespace Tango.MachineStudio.Technician.ViewModels item.RecordingStarted += () => { - _multi_graph_recordings.Add(new MultiTechRecordingData<MultiGraphItem>(item, item.TechMonitor.ChannelCount)); + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Title = "Save graph data as csv file"; + dlg.Filter = "CSV Files|*.csv"; + dlg.DefaultExt = ".csv"; + dlg.FileName = item.TechName; + if (dlg.ShowDialog().Value) + { + _multi_graph_recordings.Add(new MultiTechRecordingData(item.TechName, item.TechMonitor.ChannelCount, dlg.FileName) { Tag = item }); + item.StartRecording(); + } }; item.RecordingStopped += () => { try { - var graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.TechItem == item); + item.StopRecording(); + + var graph_recording = _multi_graph_recordings.SingleOrDefault(x => x.Tag == item); if (graph_recording != null) { _multi_graph_recordings.Remove(graph_recording); - - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Title = "Save graph data as csv file"; - dlg.Filter = "CSV Files|*.csv"; - dlg.DefaultExt = ".csv"; - dlg.FileName = item.TechName; - if (dlg.ShowDialog().Value) - { - graph_recording.Save(dlg.FileName); - graph_recording.Dispose(); - } + graph_recording.Dispose(); } } catch (Exception ex) @@ -1335,7 +1554,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <param name="item">The controller item.</param> private void InitControllerItem(ControllerItem item) { - item.ValueChanged += async (x, value) => + item.SetCommandClicked += async (_, __) => { try { @@ -1343,7 +1562,7 @@ namespace Tango.MachineStudio.Technician.ViewModels await MachineOperator.SetComponentValue(new SetComponentValueRequest() { Component = (ValueComponent)item.TechController.Code, - Value = value + Value = item.Value }); } catch (Exception ex) @@ -1446,7 +1665,7 @@ namespace Tango.MachineStudio.Technician.ViewModels #endregion - #region Public Methods + #region Project Management /// <summary> /// Opens a file open dialog to select a project file. @@ -1469,8 +1688,31 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <param name="fileName">File path.</param> public void OpenProjectFile(String fileName) { - LoadProject(MachineTechViewProject.Load(fileName)); - _lastTechProjectFile = fileName; + try + { + MachineTechViewProject project = null; + + project = MachineTechViewProject.Load(fileName); + + if (project.Tabs.Count == 0) + { + LogManager.Log($"Error loading project file {fileName}. Trying to load using legacy project loader.", LogCategory.Warning); + + MachineTechViewProjectTab tab = new MachineTechViewProjectTab(); + tab.Name = "Untitled"; + tab.Items.AddRange(project.Items); + project.Items.Clear(); + project.Tabs.Add(tab); + } + + LoadProject(project); + _lastTechProjectFile = fileName; + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error loading project file {fileName}."); + _notification.ShowError("An error occurred while trying to load the tech board project file."); + } } /// <summary> @@ -1481,19 +1723,30 @@ namespace Tango.MachineStudio.Technician.ViewModels { using (_notification.PushTaskItem("Loading technician project file...")) { - Elements.Clear(); + Tabs.Clear(); _singleControllers.Clear(); _multiControllers.Clear(); - foreach (var item in project.Items) + foreach (var tab in project.Tabs) { - if (item is MotorGroupItem) + MachineTechTabVM t = new MachineTechTabVM(); + t.Name = tab.Name; + Tabs.Add(t); + + SelectedTab = t; + + foreach (var item in tab.Items) { - (item as MotorGroupItem).TechMotors = ObservablesStaticCollections.Instance.HardwareMotorTypes.Where(x => (item as MotorGroupItem).ItemsGuids.Contains(x.Guid)).ToObservableCollection(); - } + if (item is MotorGroupItem) + { + (item as MotorGroupItem).TechMotors = ObservablesStaticCollections.Instance.HardwareMotorTypes.Where(x => (item as MotorGroupItem).ItemsGuids.Contains(x.Guid)).ToObservableCollection(); + } - AddTechItem(item); + AddTechItem(item); + } } + + SelectedTab = Tabs.ElementAt(project.SelectedTabIndex); } } @@ -1548,22 +1801,115 @@ namespace Tango.MachineStudio.Technician.ViewModels private MachineTechViewProject GenerateProjectFile() { MachineTechViewProject project = new MachineTechViewProject(); + project.SelectedTabIndex = Tabs.IndexOf(SelectedTab); - foreach (var element in Elements) + foreach (var tab in Tabs) { - if (element.HostedElement is MotorGroupItem) + MachineTechViewProjectTab pTab = new MachineTechViewProjectTab(); + pTab.Name = tab.Name; + + foreach (var element in tab.Elements) { - var group = element.HostedElement as MotorGroupItem; - group.ItemsGuids = group.TechMotors.Select(x => x.Guid).ToList(); + if (element.HostedElement is MotorGroupItem) + { + var group = element.HostedElement as MotorGroupItem; + group.ItemsGuids = group.TechMotors.Select(x => x.Guid).ToList(); + } + + (element.HostedElement as TechItem).SetBounds(element.GetBounds()); + pTab.Items.Add(element.HostedElement as TechItem); } - (element.HostedElement as TechItem).SetBounds(element.GetBounds()); - project.Items.Add(element.HostedElement as TechItem); + project.Tabs.Add(pTab); } return project; } + /// <summary> + /// Removes the specified tab. + /// </summary> + /// <param name="tab">The tab.</param> + private void RemoveTab(MachineTechTabVM tab) + { + if (_notification.ShowQuestion("Are you sure you want to delete the selected tab?")) + { + Tabs.Remove(tab); + SelectedTab = Tabs.LastOrDefault(); + + if (SelectedTab == null) + { + AddNewTab("Untitled"); + } + } + } + + /// <summary> + /// Adds a new tab. + /// </summary> + private bool AddNewTab(String name = null) + { + if (Tabs.Count > 7) + { + _notification.ShowError("Cannot exceed the maximum number of 8 tabs. You can remove a tab, or create a new project."); + return false; + } + + if (name == null) + { + name = _notification.ShowTextInput("Enter tab name", "Tab Name", "Untitled"); + } + + if (!String.IsNullOrWhiteSpace(name)) + { + MachineTechTabVM t = new MachineTechTabVM(); + t.Name = name; + Tabs.Add(t); + SelectedTab = t; + return true; + } + else + { + return false; + } + } + + /// <summary> + /// Creates a new project. + /// </summary> + private void CreateNewProject() + { + var to_remove = Tabs.ToList(); + + if (AddNewTab()) + { + _singleControllers.Clear(); + _multiControllers.Clear(); + + foreach (var tab in to_remove) + { + Tabs.Remove(tab); + } + } + } + + /// <summary> + /// Renames the tab. + /// </summary> + /// <param name="tab">The tab.</param> + private void RenameTab() + { + if (SelectedTab != null) + { + var name = _notification.ShowTextInput("Enter tab name", "Tab Name", SelectedTab.Name); + + if (!String.IsNullOrWhiteSpace(name)) + { + SelectedTab.Name = name; + } + } + } + #endregion #region IStudioModuleVM @@ -1599,7 +1945,7 @@ namespace Tango.MachineStudio.Technician.ViewModels private void SyncHardwareConfiguration() { - var elements = Elements.ToList(); + var elements = Tabs.SelectMany(x => x.Elements).ToList(); if (MachineOperator != null && MachineOperator.CurrentHardwareConfiguration != null) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 3fe82944c..ac207fc55 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -14,6 +14,7 @@ xmlns:templates="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:localConverters="clr-namespace:Tango.MachineStudio.Technician.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" mc:Ignorable="d" @@ -22,6 +23,102 @@ <UserControl.Resources> <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> <converters:NumberToFileSizeConverter x:Key="NumberToFileSizeConverter" /> + <localConverters:SecondsToTimeSpanConverter x:Key="SecondsToTimeSpanConverter" /> + + <DataTemplate x:Key="TabTemplate"> + <Grid> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSelected}" Value="False"> + <Setter Property="Visibility" Value="Hidden"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <editors:ElementsEditor + x:Name="editor" + Elements="{Binding Elements}" + Loaded="Editor_Loaded" + ElementCreation="ElementsEditor_ElementCreation" + ElementsRemoved="ElementsEditor_ElementsRemoved" + AfterPaste="ElementsEditor_AfterPaste" + RulerHeight="32" + EditorWidth="1920" + EditorHeight="1080" + FontSize="10" + Background="#7EFFFFFF" + EditorBackground="#70FFFFFF" + RulerBackground="Transparent" + Foreground="#1EA9FF" + SelectionFillBrush="#338D8D8D" + SelectionStrokeBrush="#1EA9FF" + BorderBrush="#1EA9FF" + BorderThickness="1"> + + <editors:ElementsEditor.Style> + <Style TargetType="editors:ElementsEditor"> + <Setter Property="IsEditable" Value="True"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=listMode,Path=SelectedIndex}" Value="1"> + <Setter Property="IsEditable" Value="False"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </editors:ElementsEditor.Style> + + <editors:ElementsEditor.ContextMenu> + <ContextMenu DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}"> + <MenuItem Header="Cut (Ctrl+X)" Command="{Binding CutCommand}" MinWidth="210"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Cut" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Copy (Ctrl+C)" Command="{Binding CopyCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Copy" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Paste (Ctrl+V)" Command="{Binding PasteCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Paste" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Undo (Ctrl+Z)" Command="{Binding UndoCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Undo" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Redo (Ctrl+Y)" Command="{Binding RedoCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="RotateRight" Width="16"></fa:ImageAwesome> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Delete (DELETE)" Command="{Binding DeleteCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Recycle" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Select All (Ctrl+A)" Command="{Binding SelectAllCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Th" Width="16" /> + </MenuItem.Icon> + </MenuItem> + </ContextMenu> + </editors:ElementsEditor.ContextMenu> + </editors:ElementsEditor> + + <Slider Grid.Column="1" Orientation="Vertical" Margin="5" Maximum="3" Minimum="0.2" Value="{Binding ElementName=editor,Path=ScaleFactor}"></Slider> + </Grid> + </DataTemplate> </UserControl.Resources> <Grid> @@ -39,6 +136,12 @@ <Menu Padding="5" Background="#C6ECECEC" Visibility="{Binding HideMenu,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <MenuItem Header="File"> + <MenuItem Command="{Binding NewProjectCommand}" MinWidth="180" Header="New" VerticalContentAlignment="Center"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="File" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> <MenuItem Command="{Binding OpenProjectCommand}" MinWidth="180" Header="Open" VerticalContentAlignment="Center"> <MenuItem.Icon> <fa:ImageAwesome Icon="FolderOpen" Width="16" /> @@ -57,58 +160,58 @@ </MenuItem> </MenuItem> <MenuItem Header="Edit"> - <MenuItem Header="Cut (Ctrl+X)" Command="{Binding ElementName=editor,Path=CutCommand}" MinWidth="210"> + <MenuItem Header="Cut (Ctrl+X)" Command="{Binding SelectedTab.Editor.CutCommand}" MinWidth="210"> <MenuItem.Icon> <fa:ImageAwesome Icon="Cut" Width="16" /> </MenuItem.Icon> </MenuItem> - <MenuItem Header="Copy (Ctrl+C)" Command="{Binding ElementName=editor,Path=CopyCommand}"> + <MenuItem Header="Copy (Ctrl+C)" Command="{Binding SelectedTab.Editor.CopyCommand}"> <MenuItem.Icon> <fa:ImageAwesome Icon="Copy" Width="16" /> </MenuItem.Icon> </MenuItem> - <MenuItem Header="Paste (Ctrl+V)" Command="{Binding ElementName=editor,Path=PasteCommand}"> + <MenuItem Header="Paste (Ctrl+V)" Command="{Binding SelectedTab.Editor.PasteCommand}"> <MenuItem.Icon> <fa:ImageAwesome Icon="Paste" Width="16" /> </MenuItem.Icon> </MenuItem> <Separator/> - <MenuItem Header="Undo (Ctrl+Z)" Command="{Binding ElementName=editor,Path=UndoCommand}"> + <MenuItem Header="Undo (Ctrl+Z)" Command="{Binding SelectedTab.Editor.UndoCommand}"> <MenuItem.Icon> <fa:ImageAwesome Icon="Undo" Width="16" /> </MenuItem.Icon> </MenuItem> - <MenuItem Header="Redo (Ctrl+Y)" Command="{Binding ElementName=editor,Path=RedoCommand}"> + <MenuItem Header="Redo (Ctrl+Y)" Command="{Binding SelectedTab.Editor.RedoCommand}"> <MenuItem.Icon> <fa:ImageAwesome Icon="RotateRight" Width="16"></fa:ImageAwesome> </MenuItem.Icon> </MenuItem> <Separator/> - <MenuItem Header="Delete (DELETE)" Command="{Binding ElementName=editor,Path=DeleteCommand}"> + <MenuItem Header="Delete (DELETE)" Command="{Binding SelectedTab.Editor.DeleteCommand}"> <MenuItem.Icon> <fa:ImageAwesome Icon="Recycle" Width="16" /> </MenuItem.Icon> </MenuItem> <Separator/> - <MenuItem Header="Select All (Ctrl+A)" Command="{Binding ElementName=editor,Path=SelectAllCommand}"> + <MenuItem Header="Select All (Ctrl+A)" Command="{Binding SelectedTab.Editor.SelectAllCommand}"> <MenuItem.Icon> <fa:ImageAwesome Icon="Th" Width="16" /> </MenuItem.Icon> </MenuItem> </MenuItem> <MenuItem Header="View"> - <MenuItem Header="Zoom In" Command="{Binding ElementName=editor,Path=ZoomCommand}" CommandParameter="0.1"> + <MenuItem Header="Zoom In" Command="{Binding SelectedTab.Editor.ZoomCommand}" CommandParameter="0.1"> <MenuItem.Icon> <fa:ImageAwesome Icon="SearchPlus" Width="16" /> </MenuItem.Icon> </MenuItem> - <MenuItem Header="Zoom Out" Command="{Binding ElementName=editor,Path=ZoomCommand}" CommandParameter="-0.1"> + <MenuItem Header="Zoom Out" Command="{Binding SelectedTab.Editor.ZoomCommand}" CommandParameter="-0.1"> <MenuItem.Icon> <fa:ImageAwesome Icon="SearchMinus" Width="16" /> </MenuItem.Icon> </MenuItem> <Separator/> - <MenuItem Header="Reset Zoom" Command="{Binding ElementName=editor,Path=ResetZoomCommand}"> + <MenuItem Header="Reset Zoom" Command="{Binding SelectedTab.Editor.ResetZoomCommand}"> <MenuItem.Icon> <fa:ImageAwesome Icon="Search" Width="16" /> </MenuItem.Icon> @@ -180,11 +283,10 @@ <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Width="275" Margin="0 15 30 0"> <TextBlock HorizontalAlignment="Center" FontWeight="SemiBold" Foreground="Gray"> - <Run>GRAPHS DURATION:</Run> - <Run Text="{Binding TempGraphsDurationSeconds,Mode=OneWay}"></Run> - <Run>sec</Run> + <Run>GRAPHS FIFO CAPACITY:</Run> + <Run Text="{Binding TempGraphsDurationSeconds,Converter={StaticResource SecondsToTimeSpanConverter},Mode=OneWay,StringFormat='hh\\:mm\\:ss'}"></Run> </TextBlock> - <Slider Margin="0 5 0 0" Minimum="1" Maximum="60" Value="{Binding TempGraphsDurationSeconds}"> + <Slider Margin="0 5 0 0" Minimum="1" Maximum="3600" Value="{Binding TempGraphsDurationSeconds}"> <i:Interaction.Triggers> <i:EventTrigger EventName="PreviewMouseUp"> <i:InvokeCommandAction Command="{Binding UpdateGraphsDurationCommand}"></i:InvokeCommandAction> @@ -192,7 +294,7 @@ </i:Interaction.Triggers> </Slider> </StackPanel> - + <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Margin="20 0 0 0"> <ListBox ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding AvailableTechItems}" SelectedItem="{Binding SelectedTechItem,Mode=TwoWay}" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> @@ -202,7 +304,7 @@ </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type techItems:TechItem}"> - <Border Cursor="Hand" ToolTip="{Binding Description}" RenderTransformOrigin="0.5,0.5" Width="60" Height="60" Padding="10" Margin="5" BorderThickness="1" CornerRadius="100"> + <Border Cursor="Hand" ToolTip="{Binding Description}" RenderTransformOrigin="0.5,0.5" Width="55" Height="55" Padding="10" Margin="5" BorderThickness="1" CornerRadius="100"> <Border.Style> <Style TargetType="Border"> <Setter Property="RenderTransform"> @@ -258,207 +360,208 @@ </Grid> </Grid> - <Grid Grid.Row="1" Margin="5"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="300"/> - </Grid.ColumnDefinitions> + <Grid Grid.Row="1"> + <Grid.RowDefinitions> + <RowDefinition Height="30"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <StackPanel Orientation="Horizontal" Margin="35 0 0 0"> + <ListBox Style="{x:Null}" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" ItemContainerStyle="{StaticResource basicListBoxItem}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" Background="Transparent" BorderThickness="0" ItemsSource="{Binding Tabs}" SelectedItem="{Binding SelectedTab}"> + <ListBox.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"></StackPanel> + </ItemsPanelTemplate> + </ListBox.ItemsPanel> + + <ListBox.ItemTemplate> + <DataTemplate> + <Border Padding="5 5" Width="160" CornerRadius="10 10 0 0" Margin="1 0" Tag="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext}"> + <Border.ContextMenu> + <ContextMenu DataContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}"> + <MenuItem Header="Rename" Command="{Binding RenameTabCommand}" MinWidth="210"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Pencil" Width="16" /> + </MenuItem.Icon> + </MenuItem> + </ContextMenu> + </Border.ContextMenu> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Background" Value="#CBCBCB"></Setter> + <Setter Property="TextElement.Foreground" Value="#202020"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSelected}" Value="True"> + <Setter Property="Background" Value="{StaticResource AccentColorBrush}"></Setter> + <Setter Property="TextElement.Foreground" Value="White"></Setter> + </DataTrigger> + <Trigger Property="IsMouseOver" Value="True"> + <Setter Property="Opacity" Value="0.8"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </Border.Style> + <DockPanel VerticalAlignment="Center"> + <Button Cursor="Hand" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveTabCommand}" CommandParameter="{Binding}" DockPanel.Dock="Right" Margin="5 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="2" Height="Auto"> + <materialDesign:PackIcon Kind="Close"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Foreground" Value="#202020"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSelected}" Value="True"> + <Setter Property="Foreground" Value="White"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </Button> + <TextBlock Text="{Binding Name}" VerticalAlignment="Center" TextAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="11"></TextBlock> + </DockPanel> + </Border> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + + <Button Margin="10 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="2" Height="24" Cursor="Hand" Command="{Binding AddTabCommand}" ToolTip="New tab"> + <materialDesign:PackIcon Width="20" Height="20" Kind="Plus" Foreground="{StaticResource AccentColorBrush}" /> + </Button> + </StackPanel> - <Grid> + <Grid Margin="5 0 5 5" Grid.Row="1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="300"/> </Grid.ColumnDefinitions> - <editors:ElementsEditor - x:Name="editor" - Elements="{Binding Elements}" - ElementCreation="ElementsEditor_ElementCreation" - ElementsRemoved="ElementsEditor_ElementsRemoved" - AfterPaste="ElementsEditor_AfterPaste" - RulerHeight="32" - EditorWidth="1920" - EditorHeight="1080" - FontSize="10" - Background="Transparent" - EditorBackground="#70FFFFFF" - RulerBackground="Transparent" - Foreground="{StaticResource AccentColorBrush}" - SelectionFillBrush="#338D8D8D" - SelectionStrokeBrush="{StaticResource AccentColorBrush}" - BorderBrush="{StaticResource AccentColorBrush}" - BorderThickness="1"> - <editors:ElementsEditor.Style> - <Style TargetType="editors:ElementsEditor"> - <Setter Property="IsEditable" Value="True"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=listMode,Path=SelectedIndex}" Value="1"> - <Setter Property="IsEditable" Value="False"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </editors:ElementsEditor.Style> + <ItemsControl ItemsSource="{Binding Tabs}" ItemTemplate="{StaticResource TabTemplate}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <Grid/> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + </ItemsControl> - <editors:ElementsEditor.ContextMenu> - <ContextMenu DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}"> - <MenuItem Header="Cut (Ctrl+X)" Command="{Binding CutCommand}" MinWidth="210"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Cut" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <MenuItem Header="Copy (Ctrl+C)" Command="{Binding CopyCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Copy" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <MenuItem Header="Paste (Ctrl+V)" Command="{Binding PasteCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Paste" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <Separator/> - <MenuItem Header="Undo (Ctrl+Z)" Command="{Binding UndoCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Undo" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <MenuItem Header="Redo (Ctrl+Y)" Command="{Binding RedoCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="RotateRight" Width="16"></fa:ImageAwesome> - </MenuItem.Icon> - </MenuItem> - <Separator/> - <MenuItem Header="Delete (DELETE)" Command="{Binding DeleteCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Recycle" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <Separator/> - <MenuItem Header="Select All (Ctrl+A)" Command="{Binding SelectAllCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Th" Width="16" /> - </MenuItem.Icon> - </MenuItem> - </ContextMenu> - </editors:ElementsEditor.ContextMenu> - </editors:ElementsEditor> + <Grid Grid.Column="1"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" Margin="0 -30 0 0" Text="{Binding SelectedTab.Editor.SelectedElement.HostedElement.TechName}" FontSize="16" FontWeight="Bold" FontStyle="Italic"></TextBlock> - <Slider Grid.Column="1" Orientation="Vertical" Margin="5" Maximum="3" Minimum="0.2" Value="{Binding ElementName=editor,Path=ScaleFactor}"></Slider> - </Grid> - - <Grid Grid.Column="1"> - <DockPanel> - <TextBlock DockPanel.Dock="Top" Margin="0 -30 0 0" DataContext="{Binding ElementName=editor,Path=SelectedElement.HostedElement}" Text="{Binding TechName}" FontSize="16" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <ScrollViewer VerticalScrollBarVisibility="Auto"> + <StackPanel> + <GroupBox DockPanel.Dock="Top" Header="BOUNDS" Padding="5"> + <StackPanel> + <!--Position--> + <UniformGrid Columns="2" Margin="0 5 0 0"> + <StackPanel Margin="0 0 5 0"> + <TextBlock>Left</TextBlock> + <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="0" Maximum="{Binding SelectedTab.Editor.EditorWidth}" Value="{Binding SelectedTab.Editor.SelectedElement.Left}"></mahapps:NumericUpDown> + </StackPanel> + <StackPanel Margin="5 0 0 0"> + <TextBlock>Top</TextBlock> + <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="0" Maximum="{Binding SelectedTab.Editor.EditorHeight}" Value="{Binding SelectedTab.Editor.SelectedElement.Top}"></mahapps:NumericUpDown> + </StackPanel> + </UniformGrid> - <ScrollViewer VerticalScrollBarVisibility="Auto"> - <StackPanel> - <GroupBox DockPanel.Dock="Top" Header="BOUNDS" Padding="5"> - <StackPanel> - <!--Position--> - <UniformGrid Columns="2" Margin="0 5 0 0"> - <StackPanel Margin="0 0 5 0"> - <TextBlock>Left</TextBlock> - <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="0" Maximum="{Binding ElementName=editor,Path=EditorWidth}" Value="{Binding ElementName=editor,Path=SelectedElement.Left}"></mahapps:NumericUpDown> - </StackPanel> - <StackPanel Margin="5 0 0 0"> - <TextBlock>Top</TextBlock> - <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="0" Maximum="{Binding ElementName=editor,Path=EditorHeight}" Value="{Binding ElementName=editor,Path=SelectedElement.Top}"></mahapps:NumericUpDown> - </StackPanel> - </UniformGrid> + <!--Size--> + <UniformGrid Columns="2" Margin="0 20 0 0"> + <StackPanel Margin="0 0 5 0"> + <TextBlock>Width</TextBlock> + <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="10" Maximum="{Binding SelectedTab.Editor.EditorWidth}" Value="{Binding SelectedTab.Editor.SelectedElement.Width}"></mahapps:NumericUpDown> + </StackPanel> + <StackPanel Margin="5 0 0 0"> + <TextBlock>Height</TextBlock> + <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="10" Maximum="{Binding SelectedTab.Editor.EditorHeight}" Value="{Binding SelectedTab.Editor.SelectedElement.Height}"></mahapps:NumericUpDown> + </StackPanel> + </UniformGrid> - <!--Size--> - <UniformGrid Columns="2" Margin="0 20 0 0"> - <StackPanel Margin="0 0 5 0"> - <TextBlock>Width</TextBlock> - <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="10" Maximum="{Binding ElementName=editor,Path=EditorWidth}" Value="{Binding ElementName=editor,Path=SelectedElement.Width}"></mahapps:NumericUpDown> - </StackPanel> - <StackPanel Margin="5 0 0 0"> - <TextBlock>Height</TextBlock> - <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="10" Maximum="{Binding ElementName=editor,Path=EditorHeight}" Value="{Binding ElementName=editor,Path=SelectedElement.Height}"></mahapps:NumericUpDown> - </StackPanel> - </UniformGrid> + <!--<Angle--> + <Grid Margin="0 20 0 0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="22*"></ColumnDefinition> + <ColumnDefinition Width="20*"></ColumnDefinition> + </Grid.ColumnDefinitions> + <TextBlock VerticalAlignment="Center" Margin="0 0 10 0" HorizontalAlignment="Left">Angle</TextBlock> + <mahapps:NumericUpDown Grid.Column="1" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Maximum="360" Minimum="-360" HasDecimals="False" Margin="0 5 0 0" Value="{Binding SelectedTab.Editor.SelectedElement.Angle}"></mahapps:NumericUpDown> + </Grid> + </StackPanel> + </GroupBox> + <ContentControl Margin="0 10 0 0" DataContext="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedTab.Editor.SelectedElement.HostedElement}" Content="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedTab.Editor.SelectedElement.HostedElement}"> + <ContentControl.Resources> + <DataTemplate DataType="{x:Type sys:Nullable}"> - <!--<Angle--> - <Grid Margin="0 20 0 0"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="22*"></ColumnDefinition> - <ColumnDefinition Width="20*"></ColumnDefinition> - </Grid.ColumnDefinitions> - <TextBlock VerticalAlignment="Center" Margin="0 0 10 0" HorizontalAlignment="Left">Angle</TextBlock> - <mahapps:NumericUpDown Grid.Column="1" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Maximum="360" Minimum="-360" HasDecimals="False" Margin="0 5 0 0" Value="{Binding ElementName=editor,Path=SelectedElement.Angle}"></mahapps:NumericUpDown> - </Grid> - </StackPanel> - </GroupBox> - <ContentControl Margin="0 10 0 0" DataContext="{Binding ElementName=editor,Path=SelectedElement.HostedElement}" Content="{Binding ElementName=editor,Path=SelectedElement.HostedElement}"> - <ContentControl.Resources> - <DataTemplate DataType="{x:Type sys:Nullable}"> - - </DataTemplate> - <DataTemplate DataType="{x:Type items:TextItem}"> - <templates:TextTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:JobRunnerItem}"> - <templates:JobRunnerTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:ProcessParametersItem}"> - <templates:ProcessParametersTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:BreakSensorItem}"> - <templates:BreakSensorTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:BlowerItem}"> - <templates:BlowerTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:SpeedSensorItem}"> - <templates:SpeedSensorTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:DancerItem}"> - <templates:DancerTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:WinderItem}"> - <templates:WinderTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:PidItem}"> - <templates:PidTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:ControllerItem}"> - <templates:ControllerTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:MonitorItem}"> - <templates:MonitorTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:DigitalInItem}"> - <templates:DigitalInTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:MotorGroupItem}"> - <templates:MotorGroupTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:ThreadMotionItem}"> - <templates:ThreadMotionTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:DigitalOutItem}"> - <templates:DigitalOutTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:DispenserItem}"> - <templates:DispenserTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:MotorItem}"> - <templates:MotorTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:MeterItem}"> - <templates:MeterTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:SingleGraphItem}"> - <templates:SingleGraphTemplate/> - </DataTemplate> - <DataTemplate DataType="{x:Type items:MultiGraphItem}"> - <templates:MultiGraphTemplate/> - </DataTemplate> - </ContentControl.Resources> - </ContentControl> - </StackPanel> - </ScrollViewer> - </DockPanel> + </DataTemplate> + <DataTemplate DataType="{x:Type items:MonitorRecorderItem}"> + <templates:MonitorRecorderTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:HeaterItem}"> + <templates:HeaterTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:TextItem}"> + <templates:TextTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:JobRunnerItem}"> + <templates:JobRunnerTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:ProcessParametersItem}"> + <templates:ProcessParametersTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:BreakSensorItem}"> + <templates:BreakSensorTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:BlowerItem}"> + <templates:BlowerTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:SpeedSensorItem}"> + <templates:SpeedSensorTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:DancerItem}"> + <templates:DancerTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:WinderItem}"> + <templates:WinderTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:PidItem}"> + <templates:PidTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:ControllerItem}"> + <templates:ControllerTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:MonitorItem}"> + <templates:MonitorTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:DigitalInItem}"> + <templates:DigitalInTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:MotorGroupItem}"> + <templates:MotorGroupTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:ThreadMotionItem}"> + <templates:ThreadMotionTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:DigitalOutItem}"> + <templates:DigitalOutTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:DispenserItem}"> + <templates:DispenserTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:MotorItem}"> + <templates:MotorTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:MeterItem}"> + <templates:MeterTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:SingleGraphItem}"> + <templates:SingleGraphTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:MultiGraphItem}"> + <templates:MultiGraphTemplate/> + </DataTemplate> + </ContentControl.Resources> + </ContentControl> + </StackPanel> + </ScrollViewer> + </DockPanel> + </Grid> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs index 977974f8a..694debd26 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs @@ -32,8 +32,6 @@ namespace Tango.MachineStudio.Technician.Views { _vm = DataContext as MachineTechViewVM; }; - - (editor.UndoRedoStatesProvider as ElementsEditorUndoRedoStatesProvider).StateExecuted += MachineTechView_StateExecuted; } private void MachineTechView_StateExecuted(object sender, UndoRedoStateExecutedEventArgs e) @@ -61,5 +59,13 @@ namespace Tango.MachineStudio.Technician.Views { //editor.DeselectElements(); } + + private void Editor_Loaded(object sender, RoutedEventArgs e) + { + ElementsEditor editor = sender as ElementsEditor; + (editor.DataContext as MachineTechTabVM).Editor = editor; + + (editor.UndoRedoStatesProvider as ElementsEditorUndoRedoStatesProvider).StateExecuted += MachineTechView_StateExecuted; + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config index ea48e62ff..adee6f7b4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config @@ -8,6 +8,8 @@ <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> + <package id="Microsoft.WindowsAPICodePack-Core" version="1.1.0.0" targetFramework="net472" /> + <package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net472" /> <package id="System.Reactive" version="3.1.1" targetFramework="net46" /> <package id="System.Reactive.Core" version="3.1.1" targetFramework="net46" /> <package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net46" /> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml index 33755f909..bf2e41afa 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml @@ -56,29 +56,29 @@ <ColumnDefinition Width="438*"/> </Grid.ColumnDefinitions> - <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1" Background="#90FFFFFF"> + <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1" Background="#E1151515"> <StackPanel Orientation="Horizontal"> - <components:YAxisScroll x:Name="yAxis" Interval="6" Graph="{Binding ElementName=Graph}" Width="35" Foreground="{StaticResource MaterialDesignLightForeground}" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll> + <components:YAxisScroll x:Name="yAxis" Interval="6" Graph="{Binding ElementName=Graph}" Width="35" Foreground="Gainsboro" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll> <components:YAxisTicks x:Name="yAxisTicks" SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=Graph}"></components:YAxisTicks> </StackPanel> </Border> - <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0"> - <graphEx:RealTimeGraphExLineErase x:Name="Graph" x:FieldModifier="public" UseAutoRange="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=UseAutoRange}" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" MarkerColor="{StaticResource graphsMarkerColor}" FillGraph="False" Stroke="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Color}" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum,Mode=TwoWay}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum,Mode=TwoWay}"> - <graphEx:RealTimeGraphExLineErase.Components> + <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="1 0 0 0"> + <graphEx:RealTimeGraphExLineScroll x:Name="Graph" x:FieldModifier="public" UseAutoRange="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=UseAutoRange}" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" FillGraph="False" Stroke="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Color}" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum,Mode=TwoWay}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum,Mode=TwoWay}"> + <graphEx:RealTimeGraphExLineScroll.Components> <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" /> - <components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines> - </graphEx:RealTimeGraphExLineErase.Components> - <graphEx:RealTimeGraphExLineErase.InnerContent> + <components:GridLines Rows="6" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines> + </graphEx:RealTimeGraphExLineScroll.Components> + <graphEx:RealTimeGraphExLineScroll.InnerContent> <Grid> <Label Style="{StaticResource graphLabel}"> <StackPanel Orientation="Horizontal"> - <TextBlock VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorName,FallbackValue='Dispenser Motor'}"></TextBlock> - <TextBlock Foreground="Gray" Margin="10 0 0 0" FontFamily="Sylfaen Regular" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorUnits,FallbackValue='(hz)'}"></TextBlock> + <TextBlock Foreground="Gainsboro" FontSize="11" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorName,FallbackValue='Dispenser Motor'}"></TextBlock> + <TextBlock Foreground="Gray" Margin="10 0 0 0" FontSize="11" FontFamily="Sylfaen Regular" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorUnits,FallbackValue='(hz)'}"></TextBlock> </StackPanel> </Label> </Grid> - </graphEx:RealTimeGraphExLineErase.InnerContent> - </graphEx:RealTimeGraphExLineErase> + </graphEx:RealTimeGraphExLineScroll.InnerContent> + </graphEx:RealTimeGraphExLineScroll> </Border> </Grid> </ContentControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml index 45b4aa9fb..4976739e4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml @@ -56,29 +56,29 @@ <ColumnDefinition Width="438*"/> </Grid.ColumnDefinitions> - <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1" Background="#90FFFFFF"> + <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1" Background="#E1151515"> <StackPanel Orientation="Horizontal"> - <components:YAxisScroll x:Name="yAxis" Interval="6" Graph="{Binding ElementName=Graph}" Width="35" Foreground="{StaticResource MaterialDesignLightForeground}" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll> + <components:YAxisScroll x:Name="yAxis" Interval="6" Graph="{Binding ElementName=Graph}" Width="35" Foreground="Gainsboro" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll> <components:YAxisTicks x:Name="yAxisTicks" SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=Graph}"></components:YAxisTicks> </StackPanel> </Border> - <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0"> - <graphEx:RealTimeGraphExMultiLineErase x:Name="Graph" x:FieldModifier="public" UseAutoRange="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=UseAutoRange}" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" MarkerColor="{StaticResource graphsMarkerColor}" FillGraph="False" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum,Mode=TwoWay}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum,Mode=TwoWay}" Stroke="DodgerBlue"> - <graphEx:RealTimeGraphExMultiLineErase.Components> + <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="1 0 0 0"> + <graphEx:RealTimeGraphExMultiLineScroll x:Name="Graph" x:FieldModifier="public" UseAutoRange="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=UseAutoRange}" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" FillGraph="False" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum,Mode=TwoWay}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum,Mode=TwoWay}" Stroke="DodgerBlue"> + <graphEx:RealTimeGraphExMultiLineScroll.Components> <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" /> - <components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines> - </graphEx:RealTimeGraphExMultiLineErase.Components> - <graphEx:RealTimeGraphExMultiLineErase.InnerContent> + <components:GridLines Rows="6" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines> + </graphEx:RealTimeGraphExMultiLineScroll.Components> + <graphEx:RealTimeGraphExMultiLineScroll.InnerContent> <Grid> <Label Style="{StaticResource graphLabel}"> <StackPanel Orientation="Horizontal"> - <TextBlock VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorName,FallbackValue='Dispensers Motors'}"></TextBlock> - <TextBlock Foreground="Gray" Margin="10 0 0 0" FontFamily="Sylfaen Regular" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorUnits,FallbackValue='(hz)'}"></TextBlock> + <TextBlock VerticalAlignment="Center" FontSize="11" Foreground="Gainsboro" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorName,FallbackValue='Dispensers Motors'}"></TextBlock> + <TextBlock Foreground="Gray" Margin="10 0 0 0" FontSize="11" FontFamily="Sylfaen Regular" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorUnits,FallbackValue='(hz)'}"></TextBlock> </StackPanel> </Label> </Grid> - </graphEx:RealTimeGraphExMultiLineErase.InnerContent> - </graphEx:RealTimeGraphExMultiLineErase> + </graphEx:RealTimeGraphExMultiLineScroll.InnerContent> + </graphEx:RealTimeGraphExMultiLineScroll> </Border> <Border Grid.Column="2" Margin="5 0 0 0" HorizontalAlignment="Right" Opacity="0.8"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index f54611d9c..22ed1a33d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -11,6 +11,13 @@ namespace Tango.MachineStudio.Common { public class MachineStudioSettings : SettingsBase { + public class StudioModuleBounds + { + public String Name { get; set; } + public Rect Bounds { get; set; } + public WindowState State { get; set; } + } + /// <summary> /// Gets or sets the last login email. /// </summary> @@ -67,6 +74,11 @@ namespace Tango.MachineStudio.Common public bool UseExternalBridgeEmulator { get; set; } /// <summary> + /// Gets or sets the studio modules bounds. + /// </summary> + public List<StudioModuleBounds> StudioModulesBounds { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="MachineStudio"/> class. /// </summary> public MachineStudioSettings() @@ -75,6 +87,7 @@ namespace Tango.MachineStudio.Common LoggingCategories = new List<LogCategory>(); UpdateServiceAddress = "http://twine01/MachineStudioUpdateService/MachineStudioUpdateService.svc"; DefaultIssueReportTags = new List<string>(); + StudioModulesBounds = new List<StudioModuleBounds>(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index 6fcf6dd72..acddeec6e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -199,7 +199,7 @@ <!--Colors--> <Color x:Key="borderColor">Silver</Color> - <Color x:Key="graphGridLinesColor">#FFE9E9E9</Color> + <Color x:Key="graphGridLinesColor">#FF464646</Color> <Color x:Key="graphsMarkerColor">Gray</Color> <Color x:Key="materialColor">#03A9F4</Color> @@ -222,18 +222,18 @@ </LinearGradientBrush> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackground"> - <GradientStop Color="White"/> - <GradientStop Color="#FFE9E9E9" Offset="1"/> + <GradientStop Color="#232323"/> + <GradientStop Color="#FF4B4B4B" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphLabelBackground" Opacity="0.7"> - <GradientStop Color="White"/> - <GradientStop Color="#FFD9D9D9" Offset="1"/> + <GradientStop Color="#252525"/> + <GradientStop Color="#FF4E4E4E" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphLegendBackground" Opacity="0.7"> - <GradientStop Color="#FFE9E9E9"/> - <GradientStop Color="#FFBDBDBD" Offset="1"/> + <GradientStop Color="#FF848484"/> + <GradientStop Color="#FF282828" Offset="1"/> </LinearGradientBrush> <SolidColorBrush Color="#FFF1F1F1" x:Key="topBarBackgroundBrush"></SolidColorBrush> @@ -251,7 +251,7 @@ <Setter.Value> <DataTemplate> <Border Width="Auto" Padding="0 0 20 0" Height="25" BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1" CornerRadius="0 0 30 0" Background="{StaticResource graphLabelBackground}" > - <Label Margin="5 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TinyFontSize}" Content="{Binding}"></Label> + <Label Margin="5 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="12" Content="{Binding}"></Label> </Border> </DataTemplate> </Setter.Value> @@ -302,7 +302,7 @@ </Style> </Ellipse.Style> </Ellipse> - <TextBlock FontSize="8" Text="{Binding Name}" VerticalAlignment="Center" Foreground="Black" FontWeight="DemiBold" HorizontalAlignment="Center"></TextBlock> + <TextBlock FontSize="8" Text="{Binding Name}" VerticalAlignment="Center" Foreground="Gainsboro" FontWeight="DemiBold" HorizontalAlignment="Center"></TextBlock> </Grid> </Grid> </ControlTemplate> @@ -484,7 +484,100 @@ </Style.Resources> </Style> + <Style x:Key="TechWidgetBorderLeft" TargetType="Border"> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush EndPoint="1,0"> + <GradientStop Color="#FF646464" Offset="1" /> + <GradientStop Color="#232323" Offset="0"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Setter Property="TextElement.Foreground" Value="Gainsboro"></Setter> + + <Style.Triggers> + <EventTrigger RoutedEvent="PreviewMouseDown"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[0].Color" To="#FF252525" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + <EventTrigger RoutedEvent="PreviewMouseUp"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[0].Color" To="#FF646464" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </Style.Triggers> + </Style> + <Style x:Key="TechWidgetBorderRight" TargetType="Border"> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush EndPoint="1,0"> + <GradientStop Color="#FF646464" Offset="0" /> + <GradientStop Color="#232323" Offset="1"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Style.Triggers> + <EventTrigger RoutedEvent="PreviewMouseDown"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[0].Color" To="#FF252525" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + <EventTrigger RoutedEvent="PreviewMouseUp"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[0].Color" To="#FF646464" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </Style.Triggers> + </Style> + + <Style x:Key="TechWidgetBorderCenter" TargetType="Border"> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> + <GradientStop Color="#232323" Offset="1" /> + <GradientStop Color="#FF646464" Offset="0"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Style.Triggers> + <EventTrigger RoutedEvent="PreviewMouseDown"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FF252525" 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="#FF646464" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </Style.Triggers> + </Style> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs index 63ff2119a..9ce79703f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs @@ -109,7 +109,10 @@ namespace Tango.MachineStudio.Common /// Called when the view has been attached /// </summary> /// <param name="view">The view.</param> - protected abstract void OnViewAttached(TView view); + protected virtual void OnViewAttached(TView view) + { + //Do Nothing. + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 09678b515..81b155748 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -300,7 +300,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config index 4147a78ec..0395c36bb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -87,6 +87,34 @@ <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory.Platform" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs index d774c14eb..bc11dfd18 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml.cs @@ -26,6 +26,14 @@ namespace Tango.MachineStudio.UI.Notifications { InitializeComponent(); this.Loaded += TextInputBoxWindow_Loaded; + + ContentRendered += TextInputBoxWindow_ContentRendered; + } + + private void TextInputBoxWindow_ContentRendered(object sender, EventArgs e) + { + txtText.Focus(); + txtText.SelectAll(); } private void TextInputBoxWindow_Loaded(object sender, RoutedEventArgs e) @@ -34,12 +42,8 @@ namespace Tango.MachineStudio.UI.Notifications ani.To = 1; ani.Duration = TimeSpan.FromSeconds(0.5); this.BeginAnimation(Window.OpacityProperty, ani); - - txtText.Focus(); } - - public String Hint { get { return (String)GetValue(HintProperty); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 29bb459ee..8eff9ea4e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -21,6 +21,7 @@ using Tango.BL.Enumerations; using Tango.Core.DI; using Tango.BL.Entities; using Tango.BL; +using Tango.MachineStudio.UI.ViewModels; namespace Tango.MachineStudio.UI.StudioApplication { @@ -45,7 +46,7 @@ namespace Tango.MachineStudio.UI.StudioApplication _navigationManager = navigationManager; _openedWindows = new List<Window>(); - Application.Current.MainWindow.ContentRendered += (_, __) => + Application.Current.MainWindow.ContentRendered += (_, __) => { TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>().ToList().ForEach(x => x.OnApplicationStarted()); }; @@ -150,8 +151,8 @@ namespace Tango.MachineStudio.UI.StudioApplication await Task.Factory.StartNew(async () => { - //Do Shutdown Procedures... - foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>()) + //Do Shutdown Procedures... + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>()) { try { @@ -173,7 +174,29 @@ namespace Tango.MachineStudio.UI.StudioApplication vm.OnShuttingDown(); } - SettingsManager.Default.GetOrCreate<MachineStudioSettings>().LastBounds = r; + + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + settings.LastBounds = r; + settings.StudioModulesBounds.Clear(); + + + foreach (var window in _openedWindows.OfType<Windows.ModuleWindow>()) + { + window.Invoke(() => + { + var context = window.ModuleContext; + + if (context != null) + { + settings.StudioModulesBounds.Add(new MachineStudioSettings.StudioModuleBounds() + { + Bounds = window.RestoreBounds, + State = window.WindowState, + Name = context.Module.Name, + }); + } + }); + } try { @@ -224,7 +247,7 @@ namespace Tango.MachineStudio.UI.StudioApplication catch (Exception ex) { IsShuttingDown = false; - LogManager.Log(ex,"An error occurred while shutting down machine studio."); + LogManager.Log(ex, "An error occurred while shutting down machine studio."); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 5a646e9c0..fce0e717f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -433,6 +433,10 @@ <Project>{d0ce8122-077d-42a2-9490-028ae4769b52}</Project> <Name>Tango.MachineStudio.MachineDesigner</Name> </ProjectReference> + <ProjectReference Include="..\Modules\Tango.MachineStudio.RML\Tango.MachineStudio.RML.csproj"> + <Project>{d0186ac0-0fcf-4d3b-9619-54812b6e524b}</Project> + <Name>Tango.MachineStudio.RML</Name> + </ProjectReference> <ProjectReference Include="..\Modules\Tango.MachineStudio.Stubs\Tango.MachineStudio.Stubs.csproj"> <Project>{22c2aa72-9493-4d0d-b421-8ef9789fb192}</Project> <Name>Tango.MachineStudio.Stubs</Name> @@ -579,7 +583,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_UpdateFileVersion="True" BuildVersion_DetectChanges="True" BuildVersion_UseGlobalSettings="False" /> + <UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 215f7afb5..4032c946c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -149,7 +149,7 @@ namespace Tango.MachineStudio.UI.ViewModels InvokeUI(() => { - _studioModuleLoader.LoadModules(); + //_studioModuleLoader.LoadModules(); _navigationManager.NavigateTo(NavigationView.LoginView); IsLoading = false; }); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 31b2181ea..cbd58134d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -47,7 +47,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Represents the Machine Studio main view, view model. /// </summary> /// <seealso cref="Tango.SharedUI.ViewModel{Tango.MachineStudio.UI.SupervisingController.IMainView}" /> - public class MainViewVM : ViewModel + public class MainViewVM : StudioViewModel { private IStudioModule _currentModule; private INavigationManager _navigation; @@ -296,7 +296,7 @@ namespace Tango.MachineStudio.UI.ViewModels ConnectCommand = new RelayCommand(ConnectToMachine); SignoutCommand = new RelayCommand(SignOut); DisconnectCommand = new RelayCommand(DisconnectFromMachine, (x) => ApplicationManager.IsMachineConnected && !_isDisconnecting); - OpenModuleInWindowCommand = new RelayCommand<IStudioModule>(OpenModuleInWindow); + OpenModuleInWindowCommand = new RelayCommand<IStudioModule>((x) => { OpenModuleInWindow(x); }); ExitCommand = new RelayCommand(ExitApplication); UpdateCenterCommand = new RelayCommand(NavigateToUpdateCenter); @@ -671,7 +671,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Opens the module in a new window. /// </summary> /// <param name="module">The module.</param> - private void OpenModuleInWindow(IStudioModule module) + private void OpenModuleInWindow(IStudioModule module, Rect? bounds = null, WindowState? state = null) { if (module == null) return; @@ -697,6 +697,20 @@ namespace Tango.MachineStudio.UI.ViewModels ModuleWindowVM vm = new ModuleWindowVM(module); ModuleWindow window = new ModuleWindow(this, vm, view); + if (bounds.HasValue) + { + window.WindowStartupLocation = WindowStartupLocation.Manual; + window.WindowState = WindowState.Normal; + window.Left = bounds.Value.Left; + window.Top = bounds.Value.Top; + window.Width = bounds.Value.Width; + window.Height = bounds.Value.Height; + window.Loaded += (_, __) => + { + window.WindowState = state.Value; + }; + } + window.Closing += (x, y) => { LogManager.Log(String.Format("Closing module '{0}' on new window...", module.Name)); @@ -847,5 +861,18 @@ namespace Tango.MachineStudio.UI.ViewModels console.Owner = MainWindow.Instance; console.Show(); } + + public override void OnApplicationReady() + { + foreach (var item in SettingsManager.Default.GetOrCreate<MachineStudioSettings>().StudioModulesBounds) + { + var module = StudioModuleLoader.AllModules.SingleOrDefault(x => x.Name == item.Name); + + if (module != null && !module.InNewWindow) + { + OpenModuleInWindow(module, item.Bounds, item.State); + } + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index 26790c67d..4e3de9e60 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -110,6 +110,12 @@ <TextBlock Text="{Binding Machine.Organization.Name}" /> <TextBlock FontWeight="SemiBold" Text="Embedded Software Version:" /> <TextBlock Text="{Binding DeviceInformation.Version}" /> + <TextBlock FontWeight="SemiBold" Text="FPGA Version:" /> + <TextBlock> + <Run Text="{Binding DeviceInformation.FPGA1Version}"></Run> • + <Run Text="{Binding DeviceInformation.FPGA2Version}"></Run> • + <Run Text="{Binding DeviceInformation.FPGA3Version}"></Run> + </TextBlock> <TextBlock FontWeight="SemiBold" Text="COM Port:" /> <TextBlock Text="{Binding ComPort}" /> <TextBlock FontWeight="SemiBold" Text="Device:" /> @@ -147,6 +153,14 @@ <TextBlock Text="{Binding Machine.Name}" /> <TextBlock FontWeight="SemiBold" Text="Organization:" /> <TextBlock Text="{Binding Machine.Organization.Name}" /> + <TextBlock FontWeight="SemiBold" Text="Embedded Software Version:" /> + <TextBlock Text="{Binding DeviceInformation.Version}" /> + <TextBlock FontWeight="SemiBold" Text="FPGA Version:" /> + <TextBlock> + <Run Text="{Binding DeviceInformation.FPGA1Version}"></Run> • + <Run Text="{Binding DeviceInformation.FPGA2Version}"></Run> • + <Run Text="{Binding DeviceInformation.FPGA3Version}"></Run> + </TextBlock> <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" /> <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" /> <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" /> |
