diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-01-27 22:57:48 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-01-27 22:57:48 +0200 |
| commit | bfc6aeabda4b320f9365f5eef4c8f1bcab9b24af (patch) | |
| tree | 9dc44c02e8f4128232f0c4c4ae87115221131605 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer | |
| parent | 20482140c124fd1d5caaffcc9b0dfe853b30dd6f (diff) | |
| download | Tango-bfc6aeabda4b320f9365f5eef4c8f1bcab9b24af.tar.gz Tango-bfc6aeabda4b320f9365f5eef4c8f1bcab9b24af.zip | |
Added IDS_PACK_FORMULA.
Added necessary login to machine designer & db module.
Started working on job segments.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
6 files changed, 198 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png Binary files differnew file mode 100644 index 000000000..173e4c204 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png Binary files differnew file mode 100644 index 000000000..016666122 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png Binary files differnew file mode 100644 index 000000000..d0f85b83f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png 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 970556986..71527d1dc 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 @@ -188,5 +188,14 @@ <ItemGroup> <Resource Include="Images\video-frame.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\segment.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\segment-single.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\ruler.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.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 8f3d2a7e3..e77093eee 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 @@ -106,7 +106,22 @@ namespace Tango.MachineStudio.Developer.ViewModels public Job SelectedJob { get { return _selectedJob; } - set { _selectedJob = value; RaisePropertyChangedAuto(); } + set + { + _selectedJob = value; + RaisePropertyChangedAuto(); + OnSelectedJobChanged(); + } + } + + private Segment _selectedSegment; + /// <summary> + /// Gets or sets the job selected segment. + /// </summary> + public Segment SelectedSegment + { + get { return _selectedSegment; } + set { _selectedSegment = value; RaisePropertyChangedAuto(); } } private Rml _selectedRML; @@ -184,6 +199,26 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> public RelayCommand SaveLiquidFactorsCommand { get; set; } + /// <summary> + /// Gets or sets the add segment command. + /// </summary> + public RelayCommand AddSegmentCommand { get; set; } + + /// <summary> + /// Gets or sets the remove segment command. + /// </summary> + public RelayCommand RemoveSegmentCommand { get; set; } + + /// <summary> + /// Gets or sets the add job command. + /// </summary> + public RelayCommand AddJobCommand { get; set; } + + /// <summary> + /// Gets or sets the remove job command. + /// </summary> + public RelayCommand RemoveJobCommand { get; set; } + #endregion #region Constructors @@ -219,6 +254,10 @@ namespace Tango.MachineStudio.Developer.ViewModels ToggleSideBarCommand = new RelayCommand(() => IsSideBarOpened = !IsSideBarOpened); SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters); SaveLiquidFactorsCommand = new RelayCommand(SaveLiquidFactors); + AddSegmentCommand = new RelayCommand(AddSegment); + RemoveSegmentCommand = new RelayCommand(RemoveSegment); + AddJobCommand = new RelayCommand(AddJob); + RemoveJobCommand = new RelayCommand(RemoveJob); } #endregion @@ -240,6 +279,17 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Virtual Methods /// <summary> + /// Called when the selected job has been changed. + /// </summary> + private void OnSelectedJobChanged() + { + if (SelectedJob != null) + { + SelectedSegment = SelectedJob.Segments.FirstOrDefault(); + } + } + + /// <summary> /// Called when the selected group history has been changed /// </summary> protected virtual void OnSelectedGroupHistoryChanged() @@ -358,6 +408,58 @@ namespace Tango.MachineStudio.Developer.ViewModels } } + /// <summary> + /// Removes the selected segment. + /// </summary> + private void RemoveSegment() + { + if (SelectedJob != null && SelectedSegment != null) + { + SelectedSegment.DefferedDelete(); + SelectedJob.Segments.Remove(SelectedSegment); + } + } + + /// <summary> + /// Adds a new segment. + /// </summary> + private void AddSegment() + { + if (SelectedJob != null) + { + Segment seg = new Segment(); + seg.Name = "New Seg"; + SelectedJob.Segments.Add(seg); + } + } + + /// <summary> + /// Removes the selected job. + /// </summary> + private void RemoveJob() + { + if (SelectedMachine != null && SelectedJob != null) + { + SelectedJob.Delete(); + SelectedMachine.Jobs.Remove(SelectedJob); + } + } + + /// <summary> + /// Adds a new job to the selected machine. + /// </summary> + private void AddJob() + { + if (SelectedMachine != null) + { + SelectedMachine.Jobs.Add(new Job() + { + Name = "New Job", + CreationDate = DateTime.UtcNow, + }); + } + } + #endregion #region Public Events diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 243165cd5..b971d9124 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -398,6 +398,14 @@ <Rectangle VerticalAlignment="Bottom" StrokeDashArray="7" StrokeThickness="1" Stroke="Silver" Margin="0 8 0 0"></Rectangle> </StackPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right"> + <Button Command="{Binding RemoveJobCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove Segment"> + <materialDesign:PackIcon Kind="Minus" Width="24" Height="24"></materialDesign:PackIcon> + </Button> + <Button Command="{Binding AddJobCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Add Segment"> + <materialDesign:PackIcon Kind="Plus" Width="24" Height="24"></materialDesign:PackIcon> + </Button> + </StackPanel> <ListBox ItemsSource="{Binding SelectedMachine.Jobs}" SelectedItem="{Binding SelectedJob}" Margin="0 10 0 0"> <ListBox.ItemTemplate> <DataTemplate> @@ -425,6 +433,10 @@ <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> <StackPanel> <Grid> <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> @@ -494,7 +506,81 @@ <Border BorderThickness="1" BorderBrush="Silver" CornerRadius="5" Margin="0 0 5 5"> <TextBox Style="{x:Null}" BorderThickness="0" Margin="5" Height="80" Text="{Binding SelectedJob.Description}" VerticalAlignment="Stretch" materialDesign:HintAssist.Hint="Enter description" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"></TextBox> </Border> + + </StackPanel> + + <Grid Grid.Row="1" Margin="0 10 0 0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="200"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <DockPanel> + <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> + <Image Source="../Images/segment.png" Width="42"></Image> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Foreground="DimGray" FontSize="16" FontWeight="SemiBold">SEGMENTS</TextBlock> + </StackPanel> + + <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right"> + <Button Command="{Binding RemoveSegmentCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove Segment"> + <materialDesign:PackIcon Kind="Minus" Width="24" Height="24"></materialDesign:PackIcon> + </Button> + <Button Command="{Binding AddSegmentCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Add Segment"> + <materialDesign:PackIcon Kind="Plus" Width="24" Height="24"></materialDesign:PackIcon> + </Button> + </StackPanel> + + <ListBox ItemsSource="{Binding SelectedJob.Segments}" SelectedItem="{Binding SelectedSegment}"> + <ListBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="0 5 0 0"> + <Image Source="../Images/segment-single.png" Width="24"></Image> + <TextBlock Margin="5 0 0 0" Text="{Binding Name}" FontSize="12" FontWeight="SemiBold" VerticalAlignment="Center"></TextBlock> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </DockPanel> + + <Grid Grid.Column="1" Margin="10 5 0 0"> + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> + <Image Source="../Images/segment-single.png" Width="24"></Image> + <TextBlock Margin="5 0 0 0" Text="{Binding SelectedSegment.Name,FallbackValue=''}" FontSize="16" FontWeight="SemiBold" VerticalAlignment="Center"></TextBlock> + </StackPanel> + + <Grid Margin="0 10 0 0"> + <DockPanel> + <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> + <Border Style="{StaticResource JobFieldBorder}"> + <StackPanel Margin="5" Width="140"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/name.png" Width="32"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Name</TextBlock> + </StackPanel> + <TextBox Margin="0 3 0 0" Text="{Binding SelectedSegment.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox> + </StackPanel> + </Border> + <Border Style="{StaticResource JobFieldBorder}"> + <StackPanel Margin="5" Width="140"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/ruler.png" Width="32"></Image> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Length</TextBlock> + </StackPanel> + <mahapps:NumericUpDown IsEnabled="{Binding SelectedJob.EnableInterSegment}" Margin="0 2 0 0" Minimum="1" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding SelectedSegment.Length,Mode=TwoWay}"></mahapps:NumericUpDown> + </StackPanel> + </Border> + </StackPanel> + + <Grid> + + </Grid> + </DockPanel> + </Grid> + </DockPanel> + </Grid> + </Grid> </Grid> <Grid Grid.Column="1" Margin="10 0 0 0" Width="340"> |
