コード例 #1
0
        /// <summary>
        /// Dismisses the message box.
        /// </summary>
        /// <param name="source">
        /// The source that caused the dismission.
        /// </param>
        /// <param name="useTransition">
        /// If true, the message box is dismissed after swiveling
        /// backward and out.
        /// </param>
        private void Dismiss(CustomMessageBoxResult source, bool useTransition)
        {
            // Ensure only a single Dismiss is being handled at a time
            if (_isBeingDismissed)
            {
                return;
            }
            _isBeingDismissed = true;

            // Handle the dismissing event.
            var handlerDismissing = Dismissing;

            if (handlerDismissing != null)
            {
                DismissingEventArgs args = new DismissingEventArgs(source);
                handlerDismissing(this, args);

                if (args.Cancel)
                {
                    _isBeingDismissed = false;
                    return;
                }
            }

            // Handle the dismissed event.
            var handlerDismissed = Dismissed;

            if (handlerDismissed != null)
            {
                DismissedEventArgs args = new DismissedEventArgs(source);
                handlerDismissed(this, args);
            }

            // Set the current instance to null.
            _currentInstance = null;

            // Cache this variable to avoid a race condition.
            bool restoreOriginalValues = _mustRestore;

            // Close popup.
            if (useTransition)
            {
                SwivelTransition backwardOut = new SwivelTransition {
                    Mode = SwivelTransitionMode.BackwardOut
                };
                ITransition swivelTransition = backwardOut.GetTransition(this);
                swivelTransition.Completed += (s, e) =>
                {
                    swivelTransition.Stop();
                    ClosePopup(restoreOriginalValues);
                };
                swivelTransition.Begin();
            }
            else
            {
                ClosePopup(restoreOriginalValues);
            }

            _isBeingDismissed = false;
        }
コード例 #2
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SlideTransition transition = new SlideTransition();

            transition.Mode = SlideTransitionMode.SlideRightFadeIn;
            PhoneApplicationPage page  = (PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content;
            ITransition          trans = transition.GetTransition(page);

            trans.Completed += delegate
            {
                trans.Stop();
            };
            trans.Begin();

            if (e.NavigationMode == NavigationMode.Back)
            {
                var id = (this.DataContext as TournViewModel).TournId;
                DataContext = null;
                DataContext = new TournViewModel();
                (this.DataContext as TournViewModel).TournId = id;
                return;
            }
            string parameterValue = NavigationContext.QueryString["param1"];

            int tournId;

            if (!Int32.TryParse(parameterValue, out tournId))
            {
                throw new NotImplementedException();
            }

            (this.DataContext as TournViewModel).TournId = tournId;
        }
コード例 #3
0
        void radioListGropus_GroupViewClosing(object sender, GroupViewClosingEventArgs e)
        {
            e.Cancel = true;

            SwivelTransition       transition             = new SwivelTransition();
            ItemContainerGenerator itemContainerGenerator = e.ItemsControl.ItemContainerGenerator;

            int animationFinished = 0;
            int itemCount         = e.ItemsControl.Items.Count;

            for (int i = 0; i < itemCount; i++)
            {
                UIElement element = itemContainerGenerator.ContainerFromIndex(i) as UIElement;

                ITransition animation = transition.GetTransition(element);
                animation.Completed += delegate
                {
                    // close the group view when all animations have completed
                    if ((++animationFinished) == itemCount)
                    {
                        radioListGropus.CloseGroupView();
                        radioListGropus.ScrollToGroup(e.SelectedGroup);
                    }
                };
                animation.Begin();
            }
        }
コード例 #4
0
 /// <summary>
 /// Transitions the new <see cref="T:System.Windows.UIElement"/>.
 /// </summary>
 /// <param name="newTransition">The <see cref="T:Microsoft.Phone.Controls.ITransition"/> for the new <see cref="T:System.Windows.UIElement"/>.</param>
 /// <param name="navigationInTransition">The <see cref="T:Microsoft.Phone.Controls.NavigationInTransition"/>  for the new <see cref="T:System.Windows.UIElement"/>.</param>
 private void TransitionNewElement(ITransition newTransition, NavigationInTransition navigationInTransition)
 {
     _oldContentPresenter.Visibility = Visibility.Collapsed;
     _oldContentPresenter.Content    = null;
     if (newTransition == null)
     {
         _newContentPresenter.IsHitTestVisible = true;
         _newContentPresenter.Opacity          = 1;
         return;
     }
     if (newTransition.GetCurrentState() != ClockState.Stopped)
     {
         newTransition.Stop();
     }
     newTransition.Completed += delegate
     {
         newTransition.Stop();
         _newContentPresenter.CacheMode        = null;
         _newContentPresenter.IsHitTestVisible = true;
         if (navigationInTransition != null)
         {
             navigationInTransition.OnEndTransition();
         }
     };
     Dispatcher.BeginInvoke(delegate
     {
         if (navigationInTransition != null)
         {
             navigationInTransition.OnBeginTransition();
         }
         _newContentPresenter.Opacity = 1;
         newTransition.Begin();
     });
 }
コード例 #5
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.NavigationMode != NavigationMode.Back)
            {
                SlideTransition transition = new SlideTransition();
                transition.Mode = SlideTransitionMode.SlideRightFadeIn;

                PhoneApplicationPage page  = (PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content;
                ITransition          trans = transition.GetTransition(page);

                trans.Completed += delegate
                {
                    trans.Stop();

                    if (e.NavigationMode == NavigationMode.New)
                    {
                        addPersonViewModel = new AddPersonViewModel(this);
                        this.DataContext   = addPersonViewModel;
                    }
                };
                trans.Begin();
            }
        }
コード例 #6
0
        private void PageTransition(NavigationTransition navigationTransition)
        {
            if (Application.Current.RootVisual == null)
            {
                return;
            }

            PhoneApplicationPage phoneApplicationPage = (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;
            ITransition          transition           = null;

            if (mNextTranistionIsForward)
            {
                transition = navigationTransition.Forward.GetTransition(phoneApplicationPage);
            }
            else
            {
                transition = navigationTransition.Backward.GetTransition(phoneApplicationPage);
            }
            transition.Completed += delegate
            {
                transition.Stop();
                if (TemporaryVisibleScreen != Screen.None)
                {
                    VisibleScreen          = TemporaryVisibleScreen;
                    TemporaryVisibleScreen = Screen.None;
                    PageTransition(Application.Current.Resources["NavigationInTransition"] as NavigationInTransition);
                }
            };
            transition.Begin();
        }
コード例 #7
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            // hack to always enable the Venue textbox if it has been disabled in the event the user clicks search while keyboard is showing
            this.BackKeyPress += EnableVenueTextBox;

            IDictionary <string, string> parameters = this.NavigationContext.QueryString;

            if (parameters.ContainsKey("DateId"))
            {
                DateId = Int32.Parse(parameters["DateId"]);
            }

            base.OnNavigatedTo(e);

            if (e.NavigationMode != NavigationMode.Back)
            {
                SlideTransition transition = new SlideTransition();
                transition.Mode = SlideTransitionMode.SlideRightFadeIn;

                PhoneApplicationPage page  = (PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content;
                ITransition          trans = transition.GetTransition(page);

                trans.Completed += delegate
                {
                    trans.Stop();

                    if (e.NavigationMode == NavigationMode.New)
                    {
                        ceDateViewModel  = new CEDateViewModel(this, DateId);
                        this.DataContext = ceDateViewModel;
                    }
                };
                trans.Begin();
            }
        }
コード例 #8
0
ファイル: App.xaml.cs プロジェクト: Jesn/MangGuoTv
 private static void PopupOffAnimation()
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         if (_popUp != null && _popUp.Child != null)
         {
             if (st == null)
             {
                 st = new SlideTransition();
             }
             st.Mode = SlideTransitionMode.SlideRightFadeOut;
             ITransition transition = st.GetTransition(_popUp.Child);
             transition.Completed  += delegate
             {
                 transition.Stop();
                 if (_popUp != null)
                 {
                     _popUp.Child = null;
                     _popUp       = null;
                 }
             };
             transition.Begin();
         }
     });
 }
コード例 #9
0
        /// <summary>
        /// Event for when the orientation of the target page changes.
        /// </summary>
        /// <param name="sender">The PhoneApplicationPage that raised the event.</param>
        /// <param name="ocea">The event args associated with this OrientationChanged event.</param>
        private void ParentPage_OrientationChanged(object sender, OrientationChangedEventArgs ocea)
        {
            // Make into an attached property.
            PageOrientation  newOrientation = ocea.Orientation;
            RotateTransition rotation       = new RotateTransition();

            switch (_lastOrientation)
            {
            // Dont need to worry about case where you go from landscape left to landscape right or vice versa (180 degrees).
            case PageOrientation.LandscapeLeft:
                // New orientation should never be == old orientation.
                if (newOrientation == PageOrientation.PortraitUp)
                {
                    // From landscape left to portrait up.
                    rotation.Mode = RotateTransitionMode.In90Counterclockwise;
                }
                else
                {
                    // From landscape left to landscape right.
                    rotation.Mode = RotateTransitionMode.In180Counterclockwise;
                }
                break;

            case PageOrientation.LandscapeRight:
                if (newOrientation == PageOrientation.PortraitUp)
                {
                    // From landscape right to portrait up.
                    rotation.Mode = RotateTransitionMode.In90Clockwise;
                }
                else
                {
                    // From landscape right to portrait down.
                    rotation.Mode = RotateTransitionMode.In180Clockwise;
                }
                break;

            // Dont need to worry about case where you go from landscape left to landscape right or vice versa (180 degrees).
            case PageOrientation.PortraitUp:
                // New orientation should never be == old orientation.
                if (newOrientation == PageOrientation.LandscapeLeft)
                {
                    rotation.Mode = RotateTransitionMode.In90Clockwise;
                }
                else
                {
                    rotation.Mode = RotateTransitionMode.In90Counterclockwise;
                }
                break;

            default:
                break;
            }

            // Execute the transition
            ITransition transition = rotation.GetTransition(_target);

            transition.Completed += (o, e) => transition.Stop();
            transition.Begin();
            _lastOrientation = newOrientation;
        }
コード例 #10
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            IDictionary <string, string> parameters = this.NavigationContext.QueryString;

            if (parameters.ContainsKey("PersonId"))
            {
                PersonId = Int32.Parse(parameters["PersonId"]);
            }

            base.OnNavigatedTo(e);

            if (e.NavigationMode != NavigationMode.Back)
            {
                SlideTransition transition = new SlideTransition();
                transition.Mode = SlideTransitionMode.SlideRightFadeIn;

                PhoneApplicationPage page  = (PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content;
                ITransition          trans = transition.GetTransition(page);

                trans.Completed += delegate
                {
                    trans.Stop();

                    if (e.NavigationMode == NavigationMode.New)
                    {
                        cePersonViewModel = new CEPersonViewModel(this, PersonId);
                        this.DataContext  = cePersonViewModel;
                    }
                };
                trans.Begin();
            }
        }
コード例 #11
0
        private void toggleMode()
        {
            SlideTransition st = new SlideTransition {
                Mode = (keysHidden) ? SlideTransitionMode.SlideUpFadeIn : SlideTransitionMode.SlideDownFadeOut
            };
            ITransition it = st.GetTransition(ContentPanel);

            it.Completed += (s, eventargs) =>
            {
                it.Stop();
                if (!keysHidden)
                {
                    lstHist.Visibility = System.Windows.Visibility.Visible;
                    grdKeys.Visibility = System.Windows.Visibility.Collapsed;
                }
                try
                {
                    BitmapImage img = new BitmapImage(new Uri(((keysHidden) ? "/images/down.png" : "/images/up.png"), UriKind.Relative));
                    imgToggleKeys.Source = img;
                }
                catch (Exception ex) { MessageBox.Show(ex.Message); }
                keysHidden = !keysHidden;
            };
            if (keysHidden)
            {
                lstHist.Visibility = System.Windows.Visibility.Collapsed; grdKeys.Visibility = System.Windows.Visibility.Visible;
            }
            it.Begin();
        }
コード例 #12
0
        private void Grid_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            RotateTransition rotate = new RotateTransition()
            {
                Mode = RotateTransitionMode.Out180Clockwise
            };

            ITransition transition = rotate.GetTransition((Grid)sender);

            transition.Begin();

            transition.Completed += delegate
            {
                transition.Stop();

                switch ((sender as Grid).Name)
                {
                case "contato":

                    EmailComposeTask contato = new EmailComposeTask()
                    {
                        To      = "*****@*****.**",
                        Subject = AppResources.Sobre_Contato_Subject
                    };

                    contato.Show();

                    break;

                case "share":

                    string[] compartilhar = new string[4] {
                        string.Empty,
                        AppResources.Sobre_Compartilhar_RedesSociais, "E-mail", "SMS"
                    };

                    lpk.Header      = AppResources.Sobre_Compartilhar;
                    lpk.ItemsSource = compartilhar;

                    lpk.Open();

                    break;

                case "avaliar":

                    IsolatedStorageSettings.ApplicationSettings["cancelReview"] = 1;

                    MarketplaceReviewTask avaliar = new MarketplaceReviewTask();
                    avaliar.Show();

                    break;

                default:
                    break;
                }
            };
        }
コード例 #13
0
        private void FullImage_OrientationChanged(object sender, OrientationChangedEventArgs e)
        {
            RotateTransition     rotateTransition = new RotateTransition();
            PhoneApplicationPage element          = (PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content;

            switch (e.Orientation)
            {
            case PageOrientation.LandscapeLeft:
                switch (this.previousOrientation)
                {
                case PageOrientation.PortraitUp:
                    rotateTransition.Mode = RotateTransitionMode.In90Clockwise;
                    break;

                case PageOrientation.LandscapeRight:
                    rotateTransition.Mode = RotateTransitionMode.In180Clockwise;
                    break;
                }
                break;

            case PageOrientation.LandscapeRight:
                switch (this.previousOrientation)
                {
                case PageOrientation.PortraitUp:
                    rotateTransition.Mode = RotateTransitionMode.In90Counterclockwise;
                    break;

                case PageOrientation.LandscapeLeft:
                    rotateTransition.Mode = RotateTransitionMode.In180Counterclockwise;
                    break;
                }
                break;

            case PageOrientation.Portrait:
                switch (this.previousOrientation)
                {
                case PageOrientation.LandscapeLeft:
                    rotateTransition.Mode = RotateTransitionMode.In90Counterclockwise;
                    break;

                case PageOrientation.LandscapeRight:
                    rotateTransition.Mode = RotateTransitionMode.In90Clockwise;
                    break;
                }
                break;
            }

            ITransition transition = rotateTransition.GetTransition(element);

            transition.Completed += delegate
            {
                transition.Stop();
            };
            transition.Begin();
            this.previousOrientation = e.Orientation;
        }
コード例 #14
0
        /// <summary>
        /// Called when the visual layout changes.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event information.</param>
        private void CustomMessageBox_LayoutUpdated(object sender, EventArgs e)
        {
            SwivelTransition backwardIn = new SwivelTransition {
                Mode = SwivelTransitionMode.BackwardIn
            };
            ITransition swivelTransition = backwardIn.GetTransition(this);

            swivelTransition.Completed += (s1, e1) => swivelTransition.Stop();
            swivelTransition.Begin();
            LayoutUpdated -= CustomMessageBox_LayoutUpdated;
        }
コード例 #15
0
        private void OnOrientationChanged(object sender, OrientationChangedEventArgs e)
        {
            PageOrientation newOrientation = e.Orientation;

            RotateTransition transitionElement = new RotateTransition();

            // Adjust padding if possible

            if (null != MainGrid)
            {
                switch (newOrientation)
                {
                case PageOrientation.Portrait:
                case PageOrientation.PortraitUp:
                    HeaderTitle.Margin = new Thickness(20, 12, 12, 12);
                    Picker.Margin      = new Thickness(8, 12, 0, 0);

                    transitionElement.Mode = (lastOrientation == PageOrientation.LandscapeLeft) ?
                                             RotateTransitionMode.In90Counterclockwise : RotateTransitionMode.In90Clockwise;

                    break;

                case PageOrientation.Landscape:
                case PageOrientation.LandscapeLeft:
                    HeaderTitle.Margin = new Thickness(72, 0, 0, 0);
                    Picker.Margin      = new Thickness(60, 0, 0, 0);

                    transitionElement.Mode = (lastOrientation == PageOrientation.LandscapeRight) ?
                                             RotateTransitionMode.In180Counterclockwise : RotateTransitionMode.In90Clockwise;
                    break;

                case PageOrientation.LandscapeRight:
                    HeaderTitle.Margin = new Thickness(20, 0, 0, 0);
                    Picker.Margin      = new Thickness(8, 0, 0, 0);

                    transitionElement.Mode = (lastOrientation == PageOrientation.PortraitUp) ?
                                             RotateTransitionMode.In90Counterclockwise : RotateTransitionMode.In180Clockwise;
                    break;
                }
            }

            PhoneApplicationPage phoneApplicationPage = (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;
            ITransition          transition           = transitionElement.GetTransition(phoneApplicationPage);

            transition.Completed += delegate
            {
                transition.Stop();
            };
            transition.Begin();

            lastOrientation = newOrientation;
        }
コード例 #16
0
ファイル: ListTopics.xaml.cs プロジェクト: FLKone/HFR8
        private void ForwardInTransition()
        {
            TransitionElement transitionElement = new TurnstileTransition {
                Mode = TurnstileTransitionMode.ForwardIn
            };
            ITransition transition = transitionElement.GetTransition((PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content);

            transition.Completed += delegate
            {
                transition.Stop();
            };
            transition.Begin();
        }
コード例 #17
0
        private void ApplyTransitionAppBarBtn_Click(object sender, EventArgs e)
        {
            RotateTransition rotateTransition =
                new RotateTransition {
                Mode = RotateTransitionMode.In180Clockwise
            };

            ITransition transition = rotateTransition.GetTransition(targetRectangle);

            transition.Completed +=
                (s, eventarg) => { transition.Stop(); targetRectangle.Opacity = 1; };

            transition.Begin();
        }
コード例 #18
0
 /// <summary>
 /// Performs a transition when given the appropriate components,
 /// includes calling the appropriate start event and ensuring opacity
 /// on the content presenter.
 /// </summary>
 /// <param name="navigationTransition">The navigation transition.</param>
 /// <param name="presenter">The content presenter.</param>
 /// <param name="transition">The transition instance.</param>
 private static void PerformTransition(NavigationTransition navigationTransition, ContentPresenter presenter, ITransition transition)
 {
     if (navigationTransition != null)
     {
         navigationTransition.OnBeginTransition();
     }
     if (presenter != null && presenter.Opacity != 1)
     {
         presenter.Opacity = 1;
     }
     if (transition != null)
     {
         transition.Begin();
     }
 }
コード例 #19
0
ファイル: PopupManager.cs プロジェクト: Jesn/MangGuoTv
        private static void PopupShowAnimation()
        {
            if (st == null)
            {
                st = new SlideTransition();
            }
            st.Mode = SlideTransitionMode.SlideUpFadeIn;
            ITransition transition = st.GetTransition(_popUp.Child);

            transition.Completed += delegate {
                transition.Stop();
            };
            transition.Begin();
            _popUp.Child.Opacity = 1;
        }
コード例 #20
0
        void radioListGropus_GroupViewOpened(object sender, GroupViewOpenedEventArgs e)
        {
            ItemContainerGenerator itemContainerGenerator = e.ItemsControl.ItemContainerGenerator;
            TurnstileTransition    turnstileTransition    = new TurnstileTransition();

            turnstileTransition.Mode = TurnstileTransitionMode.ForwardIn;

            int itemCount = e.ItemsControl.Items.Count;

            for (int i = 0; i < itemCount; i++)
            {
                UIElement   element   = itemContainerGenerator.ContainerFromIndex(i) as UIElement;
                ITransition animation = turnstileTransition.GetTransition(element);
                animation.Begin();
            }
        }
コード例 #21
0
        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            if (AppHelper.AppEff)
            {
                SlideTransitionMode slideTransitionMode = (SlideTransitionMode)Enum.Parse(typeof(SlideTransitionMode), "SlideDownFadeOut", false);
                TransitionElement   transitionElement   = new SlideTransition {
                    Mode = slideTransitionMode
                };

                PhoneApplicationPage phoneApplicationPage = (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;

                ITransition transition = transitionElement.GetTransition(phoneApplicationPage);
                transition.Completed += delegate { transition.Stop(); };
                transition.Begin();
            }
        }
コード例 #22
0
 /// <summary>
 /// Performs a transition when given the appropriate components,
 /// includes calling the appropriate start event and ensuring opacity
 /// on the content presenter.
 /// </summary>
 /// <param name="navigationTransition">The navigation transition.</param>
 /// <param name="presenter">The content presenter.</param>
 /// <param name="transition">The transition instance.</param>
 private static void PerformTransition(TelegramNavigationTransition navigationTransition, ContentPresenter presenter, ITransition transition)
 {
     if (navigationTransition != null)
     {
         navigationTransition.OnBeginTransition();
         //var dynMethod = navigationTransition.GetType().GetMethod("OnBeginTransition", BindingFlags.NonPublic | BindingFlags.Instance);
         //dynMethod.Invoke(navigationTransition, new object[] { });
     }
     if (presenter != null && presenter.Opacity != 1)
     {
         presenter.Opacity = 1;
     }
     if (transition != null)
     {
         transition.Begin();
     }
 }
コード例 #23
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            IDictionary <string, string> parameters = this.NavigationContext.QueryString;

            if (parameters.ContainsKey("DateId"))
            {
                DateId = parameters["DateId"];
            }


            if (e.NavigationMode != NavigationMode.Back)
            {
                SlideTransition transition = new SlideTransition();
                transition.Mode = SlideTransitionMode.SlideRightFadeIn;

                PhoneApplicationPage page  = (PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content;
                ITransition          trans = transition.GetTransition(page);

                trans.Completed += delegate
                {
                    trans.Stop();

                    if (e.NavigationMode == NavigationMode.New)
                    {
                        editDateViewModel = new EditDateViewModel(Int32.Parse(DateId), this);
                        this.DataContext  = editDateViewModel;

                        DoubleLoopingDataSource doubleLoopingDataSource = new DoubleLoopingDataSource()
                        {
                            MinValue = 0, MaxValue = 5, SelectedItem = editDateViewModel.EditDate.Rating
                        };
                        doubleLoopingDataSource.SelectionChanged += new EventHandler <SelectionChangedEventArgs>(LoopingSelector_SelectionChanged);

                        IntLoopingDataSource intLoopingDataSource = new IntLoopingDataSource()
                        {
                            MinValue = 0, MaxValue = 10, SelectedItem = editDateViewModel.EditDate.Rating
                        };
                        intLoopingDataSource.SelectionChanged += new EventHandler <SelectionChangedEventArgs>(LoopingSelector_SelectionChanged);
                        this.selector.DataSource = doubleLoopingDataSource;
                    }
                };
                trans.Begin();
            }
        }
コード例 #24
0
        // Избранное
        private void AppList_Click_1(object sender, EventArgs e)
        {
            NavigationService.Navigate(new Uri("/Pages/ListPage.xaml", UriKind.Relative));

            if (AppHelper.AppEff)
            {
                SlideTransitionMode slideTransitionMode = (SlideTransitionMode)Enum.Parse(typeof(SlideTransitionMode), "SlideDownFadeOut", false);
                TransitionElement   transitionElement   = new SlideTransition {
                    Mode = slideTransitionMode
                };

                PhoneApplicationPage phoneApplicationPage = (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;

                ITransition transition = transitionElement.GetTransition(phoneApplicationPage);
                transition.Completed += delegate { transition.Stop(); };
                transition.Begin();
            }
        }
コード例 #25
0
        // Load data for the ViewModel Items
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            SlideTransition transition = new SlideTransition();

            transition.Mode = SlideTransitionMode.SlideRightFadeIn;
            PhoneApplicationPage page  = (PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content;
            ITransition          trans = transition.GetTransition(page);

            trans.Completed += delegate
            {
                trans.Stop();
            };
            trans.Begin();
            //if (!App.ViewModel.IsDataLoaded)
            //{
            //    App.ViewModel.LoadData();
            //}
        }
コード例 #26
0
        private void GestureListener_Flick(object sender, FlickGestureEventArgs e)
        {
            if (e.Direction == System.Windows.Controls.Orientation.Horizontal && items != null && items.Count > 0)
            {
                bool increase = e.HorizontalVelocity > 0;//? "Right" : "Left";

                SlideTransition sTx = new SlideTransition();
                sTx.Mode = !increase ? SlideTransitionMode.SlideLeftFadeIn : SlideTransitionMode.SlideRightFadeIn;
                ITransition transition = sTx.GetTransition(htmlBlock);
                transition.Completed += delegate
                {
                    transition.Stop();
                };
                transition.Begin();



                if (!increase)
                {
                    if (position < items.Count - 1)
                    {
                        position++;
                    }
                    else
                    {
                        position = 0;//we do a loop
                    }
                }
                else
                {
                    if (position > 0)
                    {
                        position--;
                    }
                    else
                    {
                        position = items.Count - 1;//we do a loop
                    }
                }
                showItem();
                //
            }
        }
コード例 #27
0
        private void StartTransition()
        {
            //RollTransition rotatetransition = new RollTransition();
            RotateTransition rotatetransition = new RotateTransition();

            //rotatetransition.Mode = RotateTransitionMode.In90Clockwise;
            rotatetransition.Mode = RotateTransitionMode.In180Counterclockwise;

            PhoneApplicationPage phoneApplicationPage =
                (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;

            ITransition transition = rotatetransition.GetTransition(phoneApplicationPage);

            transition.Completed += delegate
            {
                transition.Stop();
            };
            transition.Begin();
        }
コード例 #28
0
ファイル: MainPage.xaml.cs プロジェクト: shegg77/Contacts
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            App.ViewModel.LoadData(true);

            base.OnNavigatedTo(e);
            SlideTransition transition = new SlideTransition();

            transition.Mode = SlideTransitionMode.SlideRightFadeIn;
            PhoneApplicationPage page  = (PhoneApplicationPage)((PhoneApplicationFrame)Application.Current.RootVisual).Content;
            ITransition          trans = transition.GetTransition(page);

            trans.Completed += delegate
            {
                RefreshList();
                DrawLongListSelector();
                trans.Stop();
            };
            trans.Begin();
        }
コード例 #29
0
        public bool Update(float elapsedTime)
        {
            if (TransitionInProgress)
            {
                if (!_transitionStarted)
                {
                    _currentTransition.Begin();
                    _transitionStarted = true;
                }

                _currentTransition.Update(elapsedTime);
                if (_currentTransition.TransitionReady)
                {
                    TransitionInProgress = false;
                    if (_afterTransitionQuit)
                    {
                        return(false);
                    }
                }
            }
            else
            {
                var stateChangeInformation = _currentState.OnUpdate(elapsedTime);
                if (stateChangeInformation != StateChangeInformation.Empty)
                {
                    if (stateChangeInformation.QuitGame)
                    {
                        QuitGame(stateChangeInformation.Transition);
                    }
                    else
                    {
                        ChangeToState(
                            stateChangeInformation.TargetState,
                            stateChangeInformation.Transition,
                            stateChangeInformation.EnterInformation);
                    }
                }
            }

            return(true);
        }
コード例 #30
0
        private void StartTransitionRigthFadeIn()
        {
            //RotateTransition rotatetransition = new RotateTransition();
            //rotatetransition.Mode = RotateTransitionMode.In90Clockwise;

            SlideTransition slideTransition = new SlideTransition();

            slideTransition.Mode = SlideTransitionMode.SlideRightFadeIn;

            PhoneApplicationPage phoneApplicationPage =
                (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content;

            ITransition transition = slideTransition.GetTransition(phoneApplicationPage);

            transition.Completed += delegate
            {
                transition.Stop();
            };
            transition.Begin();
            myStoryboard.Begin();
        }
コード例 #31
0
 /// <summary>
 /// Performs a transition when given the appropriate components,
 /// includes calling the appropriate start event and ensuring opacity
 /// on the content presenter.
 /// </summary>
 /// <param name="navigationTransition">The navigation transition.</param>
 /// <param name="presenter">The content presenter.</param>
 /// <param name="transition">The transition instance.</param>
 private static void PerformTransition(NavigationTransition navigationTransition, ContentPresenter presenter, ITransition transition)
 {
     if (navigationTransition != null)
     {
         navigationTransition.OnBeginTransition();
     }
     if (presenter != null && presenter.Opacity != 1)
     {
         presenter.Opacity = 1;
     }
     if (transition != null)
     {
         transition.Begin();
     }
 }
コード例 #32
0
        /// <summary>
        /// Load either from the cache on internet
        /// </summary>
        private void LoadData(int numberOfStarts, ITransition transition = null)
        {
            IndicateStartedLoading(numberOfStarts);

            var loadContext = new DayLoadContext(CurrentDateForWiki, AppSettings.ShowNewestItemsFirst);
            this.DataContext = DataManager.Current.Load<DayViewModel>(
                loadContext,
                vm =>
                {
                    if (App.ReloadRequired)
                    {
                        App.ReloadRequired = false;
                    }
                    else if (App.FontSizeChanged)
                    {
                        vm.UpdateLayout();
                        App.FontSizeChanged = false;
                    }

                    if (App.ReverseRequired)
                    {
                        vm.Highlights = new ObservableCollection<Entry>(vm.Highlights.Reverse());
                        vm.Events.Events = new ObservableCollection<GroupedEntries>(vm.Events.Events.Reverse());
                        vm.Births.Births = new ObservableCollection<GroupedEntries>(vm.Births.Births.Reverse());
                        vm.Deaths.Deaths = new ObservableCollection<GroupedEntries>(vm.Deaths.Deaths.Reverse());
                        App.ReverseRequired = false;
                    }

                    if (!App.IsMemoryLimited && App.FirstLoad)
                    {
                        SetUpLiveTile(numberOfStarts);
                    }

                    if (App.IsMemoryLimited)
                    {
                        ((ApplicationBarMenuItem)ApplicationBar.MenuItems[3]).IsEnabled = false;
                    }

                    IndicateStoppedLoading();

                    if (!inTransition && transition != null)
                    {
                        inTransition = true;
                        transition.Begin();
                    }

                    AdPanel.Opacity = 100;
                },
                ex =>
                {
                    GlobalLoading.Instance.IsLoading = false;
                    GlobalLoading.Instance.LoadingText = null;

                    if (NetworkInterface.GetIsNetworkAvailable())
                    {
                        var extraData = new Collection<CrashExtraData>
                        {
                            new CrashExtraData { Key = "Date", Value = CurrentDateForWiki }
                        };
                        BugSenseHandler.Instance.SendExceptionMap(ex, extraData);
                    }
                    else
                    {
                        MessageBox.Show(Strings.ErrorInternetConnection);
                    }

                    if (!inTransition && transition != null)
                    {
                        inTransition = true;
                        transition.Begin();
                    }
                });

            SetPivotTitle();
        }
コード例 #33
0
 /// <summary>
 /// Transitions the new <see cref="T:System.Windows.UIElement"/>.
 /// </summary>
 /// <param name="oldContentPresenter">The old <see cref="T:System.Windows.Controls.ContentPresenter"/>.</param>
 /// <param name="newContentPresenter">The new <see cref="T:System.Windows.Controls.ContentPresenter"/>.</param>
 /// <param name="transition">The <see cref="T:Microsoft.Phone.Controls.ITransition"/>.</param>
 private static void TransitionNewElement(ContentPresenter oldContentPresenter, ContentPresenter newContentPresenter, ITransition transition)
 {
     oldContentPresenter.Visibility = Visibility.Collapsed;
     oldContentPresenter.Content = null;
     if (transition == null)
     {
         newContentPresenter.Opacity = 1;
     }
     else
     {
         if (transition.GetCurrentState() != ClockState.Stopped)
         {
             transition.Stop();
         }
         transition.Completed += delegate
         {
             transition.Stop();
         };
         newContentPresenter.Opacity = 1;
         transition.Begin();
     }
 }
コード例 #34
0
 /// <summary>
 /// Transitions the new <see cref="T:System.Windows.UIElement"/>.
 /// </summary>
 /// <param name="newTransition">The <see cref="T:Microsoft.Phone.Controls.ITransition"/> for the new <see cref="T:System.Windows.UIElement"/>.</param>
 /// <param name="navigationInTransition">The <see cref="T:Microsoft.Phone.Controls.NavigationInTransition"/>  for the new <see cref="T:System.Windows.UIElement"/>.</param>
 private void TransitionNewElement(ITransition newTransition, NavigationInTransition navigationInTransition)
 {
     _oldContentPresenter.Visibility = Visibility.Collapsed;
     _oldContentPresenter.Content = null;
     if (newTransition == null)
     {
         _newContentPresenter.IsHitTestVisible = true;
         _newContentPresenter.Opacity = 1;
         return;
     }
     if (newTransition.GetCurrentState() != ClockState.Stopped)
     {
         newTransition.Stop();
     }
     newTransition.Completed += delegate
     {
         newTransition.Stop();
         _newContentPresenter.CacheMode = null;
         _newContentPresenter.IsHitTestVisible = true;
         if (navigationInTransition != null)
         {
             navigationInTransition.OnEndTransition();
         }
     };
     Dispatcher.BeginInvoke(delegate
     {
         if (navigationInTransition != null)
         {
             navigationInTransition.OnBeginTransition();
         }
         _newContentPresenter.Opacity = 1;
         newTransition.Begin();
     });
 }