diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-01-02 08:47:29 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-01-02 08:47:29 +0200 |
| commit | 520e878bf98efcec9c75abcfe483175ff72620a2 (patch) | |
| tree | 62a7221e3c22187821f6a5e399eca0f7bd31168a /Software/Visual_Studio/PPC/Modules | |
| parent | 30574fe4a6e1bb4f60a43e9000acaf919811689a (diff) | |
| parent | 25f5e6ddef7ef2fa0a747305847eeb4ceee5a2c9 (diff) | |
| download | Tango-520e878bf98efcec9c75abcfe483175ff72620a2.tar.gz Tango-520e878bf98efcec9c75abcfe483175ff72620a2.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
49 files changed, 1367 insertions, 210 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs index 2b4a5a75b..81b6e5942 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs @@ -88,7 +88,7 @@ namespace Tango.PPC.Events.ViewModels notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Error; break; case EventTypesCategories.Critical: - notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Error; + notificationItem.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Critical; break; } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs new file mode 100644 index 000000000..8efd46e18 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Integration.Operation; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Jobs.AppButtons +{ + public class StartPrintingButton : AppButton + { + public StartPrintingButton(RelayCommand command, IMachineOperator op) : base("START DYEING", command) + { + op.StatusChanged += Op_StatusChanged; + + Op_StatusChanged(this, op.Status); + } + + private void Op_StatusChanged(object sender, MachineStatuses status) + { + IsEnabled = status == MachineStatuses.ReadyToDye; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StopPrintingButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StopPrintingButton.cs new file mode 100644 index 000000000..8c3b444b3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StopPrintingButton.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Jobs.AppButtons +{ + public class StopPrintingButton : AppButton + { + public StopPrintingButton() : base("STOP DYEING", true) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobCollectionToCategoryCountConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobCollectionToCategoryCountConverter.cs deleted file mode 100644 index 4f91866b9..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobCollectionToCategoryCountConverter.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Data; -using Tango.BL.Entities; -using Tango.BL.Enumerations; - -namespace Tango.PPC.Jobs.Converters -{ - /// <summary> - /// Filters the job collection by the specified <see cref="JobCategories"/>. - /// </summary> - /// <seealso cref="System.Windows.Data.IMultiValueConverter" /> - public class JobCollectionToCategoryCountConverter : IMultiValueConverter - { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) - { - IList<Job> jobs = values[0] as IList<Job>; - - JobCategories category = (JobCategories)values[1]; - - if (jobs != null) - { - return jobs.Where(x => x.JobCategories.Contains(category)).Count().ToString(); - } - - return "0"; - } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToVisibilityConverter.cs new file mode 100644 index 000000000..e602a99fc --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToVisibilityConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using static Tango.PPC.Jobs.ViewModels.JobsViewVM; + +namespace Tango.PPC.Jobs.Converters +{ + public class JobsCategoryToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + JobsCategory selected = (JobsCategory)Enum.Parse(typeof(JobsCategory), parameter.ToString()); + JobsCategory category = (JobsCategory)value; + + return category.Equals(selected) ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml index 4317264ee..69eb1fd72 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml @@ -37,7 +37,7 @@ <DockPanel Grid.Row="2" Margin="0 0 0 0"> <TextBlock DockPanel.Dock="Top" Margin="40 0 0 0">Please select the best alternative</TextBlock> - <hive:HexList Width="340" Height="460" Margin="0 20 0 0" RowCount="6" ColumnCount="5" ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion,Mode=TwoWay}"> + <hive:HexList Width="330" Height="460" Margin="0 20 0 0" RowCount="6" ColumnCount="5" ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion,Mode=TwoWay}"> <hive:HexList.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionViewVM.cs index f772edb0a..3cfedd3f0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionViewVM.cs @@ -43,10 +43,16 @@ namespace Tango.PPC.Jobs.Dialogs /// </summary> public List<ColorConversionSuggestion> Suggestions { get; set; } + + private ColorConversionSuggestion _selectedSuggestion; /// <summary> /// Gets or sets the selected suggestion. /// </summary> - public ColorConversionSuggestion SelectedSuggestion { get; set; } + public ColorConversionSuggestion SelectedSuggestion + { + get { return _selectedSuggestion; } + set { _selectedSuggestion = value; RaisePropertyChangedAuto(); } + } /// <summary> /// Gets or sets the more options command. @@ -82,5 +88,14 @@ namespace Tango.PPC.Jobs.Dialogs Result = ColorCorrectionDialogResult.None; base.Cancel(); } + + /// <summary> + /// Called when the dialog has been shown. + /// </summary> + public override void OnShow() + { + base.OnShow(); + SelectedSuggestion = Suggestions.GetCenterSuggestion(); + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml index cbec4afd8..0d6faa092 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml @@ -29,9 +29,7 @@ <Setter Property="Content"> <Setter.Value> <Ellipse Width="70" Height="70" Fill="{Binding Brush}" HorizontalAlignment="Center"> - <Ellipse.Effect> - <DropShadowEffect Color="{StaticResource TangoDropShadowColor}" ShadowDepth="10" Direction="10" BlurRadius="15" Opacity="1" /> - </Ellipse.Effect> + </Ellipse> </Setter.Value> </Setter> @@ -88,7 +86,7 @@ </touch:TouchButton> </DockPanel> - <hive:HexList Width="340" Height="460" Margin="0 40 0 0" RowCount="6" ColumnCount="5" ItemsSource="{Binding HiveSuggestions}" SelectedItem="{Binding SelectedHiveSuggestion,Mode=TwoWay}"> + <hive:HexList Width="330" Height="460" Margin="0 40 0 0" RowCount="6" ColumnCount="5" ItemsSource="{Binding HiveSuggestions}" SelectedItem="{Binding SelectedHiveSuggestion,Mode=TwoWay}"> <hive:HexList.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml index df524aafb..6d719aba9 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml @@ -10,8 +10,8 @@ <Grid Margin="20"> <DockPanel> <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Orientation="Horizontal"> - <touch:TouchButton Command="{Binding CloseCommand}" CornerRadius="25" Style="{StaticResource TangoMessageBoxButton}" HorizontalContentAlignment="Center" DockPanel.Dock="Right" Width="120" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> - <touch:TouchButton Command="{Binding OKCommand}" CornerRadius="25" Style="{StaticResource TangoMessageBoxButton}" Foreground="{StaticResource TangoPrimaryAccentBrush}" HorizontalContentAlignment="Center" DockPanel.Dock="Right" Width="120" Height="50" VerticalAlignment="Bottom">IMPORT</touch:TouchButton> + <touch:TouchButton Command="{Binding CloseCommand}" Style="{StaticResource TangoMessageBoxButton}" DockPanel.Dock="Right" Width="120" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> + <touch:TouchButton Command="{Binding OKCommand}" Style="{StaticResource TangoMessageBoxButton}" DockPanel.Dock="Right" Width="120" Height="50" VerticalAlignment="Bottom">IMPORT</touch:TouchButton> </StackPanel> <StackPanel> <Image Source="../Images/job.png" Stretch="Uniform" Height="120"></Image> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml new file mode 100644 index 000000000..1f48474aa --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml @@ -0,0 +1,84 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.JobCreationView" + 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:converters="clr-namespace:Tango.PPC.Jobs.Converters" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="550" Height="750" d:DataContext="{d:DesignInstance Type=local:JobCreationViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:JobTypeToImageConverter x:Key="JobTypeToImageConverter" /> + + </UserControl.Resources> + + <Grid Margin="20"> + + <DockPanel> + <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Orientation="Horizontal"> + <touch:TouchButton Command="{Binding CloseCommand}" Style="{StaticResource TangoMessageBoxButton}" DockPanel.Dock="Right" Width="120" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> + <touch:TouchButton Command="{Binding OKCommand}" Style="{StaticResource TangoMessageBoxButton}" DockPanel.Dock="Right" Width="120" Height="50" VerticalAlignment="Bottom">CREATE</touch:TouchButton> + </StackPanel> + <StackPanel> + <touch:TouchIcon HorizontalAlignment="Center" Icon="PlusCircle" Foreground="{StaticResource TangoSuccessBrush}" Height="80" /> + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">NEW JOB</TextBlock> + <TextBlock Margin="20 20" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">Please select the job application and color space/catalog and press 'CREATE'.</TextBlock> + + <touch:TouchStaticListBox Margin="20" ItemsSource="{Binding SupportedJobTypes}" SelectedItem="{Binding SelectedJobType,Mode=TwoWay}"> + <touch:TouchStaticListBox.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Rows="1" /> + </ItemsPanelTemplate> + </touch:TouchStaticListBox.ItemsPanel> + <touch:TouchStaticListBox.ItemContainerStyle> + <Style TargetType="touch:TouchStaticListBoxItem"> + <Setter Property="Opacity" Value="0.5"></Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Opacity" Value="1"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchStaticListBox.ItemContainerStyle> + <touch:TouchStaticListBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Vertical" HorizontalAlignment="Center"> + <Image Stretch="Fill" Width="60" RenderOptions.BitmapScalingMode="Fant" Height="60" Source="{Binding Converter={StaticResource JobTypeToImageConverter}}"></Image> + <TextBlock HorizontalAlignment="Center" Margin="0 5 0 0" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}" FontSize="{StaticResource TangoButtonFontSize}"></TextBlock> + </StackPanel> + </DataTemplate> + </touch:TouchStaticListBox.ItemTemplate> + </touch:TouchStaticListBox> + + <touch:TouchStaticListBox Margin="20 100 20 20" ItemsSource="{Binding SupportedColorSpaces}" SelectedItem="{Binding SelectedColorSpace,Mode=TwoWay}"> + <touch:TouchStaticListBox.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Rows="1" /> + </ItemsPanelTemplate> + </touch:TouchStaticListBox.ItemsPanel> + <touch:TouchStaticListBox.ItemContainerStyle> + <Style TargetType="touch:TouchStaticListBoxItem"> + <Setter Property="Opacity" Value="0.5"></Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Opacity" Value="1"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchStaticListBox.ItemContainerStyle> + <touch:TouchStaticListBox.ItemTemplate> + <DataTemplate> + <Border BorderBrush="{StaticResource TangoLightBorderBrush}" BorderThickness="1" Padding="20" Margin="5" Background="Transparent"> + <TextBlock HorizontalAlignment="Center" Text="{Binding}" FontSize="{StaticResource TangoDefaultFontSize}"></TextBlock> + </Border> + </DataTemplate> + </touch:TouchStaticListBox.ItemTemplate> + </touch:TouchStaticListBox> + </StackPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml.cs index 217ee5c9c..4d57794d7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml.cs @@ -17,16 +17,16 @@ using Tango.BL.Enumerations; namespace Tango.PPC.Jobs.Dialogs { /// <summary> - /// Represents the JobType selection dialog. + /// Represents the new job creation dialog. /// </summary> /// <seealso cref="System.Windows.Controls.UserControl" /> /// <seealso cref="System.Windows.Markup.IComponentConnector" /> - public partial class JobTypePickerView : UserControl + public partial class JobCreationView : UserControl { /// <summary> - /// Initializes a new instance of the <see cref="JobTypePickerView"/> class. + /// Initializes a new instance of the <see cref="JobCreationView"/> class. /// </summary> - public JobTypePickerView() + public JobCreationView() { InitializeComponent(); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationViewVM.cs index db5737013..e2176c6af 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationViewVM.cs @@ -12,45 +12,55 @@ namespace Tango.PPC.Jobs.Dialogs /// Represents the a job type picker view model /// </summary> /// <seealso cref="Tango.SharedUI.DialogViewVM" /> - public class JobTypePickerViewVM : DialogViewVM + public class JobCreationViewVM : DialogViewVM { /// <summary> /// Gets or sets the supported job types. /// </summary> public List<JobTypes> SupportedJobTypes { get; set; } - private JobTypes? _selectedJobType; + private JobTypes _selectedJobType; /// <summary> /// Gets or sets the type of the selected job. /// </summary> - public JobTypes? SelectedJobType + public JobTypes SelectedJobType { get { return _selectedJobType; } set { _selectedJobType = value; - OnSelectedJobTypeChanged(); + RaisePropertyChangedAuto(); } } /// <summary> - /// Initializes a new instance of the <see cref="JobTypePickerViewVM"/> class. + /// Gets or sets the supported color spaces. /// </summary> - /// <param name="supportedJobTypes">The supported job types.</param> - public JobTypePickerViewVM(List<JobTypes> supportedJobTypes) : base() - { - SupportedJobTypes = supportedJobTypes; - } + public List<ColorSpaces> SupportedColorSpaces { get; set; } + private ColorSpaces _selectedColorSpace; /// <summary> - /// Called when the selected job type has been changed + /// Gets or sets the selected color space. /// </summary> - private void OnSelectedJobTypeChanged() + public ColorSpaces SelectedColorSpace { - if (SelectedJobType.HasValue) + get { return _selectedColorSpace; } + set { - Accept(); + _selectedColorSpace = value; + RaisePropertyChangedAuto(); } } + + /// <summary> + /// Initializes a new instance of the <see cref="JobCreationViewVM"/> class. + /// </summary> + /// <param name="supportedJobTypes">The supported job types.</param> + /// <param name="supportedColorSpaces">The supported color spaces</param> + public JobCreationViewVM(List<JobTypes> supportedJobTypes,List<ColorSpaces> supportedColorSpaces) : base() + { + SupportedJobTypes = supportedJobTypes; + SupportedColorSpaces = supportedColorSpaces; + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml deleted file mode 100644 index 814f73eb1..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml +++ /dev/null @@ -1,49 +0,0 @@ -<UserControl x:Class="Tango.PPC.Jobs.Dialogs.JobTypePickerView" - 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:local="clr-namespace:Tango.PPC.Jobs.Dialogs" - xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" - xmlns:converters="clr-namespace:Tango.PPC.Jobs.Converters" - xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" - xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" - mc:Ignorable="d" - Background="{StaticResource TangoPrimaryBackgroundBrush}" Width="600" Height="380" d:DataContext="{d:DesignInstance Type=local:JobTypePickerViewVM, IsDesignTimeCreatable=False}"> - - <UserControl.Resources> - <converters:JobTypeToImageConverter x:Key="JobTypeToImageConverter" /> - - </UserControl.Resources> - - <Grid> - <Grid Margin="20"> - <Grid.RowDefinitions> - <RowDefinition Height="40"/> - <RowDefinition Height="1*"/> - <RowDefinition Height="0"/> - </Grid.RowDefinitions> - - <TextBlock VerticalAlignment="Center" Text="Select Job Application" FontSize="{StaticResource TangoMessageBoxTitleFontSize}"></TextBlock> - - <touch:TouchNativeListBox RippleFactor="10" Grid.Row="1" Margin="0 15 0 0" ItemsSource="{Binding SupportedJobTypes}" SelectedItem="{Binding SelectedJobType,Mode=OneWayToSource}" SelectedIndex="-1"> - <ListBox.ItemTemplate> - <DataTemplate> - <Border Padding="0 15"> - <StackPanel Orientation="Horizontal"> - <Image Stretch="Fill" Width="60" RenderOptions.BitmapScalingMode="Fant" Height="60" Source="{Binding Converter={StaticResource JobTypeToImageConverter}}"></Image> - <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}" FontSize="{StaticResource TangoButtonFontSize}"></TextBlock> - </StackPanel> - </Border> - </DataTemplate> - </ListBox.ItemTemplate> - </touch:TouchNativeListBox> - - <!--<Grid Grid.Row="3"> - <StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> - <touch:TouchButton Command="{Binding CloseCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" Width="170" Height="50" VerticalAlignment="Bottom">CLOSE</touch:TouchButton> - </StackPanel> - </Grid>--> - </Grid> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/SpoolChangeView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/SpoolChangeView.xaml new file mode 100644 index 000000000..c0874363f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/SpoolChangeView.xaml @@ -0,0 +1,32 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.SpoolChangeView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + mc:Ignorable="d" + Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="630" d:DesignWidth="560" MinWidth="560" Height="700" d:DataContext="{d:DesignInstance Type=local:SpoolChangeViewVM, IsDesignTimeCreatable=False}"> + + <Grid Margin="20"> + <DockPanel> + <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Orientation="Horizontal"> + <touch:TouchButton Command="{Binding CloseCommand}" Style="{StaticResource TangoMessageBoxButton}" DockPanel.Dock="Right" Width="140" Height="50" VerticalAlignment="Bottom">ABORT</touch:TouchButton> + <touch:TouchButton Command="{Binding OKCommand}" Style="{StaticResource TangoMessageBoxButton}" DockPanel.Dock="Right" Width="140" Height="50" VerticalAlignment="Bottom">CONTINUE</touch:TouchButton> + </StackPanel> + <StackPanel> + <Image Source="../Images/spool_replace.png" Stretch="Uniform" Height="200" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">SPOOL CHANGE</TextBlock> + <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"> + <Run>The current job was set to dye each color segment on a single spool.</Run> + <LineBreak/> + <Run>Please replace the spool and press 'continue'.</Run> + </TextBlock> + + <TextBlock FontSize="{StaticResource TangoHeaderFontSize}" Foreground="{StaticResource TangoPrimaryAccentBrush}" HorizontalAlignment="Center" Margin="0 50 0 0"> + <Run Text="{Binding SpoolChangeRequiredEventArgs.CurrentSegment}"></Run><Run>/</Run><Run Text="{Binding SpoolChangeRequiredEventArgs.TotalSegments}"></Run> + </TextBlock> + </StackPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/SpoolChangeView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/SpoolChangeView.xaml.cs new file mode 100644 index 000000000..f79e1f4b7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/SpoolChangeView.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.PPC.Jobs.Dialogs +{ + /// <summary> + /// Interaction logic for SpoolChangeView.xaml + /// </summary> + public partial class SpoolChangeView : UserControl + { + public SpoolChangeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/SpoolChangeViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/SpoolChangeViewVM.cs new file mode 100644 index 000000000..8942cb284 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/SpoolChangeViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operation; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class SpoolChangeViewVM : DialogViewVM + { + public SpoolChangeRequiredEventArgs SpoolChangeRequiredEventArgs { get; set; } + + public SpoolChangeViewVM(SpoolChangeRequiredEventArgs spoolChangeRequiredEventArgs) + { + SpoolChangeRequiredEventArgs = spoolChangeRequiredEventArgs; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small.png Binary files differnew file mode 100644 index 000000000..e29b5fb67 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small_gray.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small_gray.png Binary files differnew file mode 100644 index 000000000..828379648 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small_gray.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small.png Binary files differnew file mode 100644 index 000000000..6e4e56fe0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small_gray.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small_gray.png Binary files differnew file mode 100644 index 000000000..edf3bf0dd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small_gray.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/spool_change.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/spool_change.png Binary files differnew file mode 100644 index 000000000..17737eed0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/spool_change.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/spool_replace.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/spool_replace.png Binary files differnew file mode 100644 index 000000000..0adf7e7d4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/spool_replace.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs index 3387477ed..259f6031b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Enumerations; using Tango.Settings; namespace Tango.PPC.Jobs @@ -19,6 +20,16 @@ namespace Tango.PPC.Jobs public List<String> RecentTwineCatalogColors { get; set; } /// <summary> + /// Gets or sets the last job color space. + /// </summary> + public ColorSpaces? LastJobColorSpace { get; set; } + + /// <summary> + /// Gets or sets the new job last type. + /// </summary> + public JobTypes? LastJobType { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="JobsModuleSettings"/> class. /// </summary> public JobsModuleSettings() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index c82512ef6..6830f2ec5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -100,7 +100,11 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Dialogs\JobTypePickerView.xaml"> + <Page Include="Dialogs\JobCreationView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\SpoolChangeView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> @@ -141,6 +145,8 @@ <Compile Include="AppBarItems\JobProgressAppBarItemView.xaml.cs"> <DependentUpon>JobProgressAppBarItemView.xaml</DependentUpon> </Compile> + <Compile Include="AppButtons\StartPrintingButton.cs" /> + <Compile Include="AppButtons\StopPrintingButton.cs" /> <Compile Include="Controls\RunningJobViewer.xaml.cs"> <DependentUpon>RunningJobViewer.xaml</DependentUpon> </Compile> @@ -150,8 +156,8 @@ <Compile Include="Controls\TwineCatalogViewer.xaml.cs"> <DependentUpon>TwineCatalogViewer.xaml</DependentUpon> </Compile> - <Compile Include="Converters\JobCollectionToCategoryCountConverter.cs" /> <Compile Include="Converters\JobProgressToPositionConverter.cs" /> + <Compile Include="Converters\JobsCategoryToVisibilityConverter.cs" /> <Compile Include="Converters\JobToPieImageConverter.cs" /> <Compile Include="Converters\JobTypeToImageConverter.cs" /> <Compile Include="Dialogs\AdvancedColorCorrectionView.xaml.cs"> @@ -170,10 +176,14 @@ <DependentUpon>ImportJobView.xaml</DependentUpon> </Compile> <Compile Include="Dialogs\ImportJobViewVM.cs" /> - <Compile Include="Dialogs\JobTypePickerView.xaml.cs"> - <DependentUpon>JobTypePickerView.xaml</DependentUpon> + <Compile Include="Dialogs\JobCreationView.xaml.cs"> + <DependentUpon>JobCreationView.xaml</DependentUpon> </Compile> - <Compile Include="Dialogs\JobTypePickerViewVM.cs" /> + <Compile Include="Dialogs\JobCreationViewVM.cs" /> + <Compile Include="Dialogs\SpoolChangeView.xaml.cs"> + <DependentUpon>SpoolChangeView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\SpoolChangeViewVM.cs" /> <Compile Include="JobsModule.cs" /> <Compile Include="JobsModuleSettings.cs" /> <Compile Include="Messages\JobSelectedMessage.cs" /> @@ -367,10 +377,24 @@ <ItemGroup> <Resource Include="Images\job.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\spool_change.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\spool_replace.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\color_approved_small.png" /> + <Resource Include="Images\sample_approved_small.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\color_approved_small_gray.png" /> + <Resource Include="Images\sample_approved_small_gray.png" /> + </ItemGroup> <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/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index 387b3e6a0..264f41131 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -8,6 +8,8 @@ using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; using Tango.PPC.Jobs.AppBarItems; +using Tango.PPC.Jobs.AppButtons; +using Tango.PPC.Jobs.Dialogs; using Tango.PPC.Jobs.Views; namespace Tango.PPC.Jobs.ViewModels @@ -18,6 +20,9 @@ namespace Tango.PPC.Jobs.ViewModels /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> public class JobProgressViewVM : PPCViewModel { + private StopPrintingButton _stop_job_btn; + private JobHandler _handler; + #region Properties private Job _job; @@ -42,6 +47,20 @@ namespace Tango.PPC.Jobs.ViewModels #endregion + public JobProgressViewVM() + { + _stop_job_btn = new StopPrintingButton(); + _stop_job_btn.Pressed += _stop_job_btn_Pressed; + } + + private void _stop_job_btn_Pressed() + { + if (_handler != null) + { + _handler.Cancel(); + } + } + #region Override Methods /// <summary> @@ -80,6 +99,8 @@ namespace Tango.PPC.Jobs.ViewModels { NotificationProvider.CurrentAppBarItem.Close(); } + + _stop_job_btn.Push(); } #endregion @@ -93,12 +114,34 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="e">The <see cref="PrintingEventArgs"/> instance containing the event data.</param> private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { + _handler = e.JobHandler; Job = e.Job; e.JobHandler.StatusChanged += JobHandler_StatusChanged; + e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; e.JobHandler.Stopped += JobHandler_Stopped; } /// <summary> + /// Handles the SpoolChangeRequired event of the JobHandler. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="SpoolChangeRequiredEventArgs"/> instance containing the event data.</param> + private void JobHandler_SpoolChangeRequired(object sender, SpoolChangeRequiredEventArgs e) + { + InvokeUI(async () => + { + if ((await NotificationProvider.ShowDialog(new SpoolChangeViewVM(e))).DialogResult) + { + e.Confirm(); + } + else + { + e.Abort(); + } + }); + } + + /// <summary> /// Handles the Stopped event of the JobHandler. /// </summary> /// <param name="sender">The source of the event.</param> @@ -109,6 +152,8 @@ namespace Tango.PPC.Jobs.ViewModels { NotificationProvider.CurrentAppBarItem.Close(); } + + _stop_job_btn.Pop(); } /// <summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index b009762b4..6a05eee12 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -30,6 +30,7 @@ using Tango.PPC.Common.Models; using Tango.Logging; using Tango.PPC.Common.Messages; using Tango.BL.Builders; +using Tango.PPC.Jobs.AppButtons; namespace Tango.PPC.Jobs.ViewModels { @@ -45,6 +46,7 @@ namespace Tango.PPC.Jobs.ViewModels private Job _job_to_load; private JobNavigationIntent _job_to_load_intent; private static Dictionary<String, List<FineTuneItem>> _jobs_fine_tune_items; + private StartPrintingButton _start_printing_btn; #region Properties @@ -458,6 +460,8 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log("Directing view to display fine tuning region."); View.DisplayFineTuning(); } + + DyeCommand.RaiseCanExecuteChanged(); } catch (Exception ex) { @@ -888,6 +892,11 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private void ResetFineTuning() { + if (Job != null && _jobs_fine_tune_items.ContainsKey(Job.Guid)) + { + _jobs_fine_tune_items.Remove(Job.Guid); + } + SyncFineTuneItemsToBrushStops(); } @@ -1012,6 +1021,8 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public override void OnNavigatedTo() { + _start_printing_btn.Push(); + base.OnNavigatedTo(); LoadJob(); } @@ -1021,6 +1032,8 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public override void OnNavigatedFrom() { + _start_printing_btn.Pop(); + base.OnNavigatedFrom(); _job_to_load_intent = JobNavigationIntent.Default; } @@ -1050,6 +1063,12 @@ namespace Tango.PPC.Jobs.ViewModels return result; } + public override void OnApplicationReady() + { + base.OnApplicationReady(); + + _start_printing_btn = new StartPrintingButton(DyeCommand, MachineProvider.MachineOperator); + } #endregion #region INavigationObjectReceiver diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index 8c1466c26..a2927660f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -27,6 +27,7 @@ using Tango.Explorer; using System.IO; using Google.Protobuf; using Tango.PMR.Exports; +using Tango.Settings; namespace Tango.PPC.Jobs.ViewModels { @@ -38,6 +39,12 @@ namespace Tango.PPC.Jobs.ViewModels { private ObservablesContext _db; //Holds the db context for the job list. + public enum JobsCategory + { + Draft, + History + } + #region Properties private ObservableCollection<Job> _jobs; @@ -50,16 +57,30 @@ namespace Tango.PPC.Jobs.ViewModels set { _jobs = value; RaisePropertyChangedAuto(); } } - private ICollectionView _jobsCollectionView; + private ICollectionView _draftJobsCollectionView; + /// <summary> + /// Gets or sets the jobs collection view. + /// </summary> + public ICollectionView DraftJobsCollectionView + { + get { return _draftJobsCollectionView; } + set + { + _draftJobsCollectionView = value; + RaisePropertyChangedAuto(); + } + } + + private ICollectionView _historyJobsCollectionView; /// <summary> /// Gets or sets the jobs collection view. /// </summary> - public ICollectionView JobsCollectionView + public ICollectionView HistoryJobsCollectionView { - get { return _jobsCollectionView; } + get { return _historyJobsCollectionView; } set { - _jobsCollectionView = value; + _historyJobsCollectionView = value; RaisePropertyChangedAuto(); } } @@ -94,17 +115,30 @@ namespace Tango.PPC.Jobs.ViewModels set { _isMultiSelecting = value; RaisePropertyChangedAuto(); } } - private JobCategories _filterCategory; + private int _selectedCategoryIndex; + /// <summary> + /// Gets or sets the index of the selected category. + /// </summary> + public int SelectedCategoryIndex + { + get { return _selectedCategoryIndex; } + set + { + _selectedCategoryIndex = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(SelectedCategory)); + } + } + /// <summary> - /// Gets or sets the filter category. + /// Gets or sets the selected category. /// </summary> - public JobCategories FilterCategory + public JobsCategory SelectedCategory { - get { return _filterCategory; } + get { return (JobsCategory)SelectedCategoryIndex; } set { - _filterCategory = value; RaisePropertyChangedAuto(); - FilterJobCategory(value); + SelectedCategoryIndex = value.ToInt32(); } } @@ -207,7 +241,7 @@ namespace Tango.PPC.Jobs.ViewModels job.JobIndex = index++; } - JobsCollectionView.Refresh(); + DraftJobsCollectionView.Refresh(); } #endregion @@ -255,9 +289,15 @@ namespace Tango.PPC.Jobs.ViewModels InvokeUI(() => { Jobs = jobs; - JobsCollectionView = CollectionViewSource.GetDefaultView(Jobs); - JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); - FilterJobCategory(FilterCategory); + DraftJobsCollectionView = new ListCollectionView(Jobs); + DraftJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); + DraftJobsCollectionView.Filter = new Predicate<object>(x => (x as Job).JobStatus == JobStatuses.Draft); + + + HistoryJobsCollectionView = new ListCollectionView(Jobs); + HistoryJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); + HistoryJobsCollectionView.Filter = new Predicate<object>(x => (x as Job).JobStatus != JobStatuses.Draft); + IsLoadingJobs = false; LogManager.Log("Machine jobs loaded!"); onCompleted?.Invoke(); @@ -281,18 +321,6 @@ namespace Tango.PPC.Jobs.ViewModels } /// <summary> - /// Filters the jobs list by the specified <see cref="JobCategories">job category</see>. - /// </summary> - /// <param name="jobCategory">The job category.</param> - public void FilterJobCategory(JobCategories jobCategory) - { - JobsCollectionView.Filter = (job) => - { - return (job as Job).JobCategories.Contains(jobCategory); - }; - } - - /// <summary> /// Adds a new job. /// </summary> private async void AddNewJob() @@ -303,18 +331,47 @@ namespace Tango.PPC.Jobs.ViewModels var machine = MachineProvider.Machine; - JobTypePickerViewVM vm = new JobTypePickerViewVM(machine.SupportedJobTypes.Count > 0 ? machine.SupportedJobTypes : Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToList()); + JobCreationViewVM vm = new JobCreationViewVM( + machine.SupportedJobTypes.Count > 0 ? machine.SupportedJobTypes : Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToList(), + machine.SupportedColorSpaces.Count > 0 ? machine.SupportedColorSpaces : Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace()).ToList() + ); + + var settings = SettingsManager.Default.GetOrCreate<JobsModuleSettings>(); - if (machine.SupportedJobTypes.Count != 1) + if (settings.LastJobType != null) + { + vm.SelectedJobType = settings.LastJobType.Value; + } + else { - vm = await NotificationProvider.ShowDialog<JobTypePickerViewVM>(vm); + vm.SelectedJobType = machine.SupportedJobTypes.FirstOrDefault(); + } + + if (settings.LastJobColorSpace != null) + { + vm.SelectedColorSpace = settings.LastJobColorSpace.Value; + } + else + { + var space = machine.SupportedColorSpaces.FirstOrDefault(); + vm.SelectedColorSpace = space.IsUserSpace() ? space : ColorSpaces.Twine; + } + + if (machine.SupportedJobTypes.Count != 1 && machine.SupportedColorSpaces.Count != 1) + { + vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm); if (!vm.DialogResult) return; } else { vm.SelectedJobType = machine.SupportedJobTypes.First(); + vm.SelectedColorSpace = machine.SupportedColorSpaces.First(); } + settings.LastJobType = vm.SelectedJobType; + settings.LastJobColorSpace = vm.SelectedColorSpace; + settings.Save(); + Job job = new Job(); job.Name = "untitled"; job.NumberOfHeads = 1; @@ -322,13 +379,18 @@ namespace Tango.PPC.Jobs.ViewModels job.SampleUnitsOrMeters = 1; job.CreationDate = DateTime.UtcNow; job.JobStatus = JobStatuses.Draft; - job.JobType = vm.SelectedJobType.Value; - job.ColorSpaceGuid = machine.DefaultColorSpace != null ? machine.DefaultColorSpaceGuid : Adapter.ColorSpaces.FirstOrDefault(x => x.Code == ColorSpaces.RGB.ToInt32()).Guid; + job.JobType = vm.SelectedJobType; + job.ColorSpaceGuid = Adapter.ColorSpaces.FirstOrDefault(x => x.Code == vm.SelectedColorSpace.ToInt32()).Guid; job.MachineGuid = MachineProvider.Machine.Guid; job.UserGuid = AuthenticationProvider.CurrentUser.Guid; job.RmlGuid = machine.DefaultRml != null ? machine.DefaultRmlGuid : Adapter.Rmls.FirstOrDefault().Guid; job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; job.SpoolTypeGuid = machine.DefaultSpoolType != null ? machine.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; + + if (Jobs.Count > 0) + { + job.JobIndex = Jobs.Max(x => x.JobIndex) + 1; + } job.AddSolidSegment(machine.DefaultSegmentLength > 0 ? machine.DefaultSegmentLength : 10); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml index 3d2f7daa8..27c3cb93a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml @@ -27,7 +27,7 @@ <Grid Grid.Row="1"> <DockPanel> - <Grid DockPanel.Dock="Bottom" Height="350" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <Grid DockPanel.Dock="Bottom" Height="350"> <StackPanel Margin="50 0 50 0"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 60 0 0"> <touch:TouchButton FontSize="{StaticResource TangoExpanderHeaderFontSize}" Command="{Binding EditCommand}" BorderThickness="2" BorderBrush="{StaticResource TangoPrimaryAccentBrush}" RippleBrush="{StaticResource TangoRippleDarkBrush}" Background="Transparent" EnableDropShadow="False" Height="80" Padding="0" Width="270" Foreground="{StaticResource TangoPrimaryAccentBrush}" CornerRadius="40" BlurRadius="20" HorizontalAlignment="Right"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index ada22ce5a..a7062d036 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -171,7 +171,7 @@ </Style.Triggers> </Style> </DockPanel.Style> - <Border DockPanel.Dock="Left" Background="{Binding SegmentBrush}"> + <Border DockPanel.Dock="Left" Background="{Binding SegmentBrush}" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}"> <Border.Style> <Style TargetType="Border"> <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> @@ -374,7 +374,10 @@ <Image Source="../Images/JobView/job-details.png" Width="39" /> <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Details</TextBlock> - <TextBlock FontWeight="Medium" Margin="50 0 0 0" VerticalAlignment="Center" Text="{Binding Job.Rml.Name}"></TextBlock> + <TextBlock FontWeight="Medium" Margin="50 0 0 0" VerticalAlignment="Center"> + <Run Text="{Binding Job.Rml.Name}"></Run><Run>,</Run> + <Run Text="{Binding Job.ColorSpace.Name}"></Run> + </TextBlock> </StackPanel> </touch:TouchExpander.Header> @@ -459,10 +462,10 @@ </UniformGrid> </StackPanel> - <DockPanel Style="{StaticResource Level2Container}"> + <!--<DockPanel Style="{StaticResource Level2Container}"> <TextBlock Text="Color Catalog/Space:" VerticalAlignment="Center"></TextBlock> <touch:TouchComboBox Margin="20 0 0 0" ItemsSource="{Binding ColorSpaces}" SelectedItem="{Binding Job.ColorSpace}" DisplayMemberPath="Name" Title="Select Color Catalog/Space" /> - </DockPanel> + </DockPanel>--> <Border x:Name="borderDockFloat" Height="80"> <DockPanel x:Name="dockEdit" LastChildFill="False" Style="{StaticResource Level2ContainerExtraMargin}" Height="40" Width="640"> @@ -522,10 +525,10 @@ <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Output</TextBlock> </StackPanel> - <DockPanel Style="{StaticResource Level2Container}"> + <!--<DockPanel Style="{StaticResource Level2Container}"> <TextBlock Text="Output spool (m):" VerticalAlignment="Center"></TextBlock> <touch:TouchComboBox ItemsSource="{Binding SpoolTypes}" SelectedItem="{Binding Job.SpoolType}" Margin="40 0 0 0" DisplayMemberPath="Name" Title="Select Output Spool" /> - </DockPanel> + </DockPanel>--> <DockPanel Style="{StaticResource Level2Container}"> <TextBlock Text="Segments per spool:" VerticalAlignment="Center"></TextBlock> @@ -1029,18 +1032,18 @@ </Grid.Background> <Rectangle Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" /> </Grid> - <Border Padding="20 20"> + <!--<Border Padding="20 20"> <Grid> <DockPanel> <touch:TouchButton IsEnabled="{Binding MachineProvider.MachineOperator.CanPrint}" DockPanel.Dock="Right" Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" DelayCommand="{Binding DyeCommand}" DelayCommandDuration="00:00:0.3"> DYE </touch:TouchButton> - <!--Add this in case you want to display job summery on bottom panel--> - <!--<localControls:JobSummeryViewer DataContext="{Binding Job}" Height="35" Margin="0 -20 30 0" />--> + --><!--Add this in case you want to display job summery on bottom panel--> + <!--<localControls:JobSummeryViewer DataContext="{Binding Job}" Height="35" Margin="0 -20 30 0" />--><!-- </DockPanel> </Grid> - </Border> + </Border>--> </Grid> <dragAndDrop:DraggingSurface x:Name="DraggingSurface" /> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml index 89feb8dc3..b02de80fc 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml @@ -31,7 +31,7 @@ <sharedConverters:DateTimeUTCToShortDateConverter x:Key="DateTimeUTCToShortDateConverter" /> <sharedConverters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> <sharedConverters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> - <converters:JobCollectionToCategoryCountConverter x:Key="JobCollectionToCategoryCountConverter" /> + <converters:JobsCategoryToVisibilityConverter x:Key="JobsCategoryToVisibilityConverter" /> </ResourceDictionary> </UserControl.Resources> @@ -112,43 +112,47 @@ </touch:TouchIconButton> </StackPanel> - <touch:TouchNavigationLinks SelectionChanged="TouchNavigationLinks_SelectionChanged" SelectedValue="{Binding FilterCategory}" SelectedValuePath="Value" ItemsSource="{Binding Source={x:Type enumerations:JobCategories},Converter={StaticResource EnumToItemsSourceConverter},Mode=OneTime}" IsEnabled="{Binding IsMultiSelecting,Converter={StaticResource BooleanInverseConverter}}" VerticalAlignment="Bottom" Margin="20" FontSize="{StaticResource TangoNavigationLinksFontSize}"> - <touch:TouchNavigationLinks.ItemTemplate> - <DataTemplate> - <TextBlock> - <Run Text="{Binding DisplayName,Mode=OneWay}"></Run> - <Run>(</Run><Run> - <Run.Text> - <MultiBinding Converter="{StaticResource JobCollectionToCategoryCountConverter}"> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Jobs" /> - <Binding Path="Value" Mode="OneWay"></Binding> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Jobs.Count" Mode="OneWay" /> - </MultiBinding> - </Run.Text> - </Run><Run>)</Run> - </TextBlock> - </DataTemplate> - </touch:TouchNavigationLinks.ItemTemplate> + <touch:TouchNavigationLinks x:Name="navigationLinks" SelectionChanged="TouchNavigationLinks_SelectionChanged" SelectedIndex="{Binding SelectedCategoryIndex,Mode=TwoWay}" IsEnabled="{Binding IsMultiSelecting,Converter={StaticResource BooleanInverseConverter}}" VerticalAlignment="Bottom" Margin="20" FontSize="{StaticResource TangoNavigationLinksFontSize}"> + <TextBlock>DRAFT</TextBlock> + <TextBlock>HISTORY</TextBlock> </touch:TouchNavigationLinks> <Grid Grid.Row="1" x:Name="moveGrid"> - <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}"> - <touch:LightTouchDataGrid RenderOptions.EdgeMode="Unspecified" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding JobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> + <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='Draft'}"> + <touch:LightTouchDataGrid AnimateSorting="False" RenderOptions.EdgeMode="Unspecified" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding DraftJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> <touch:LightTouchDataGrid.Columns> - <touch:LightTouchDataGridColumn Width="50"> + <touch:LightTouchDataGridColumn Width="90"> <touch:LightTouchDataGridColumn.Header> <Image Source="../Images/warning.png" Width="24" /> </touch:LightTouchDataGridColumn.Header> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <Image Source="../Images/Job Issues/cyan.png" Width="38" /> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - <touch:LightTouchDataGridColumn Width="100" Header="Status" SortMember="JobStatus"> - <touch:LightTouchDataGridColumn.CellTemplate> - <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + <Grid Margin="5 0 0 0" Width="40" Height="40"> + <Image HorizontalAlignment="Left" VerticalAlignment="Top" Width="20"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Source" Value="../Images/sample_approved_small_gray.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding JobSampleDyeStatus}" Value="Approved"> + <Setter Property="Source" Value="../Images/sample_approved_small.png"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + <Image HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="20"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Source" Value="../Images/color_approved_small_gray.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding JobFineTuningStatus}" Value="Approved"> + <Setter Property="Source" Value="../Images/color_approved_small.png"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + </Grid> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> @@ -225,6 +229,71 @@ </touch:LightTouchDataGrid.Columns> </touch:LightTouchDataGrid> </touch:TouchLoadingPanel> + + <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}"> + <touch:LightTouchDataGrid AnimateSorting="False" RenderOptions.EdgeMode="Unspecified" x:Name="dataGridJobsHistory" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='History'}" Style="{StaticResource TangoJobsGrid}" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" ItemsSource="{Binding HistoryJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> + <touch:LightTouchDataGrid.Columns> + <touch:LightTouchDataGridColumn Width="50"> + <touch:LightTouchDataGridColumn.Header> + <Image Source="../Images/warning.png" Width="24" /> + </touch:LightTouchDataGridColumn.Header> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <touch:TouchIcon Width="26"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon"> + <Setter Property="Icon" Value="Check"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding JobStatus}" Value="Disrupted"> + <Setter Property="Icon" Value="AlertCircleOutline"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Width="100" Header="Status" SortMember="JobStatus"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Width="1*" Header="Name" SortMember="Name" HorizontalContentAlignment="Left"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding Name}"></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Width="117" Header="Length (m)" SortMember="Length"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0}"></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Header="Colors" SortMember="Segments.Count" Width="85"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <Image Stretch="Fill" IsHitTestVisible="False" Source="{Binding Converter={StaticResource JobToPieImageConverter},ConverterParameter='25,25'}" Width="25" Height="25" HorizontalAlignment="Left"></Image> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + </touch:LightTouchDataGrid.Columns> + </touch:LightTouchDataGrid> + </touch:TouchLoadingPanel> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs index efd4ec64e..d8ef4056c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs @@ -25,11 +25,17 @@ namespace Tango.PPC.Jobs.Views InitializeComponent(); } - private void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e) + private async void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dataGridJobs != null) { + await Task.Delay(200); + + dataGridJobs.LayoutRows(false); dataGridJobs.ScrollViewer.ScrollToTop(); + + dataGridJobsHistory.LayoutRows(false); + dataGridJobsHistory.ScrollViewer.ScrollToTop(); } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/App.xaml new file mode 100644 index 000000000..66ea48976 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/App.xaml @@ -0,0 +1,11 @@ +<Application x:Class="Tango.PPC.Logging.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.PPC.Common;component/Resources/Merged.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Images/logging_module.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Images/logging_module.png Binary files differnew file mode 100644 index 000000000..3f8318f70 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Images/logging_module.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/LoggingModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/LoggingModule.cs new file mode 100644 index 000000000..78c597e81 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/LoggingModule.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.Logging.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Logging +{ + [PPCModule(5)] + public class LoggingModule : PPCModuleBase + { + public override string Name => "Logging"; + public override string Description => "PPC logging module."; + public override BitmapSource Image => ResourceHelper.GetImageFromResources("Images/logging_module.png"); + public override Type MainViewType => typeof(MainView); + public override Permissions Permission => Permissions.RunPPC; + + public LoggingModule() + { + IsVisibleInMenu = false; + } + + public override void OnTechnicianEntered() + { + base.OnTechnicianEntered(); + + IsVisibleInMenu = true; + } + + public override void OnTechnicianExited() + { + base.OnTechnicianExited(); + + IsVisibleInMenu = false; + } + + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..612af80ce --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango PPC Logging Module")] +[assembly: AssemblyVersion("2.0.4.1119")] + +[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/PPC/Modules/Tango.PPC.Logging/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.Designer.cs new file mode 100644 index 000000000..6cbf8164a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/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.PPC.Logging.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.PPC.Logging.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/PPC/Modules/Tango.PPC.Logging/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/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/PPC/Modules/Tango.PPC.Logging/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.Designer.cs new file mode 100644 index 000000000..ab102e0eb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/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.PPC.Logging.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/PPC/Modules/Tango.PPC.Logging/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/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/PPC/Modules/Tango.PPC.Logging/Tango.PPC.Logging.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Tango.PPC.Logging.csproj new file mode 100644 index 000000000..cc6394c9f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Tango.PPC.Logging.csproj @@ -0,0 +1,117 @@ +<?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>{D2EE865B-B006-487A-9487-60A663636AC3}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.PPC.Logging</RootNamespace> + <AssemblyName>Tango.PPC.Logging</AssemblyName> + <TargetFrameworkVersion>v4.6.1</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\PPC\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\PPC\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <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="LoggingModule.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> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <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.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491D07B-C1F6-4B62-A412-41B9FD2D6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Touch\Tango.Touch.csproj"> + <Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project> + <Name>Tango.Touch</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PPC.Common\Tango.PPC.Common.csproj"> + <Project>{0BE74EEE-22CB-4DBA-B896-793B9E1A3AC0}</Project> + <Name>Tango.PPC.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\logging_module.png" /> + </ItemGroup> + <ItemGroup> + <Page Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModelLocator.cs new file mode 100644 index 000000000..d86a0d2ab --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModelLocator.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Logging.ViewModels; + +namespace Tango.PPC.Logging +{ + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + TangoIOC.Default.Register<MainViewVM>(); + } + + /// <summary> + /// Gets the main view VM. + /// </summary> + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance<MainViewVM>(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..736bff5a2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModels/MainViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.Logging.ViewModels +{ + public class MainViewVM : PPCViewModel + { + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml new file mode 100644 index 000000000..fb4dd5d04 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml @@ -0,0 +1,45 @@ +<UserControl x:Class="Tango.PPC.Logging.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:sys="clr-namespace:System;assembly=mscorlib" + xmlns:vm="clr-namespace:Tango.PPC.Logging.ViewModels" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:global="clr-namespace:Tango.PPC.Logging" + xmlns:local="clr-namespace:Tango.PPC.Logging.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Logs</TextBlock> + </Border> + + <Grid Grid.Row="1"> + + <DockPanel> + <DockPanel DockPanel.Dock="Top"> + <touch:TouchNavigationLinks Margin="20" FontSize="{StaticResource TangoNavigationLinksFontSize}"> + <sys:String>Application</sys:String> + <sys:String>Embedded</sys:String> + </touch:TouchNavigationLinks> + + <touch:TouchDatePicker SelectedDate="12/15/2018" Height="40" /> + </DockPanel> + + <Grid> + + </Grid> + </DockPanel> + + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml.cs new file mode 100644 index 000000000..eb448c67c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.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.PPC.Logging.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj index 9d44a6a63..e8d5b49d6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj @@ -121,6 +121,10 @@ <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> <Name>Tango.DragAndDrop</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> @@ -160,7 +164,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/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 6bbe1c47b..7896367ec 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -43,6 +44,47 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _selectedJobTypes = value; RaisePropertyChangedAuto(); } } + private SelectedObjectCollection<ColorSpaces> _selectedColorSpaces; + public SelectedObjectCollection<ColorSpaces> SelectedColorSpaces + { + get { return _selectedColorSpaces; } + set { _selectedColorSpaces = value; RaisePropertyChangedAuto(); } + } + + private bool _enableHotSpot; + public bool EnableHotSpot + { + get { return _enableHotSpot; } + set { _enableHotSpot = value; RaisePropertyChangedAuto(); OnEnableHotSpotChanged(); } + } + + private String _hotSpotPassword; + public String HotSpotPassword + { + get { return _hotSpotPassword; } + set { _hotSpotPassword = value; RaisePropertyChangedAuto(); } + } + + private bool _enableExternalBridge; + public bool EnableExternalBridge + { + get { return _enableExternalBridge; } + set { _enableExternalBridge = value; RaisePropertyChangedAuto(); OnEnableExternalBridgeChanged(); } + } + + private String _externalBridgePassword; + public String ExternalBridgePassword + { + get { return _externalBridgePassword; } + set { _externalBridgePassword = value; RaisePropertyChangedAuto(); } + } + + private bool _enableRemoteAssistance; + public bool EnableRemoteAssistance + { + get { return _enableRemoteAssistance; } + set { _enableRemoteAssistance = value; RaisePropertyChangedAuto(); OnEnableRemoteAssistanceChanged(); } + } #endregion @@ -73,10 +115,26 @@ namespace Tango.PPC.MachineSettings.ViewModels private async void Save() { - Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList(); - Machine.ShallowCopyTo(MachineProvider.Machine); - await MachineProvider.SaveMachine(); - await NavigationManager.NavigateBack(); + if (Validate()) + { + Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList(); + Machine.SupportedColorSpaces = SelectedColorSpaces.SynchedSource.ToList(); + Machine.ShallowCopyTo(MachineProvider.Machine); + + Settings.EnableHotSpot = EnableHotSpot; + Settings.HotSpotPassword = HotSpotPassword; + Settings.EnableExternalBridge = EnableExternalBridge; + Settings.ExternalBridgePassword = ExternalBridgePassword; + Settings.Save(); + + await MachineProvider.SaveMachine(); + await NavigationManager.NavigateBack(); + } + } + + protected override void OnValidating() + { + base.OnValidating(); } /// <summary> @@ -95,7 +153,95 @@ namespace Tango.PPC.MachineSettings.ViewModels MachineProvider.Machine.ShallowCopyTo(Machine); RaisePropertyChanged(nameof(Machine)); + _enableHotSpot = HotSpotProvider.IsEnabled; + RaisePropertyChanged(nameof(EnableHotSpot)); + + HotSpotPassword = Settings.HotSpotPassword; + + _enableExternalBridge = ExternalBridgeService.Enabled; + RaisePropertyChanged(nameof(EnableExternalBridge)); + + ExternalBridgePassword = Settings.ExternalBridgePassword; + + _enableRemoteAssistance = RemoteAssistanceProvider.IsEnabled; + RaisePropertyChanged(nameof(EnableRemoteAssistance)); + + SelectedJobTypes = new SelectedObjectCollection<JobTypes>(Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToObservableCollection(), Machine.SupportedJobTypes.ToObservableCollection()); + SelectedColorSpaces = new SelectedObjectCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace()).ToObservableCollection(), Machine.SupportedColorSpaces.ToObservableCollection()); + } + + private async void OnEnableRemoteAssistanceChanged() + { + if (EnableRemoteAssistance) + { + try + { + await RemoteAssistanceProvider.EnableRemoteAssistance(); + } + catch + { + await NotificationProvider.ShowError("An error occurred while trying to activate the remote assistance service. Please check your device settings and try again."); + _enableRemoteAssistance = false; + } + } + else + { + try + { + await RemoteAssistanceProvider.DisableRemoteAssistance(); + } + catch + { + await NotificationProvider.ShowError("An error occurred while trying to deactivate the remote assistance service. Please check your device settings and try again."); + _enableRemoteAssistance = true; + } + } + + RaisePropertyChanged(nameof(EnableRemoteAssistance)); + } + + private async void OnEnableHotSpotChanged() + { + if (EnableHotSpot) + { + if (HotSpotPassword == null || HotSpotPassword.Length < 8 || HotSpotPassword.Length > 16) + { + await NotificationProvider.ShowError("Hot spot requires a password of 8 to 16 characters."); + _enableHotSpot = false; + RaisePropertyChanged(nameof(EnableHotSpot)); + return; + } + + try + { + await HotSpotProvider.EnableHotSpot(HotSpotPassword); + } + catch + { + await NotificationProvider.ShowError("An error occurred while trying to activate the hot spot network. Please check your device settings and try again."); + _enableHotSpot = false; + } + } + else + { + try + { + await HotSpotProvider.DisableHotSpot(); + } + catch + { + await NotificationProvider.ShowError("An error occurred while trying to deactivate the hot spot network."); + _enableHotSpot = true; + } + } + + RaisePropertyChanged(nameof(EnableHotSpot)); + } + + private void OnEnableExternalBridgeChanged() + { + ExternalBridgeService.Enabled = EnableExternalBridge; } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 4823f0811..d1de12664 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -43,6 +43,15 @@ <touch:TouchExpander Header="Connectivity" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> <StackPanel Margin="10 30 10 10"> <connectivity:AvailableWiFiConnectionsControl DataContext="{Binding ConnectivityProvider}" /> + + <controls:TableGrid Margin="10" RowHeight="60" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable Hot Spot</TextBlock> + <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding EnableHotSpot}"></touch:TouchToggleSlider> + + + <TextBlock VerticalAlignment="Bottom">Hot Spot Password</TextBlock> + <touch:TouchTextBox IsPassword="True" Watermark="•••••••" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Text="{Binding HotSpotPassword}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchTextBox> + </controls:TableGrid> </StackPanel> </touch:TouchExpander> @@ -50,10 +59,10 @@ <touch:TouchExpander Margin="0 20 0 0" Header="External Bridge" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> <controls:TableGrid Margin="10" RowHeight="70" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> <TextBlock VerticalAlignment="Center">Enable External Bridge Service</TextBlock> - <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding Machine.EnableExternalBridge}"></touch:TouchToggleSlider> + <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding EnableExternalBridge}"></touch:TouchToggleSlider> <TextBlock VerticalAlignment="Bottom">External Bridge Password</TextBlock> - <touch:TouchTextBox IsPassword="True" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Text="{Binding Machine.ExternalBridgePassword}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchTextBox> + <touch:TouchTextBox IsPassword="True" Watermark="•••••••" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Text="{Binding ExternalBridgePassword}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchTextBox> </controls:TableGrid> </touch:TouchExpander> @@ -85,20 +94,50 @@ </ItemsControl.ItemTemplate> </ItemsControl> + <TextBlock VerticalAlignment="Center">Supported Color Spaces/Catalogs</TextBlock> + <ItemsControl ItemsSource="{Binding SelectedColorSpaces}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel IsItemsHost="True" Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <touch:TouchToggleButton IsChecked="{Binding IsSelected}" Content="{Binding Data}" CornerRadius="5" CheckedContent="{Binding Data}" Padding="10" Margin="5"> + <touch:TouchToggleButton.Style> + <Style TargetType="touch:TouchToggleButton"> + <Setter Property="Background" Value="{StaticResource TangoGrayBrush}"></Setter> + <Style.Triggers> + <Trigger Property="IsChecked" Value="True"> + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchToggleButton.Style> + </touch:TouchToggleButton> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <TextBlock VerticalAlignment="Bottom">Default Media</TextBlock> <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding Machine.DefaultRml}" DisplayMemberPath="Name"></touch:TouchComboBox> - <TextBlock VerticalAlignment="Bottom">Default Color Space/Catalog</TextBlock> - <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.ColorSpaces}" SelectedItem="{Binding Machine.DefaultColorSpace}" DisplayMemberPath="Name"></touch:TouchComboBox> - - <TextBlock VerticalAlignment="Bottom">Default Spool</TextBlock> - <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.SpoolTypes}" SelectedItem="{Binding Machine.DefaultSpoolType}" DisplayMemberPath="Name"></touch:TouchComboBox> + <!--<TextBlock VerticalAlignment="Bottom">Default Spool</TextBlock> + <touch:TouchComboBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" ItemsSource="{Binding Adapter.SpoolTypes}" SelectedItem="{Binding Machine.DefaultSpoolType}" DisplayMemberPath="Name"></touch:TouchComboBox>--> <TextBlock VerticalAlignment="Bottom">Default Segment Length</TextBlock> <touch:TouchNumericTextBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="1" Maximum="1000" Value="{Binding Machine.DefaultSegmentLength}" HasDecimalPoint="True" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox> </controls:TableGrid> </touch:TouchExpander> + + <!--REMOTE ASSISTANCE--> + <touch:TouchExpander Margin="0 20 0 0" Header="Remote Assistance" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> + <controls:TableGrid Margin="10" RowHeight="70" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable Remote Assistance</TextBlock> + <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding EnableRemoteAssistance}"></touch:TouchToggleSlider> + </controls:TableGrid> + </touch:TouchExpander> </StackPanel> </touch:LightTouchScrollViewer> </Grid> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs index 3882fb486..688f82fe7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -33,7 +33,23 @@ namespace Tango.PPC.Storage.ViewModels public StorageNavigationRequest Request { get { return _request; } - set { _request = value; RaisePropertyChangedAuto(); } + set + { + _request = value; + RaisePropertyChangedAuto(); + + if (_request != null) + { + FileName = _request.DefaultFileName; + } + } + } + + private String _fileName; + public String FileName + { + get { return _fileName; } + set { _fileName = value; RaisePropertyChangedAuto(); SaveCommand.RaiseCanExecuteChanged(); } } public RelayCommand<ExplorerFileItem> FileSelectedCommand { get; set; } @@ -43,7 +59,7 @@ namespace Tango.PPC.Storage.ViewModels public MainViewVM() { FileSelectedCommand = new RelayCommand<ExplorerFileItem>(OnFileSelected); - SaveCommand = new RelayCommand(OnSaveCommand); + SaveCommand = new RelayCommand(OnSaveCommand, (x) => !String.IsNullOrWhiteSpace(FileName)); Request = new StorageNavigationRequest(); } @@ -161,7 +177,7 @@ namespace Tango.PPC.Storage.ViewModels { _selectedItem = new ExplorerFileItem() { - Path = CurrentPath + "\\" + Request.DefaultFileName, + Path = CurrentPath + "\\" + FileName, }; NavigationManager.NavigateBack(); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml index 3b098f557..2ff1d5936 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:explorer="clr-namespace:Tango.Explorer;assembly=Tango.Explorer" xmlns:vm="clr-namespace:Tango.PPC.Storage.ViewModels" xmlns:models="clr-namespace:Tango.PPC.Storage.Models" @@ -11,6 +12,11 @@ xmlns:local="clr-namespace:Tango.PPC.Storage.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + + <UserControl.InputBindings> + <KeyBinding Key="Return" Command="{Binding SaveCommand}"></KeyBinding> + </UserControl.InputBindings> + <Grid> <Grid Margin="10"> <DockPanel> @@ -20,8 +26,12 @@ <StackPanel> <TextBlock Text="{Binding Request.Title}" FontSize="{StaticResource TangoHeaderFontSize}"></TextBlock> <DockPanel Margin="0 10 0 0"> - <touch:TouchButton Command="{Binding SaveCommand}" Margin="20 0 0 0" Height="50" Width="200" Style="{StaticResource TangoHollowButton}" CornerRadius="0" DockPanel.Dock="Right">SAVE</touch:TouchButton> - <touch:TouchTextBox x:Name="txtFileName" FocusSelectionMode="SelectAll" VerticalAlignment="Bottom" Text="{Binding Request.DefaultFileName}" /> + <touch:TouchButton Command="{Binding SaveCommand}" Margin="20 0 0 0" Height="50" Width="200" Style="{StaticResource TangoHollowButton}" CornerRadius="0" DockPanel.Dock="Right"> + <touch:TouchButton.Content> + SAVE + </touch:TouchButton.Content> + </touch:TouchButton> + <touch:TouchTextBox x:Name="txtFileName" KeyboardAction="Go" FocusSelectionMode="SelectAll" VerticalAlignment="Bottom" Text="{Binding FileName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> </DockPanel> </StackPanel> </Border> |
