/// <summary> /// Severes the connections related to showing and hiding the filter /// property controls and hides the controls if visible. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void FilterPreviewPivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { Debug.WriteLine(DebugTag + ".FilterPreviewPivot_SelectionChanged()"); if (!_hintTextShown && FilterPreviewPivot.SelectedIndex != 0) { HintText.Visibility = Visibility.Visible; _hintTextShown = true; } else if (_hintTextShown && HintText.Visibility == Visibility.Visible && FilterPreviewPivot.SelectedIndex == 0) { HintText.Visibility = Visibility.Collapsed; _hintTextShown = false; } ShowControlsAnimationStoryBoard.Completed -= ShowControlsAnimationStoryBoard_Completed; HideControlsAnimation.Completed -= HideControlsAnimation_Completed; ShowControlsAnimationStoryBoard.Stop(); HideControlsAnimationStoryBoard.Stop(); if (_controlToHide != null) { _controlToHide.Visibility = Visibility.Collapsed; _controlToHide.Opacity = 0; _controlToHide = null; } }
/// <summary> /// Severes the connections related to showing and hiding the filter /// property controls and hides the controls if visible. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void FilterPreviewPivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { int index = FilterPreviewPivot.SelectedIndex; Debug.WriteLine(DebugTag + "FilterPreviewPivot_SelectionChanged(): Index is " + index); if (!_hintTextShown && index != 0) { HintText.Visibility = Visibility.Visible; _hintTextShown = true; } else if (_hintTextShown && HintText.Visibility == Visibility.Visible && index == 0) { HintText.Visibility = Visibility.Collapsed; _hintTextShown = false; } ShowControlsAnimationStoryBoard.Completed -= ShowControlsAnimationStoryBoard_Completed; HideControlsAnimation.Completed -= HideControlsAnimation_Completed; ShowControlsAnimationStoryBoard.Stop(); HideControlsAnimationStoryBoard.Stop(); FilterControlsContainer.Visibility = Visibility.Collapsed; FilterControlsContainer.Opacity = 0; FilterControlsContainer.Children.Clear(); AbstractFilter filter = _filters[index]; if (filter.Control != null) { FilterControlsContainer.Children.Add(filter.Control); } }
/// <summary> /// Shows the filter property controls. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ShowPropertiesControls(object sender, System.Windows.Input.GestureEventArgs e) { if (sender is Grid) { Grid grid = (Grid)sender; foreach (UIElement element in grid.Children) { if (element is FilterPropertiesControl) { if (element.Visibility == Visibility.Collapsed || element.Opacity < 1) { Debug.WriteLine(DebugTag + "ShowPropertiesControls()"); if (HintText.Visibility == Visibility.Visible) { HintText.Visibility = Visibility.Collapsed; } HideControlsAnimation.Completed -= HideControlsAnimation_Completed; HideControlsAnimationStoryBoard.Stop(); if (_timer != null) { _timer.Tick -= HidePropertiesControls; _timer.Stop(); _timer = null; } _controlToHide = (FilterPropertiesControl)element; _controlToHide.Visibility = Visibility.Visible; try { Storyboard.SetTargetName(ShowControlsAnimation, _controlToHide.Name); ShowControlsAnimation.From = _controlToHide.Opacity; ShowControlsAnimationStoryBoard.Completed += ShowControlsAnimationStoryBoard_Completed; ShowControlsAnimationStoryBoard.Begin(); } catch (InvalidOperationException ex) { Debug.WriteLine(ex.ToString()); } _timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, HideControlsDelay) }; _timer.Tick += HidePropertiesControls; _timer.Start(); } else if (e.OriginalSource is Image) { HidePropertiesControls(null, null); } } } } }
/// <summary> /// Shows the filter property controls. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ShowPropertiesControls(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) { Debug.WriteLine(DebugTag + "ShowPropertiesControls()"); if (FilterControlsContainer.Visibility == Visibility.Collapsed || FilterControlsContainer.Opacity < 1) { Debug.WriteLine(DebugTag + "ShowPropertiesControls(): Showing"); if (HintText.Visibility == Visibility.Visible) { HintText.Visibility = Visibility.Collapsed; } HideControlsAnimation.Completed -= HideControlsAnimation_Completed; HideControlsAnimationStoryBoard.Stop(); if (_timer != null) { _timer.Tick -= HidePropertiesControls; _timer.Stop(); _timer = null; } FilterControlsContainer.Visibility = Visibility.Visible; try { Storyboard.SetTargetName(ShowControlsAnimation, FilterControlsContainer.Name); ShowControlsAnimation.From = FilterControlsContainer.Opacity; ShowControlsAnimationStoryBoard.Completed += ShowControlsAnimationStoryBoard_Completed; ShowControlsAnimationStoryBoard.Begin(); } catch (InvalidOperationException ex) { Debug.WriteLine(ex.ToString()); } _timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, HideControlsDelay) }; _timer.Tick += HidePropertiesControls; _timer.Start(); } else if (e.OriginalSource is Image) { HidePropertiesControls(null, null); } }
/// <summary> /// Hides the filter property controls. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void HidePropertiesControls(object sender, object e) { Debug.WriteLine(DebugTag + "HidePropertiesControls()"); ShowControlsAnimationStoryBoard.Stop(); Storyboard.SetTargetName(HideControlsAnimation, FilterControlsContainer.Name); HideControlsAnimation.From = FilterControlsContainer.Opacity; HideControlsAnimationStoryBoard.Begin(); HideControlsAnimation.Completed += HideControlsAnimation_Completed; if (_timer != null) { _timer.Tick -= HidePropertiesControls; _timer.Stop(); _timer = null; } }
/// <summary> /// Hides the filter property controls. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void HidePropertiesControls(object sender, EventArgs e) { ShowControlsAnimationStoryBoard.Stop(); if (_controlToHide != null) { Debug.WriteLine(DebugTag + ".HidePropertiesControls()"); Storyboard.SetTargetName(HideControlsAnimation, _controlToHide.Name); HideControlsAnimation.From = _controlToHide.Opacity; HideControlsAnimationStoryBoard.Begin(); HideControlsAnimation.Completed += HideControlsAnimation_Completed; } if (_timer != null) { _timer.Tick -= HidePropertiesControls; _timer.Stop(); _timer = null; } }