aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2020-02-19 17:50:16 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2020-02-19 17:50:16 +0200
commitb0c68adb4672171b00fe200ac568724fee968899 (patch)
treec2a2c34334a2a1dcbed15424575cdddce5b45584 /Software/Visual_Studio/Tango.Touch
parent527c93f3ce40439bc33010ab978dc3b3e84c1333 (diff)
downloadTango-b0c68adb4672171b00fe200ac568724fee968899.tar.gz
Tango-b0c68adb4672171b00fe200ac568724fee968899.zip
PPC: Fixed issue with touch panel dialogs closing..
Some work on FSE..
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch')
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs38
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml6
2 files changed, 37 insertions, 7 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs
index 6aa92d15e..9044b209f 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -22,6 +23,7 @@ namespace Tango.Touch.Controls
private TouchIconButton _comboBoxCloseButton;
private TouchCalendar _calendar;
private Grid _calendar_grid;
+ private bool _isDialogGridMaskMouseDown;
static TouchPanel()
{
@@ -30,19 +32,19 @@ namespace Tango.Touch.Controls
public TouchPanel()
{
- ComboBoxPickedCommand = new RelayCommand((x) =>
+ ComboBoxPickedCommand = new RelayCommand((x) =>
{
CurrentComboBox.SetResultFromTouchPanel(x);
CurrentComboBox = null;
});
- DateSelectedCommand = new RelayCommand(() =>
+ DateSelectedCommand = new RelayCommand(() =>
{
CurrentDatePicker.SetResultFromTouchPanel(_calendar.SelectedDate.Value);
CurrentDatePicker = null;
});
- CancelDateCommand = new RelayCommand(() =>
+ CancelDateCommand = new RelayCommand(() =>
{
CurrentDatePicker = null;
});
@@ -70,6 +72,9 @@ namespace Tango.Touch.Controls
_comboBoxCloseButton = GetTemplateChild("PART_comboboxCloseButton") as TouchIconButton;
_calendar_grid = GetTemplateChild("PART_datepicker_grid") as Grid;
_calendar = GetTemplateChild("PART_calendar") as TouchCalendar;
+ var gridDialogsMask = GetTemplateChild("PART_gridDialogsMask") as Grid;
+ gridDialogsMask.MouseUp += GridDialogsMask_MouseUp;
+ gridDialogsMask.MouseDown += GridDialogsMask_MouseDown;
_comboBoxCloseButton.RegisterForPreviewMouseOrTouchUp(OnComboBoxClose);
_combobox_grid.RegisterForMouseOrTouchDown(OnComboBoxGridDown);
@@ -79,6 +84,31 @@ namespace Tango.Touch.Controls
_calendar.SelectedDatesChanged += _calendar_SelectedDatesChanged;
}
+ private void GridDialogsMask_MouseDown(object sender, MouseButtonEventArgs e)
+ {
+ _isDialogGridMaskMouseDown = true;
+ }
+
+ private void GridDialogsMask_MouseUp(object sender, MouseButtonEventArgs e)
+ {
+ if (_isDialogGridMaskMouseDown)
+ {
+ if (e.Source == sender)
+ {
+ try
+ {
+ (CurrentDialog.DataContext as DialogViewVM).CloseCommand?.Execute(null);
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"Error in touch panel {ex.ToString()}");
+ }
+ }
+ }
+
+ _isDialogGridMaskMouseDown = false;
+ }
+
private void _calendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
{
Mouse.Capture(null);
@@ -148,7 +178,7 @@ namespace Tango.Touch.Controls
set { SetValue(CurrentComboBoxProperty, value); }
}
internal static readonly DependencyProperty CurrentComboBoxProperty =
- DependencyProperty.Register("CurrentComboBox", typeof(TouchComboBox), typeof(TouchPanel), new PropertyMetadata(null,(d,e) => (d as TouchPanel).OnCurrentComboBoxChanged()));
+ DependencyProperty.Register("CurrentComboBox", typeof(TouchComboBox), typeof(TouchPanel), new PropertyMetadata(null, (d, e) => (d as TouchPanel).OnCurrentComboBoxChanged()));
internal TouchDatePicker CurrentDatePicker
{
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml
index 8a5367234..97d91477d 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml
@@ -64,12 +64,12 @@
</Style>
</Grid.Style>
- <Grid Background="#9E000000">
- <i:Interaction.Triggers>
+ <Grid Background="#9E000000" x:Name="PART_gridDialogsMask">
+ <!--<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseUp">
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentDialog.DataContext.CloseCommand}" />
</i:EventTrigger>
- </i:Interaction.Triggers>
+ </i:Interaction.Triggers>-->
</Grid>
<Border Background="{StaticResource TangoPrimaryBackgroundBrush}" CornerRadius="5" Padding="10" HorizontalAlignment="Center" VerticalAlignment="Center">