aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-11-25 10:44:37 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-11-25 10:44:37 +0200
commitbeff6af103bb0ae9b9147a907c6567bdb33abd00 (patch)
tree375eefd654c25f3b68c0cf5b3612df844a140d8e /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer
parent57f20269fbb4c591aa73c9f5e50118310cc4892e (diff)
parentdff24e56a8906b8c9b355cf407f25f4b793beafe (diff)
downloadTango-beff6af103bb0ae9b9147a907c6567bdb33abd00.tar.gz
Tango-beff6af103bb0ae9b9147a907c6567bdb33abd00.zip
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModuleSettings.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs27
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs11
4 files changed, 41 insertions, 3 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModuleSettings.cs
index 5e0e6d838..e6d5674e1 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModuleSettings.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModuleSettings.cs
@@ -22,6 +22,8 @@ namespace Tango.MachineStudio.Developer
public List<ParameterIndex> ProcessParametersIndices { get; set; }
+ public String DefaultJobRmlGuid { get; set; }
+
public DeveloperModuleSettings()
{
ProcessParametersIndices = new List<ParameterIndex>();
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 79b1f1c17..f15ffb2c7 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
@@ -1773,6 +1773,10 @@ namespace Tango.MachineStudio.Developer.ViewModels
SelectedMachineJob.Segments = SelectedMachineJob.Segments;
});
+ var settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>();
+ settings.DefaultJobRmlGuid = ActiveJob.RmlGuid;
+ settings.Save();
+
});
}
@@ -2015,16 +2019,37 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
LogManager.Log(String.Format("Adding new job {0}...", jobName));
+ var settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>();
+
Job newJob = new Job();
newJob.Name = jobName;
newJob.CreationDate = DateTime.UtcNow;
newJob.UserGuid = _authentication.CurrentUser.Guid;
- newJob.Rml = _machineDbContext.Rmls.FirstOrDefault();
+
+ if (String.IsNullOrWhiteSpace(settings.DefaultJobRmlGuid))
+ {
+ newJob.Rml = _machineDbContext.Rmls.FirstOrDefault();
+ }
+ else
+ {
+ var rml = _machineDbContext.Rmls.SingleOrDefault(x => x.Guid == settings.DefaultJobRmlGuid);
+ if (rml != null)
+ {
+ newJob.Rml = rml;
+ }
+ else
+ {
+ newJob.Rml = _machineDbContext.Rmls.FirstOrDefault();
+ }
+ }
+
newJob.WindingMethod = _machineDbContext.WindingMethods.FirstOrDefault();
newJob.SpoolType = _machineDbContext.SpoolTypes.FirstOrDefault();
newJob.ColorSpace = _machineDbContext.ColorSpaces.FirstOrDefault();
newJob.Machine = SelectedMachine;
+
+
SelectedMachine.Jobs.Add(newJob);
var segment = newJob.AddSolidSegment();
segment.BrushStops[0].SetAllDispensingStepDivisions(BL.Dispensing.DispenserStepDivisions.D8);
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 884f60875..9151cbaa0 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
@@ -311,7 +311,7 @@
</StackPanel>
</Border>
- <controls:MultiSelectListBox x:Name="listBoxSegments" AutomationProperties.AutomationId="{x:Static automation:Developer.SegmentsListBox}" Style="{StaticResource {x:Type ListBox}}" SelectionMode="Extended" SelectionChanged="ListBox_SelectionChanged" ItemsSource="{Binding SegmentsCollectionView}" SelectedItem="{Binding SelectedSegment}" SelectedItemsList="{Binding SelectedSegments,Mode=TwoWay}" HorizontalContentAlignment="Stretch">
+ <controls:MultiSelectListBox FocusVisualStyle="{x:Null}" x:Name="listBoxSegments" MouseEnter="listBoxSegments_MouseEnter" PreviewMouseDown="listBoxSegments_PreviewMouseDown" AutomationProperties.AutomationId="{x:Static automation:Developer.SegmentsListBox}" Style="{StaticResource {x:Type ListBox}}" SelectionMode="Extended" SelectionChanged="ListBox_SelectionChanged" ItemsSource="{Binding SegmentsCollectionView}" SelectedItem="{Binding SelectedSegment}" SelectedItemsList="{Binding SelectedSegments,Mode=TwoWay}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource basicListBoxItem}">
<EventSetter Event="PreviewMouseDown" Handler="ListBoxItem_PreviewMouseDown"></EventSetter>
@@ -555,7 +555,7 @@
<Image Source="../Images/ruler.png" Width="32"></Image>
<TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Segment Length</TextBlock>
</StackPanel>
- <mahapps:NumericUpDown FontSize="{StaticResource NumbersFontSize}" HideUpDownButtons="True" Width="90" HorizontalAlignment="Left" FontFamily="{StaticResource digital-7}" StringFormat="{}{0:N1} m" 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>
+ <mahapps:NumericUpDown x:Name="numSegmentLength" FontSize="{StaticResource NumbersFontSize}" HideUpDownButtons="True" Width="90" HorizontalAlignment="Left" FontFamily="{StaticResource digital-7}" StringFormat="{}{0:N1} m" 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,UpdateSourceTrigger=PropertyChanged}"></mahapps:NumericUpDown>
</StackPanel>
</Border>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
index f7e2e8260..d96f130ae 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
@@ -281,5 +281,16 @@ namespace Tango.MachineStudio.Developer.Views
{
listBoxSegments.SelectedItem = (sender as ListBoxItem).DataContext;
}
+
+ private void listBoxSegments_PreviewMouseDown(object sender, MouseButtonEventArgs e)
+ {
+
+ }
+
+ private void listBoxSegments_MouseEnter(object sender, MouseEventArgs e)
+ {
+ Keyboard.ClearFocus();
+ listBoxSegments.Focus();
+ }
}
}