diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-03-04 21:34:15 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-03-04 21:34:15 +0200 |
| commit | 9ff3a5b95ae353fab5b29b75a786a6ae8964ba1b (patch) | |
| tree | d53c9b2e2f1a8bdcd91671dbed0eaadb24d133b7 | |
| parent | fc8f4f7a358640f8f6495397f822320f87018d04 (diff) | |
| download | Tango-9ff3a5b95ae353fab5b29b75a786a6ae8964ba1b.tar.gz Tango-9ff3a5b95ae353fab5b29b75a786a6ae8964ba1b.zip | |
Improvements to PPC !!
43 files changed, 203 insertions, 37 deletions
diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf Binary files differindex 13f9ed4ea..8d64d88b7 100644 --- a/Software/DB/PPC/Tango.mdf +++ b/Software/DB/PPC/Tango.mdf diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf Binary files differindex f6898d4a9..5454b5236 100644 --- a/Software/DB/PPC/Tango_log.ldf +++ b/Software/DB/PPC/Tango_log.ldf diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 4de8470d3..7c896f39c 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 65787c7ad..fc91172d7 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Graphics/Mobile/Menu/events.png b/Software/Graphics/Mobile/Menu/events.png Binary files differnew file mode 100644 index 000000000..7966aa561 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/events.png diff --git a/Software/Graphics/Mobile/Menu/events@2x.png b/Software/Graphics/Mobile/Menu/events@2x.png Binary files differnew file mode 100644 index 000000000..1a557347d --- /dev/null +++ b/Software/Graphics/Mobile/Menu/events@2x.png diff --git a/Software/Graphics/Mobile/Menu/events@3x.png b/Software/Graphics/Mobile/Menu/events@3x.png Binary files differnew file mode 100644 index 000000000..536d7ed05 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/events@3x.png diff --git a/Software/Graphics/Mobile/Menu/jobs.png b/Software/Graphics/Mobile/Menu/jobs.png Binary files differnew file mode 100644 index 000000000..04e456074 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/jobs.png diff --git a/Software/Graphics/Mobile/Menu/jobs@2x.png b/Software/Graphics/Mobile/Menu/jobs@2x.png Binary files differnew file mode 100644 index 000000000..c35200fcb --- /dev/null +++ b/Software/Graphics/Mobile/Menu/jobs@2x.png diff --git a/Software/Graphics/Mobile/Menu/jobs@3x.png b/Software/Graphics/Mobile/Menu/jobs@3x.png Binary files differnew file mode 100644 index 000000000..25f30c79b --- /dev/null +++ b/Software/Graphics/Mobile/Menu/jobs@3x.png diff --git a/Software/Graphics/Mobile/Menu/logo.png b/Software/Graphics/Mobile/Menu/logo.png Binary files differnew file mode 100644 index 000000000..b49838e37 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/logo.png diff --git a/Software/Graphics/Mobile/Menu/logo@2x.png b/Software/Graphics/Mobile/Menu/logo@2x.png Binary files differnew file mode 100644 index 000000000..58539a9ff --- /dev/null +++ b/Software/Graphics/Mobile/Menu/logo@2x.png diff --git a/Software/Graphics/Mobile/Menu/logo@3x.png b/Software/Graphics/Mobile/Menu/logo@3x.png Binary files differnew file mode 100644 index 000000000..7f86efc78 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/logo@3x.png diff --git a/Software/Graphics/Mobile/Menu/maintenance.png b/Software/Graphics/Mobile/Menu/maintenance.png Binary files differnew file mode 100644 index 000000000..5edfe7125 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/maintenance.png diff --git a/Software/Graphics/Mobile/Menu/maintenance@2x.png b/Software/Graphics/Mobile/Menu/maintenance@2x.png Binary files differnew file mode 100644 index 000000000..91be3bd10 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/maintenance@2x.png diff --git a/Software/Graphics/Mobile/Menu/maintenance@3x.png b/Software/Graphics/Mobile/Menu/maintenance@3x.png Binary files differnew file mode 100644 index 000000000..7d72a12f2 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/maintenance@3x.png diff --git a/Software/Graphics/Mobile/Menu/settings.png b/Software/Graphics/Mobile/Menu/settings.png Binary files differnew file mode 100644 index 000000000..79ccc16d0 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/settings.png diff --git a/Software/Graphics/Mobile/Menu/settings@2x.png b/Software/Graphics/Mobile/Menu/settings@2x.png Binary files differnew file mode 100644 index 000000000..a8f14b940 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/settings@2x.png diff --git a/Software/Graphics/Mobile/Menu/settings@3x.png b/Software/Graphics/Mobile/Menu/settings@3x.png Binary files differnew file mode 100644 index 000000000..8455cdb43 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/settings@3x.png diff --git a/Software/Graphics/Mobile/Menu/storage.png b/Software/Graphics/Mobile/Menu/storage.png Binary files differnew file mode 100644 index 000000000..d86d5d3f7 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/storage.png diff --git a/Software/Graphics/Mobile/Menu/storage@2x.png b/Software/Graphics/Mobile/Menu/storage@2x.png Binary files differnew file mode 100644 index 000000000..8d90e3f67 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/storage@2x.png diff --git a/Software/Graphics/Mobile/Menu/storage@3x.png b/Software/Graphics/Mobile/Menu/storage@3x.png Binary files differnew file mode 100644 index 000000000..b62079446 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/storage@3x.png diff --git a/Software/Graphics/Mobile/Menu/vector-smart-object.png b/Software/Graphics/Mobile/Menu/vector-smart-object.png Binary files differnew file mode 100644 index 000000000..a739bd0f9 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/vector-smart-object.png diff --git a/Software/Graphics/Mobile/Menu/vector-smart-object@2x.png b/Software/Graphics/Mobile/Menu/vector-smart-object@2x.png Binary files differnew file mode 100644 index 000000000..1f42d43a1 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/vector-smart-object@2x.png diff --git a/Software/Graphics/Mobile/Menu/vector-smart-object@3x.png b/Software/Graphics/Mobile/Menu/vector-smart-object@3x.png Binary files differnew file mode 100644 index 000000000..f0632d6f7 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/vector-smart-object@3x.png diff --git a/Software/Graphics/Mobile/Menu/x-close.png b/Software/Graphics/Mobile/Menu/x-close.png Binary files differnew file mode 100644 index 000000000..e0934e41e --- /dev/null +++ b/Software/Graphics/Mobile/Menu/x-close.png diff --git a/Software/Graphics/Mobile/Menu/x-close@2x.png b/Software/Graphics/Mobile/Menu/x-close@2x.png Binary files differnew file mode 100644 index 000000000..460ab4182 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/x-close@2x.png diff --git a/Software/Graphics/Mobile/Menu/x-close@3x.png b/Software/Graphics/Mobile/Menu/x-close@3x.png Binary files differnew file mode 100644 index 000000000..c0615dcc0 --- /dev/null +++ b/Software/Graphics/Mobile/Menu/x-close@3x.png 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 042272960..f0cf87079 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 @@ -486,6 +486,22 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log("Saving job..."); + if (!String.IsNullOrWhiteSpace(CustomersFilter)) + { + if (!Customers.Exists(x => x.Name == CustomersFilter)) + { + var newCustomer = new Customer() + { + OrganizationGuid = MachineProvider.Machine.OrganizationGuid, + Name = CustomersFilter, + }; + + _db.Customers.Add(newCustomer); + + Job.Customer = newCustomer; + } + } + await _db.SaveChangesAsync(); RaiseMessage(new JobSavedMessage() { Job = Job }); 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 30f444a6f..d29323412 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 @@ -127,6 +127,7 @@ namespace Tango.PPC.Jobs.ViewModels _selectedCategoryIndex = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(SelectedCategory)); + Filter = null; } } @@ -138,10 +139,24 @@ namespace Tango.PPC.Jobs.ViewModels get { return (JobsCategory)SelectedCategoryIndex; } set { - SelectedCategoryIndex = value.ToInt32(); + if (SelectedCategoryIndex != value.ToInt32()) + { + SelectedCategoryIndex = value.ToInt32(); + Filter = null; + } } } + private String _filter; + /// <summary> + /// Gets or sets the search filter. + /// </summary> + public String Filter + { + get { return _filter; } + set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); } + } + #endregion #region Commands @@ -284,19 +299,43 @@ namespace Tango.PPC.Jobs.ViewModels _db = ObservablesContext.CreateDefault(); - var jobs = new JobsCollectionBuilder(_db).Set(x => x.MachineGuid == MachineProvider.Machine.Guid).WithSegments().WithBrushStops().Build(); + var jobs = new JobsCollectionBuilder(_db).Set(x => x.MachineGuid == MachineProvider.Machine.Guid).WithSegments().WithBrushStops().WithCustomer().Build(); InvokeUI(() => { Jobs = jobs; 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); + DraftJobsCollectionView.Filter = new Predicate<object>(x => + { + var job = x as Job; + + if (String.IsNullOrWhiteSpace(Filter)) + { + return job.JobStatus == JobStatuses.Draft; + } + else + { + return job.JobStatus == JobStatuses.Draft && (job.Name.ToLower().StartsWith(Filter) || (job.Customer != null && job.Customer.Name.ToLower().StartsWith(Filter))); + } + }); 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); + HistoryJobsCollectionView.Filter = new Predicate<object>(x => + { + var job = x as Job; + + if (String.IsNullOrWhiteSpace(Filter)) + { + return job.JobStatus != JobStatuses.Draft; + } + else + { + return job.JobStatus != JobStatuses.Draft && (job.Name.ToLower().StartsWith(Filter) || (job.Customer != null && job.Customer.Name.ToLower().StartsWith(Filter))); + } + }); IsLoadingJobs = false; LogManager.Log("Machine jobs loaded!"); @@ -485,6 +524,21 @@ namespace Tango.PPC.Jobs.ViewModels } } + /// <summary> + /// Called when the search filter has been changed + /// </summary> + private void OnFilterChanged() + { + if (SelectedCategory == JobsCategory.Draft) + { + DraftJobsCollectionView.Refresh(); + } + else if (SelectedCategory == JobsCategory.History) + { + HistoryJobsCollectionView.Refresh(); + } + } + #endregion #region Message Handling 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 5cefce5c2..b6dcad145 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 @@ -388,7 +388,7 @@ <touch:TouchTextBox Text="{Binding Job.Name,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" KeyboardMode="AlphaNumeric" FocusSelectionMode="SelectAll" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> <TextBlock>Customer:</TextBlock> - <touch:TouchAutoComplete Text="{Binding CustomersFilter}" ItemsSource="{Binding Customers}" SelectedItem="{Binding Job.Customer}" DisplayMemberPath="Name" AutoCompleteProvider="{Binding CustomersAutoCompleteProvider}" KeyboardMode="AlphaNumeric" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> + <touch:TouchAutoComplete ForceItemSelection="False" Text="{Binding CustomersFilter}" ItemsSource="{Binding Customers}" SelectedItem="{Binding Job.Customer}" DisplayMemberPath="Name" AutoCompleteProvider="{Binding CustomersAutoCompleteProvider}" KeyboardMode="AlphaNumeric" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> <TextBlock>Thread type:</TextBlock> <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding Job.Rml}" DisplayMemberPath="Name" Title="Select Thread" /> 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 b02de80fc..01d0c86a2 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 @@ -112,10 +112,20 @@ </touch:TouchIconButton> </StackPanel> - <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> + <DockPanel> + <touch:TouchNavigationLinks DockPanel.Dock="Left" 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 VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0 5 0 0"> + <DockPanel> + <Rectangle Margin="0 0 20 0" HorizontalAlignment="Center" VerticalAlignment="Bottom" Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" Height="25"></Rectangle> + <touch:TouchIcon DockPanel.Dock="Left" Foreground="{StaticResource TangoGrayBrush}" Width="20" Height="20" VerticalAlignment="Bottom" Icon="Magnify" /> + <touch:TouchTextBox Margin="5 0 0 0" Width="300" Text="{Binding Filter,Mode=TwoWay}" Watermark="find name, customer..."></touch:TouchTextBox> + </DockPanel> + </Grid> + </DockPanel> <Grid Grid.Row="1" x:Name="moveGrid"> <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='Draft'}"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/logo.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/logo.png Binary files differindex 9c9eb4abf..b49838e37 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/logo.png +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/logo.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 0a6919fbf..2743e5126 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -29,7 +29,7 @@ <DockPanel LastChildFill="False" Background="{StaticResource TangoPrimaryBackgroundBrush}"> <StackPanel MinWidth="300" DockPanel.Dock="Top"> <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1"> - <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid> <Image Source="/Images/logo.png" Stretch="Uniform" Margin="20 50 50 50"></Image> <touch:TouchToggleButton Style="{StaticResource TangoTouchToggleButtonHamburger}" VerticalAlignment="Top" @@ -50,7 +50,7 @@ <ItemsControl.ItemTemplate> <DataTemplate> <Border Visibility="{Binding DockToBottom,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 1 0 0" Visibility="{Binding IsVisibleInMenu,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Border BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 1 0 0" Visibility="{Binding IsVisibleInMenu,Converter={StaticResource BooleanToVisibilityConverter}}"> <touch:TouchButton Margin="0 0 0 0" Padding="30" Foreground="{StaticResource TangoDarkForegroundBrush}" Style="{StaticResource TangoFlatButton}" FontSize="{StaticResource TangoHeaderFontSize}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ModuleNavigationCommand}" CommandParameter="{Binding Name}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image VerticalAlignment="Center" Source="{Binding Image}" Width="48" Height="48"></Image> diff --git a/Software/Visual_Studio/Tango.BL/Builders/JobsCollectionBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/JobsCollectionBuilder.cs index 5750f8c1c..0d0b555ee 100644 --- a/Software/Visual_Studio/Tango.BL/Builders/JobsCollectionBuilder.cs +++ b/Software/Visual_Studio/Tango.BL/Builders/JobsCollectionBuilder.cs @@ -15,6 +15,14 @@ namespace Tango.BL.Builders } + public virtual JobsCollectionBuilder WithCustomer() + { + return AddQueryStep(1, (query) => + { + return query.Include(x => x.Customer); + }); + } + public virtual JobsCollectionBuilder WithSegments() { return AddStep(1, () => diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs index fd8f17367..a684cbf5a 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs @@ -105,6 +105,16 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty PopupHeightProperty = DependencyProperty.Register("PopupHeight", typeof(double), typeof(TouchAutoComplete), new PropertyMetadata(200.0)); + public bool ForceItemSelection + { + get { return (bool)GetValue(ForceItemSelectionProperty); } + set { SetValue(ForceItemSelectionProperty, value); } + } + public static readonly DependencyProperty ForceItemSelectionProperty = + DependencyProperty.Register("ForceItemSelection", typeof(bool), typeof(TouchAutoComplete), new PropertyMetadata(true)); + + + public TouchAutoComplete() { //AutoCompleteProvider = new AutoCompleteProvider<Object>((obj, filter) => { return obj.ToString().ToLower().StartsWith(filter.ToLower()); }); @@ -137,15 +147,18 @@ namespace Tango.Touch.Controls { _popup.IsOpen = false; - if (EffectiveItemsSource != null && EffectiveItemsSource.Count > 0 && SelectedItem == null) + if (ForceItemSelection) { - SelectedItem = EffectiveItemsSource[0]; + if (EffectiveItemsSource != null && EffectiveItemsSource.Count > 0 && SelectedItem == null) + { + SelectedItem = EffectiveItemsSource[0]; - var binding = BindingOperations.GetBindingExpressionBase(this, SelectedItemProperty); + var binding = BindingOperations.GetBindingExpressionBase(this, SelectedItemProperty); - if (binding != null) - { - binding.UpdateSource(); + if (binding != null) + { + binding.UpdateSource(); + } } } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml index 40fe09603..738fe6a3c 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml @@ -7,6 +7,7 @@ <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="../Resources/Colors.xaml" /> + <ResourceDictionary Source="../Resources/Fonts.xaml" /> <ResourceDictionary> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> @@ -28,12 +29,12 @@ <Setter Property="ItemTemplate"> <Setter.Value> <DataTemplate> - <Border Padding="10"> + <Border> <DockPanel> - <Ellipse DockPanel.Dock="Left" Width="16" Height="16" StrokeThickness="1" Stroke="{StaticResource TangoPrimaryAccentBrush}" VerticalAlignment="Center"> - <Ellipse.Style> - <Style TargetType="Ellipse"> - <Setter Property="Fill" Value="Transparent"></Setter> + <Label VerticalAlignment="Center" Padding="30" FontSize="{StaticResource TangoComboBoxItemFontSize}"> + <Label.Style> + <Style TargetType="Label"> + <Setter Property="Background" Value="Transparent"></Setter> <Style.Triggers> <DataTrigger Value="True"> <DataTrigger.Binding> @@ -42,13 +43,12 @@ <Binding RelativeSource="{RelativeSource AncestorType=local:TouchListBox}" Path="DataContext.SelectedItem" /> </MultiBinding> </DataTrigger.Binding> - <Setter Property="Fill" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoMidBackgroundBrush}"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> </DataTrigger> </Style.Triggers> </Style> - </Ellipse.Style> - </Ellipse> - <Label VerticalAlignment="Center" Margin="10 0 0 0" FontWeight="Normal"> + </Label.Style> <Label.Content> <MultiBinding Converter="{StaticResource DisplayMemberPathConverter}"> <Binding Path="." /> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs index 54906c7a6..6c29e4652 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs @@ -19,6 +19,7 @@ namespace Tango.Touch.Controls { private TouchListBox _combobox_list; private Grid _combobox_grid; + private TouchIconButton _comboBoxCloseButton; private TouchCalendar _calendar; private Grid _calendar_grid; @@ -66,9 +67,11 @@ namespace Tango.Touch.Controls _combobox_list = GetTemplateChild("PART_ComboBoxList") as TouchListBox; _combobox_grid = GetTemplateChild("PART_combobox_grid") as Grid; + _comboBoxCloseButton = GetTemplateChild("PART_comboboxCloseButton") as TouchIconButton; _calendar_grid = GetTemplateChild("PART_datepicker_grid") as Grid; _calendar = GetTemplateChild("PART_calendar") as TouchCalendar; + _comboBoxCloseButton.RegisterForPreviewMouseOrTouchUp(OnComboBoxClose); _combobox_grid.RegisterForMouseOrTouchDown(OnComboBoxGridDown); _calendar_grid.RegisterForMouseOrTouchDown(OnCalendarGridDown); @@ -98,6 +101,11 @@ namespace Tango.Touch.Controls } } + private void OnComboBoxClose(object sender, MouseOrTouchEventArgs e) + { + CurrentComboBox = null; + } + private async void OnCurrentComboBoxChanged() { if (CurrentComboBox != null) diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml index aadc2b3e6..43b27e174 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml @@ -9,6 +9,7 @@ <ResourceDictionary Source="../Resources/Colors.xaml" /> <ResourceDictionary Source="../Resources/Fonts.xaml" /> <ResourceDictionary Source="../Styles/TouchButton.xaml" /> + <ResourceDictionary Source="../Styles/TouchIconButton.xaml" /> <ResourceDictionary> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> @@ -64,17 +65,20 @@ </Grid.Style> <Grid DataContext="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentComboBox}" VerticalAlignment="Center" HorizontalAlignment="Center"> - <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" CornerRadius="5" Margin="10" Padding="{Binding Padding}"> + <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" CornerRadius="5" Margin="10"> <Border.Effect> <DropShadowEffect BlurRadius="10" /> </Border.Effect> <Grid ClipToBounds="True"> <DockPanel> - <Border DockPanel.Dock="Top" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1" Padding="10 10 10 15"> - <TextBlock DockPanel.Dock="Top" Text="{Binding Title}" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock> + <Grid DockPanel.Dock="Top"> + <Border CornerRadius="5 5 0 0" Background="{StaticResource TangoComboBoxPopupTitleBackgroundBrush}" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1" Padding="30"> + <TextBlock DockPanel.Dock="Top" Text="{Binding Title}" FontSize="{StaticResource TangoComboBoxTitleFontSize}" FontWeight="SemiBold"></TextBlock> </Border> - <local:TouchListBox x:Name="PART_ComboBoxList" Margin="0 10 0 0" Width="{Binding MinPopupWidth}" Height="{Binding MinPopupHeight}" ItemSelectedCommand="{Binding RelativeSource={RelativeSource AncestorType=local:TouchPanel},Path=ComboBoxPickedCommand}" ItemsSource="{Binding ItemsSource}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" SelectionMode="None" ItemTemplate="{Binding ItemTemplate}" ValuePath="{Binding ValuePath}" VerticalAlignment="Top"> + <local:TouchIconButton x:Name="PART_comboboxCloseButton" Background="Transparent" Padding="35" Style="{StaticResource TangoRoundTouchIconButton}" Command="{Binding CloseCommand}" CommandParameter="{Binding}" HorizontalAlignment="Right" MaxHeight="90" Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}" Icon="Close" Foreground="{StaticResource TangoDarkForegroundBrush}" Opacity="0.5" /> + </Grid> + <local:TouchListBox x:Name="PART_ComboBoxList" Width="{Binding MinPopupWidth}" Height="{Binding MinPopupHeight}" ItemSelectedCommand="{Binding RelativeSource={RelativeSource AncestorType=local:TouchPanel},Path=ComboBoxPickedCommand}" ItemsSource="{Binding ItemsSource}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" SelectionMode="None" ItemTemplate="{Binding ItemTemplate}" ValuePath="{Binding ValuePath}" VerticalAlignment="Top" > </local:TouchListBox> </DockPanel> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml index adf3ee7a3..c00bd40b9 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml @@ -106,7 +106,7 @@ <Grid> <TextBox IsReadOnly="{TemplateBinding IsReadOnly}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Foreground="{TemplateBinding Foreground}" Padding="0 0 0 4" CaretBrush="{StaticResource TangoPrimaryAccentBrush}" FocusVisualStyle="{x:Null}" x:Name="PART_TextBox" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Text,UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" Background="Transparent" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=IsPassword,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></TextBox> <PasswordBox Foreground="{TemplateBinding Foreground}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Padding="0 0 0 4" CaretBrush="{StaticResource TangoPrimaryAccentBrush}" FocusVisualStyle="{x:Null}" x:Name="PART_PasswordBox" BorderThickness="0" Background="Transparent" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=IsPassword,Converter={StaticResource BooleanToVisibilityConverter}}"></PasswordBox> - <TextBlock IsHitTestVisible="False" Text="{TemplateBinding Watermark}" Foreground="{StaticResource TangoTextWatermarkBrush}"> + <TextBlock IsHitTestVisible="False" Text="{TemplateBinding Watermark}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="{StaticResource TangoTextWatermarkBrush}"> <TextBlock.Style> <Style TargetType="TextBlock"> <Setter Property="Visibility" Value="Hidden"></Setter> @@ -134,7 +134,7 @@ </Grid> </components:Ripple> - <Canvas VerticalAlignment="Top" IsHitTestVisible="False" Margin="0 -4 0 0"> + <!--<Canvas VerticalAlignment="Top" IsHitTestVisible="False" Margin="0 -4 0 0" Visibility="Collapsed"> <Canvas.Style> <Style TargetType="Canvas"> <Setter Property="Visibility" Value="Hidden"></Setter> @@ -176,7 +176,7 @@ </Style> </TextBlock.Style> </TextBlock> - </Canvas> + </Canvas>--> </Grid> </DockPanel> </DockPanel> diff --git a/Software/Visual_Studio/Tango.Touch/Keyboard/TouchKeyboard.cs b/Software/Visual_Studio/Tango.Touch/Keyboard/TouchKeyboard.cs index 172094b33..e9938efc8 100644 --- a/Software/Visual_Studio/Tango.Touch/Keyboard/TouchKeyboard.cs +++ b/Software/Visual_Studio/Tango.Touch/Keyboard/TouchKeyboard.cs @@ -508,20 +508,66 @@ namespace Tango.Touch.Keyboard //Forms.SendKeys.SendWait(key); var text = key; - var target = FocusManager.GetFocusedElement(Application.Current.MainWindow); + var target = FocusManager.GetFocusedElement(Application.Current.MainWindow) as UIElement; + + Key k = Key.None; + Enum.TryParse<Key>(key, out k); + + RaiseKeyUp(target, k); + var routedEvent = TextCompositionManager.TextInputEvent; target.RaiseEvent(new TextCompositionEventArgs(InputManager.Current.PrimaryKeyboardDevice, new TextComposition(InputManager.Current, target, text)) - { - RoutedEvent = routedEvent - } + { + RoutedEvent = routedEvent + } ); } _soundPlayer.Play(); } + private void RaiseKeyDown(UIElement target, Key key) + { + target.RaiseEvent( + new KeyEventArgs( + System.Windows.Input.Keyboard.PrimaryDevice, + PresentationSource.FromVisual(target), + 0, + key) + { RoutedEvent = System.Windows.Input.Keyboard.PreviewKeyDownEvent }); + + target.RaiseEvent( + new KeyEventArgs( + System.Windows.Input.Keyboard.PrimaryDevice, + PresentationSource.FromVisual(target), + 0, + key) + { RoutedEvent = System.Windows.Input.Keyboard.KeyDownEvent }); + + } + + private void RaiseKeyUp(UIElement target, Key key) + { + target.RaiseEvent( +new KeyEventArgs( +System.Windows.Input.Keyboard.PrimaryDevice, +PresentationSource.FromVisual(target), +0, +key) +{ RoutedEvent = System.Windows.Input.Keyboard.PreviewKeyUpEvent }); + + target.RaiseEvent( + new KeyEventArgs( + System.Windows.Input.Keyboard.PrimaryDevice, + PresentationSource.FromVisual(target), + 0, + key) + { RoutedEvent = System.Windows.Input.Keyboard.KeyUpEvent } + ); + } + public static void PressCtrl() { keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY, 0); diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml index 26926e43b..409006201 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml @@ -52,6 +52,8 @@ <Color x:Key="TangoNotificationBorderColor">#757373</Color> <Color x:Key="TangoNotificationBarBackgroundColor">#C3F2F5FA</Color> + <Color x:Key="TangoComboBoxPopupTitleBackgroundColor">#DDE7FD</Color> + <!--Brushes--> <SolidColorBrush x:Key="TangoPrimaryBackgroundBrush" Color="{StaticResource TangoPrimaryBackgroundColor}"></SolidColorBrush> <SolidColorBrush x:Key="TangoMidBackgroundBrush" Color="{StaticResource TangoMidBackgroundColor}"></SolidColorBrush> @@ -112,4 +114,6 @@ <SolidColorBrush x:Key="TangoKeyboardKeyDarkBrush">#616161</SolidColorBrush> <SolidColorBrush x:Key="TangoKeyboardKeyDarkTextBrush">#121212</SolidColorBrush> <SolidColorBrush x:Key="TangoKeyboardKeyLightTextBrush">#F1F1F1</SolidColorBrush> + + <SolidColorBrush x:Key="TangoComboBoxPopupTitleBackgroundBrush" Color="{StaticResource TangoComboBoxPopupTitleBackgroundColor}"></SolidColorBrush> </ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml index 112dec891..b81e247de 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml @@ -19,4 +19,7 @@ <sys:Double x:Key="TangoExpanderHeaderFontSize">23</sys:Double> + <sys:Double x:Key="TangoComboBoxTitleFontSize">26</sys:Double> + <sys:Double x:Key="TangoComboBoxItemFontSize">18</sys:Double> + </ResourceDictionary>
\ No newline at end of file |
