Exemple #1
0
        /// <summary>
        /// Creates an <see cref="AppViewInfo"/> from the specified dispatcher.
        /// </summary>
        /// <param name="name">
        /// The name of the view.
        /// </param>
        /// <param name="dispatcher">
        /// The dispatcher to get the view from.
        /// </param>
        /// <returns>
        /// A <see cref="Task"/> that yields the <see cref="AppViewInfo"/> for the current view in the dispatcher.
        /// </returns>
        static public async Task <AppViewInfo> CreateFromDispatcherAsync(string name, CoreDispatcher dispatcher)
        {
            // Validate
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException(nameof(name));
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException(nameof(dispatcher));
            }

            // Placeholders
            ApplicationView view = null;
            AppViewInfo     info = null;

            // Use dispatcher to get ApplicationView
            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                // Get view
                view = ApplicationView.GetForCurrentView();

                // Create info class
                info = new AppViewInfo(view, dispatcher, name);
            });

            // Add to list
            views.Add(info);

            // Done
            return(info);
        }
Exemple #2
0
        /// <summary>
        /// Visually replaces the current view with this view.
        /// </summary>
        /// <param name="fromView">
        /// The view you are switching from.
        /// </param>
        /// <param name="options">
        /// Options for the display transition behaviors.
        /// </param>
        /// <returns>
        /// A <see cref="Task"/> that represents the operation.
        /// </returns>
        public async Task SwitchAsync(AppViewInfo fromView, ApplicationViewSwitchingOptions options)
        {
            // From view MUST be passed
            if (fromView == null)
            {
                throw new ArgumentNullException(nameof(fromView));
            }

            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                await ApplicationViewSwitcher.SwitchAsync(this.view.Id, fromView.view.Id, options);
            });
        }
Exemple #3
0
        public void Switch(AppViewInfo fromView)
        {
#if WINDOWS_UWP
            SwitchAsync(fromView, Windows.UI.ViewManagement.ApplicationViewSwitchingOptions.SkipAnimation).Wait();
#endif
        }