Esempio n. 1
0
        private void ChartGroup_CurrentStateChanged(object sender, VisualStateChangedEventArgs e)
        {
            if (e.NewState.Name == "ShowXBar" || e.NewState.Name == "ShowR" || e.NewState.Name == "ShowstDev")
            {
                xbarChartMenuItem.Visibility = Visibility.Visible;
                rChartMenuItem.Visibility = Visibility.Visible;
                stdevChartMenuItem.Visibility = Visibility.Visible;

                npChartMenuItem.Visibility = Visibility.Collapsed;
                pChartMenuItem.Visibility = Visibility.Collapsed;
            }
            else
            {
                xbarChartMenuItem.Visibility = Visibility.Collapsed;
                rChartMenuItem.Visibility = Visibility.Collapsed;
                stdevChartMenuItem.Visibility = Visibility.Collapsed;

                npChartMenuItem.Visibility = Visibility.Visible;
                pChartMenuItem.Visibility = Visibility.Visible;
            }

            if (e.NewState.Name == "ShowNP" || e.NewState.Name == "ShowP")
                rejectedText.Visibility = Visibility.Visible;
            else
                rejectedText.Visibility = Visibility.Collapsed;

            if (e.NewState.Name == "ShowP")
                subgroupSize.Visibility = Visibility.Collapsed;
            else
                subgroupSize.Visibility = Visibility.Visible;
        }
Esempio n. 2
0
 private void ConversationsListBox_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
 {
     switch (e.NewState.Name)
     {
         case "CompressionBottom":
             App.ViewModel.LoadMoreConversations();
             break;
         case "CompressionTop":
         case "NoVerticalCompression":
             break;
     }
 }
 private void ScrollViewer_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
 {
     switch (e.NewState.Name)
     {
         case "CompressionTop":
             break;
         case "CompressionBottom":
             this.LoadMore(this.source.Count(), FetchSize);
             break;
         case "NoVerticalCompression":
             break;
         default:
             break;
     }
     return;
 }
Esempio n. 4
0
 private void vgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState.Name == "CompressionTop")
     {
         _isBouncy = true;
         if (Compression != null)
             Compression(this, new CompressionEventArgs(CompressionType.Top));
     }
     if (e.NewState.Name == "CompressionBottom")
     {
         _isBouncy = true;
         if (Compression != null)
             Compression(this, new CompressionEventArgs(CompressionType.Bottom));
     }
     if (e.NewState.Name == "NoVerticalCompression")
         _isBouncy = false;
 }
 void vgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
 {
     DebugText.Text = e.NewState.Name;
     switch (e.NewState.Name)
     {
         case "CompressionTop":
             TopCompress.Visibility = System.Windows.Visibility.Visible;
             TopTextBlock.Text = "Top";
             break;
         case "CompressionTopLimit":
             TopCompress.Visibility = System.Windows.Visibility.Visible;
             TopTextBlock.Text = "TopLimitOver";
             break;
         case "ReleaseOnTopLimit":
             TopCompress.Visibility = System.Windows.Visibility.Visible;
             TopTextBlock.Text = "ReleaseTop";
             break;
         case "CompressionBottom":
             BottomCompress.Visibility = System.Windows.Visibility.Visible;
             BottomTextBlock.Text = "Bottom";
             break;
         case "CompressionBottomLimit":
             BottomCompress.Visibility = System.Windows.Visibility.Visible;
             BottomTextBlock.Text = "BottomLimitOver";
             break;
         case "ReleaseOnBottomLimit":
             BottomCompress.Visibility = System.Windows.Visibility.Visible;
             BottomTextBlock.Text = "ReleaseBottom";
             break;
         case "NoVerticalCompression":
             TopCompress.Visibility = System.Windows.Visibility.Collapsed;
             BottomCompress.Visibility = System.Windows.Visibility.Collapsed;
             TopTextBlock.Text = "";
             BottomTextBlock.Text = "";
             break;
         default:
             TopCompress.Visibility = System.Windows.Visibility.Collapsed;
             BottomCompress.Visibility = System.Windows.Visibility.Collapsed;
             TopTextBlock.Text = "";
             BottomTextBlock.Text = "";
             break;
     }
 }
Esempio n. 6
0
        private void hgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
        {
            if (e.NewState.Name == "CompressionLeft")
            {
                _isBouncy = true;
                if (Compression != null)
                    Compression(this, new CompressionEventArgs(CompressionType.Left));
            }

            if (e.NewState.Name == "CompressionRight")
            {
                _isBouncy = true;
                if (Compression != null)
                    Compression(this, new CompressionEventArgs(CompressionType.Right));
            }
            if (e.NewState.Name == "NoHorizontalCompression")
            {
                _isBouncy = false;
            }
        }
        private void ApplyAnimationIfNoScrolling(object sender, VisualStateChangedEventArgs args)
        {
            if (args.NewState.Name == "NotScrolling")
            {
                if (_scrollViewer.VerticalOffset != Math.Round(_scrollViewer.VerticalOffset))
                {
                    args.NewState.Dispatcher.BeginInvoke(() =>
                    {
                        double deOnde = _scrollViewer.VerticalOffset;
                        double praOnde = Math.Round(_scrollViewer.VerticalOffset);

                        double fator = Math.Abs(deOnde - praOnde);

                        var animation = new DoubleAnimation
                        {
                            From = deOnde,
                            By = deOnde,
                            To = praOnde,
                            Duration = new Duration(TimeSpan.FromSeconds(fator*3)),
                            EasingFunction = new BackEase {Amplitude = 0.5, EasingMode = EasingMode.EaseOut},
                            SpeedRatio = 0.8
                        };

                        Storyboard.SetTarget(animation, _scrollViewer);
                        Storyboard.SetTargetProperty(animation, new PropertyPath(ScrollViewerUtilities.VerticalOffsetProperty));

                        // Create a storyboard to contain the animation.
                        _storyboard = new Storyboard();
                        _storyboard.Children.Add(animation);
                        _storyboard.AutoReverse = false;

                        // Animate the button width when it's clicked.
                        _storyboard.Begin();
                    });
                }
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Fires the current state changed event.
 /// </summary>
 /// <param name="sender">The source object.</param>
 /// <param name="e">The event arguments.</param>
 private void OnCurrentStateChanged(object sender, VisualStateChangedEventArgs e)
 {
     // Collapse the slide when "offscreen"
     if (e.NewState.Name != StatePositionNormal)
     {
         Visibility = Visibility.Collapsed;
         OnSlideChanged();
     }
 }
Esempio n. 9
0
 void hgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState.Name == "CompressionLeft")
     {
         markAsComplete = true;
     }
     else if (e.NewState.Name == "CompressionRight")
     {
        // Do nothing
     }
     else if (e.NewState.Name == "NoHorizontalCompression" && !scrolling)
     {
         deleteItem = false;
         markAsComplete = false;
     }
 }
Esempio n. 10
0
        /// <summary>
        /// Called when the scrolling state of the list box changes.
        /// </summary>
        private void OnStretchStateChanging(object sender, VisualStateChangedEventArgs e)
        {
            IsStretching = e.NewState.Name == CompressionBottom || e.NewState.Name == CompressionTop;

            if (e.NewState.Name == CompressionTop && StretchingTop != null)
            {
                StretchingTop(this, null);
            }
            else if (e.NewState.Name == CompressionBottom && StretchingBottom != null)
            {
                StretchingBottom(this, null);
            }
            else if (e.NewState.Name == NoVerticalCompression && StretchingCompleted != null)
            {
                StretchingCompleted(this, null);
            }
        }
Esempio n. 11
0
 private void HandleCurrentStateChanged(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState.Name == LevelState.Intro.ToString()) {
         this.State = LevelState.Playing;
         this.Start();
     }
     else if (e.NewState.Name == LevelState.Completed.ToString()) {
         if (this.Completed != null)
             this.Completed(this, EventArgs.Empty);
     }
 }
Esempio n. 12
0
 private void HandleTextStatesChanged(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState.Name == "Visible")
         VisualStateManager.GoToState(this, "Hidden", true);
 }
Esempio n. 13
0
 private void vgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState.Name == "CompressionBottom")
     {
         //Load more items to the list
     }
 }
Esempio n. 14
0
 void vgroupArtists_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState.Name == "CompressionBottom")
         loadMoreRecommendedArtists();
 }
        private void OnCoveringStateChanging(object sender, VisualStateChangedEventArgs e)
        {
            Debug("OnCoveringStateChanging");

            if (e.NewState != null && e.NewState.Name == UncoveredStateName && _contentPanel != null && _contentPanel.Children.Count == 0)
            {
                RealizeContent();
            }
        }
Esempio n. 16
0
 private void HandleAlertStateChanged(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState.Name == "Float")
         ((Panel)this.Parent).Children.Remove(this);
 }
Esempio n. 17
0
        void group_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
        {
            if (scrolling && deleteItem)
            {
                var item = (e.Control as ScrollViewer).DataContext.ToString();

                // List<string> favourites = (List<string>)favouriteList.ItemsSource;

                //favourites.Remove(item);
                //favouriteList.ItemsSource = favourites;

                deleteItem = false;
            }
            else if (scrolling)
            {
                if (markAsComplete)
                {
                    var sv = e.Control as ScrollViewer;
                    var sp = sv.Content as StackPanel;
                    var textBlock = sp.Children[0] as TextBlock;

                    Navigation.GoToPage(this, Pages.Action, textBlock.Text);

                }
                var storyboard = new Storyboard();
                var animation = new DoubleAnimation()
                {
                    Duration = TimeSpan.FromMilliseconds(300),
                    From = (e.Control as ScrollViewer).HorizontalOffset,
                    To = 150,
                    EasingFunction = new CubicEase()
                    {
                        EasingMode = EasingMode.EaseOut
                    }
                };
                Storyboard.SetTarget(animation, e.Control.Tag as ScrollViewerOffsetMediator);
                Storyboard.SetTargetProperty(animation, new PropertyPath(ScrollViewerOffsetMediator.HorizontalOffsetProperty));

                storyboard.Children.Add(animation);
                storyboard.Begin();
                //(e.Control as ScrollViewer).ScrollToHorizontalOffset(150);
            }

            scrolling = e.NewState.Name == "Scrolling";
        }
Esempio n. 18
0
        private void VSGCurrentStateChanged(object sender, VisualStateChangedEventArgs e)
        {
            // update the next visual state storyboard target (only if it's not the last slide)
            if (m_curSlideIndex < m_slides.Count - 1)
            {
                Timeline tl = FindObjectByName(m_curVS.Storyboard.Children, m_curVS.Name + "_next" + TLOpacName);
                if (tl != null)
                    tl.SetValue(Storyboard.TargetNameProperty, m_slides[m_curSlideIndex + 1].Name);

                tl = FindObjectByName(m_curVS.Storyboard.Children, m_curVS.Name + "_next" + TLVisName);
                if (tl != null)
                    tl.SetValue(Storyboard.TargetNameProperty, m_slides[m_curSlideIndex + 1].Name);
            }

            m_inTransition = false;
        }
 /// <summary>
 /// Actually closes the popup after the VSM state animation completes.
 /// </summary>
 /// <param name="sender">Event source.</param>
 /// <param name="e">Event arguments.</param>
 private void OnPopupClosedStateChanged(object sender, VisualStateChangedEventArgs e)
 {
     // Delayed closing of the popup until now
     if (e != null && e.NewState != null && e.NewState.Name == VisualStates.StatePopupClosed)
     {
         if (Popup != null)
         {
             Popup.IsOpen = false;
         }
         OnClosed(EventArgs.Empty);
     }
 }
Esempio n. 20
0
 /// <summary>
 /// Changes the DataPoint object's state after one of the VSM state animations completes.
 /// </summary>
 /// <param name="sender">Event source.</param>
 /// <param name="e">Event arguments.</param>
 private void OnCurrentStateChanged(object sender, VisualStateChangedEventArgs e)
 {
     switch (e.NewState.Name)
     {
         case StateRevealShown:
             if (State == DataPointState.Showing)
             {
                 State = DataPointState.Normal;
             }
             break;
         case StateRevealHidden:
             if (State == DataPointState.Hiding)
             {
                 State = DataPointState.Hidden;
             }
             break;
     }
 }
        private void OnCoveringStateChanged(object sender, VisualStateChangedEventArgs e)
        {
            Debug("OnCoveringStateChanged");

            if (e.NewState != null && e.NewState.Name == CoveredStateName && _contentPanel != null && ReleaseContentTree)
            {
                ClearContentVisualTree();
            }
            else if (e.NewState != null && e.NewState.Name == UncoveredStateName && _contentPresenter != null && _contentPresenter.IsHitTestVisible == false)
            {
                _contentPresenter.IsHitTestVisible = true;
            }
        }
        private void hgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
        {
            if (e.NewState.Name == "CompressionLeft")
            {
                ProcessBounce();
                HCompressionTxb.Foreground = new SolidColorBrush(Colors.White);
                LeftTxb.Foreground = new SolidColorBrush(Colors.Green);
            }

            if (e.NewState.Name == "CompressionRight")
            {
                ProcessBounce();
                HCompressionTxb.Foreground = new SolidColorBrush(Colors.White);
                RightTxb.Foreground = new SolidColorBrush(Colors.Green);
            }
            if (e.NewState.Name == "NoHorizontalCompression")
            {
                ReleaseBounce();
                LeftTxb.Foreground = new SolidColorBrush(Colors.White);
                RightTxb.Foreground = new SolidColorBrush(Colors.White);
                HCompressionTxb.Foreground = new SolidColorBrush(Colors.Green);
            }
        }
Esempio n. 23
0
 private void vgroupTracks_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState.Name == "CompressionBottom")
     {
         //Load more items to the recent track list
         loadMoreTracks();
     }
 }
        private void vgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
        {
            if (e.NewState.Name == "CompressionTop")
            {
                ProcessBounce();
                VCompressionTxb.Foreground = new SolidColorBrush(Colors.White);
                TopTxb.Foreground = new SolidColorBrush(Colors.Green);
            }

            if (e.NewState.Name == "CompressionBottom")
            {
                ProcessBounce();
                VCompressionTxb.Foreground = new SolidColorBrush(Colors.White);
                BottomTxb.Foreground = new SolidColorBrush(Colors.Green);

                /*
                 * As an example, this is where you can add code to load new items, have the progress bar animation and so on
                 *
                 */
            }
            if (e.NewState.Name == "NoVerticalCompression")
            {
                ReleaseBounce();
                TopTxb.Foreground = new SolidColorBrush(Colors.White);
                BottomTxb.Foreground = new SolidColorBrush(Colors.White);
                VCompressionTxb.Foreground = new SolidColorBrush(Colors.Green);
            }
        }
        private void vgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
        {
            if (e.NewState.Name == "CompressionTop")
            {

            }

            if (e.NewState.Name == "CompressionBottom")
            {
                if (!isCurrentlyLoading )
                {
                    LoadDataFromSource();
                }
            }
            if (e.NewState.Name == "NoVerticalCompression")
            {

            }
        }
 private void group_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState.Name == "Scrolling")
     {
         isScrollingTxb.Foreground = new SolidColorBrush(Colors.Green);
         AnimateText(scrollStartedTxb);
     }
     else
     {
         isScrollingTxb.Foreground = new SolidColorBrush(Colors.White);
         AnimateText(scrollCompletedTxb);
     }
 }
Esempio n. 27
0
        /// <summary>
        /// Called when the scrolling state of the list box changes.
        /// </summary>
        private void OnScrollStateChanging(object sender, VisualStateChangedEventArgs e)
        {
            IsScrolling = e.NewState.Name == ScrollingState;

            if (e.NewState.Name == ScrollingState && ScrollingStarted != null)
            {
                ScrollingStarted(this, null);
            }
            else if (e.NewState.Name == NotScrollingState && ScrollingCompleted != null)
            {
                ScrollingCompleted(this, null);
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Provides handling for the ExpansionStates CurrentChanged event.
        /// </summary>
        /// <param name="sender">The ExpansionState VisualStateGroup.</param>
        /// <param name="e">Event arguments.</param>
        private void OnExpansionStateGroupStateChanged(object sender, VisualStateChangedEventArgs e)
        {
            // Only listen for the Expanded state
            if (string.Compare(e.NewState.Name, VisualStates.StateExpanded, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return;
            }

            // Scroll the TreeViewItem into view when it's expanded
            TreeView parent = ParentTreeView;
            if (parent != null)
            {
                // The child items aren't necessarily in the visual tree yet
                // so we wait for two ticks to pass before trying to scroll
                // so there size will be respected.
                Dispatcher.BeginInvoke(() =>
                {
                    Dispatcher.BeginInvoke(() =>
                    {
                        // Note that we scroll the entire TreeViewItem into view,
                        // not just its HeaderElement.
                        parent.ItemContainerGenerator.ScrollIntoView(this);
                    });
                });
            }
        }
        private void VerticalGroupCurrentStateChanging(object sender, VisualStateChangedEventArgs e)
        {
            if (e.NewState.Name == CompressionTopState)
            {
                _addToHeadTimer = new DispatcherTimer();
                _refresh = false;
                _addToHeadTimer.Interval = TimeSpan.FromSeconds(PullDownInterval);
                _addToHeadTimer.Tick += (s, ea) => { _refresh = true; textBlockAddToHead.Text = "ReleaseToRefresh"; };
                _addToHeadTimer.Start();

                textBlockAddToHead.Text = "HoldToRefresh";
                stackPanelAddToHead.Visibility = System.Windows.Visibility.Visible;
            }

            if (e.NewState.Name == CompressionBottomState)
                if (LoadTail != null &&
                    LoadTail.CanExecute(ItemsSource))
                    LoadTail.Execute(ItemsSource);

            if (e.NewState.Name == NoVerticalCompressionState)
            {
                stackPanelAddToHead.Visibility = System.Windows.Visibility.Collapsed;

                if (_addToHeadTimer != null &&
                    _addToHeadTimer.IsEnabled)
                {
                    _addToHeadTimer.Stop();

                    if (_refresh &&
                        LoadHead != null &&
                        LoadHead.CanExecute(ItemsSource))
                    {
                        _refresh = false;
                        LoadHead.Execute(ItemsSource);
                    }
                }
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Provides handling for the ExpansionStates CurrentChanged event.
        /// </summary>
        /// <param name="sender">The ExpansionState VisualStateGroup.</param>
        /// <param name="e">Event arguments.</param>
        private void OnExpansionStateGroupStateChanged(object sender, VisualStateChangedEventArgs e)
        {
            // Only listen for the Expanded state
            if (string.Compare(e.NewState.Name, VisualStates.StateExpanded, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return;
            }

            BringIntoView();
        }