Ejemplo n.º 1
0
        public MainPage()
        {
            this.InitializeComponent();

            string family = AnalyticsInfo.VersionInfo.DeviceFamily;

            var appView  = ApplicationView.GetForCurrentView();
            var titleBar = appView.TitleBar;

            if (family.Contains("Desktop"))
            {
                CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
                coreTitleBar.ExtendViewIntoTitleBar = false;
            }
            else if (family.Contains("Mobile"))
            {
                var statusBar = StatusBar.GetForCurrentView();
                statusBar.ShowAsync();
            }

            TransitionCollection      collection = new TransitionCollection();
            NavigationThemeTransition theme      = new NavigationThemeTransition();

            var info = new EntranceNavigationTransitionInfo();

            theme.DefaultNavigationTransitionInfo = info;
            collection.Add(theme);
            this.Transitions = collection;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame {
                    CacheSize = 3
                };

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated ||
                    e.PreviousExecutionState == ApplicationExecutionState.ClosedByUser ||
                    e.PreviousExecutionState == ApplicationExecutionState.NotRunning)
                {
                    // TODO: Load state from previously suspended application
                    _localSettingsProvider.Load();
                    AppSettings.Instance.Initialize(_localSettingsProvider);
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    _transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        _transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 3
0
        public MainPage()
        {
            TransitionCollection      collection = new TransitionCollection();
            NavigationThemeTransition theme      = new NavigationThemeTransition();

            //var info = new ContinuumNavigationTransitionInfo();
            //var info = new CommonNavigationTransitionInfo();
            var info = new DrillInNavigationTransitionInfo();

            //var info = new EntranceNavigationTransitionInfo();
            //var info = new SlideNavigationTransitionInfo();
            //var info = new SuppressNavigationTransitionInfo();

            theme.DefaultNavigationTransitionInfo = info;
            collection.Add(theme);
            this.Transitions = collection;

            //

            this.InitializeComponent();

            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var i = Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
            }

            if (IsInternet())
            {
                MainFrame.Navigate(typeof(HomePage));
            }
            else
            {
                MainFrame.Navigate(typeof(NoInternetPage));
            }
        }
Ejemplo n.º 4
0
        public Shell()
        {
            this.InitializeComponent();

            var vm = new ShellViewModel();

            vm.MenuItems.Add(new MenuItem {
                Icon = "", Title = "Welcome", PageType = typeof(WelcomePage)
            });
            vm.MenuItems.Add(new MenuItem {
                Icon = "", Title = "Page 1", PageType = typeof(Page1)
            });
            vm.MenuItems.Add(new MenuItem {
                Icon = "", Title = "Page 2", PageType = typeof(Page2)
            });
            vm.MenuItems.Add(new MenuItem {
                Icon = "", Title = "Page 3", PageType = typeof(Page3)
            });

            // select the first menu item
            vm.SelectedMenuItem = vm.MenuItems.First();

            this.ViewModel = vm;

            // add entry animations
            var transitions = new TransitionCollection {
            };
            var transition  = new NavigationThemeTransition {
            };

            transitions.Add(transition);
            this.Frame.ContentTransitions = transitions;
        }
Ejemplo n.º 5
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = GetOrCreateRootFrame();

            if (rootFrame.Content == null)
            {
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += RootFrame_FirstNavigated;

                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            Window.Current.Activate();
        }
Ejemplo n.º 6
0
        public FengCaiPage() : base()
        {
            this.InitializeComponent();
            pivot_index          = 0;
            zuzhi_listview_index = 0;

            viewmodel         = new ZSCY_Win10.ViewModels.FengCaiViewModel();
            this.DataContext  = viewmodel;
            fengcaipage       = this;
            this.SizeChanged += FengCaiPage_SizeChanged;

            //手机物理返回键订阅事件
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += OnBackPressed;
            }
            else
            {
                Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.Visible;
                Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += PC_BackRequested;
            }
            Transitions = new TransitionCollection();
            Transitions.Add(PaneAnim);
            ManipulationMode = ManipulationModes.TranslateX;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as global::Windows.UI.Xaml.Controls.Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new global::Windows.UI.Xaml.Controls.Frame();

                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                Forms.Init(e);
                FormsMaps.Init(Controls.App.Config["WinPhoneMapsAuthKey"]);

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    _transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        _transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 8
0
        private void SetRootFrameContent(Frame rootFrame, LaunchActivatedEventArgs e = null)
        {
            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    _transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        _transitions.Add(c);
                    }
                }

                rootFrame.Navigated += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), e?.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
        }
Ejemplo n.º 9
0
        public Shell()
        {
            this.InitializeComponent();

            var vm = new ShellViewModel();

            vm.TopItems.Add(new MenuItem {
                Icon = "", Title = "Accueil", PageType = typeof(HomePage)
            });
            vm.TopItems.Add(new MenuItem {
                Icon = "", Title = "Gestion du patrimoine", PageType = typeof(EstatesPage)
            });

            vm.BottomItems.Add(new MenuItem {
                Icon = "", Title = "Paramètres", PageType = typeof(SettingsPage)
            });


            // select the first menu item
            vm.SelectedMenuItem = vm.TopItems.First();

            this.ViewModel = vm;

            // add entry animations
            var transitions = new TransitionCollection {
            };
            var transition  = new NavigationThemeTransition {
            };

            transitions.Add(transition);
            this.Frame.ContentTransitions = transitions;
        }
Ejemplo n.º 10
0
 public LoginPage()
 {
     ManipulationCompleted += AppleAnimationPage_ManipulationCompleted;
     Transitions            = new TransitionCollection();
     Transitions.Add(PaneAnim);
     ManipulationMode = ManipulationModes.TranslateX;
 }
Ejemplo n.º 11
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = GetOrCreateRootFrame();

            if (rootFrame.Content == null)
            {
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;

                if (!rootFrame.Navigate(typeof (MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            Window.Current.Activate();
        }
Ejemplo n.º 12
0
        private static Popup CreateNotification(string title, string text, string icon, bool isindeterminate, UIElement content, double defaultwidth = 360)
        {
            var offsetY = Window.Current.CoreWindow.Bounds.Width - defaultwidth;
            var toast   = new Popup()
            {
                Margin = new Thickness(offsetY, 32, 0, 0), VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Right
            };

            toast.Child = new Crostini()
            {
                Icon            = icon,
                Title           = title,
                Text            = text,
                IsIndeterminate = isindeterminate,
                ContentElement  = content,
                DefaultWidth    = defaultwidth
            };
            var transition = new TransitionCollection();

            transition.Add(new PopupThemeTransition()
            {
                FromHorizontalOffset = defaultwidth, FromVerticalOffset = 0
            });
            toast.ChildTransitions = transition;
            return(toast);
        }
Ejemplo n.º 13
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = GetOrCreateRootFrame();

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof (MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 14
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = GetOrCreateRootFrame();

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
        /// <summary>
        ///     Invoked when the application is launched normally by the end user.  Other entry points
        ///     will be used when the application is launched to open a specific file, to display
        ///     search results, and so forth.
        /// </summary>
        /// <remarks>This method ensures that Window.Current.Content is set to a valid Frame.</remarks>
        /// <remarks>This method calls Window.Current.Activate.</remarks>
        /// <param name="e">Details about the launch request and process.</param>
        public async void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = CreateRootFrame();

            await RestoreStatus(e.PreviousExecutionState);

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (Transition c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(SDKManager.RootApplicationPage, e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 向前导航到新内容
        /// </summary>
        /// <param name="p_content"></param>
        void INaviHost.NaviTo(INaviContent p_content)
        {
            INaviContent current;

            if (p_content == null || (current = Content as INaviContent) == null)
            {
                return;
            }

            if (Kit.IsPhoneUI)
            {
                Tab tab = new Tab {
                    OwnWin = OwnWin, Content = p_content
                };
                PhonePage.Show(tab);
                return;
            }

            if (_naviCache == null)
            {
                _naviCache = new Stack <INaviContent>();
                // 内容切换动画
                var ls = new TransitionCollection();
                ls.Add(new ContentThemeTransition {
                    VerticalOffset = 60
                });
                OwnTabs.ContentTransitions = ls;
            }
            _naviCache.Push(current);
            Content = p_content;
        }
Ejemplo n.º 17
0
        /// <summary>
        ///     Invoked when the application is launched normally by the end user.  Other entry points
        ///     will be used when the application is launched to open a specific file, to display
        ///     search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 2;

                // Set the default language
                rootFrame.Language = ApplicationLanguages.Languages[0];

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof (SearchPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 18
0
        internal Task <PieceType> GetPromotionSelectionAsync()
        {
            var tcs = new TaskCompletionSource <PieceType>();

            var selector      = new PromotionSelector();
            var selectorPopup = new Popup();

            selector.PromotionSelected += (sender, args) =>
            {
                selectorPopup.IsOpen = false;
                //BoardGrid.Children.Remove(selectorPopup);
                tcs.SetResult(args.NewCapabilities.Type);
            };

            selector.PromotionCancelled += (sender, args) =>
            {
                selectorPopup.IsOpen = false;
                //BoardGrid.Children.Remove(selectorPopup);
                tcs.SetCanceled();
            };

            selectorPopup.Child = selector;
            selectorPopup.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            selectorPopup.VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Center;
            //selectorPopup.HorizontalOffset = -300;
            //selectorPopup.VerticalOffset = -125;
            var transitions = new TransitionCollection();

            transitions.Add(new PopupThemeTransition());
            selectorPopup.Transitions = transitions;
            //GameTableGrid.Children.Add(selectorPopup);
            selectorPopup.IsOpen = true;

            return(tcs.Task);
        }
Ejemplo n.º 19
0
        // *** Private Methods ***

        private void CreatePopup()
        {
            // Create the transitions

            TransitionCollection childTransitions = new TransitionCollection();

            childTransitions.Add(new PaneThemeTransition()
            {
                Edge = GetPopupTransitionEdge()
            });

            // Create a new Popup to display the content

            popup = new Popup()
            {
                IsLightDismissEnabled = isLightDismissEnabled,
                ChildTransitions      = childTransitions
            };

            // Register for the Opened and Closed events

            popup.Opened += Popup_Opened;
            popup.Closed += Popup_Closed;

            // Create a content control to display the content

            contentControl = new ContentControl()
            {
                Height = Window.Current.Bounds.Height,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Stretch
            };

            popup.Child = contentControl;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Se invoca cuando la aplicación la inicia normalmente el usuario final. Se usarán otros puntos
        /// de entrada cuando la aplicación se inicie para abrir un archivo específico, para mostrar
        /// resultados de la búsqueda, etc.
        /// </summary>
        /// <param name="e">Información detallada acerca de la solicitud y el proceso de inicio.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // No repetir la inicialización de la aplicación si la ventana tiene contenido todavía,
            // solo asegurarse de que la ventana está activa.
            if (rootFrame == null)
            {
                // Crear un marco para que actúe como contexto de navegación y navegar a la primera página.
                rootFrame = new Frame();

                // TODO: Cambiar este valor a un tamaño de caché adecuado para la aplicación
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Cargar el estado de la aplicación suspendida previamente
                }

                // Poner el marco en la ventana actual.
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
#if WINDOWS_PHONE_APP
                // Quita la navegación de transición en el inicio.
                if (rootFrame.ContentTransitions != null)
                {
                    _transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        _transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += RootFrame_FirstNavigated;
#endif

                // Cuando no se restaura la pila de navegación para navegar a la primera página,
                // configurar la nueva página al pasar la información requerida como parámetro
                // de navegación
                if (!rootFrame.Navigate(typeof(MainView), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Asegurarse de que la ventana actual está activa.
            Window.Current.Activate();
        }
Ejemplo n.º 21
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            #if WINDOWS_PHONE_APP
            var applicationView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
            applicationView.VisibleBoundsChanged += ApplicationView_VisibleBoundsChanged;
            applicationView.SetDesiredBoundsMode(Windows.UI.ViewManagement.ApplicationViewBoundsMode.UseCoreWindow);
            #endif

            Frame rootFrame = Window.Current.Content as Frame;
            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
            #if WINDOWS_PHONE_APP
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                        transitions.Add(c);
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;
            #endif

                ParticleCloud.SharedCloud.SynchronizationContext = System.Threading.SynchronizationContext.Current;

                Type firstPage = null;

                string accessToken = TinkerData.AccessToken;
                if (!String.IsNullOrWhiteSpace(accessToken))
                {
                    ParticleCloud.SharedCloud.SetAuthentication(accessToken);
                    firstPage = typeof(DevicesPage);
                }
                else
                {
                    firstPage = typeof(GetStartedPage);
                }

                if (!rootFrame.Navigate(firstPage, e.Arguments))
                    throw new Exception("Failed to create initial page");

                TinkerData.SetApplcationFrame(rootFrame);
            }

            Window.Current.Activate();
        }
Ejemplo n.º 22
0
 public SignUpPage()
 {
     //this.InitializeComponent();
     ManipulationCompleted += AppleAnimationPage_ManipulationCompleted;
     Transitions            = new TransitionCollection();
     Transitions.Add(PaneAnim);
     ManipulationMode = ManipulationModes.TranslateX;
 }
Ejemplo n.º 23
0
        public PageBase()
        {
            Transitions = new TransitionCollection();
#if WINDOWS_PHONE_APP
            var theme = new NavigationThemeTransition
            {
                DefaultNavigationTransitionInfo = new SlideNavigationTransitionInfo()
            };
            Transitions.Add(theme);
#else
            var theme = new PopupThemeTransition()
            {
                FromVerticalOffset = -200
            };
            Transitions.Add(theme);
#endif
        }
        private void AddItemContainerTransition()
        {
            TransitionCollection    collection = new TransitionCollection();
            EntranceThemeTransition transition = new EntranceThemeTransition();

            collection.Add(transition);
            this.ItemContainerTransitions = collection;
        }
Ejemplo n.º 25
0
 public PageBase()
 {
     Transitions = new TransitionCollection();
     #if WINDOWS_PHONE_APP
     var theme = new NavigationThemeTransition
     {
         DefaultNavigationTransitionInfo = new SlideNavigationTransitionInfo()
     };
     Transitions.Add(theme);
     #else
     var theme = new PopupThemeTransition()
     {
         FromVerticalOffset = -200
     };
     Transitions.Add(theme);
     #endif
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                var setup = new Setup(rootFrame);
                setup.Initialize();

                var start = Mvx.Resolve <IMvxAppStart>();
                start.Start();
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 27
0
        protected virtual void SetUpPageAnimation()
        {
            TransitionCollection      collection = new TransitionCollection();
            NavigationThemeTransition theme      = new NavigationThemeTransition();

            theme.DefaultNavigationTransitionInfo = new ContinuumNavigationTransitionInfo();
            collection.Add(theme);
            Transitions = collection;
        }
Ejemplo n.º 28
0
        public static void SetupTransition(this Page page, NavigationTransitionInfo transitionInfo)
        {
            TransitionCollection      collection = new TransitionCollection();
            NavigationThemeTransition theme      = new NavigationThemeTransition();

            theme.DefaultNavigationTransitionInfo = transitionInfo;
            collection.Add(theme);
            page.Transitions = collection;
        }
Ejemplo n.º 29
0
        /// <summary>
        ///     Вызывается при обычном запуске приложения пользователем.  Будут использоваться другие точки входа,
        ///     если приложение запускается для открытия конкретного файла, отображения
        ///     результатов поиска и т. д.
        /// </summary>
        /// <param name="e">Сведения о запросе и обработке запуска.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Frame;

            // Не повторяйте инициализацию приложения, если в окне уже имеется содержимое,
            // только обеспечьте активность окна
            if (rootFrame == null)
            {
                // Создание фрейма, который станет контекстом навигации, и переход к первой странице
                rootFrame = new Frame();

                // TODO: Измените это значение на размер кэша, подходящий для вашего приложения
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Загрузить состояние из ранее приостановленного приложения
                }

                // Размещение фрейма в текущем окне
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Удаляет турникетную навигацию для запуска.
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += RootFrame_FirstNavigated;

                // Если стек навигации не восстанавливается для перехода к первой странице,
                // настройка новой страницы путем передачи необходимой информации в качестве параметра
                // навигации
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Обеспечение активности текущего окна
            Window.Current.Activate();
        }
Ejemplo n.º 30
0
 public PageBase()
 {
     Transitions = new TransitionCollection();
     var theme = new NavigationThemeTransition
     {
         DefaultNavigationTransitionInfo = new SlideNavigationTransitionInfo()
     };
     Transitions.Add(theme);
 }
Ejemplo n.º 31
0
    /// <summary>
    /// Wird aufgerufen, wenn die Anwendung durch den Endbenutzer normal gestartet wird.  Weitere Einstiegspunkte
    /// werden verwendet, wenn die Anwendung zum Öffnen einer bestimmten Datei, zum Anzeigen
    /// von Suchergebnissen usw. gestartet wird.
    /// </summary>
    /// <param name="e">Details über Startanforderung und -prozess.</param>
    protected override void OnLaunched(LaunchActivatedEventArgs e)
    {
#if DEBUG
      if (System.Diagnostics.Debugger.IsAttached)
      {
        DebugSettings.EnableFrameRateCounter = true;
      }
#endif

      var rootFrame = Window.Current.Content as Frame;

      // App-Initialisierung nicht wiederholen, wenn das Fenster bereits Inhalte enthält.
      // Nur sicherstellen, dass das Fenster aktiv ist.
      if (rootFrame == null)
      {
        // Einen Rahmen erstellen, der als Navigationskontext fungiert und zum Parameter der ersten Seite navigieren
        rootFrame = new Frame { CacheSize = 1 };

        // TODO: diesen Wert auf eine Cachegröße ändern, die für Ihre Anwendung geeignet ist

        if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
        {
          // TODO: Zustand von zuvor angehaltener Anwendung laden
        }

        // Den Rahmen im aktuellen Fenster platzieren
        Window.Current.Content = rootFrame;
      }

      if (rootFrame.Content == null)
      {
        // Entfernt die Drehkreuznavigation für den Start.
        if (rootFrame.ContentTransitions != null)
        {
          transitions = new TransitionCollection();
          foreach (var c in rootFrame.ContentTransitions)
          {
            transitions.Add(c);
          }
        }

        rootFrame.ContentTransitions = null;
        rootFrame.Navigated += RootFrame_FirstNavigated;

        // Wenn der Navigationsstapel nicht wiederhergestellt wird, zur ersten Seite navigieren
        // und die neue Seite konfigurieren, indem die erforderlichen Informationen als Navigationsparameter
        // übergeben werden
        if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
        {
          throw new Exception("Failed to create initial page");
        }
      }

      // Sicherstellen, dass das aktuelle Fenster aktiv ist
      Window.Current.Activate();
    }
Ejemplo n.º 32
0
        /// <summary>
        /// Invoqué lorsque l'application est lancée normalement par l'utilisateur final.  D'autres points d'entrée
        /// sont utilisés lorsque l'application est lancée pour ouvrir un fichier spécifique, pour afficher
        /// des résultats de recherche, etc.
        /// </summary>
        /// <param name="e">Détails concernant la requête et le processus de lancement.</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Frame;

            // Ne répétez pas l'initialisation de l'application lorsque la fenêtre comporte déjà du contenu,
            // assurez-vous juste que la fenêtre est active
            if (rootFrame == null)
            {
                // Créez un Frame utilisable comme contexte de navigation et naviguez jusqu'à la première page
                rootFrame = new Frame {CacheSize = 1};

                // TODO: modifier cette valeur à une taille de cache qui contient à votre application

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: chargez l'état de l'application précédemment suspendue
                }

                // Placez le frame dans la fenêtre active
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Supprime la navigation tourniquet pour le démarrage.
                if (rootFrame.ContentTransitions != null)
                {
                    _transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        _transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;

                // Quand la pile de navigation n'est pas restaurée, accédez à la première page,
                // puis configurez la nouvelle page en transmettant les informations requises en tant que
                // paramètre
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Vérifiez que la fenêtre actuelle est active
            Window.Current.Activate();
        }
Ejemplo n.º 33
0
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Frame;
            if (rootFrame == null)
            {
                rootFrame = new Frame { CacheSize = 1 };

                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        Debug.Assert(false, "Error while restoring app state");
                    }
                }

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
#if WINDOWS_PHONE_APP
                if (rootFrame.ContentTransitions != null)
                {
                    mTransistions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        mTransistions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += OnFirstNavigated;
#endif

                if (!rootFrame.Navigate(typeof(HubPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            Window.Current.Activate();
        }
Ejemplo n.º 34
0
        public Shell()
        {
            this.InitializeComponent();

            var vm = new ShellViewModel();

            vm.MenuItems.Add(new MenuItem
            {
                Icon         = "",
                SymbolAsChar = '\uEA8A',
                Label        = "Home",
                PageType     = typeof(WelcomePage)
            });
            vm.MenuItems.Add(new MenuItem
            {
                Icon         = "",
                SymbolAsChar = '\uE74C',
                Label        = "wincomposition",
                PageType     = typeof(WincompositionPage)
            });
            vm.MenuItems.Add(new MenuItem
            {
                Icon         = "",
                SymbolAsChar = '\uE179',
                Label        = "ListView",
                PageType     = typeof(ListPage)
            });
            vm.MenuItems.Add(new MenuItem
            {
                Icon         = "",
                SymbolAsChar = '\uE81C',
                Label        = "Tasks",
                PageType     = typeof(TasksPage)
            });
            vm.MenuItems.Add(new MenuItem {
                Icon         = "",
                SymbolAsChar = '\uE713',
                Label        = "About",
                PageType     = typeof(AboutPage)
            });

            // select the first menu item
            vm.SelectedMenuItem = vm.MenuItems.First();

            this.ViewModel = vm;

            // add entry animations
            var transitions = new TransitionCollection {
            };
            var transition  = new NavigationThemeTransition {
            };

            transitions.Add(transition);
            this.Frame.ContentTransitions = transitions;
        }
Ejemplo n.º 35
0
        private void SetUpPageAnimation()
        {
            TransitionCollection      collection = new TransitionCollection();
            NavigationThemeTransition theme      = new NavigationThemeTransition();

            var info = new ContinuumNavigationTransitionInfo();

            theme.DefaultNavigationTransitionInfo = info;
            collection.Add(theme);
            this.Transitions = collection;
        }
        public void SetUpPageAnimation()
        {
            TransitionCollection collection = new TransitionCollection();
            NavigationThemeTransition theme = new NavigationThemeTransition();

            var info = new ContinuumNavigationTransitionInfo();

            theme.DefaultNavigationTransitionInfo = info;
            collection.Add(theme);
            this.Transitions = collection;
        }
Ejemplo n.º 37
0
        public MainPage()
        {
            InitializeComponent();
            // add entry animations
            var transitions = new TransitionCollection();
            var transition  = new NavigationThemeTransition();

            transitions.Add(transition);
            VMFrame.ContentTransitions = transitions;
            //ToggleStatusBar();
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Exibir uma página com uma transição de entrada.
        /// </summary>
        /// <param name="p">Página a ser adicionada a transição.</param>
        public static void Transition(Page p)
        {
            TransitionCollection      collection = new TransitionCollection();
            NavigationThemeTransition theme      = new NavigationThemeTransition();

            var info = new DrillInNavigationTransitionInfo();

            theme.DefaultNavigationTransitionInfo = info;
            collection.Add(theme);
            p.Transitions = collection;
        }
Ejemplo n.º 39
0
        protected virtual void SetUpPageAnimation()
        {
            TransitionCollection      collection = new TransitionCollection();
            NavigationThemeTransition theme      = new NavigationThemeTransition();

            var info = new DrillInNavigationTransitionInfo();

            theme.DefaultNavigationTransitionInfo = info;
            collection.Add(theme);
            this.Transitions = collection;
        }
Ejemplo n.º 40
0
        public NavigationFacade(Frame frame)
        {
            _frame = frame;

            // setup animations
            var c = new TransitionCollection();
            var t = new NavigationThemeTransition();
            //var i = new EntranceNavigationTransitionInfo();
            //t.DefaultNavigationTransitionInfo = i;
            c.Add(t);
            _frame.ContentTransitions = c;
        }
Ejemplo n.º 41
0
        public FrameFacade(Frame frame)
        {
            _frame = frame;
            _navigatedEventHandlers = new List<EventHandler<NavigatedEventArgs>>();

            // setup animations
            var c = new TransitionCollection { };
            var t = new NavigationThemeTransition { };
            var i = new EntranceNavigationTransitionInfo();
            t.DefaultNavigationTransitionInfo = i;
            c.Add(t);
            _frame.ContentTransitions = c;
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(320, 320));
            Common.SuspensionManager.KnownTypes.Add(typeof(string[]));
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            RootFrame = MainHamburgerBar.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (RootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                RootFrame = new Frame();
                Common.SuspensionManager.RegisterFrame(RootFrame, "appFrame");

                RootFrame.NavigationFailed += OnNavigationFailed;

                TransitionCollection transitions = new TransitionCollection();
                transitions.Add(new EntranceThemeTransition() { FromHorizontalOffset = 200 });
                RootFrame.ContentTransitions = transitions;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    await Common.SuspensionManager.RestoreAsync();
                }

                // Place the frame in the current Window
                MainHamburgerBar.Content = RootFrame;
            }

            if (RootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                RootFrame.Navigate(typeof(BusMapPage), "CurrentLocation");
                //RootFrame.Navigate(typeof(RoutesPage));
            }
            // Ensure the current window is active
            Window.Current.Content = MainHamburgerBar;
            Window.Current.Activate();
            SetTitleBar();
            var opts = BandwidthManager.EffectiveBandwidthOptions;
        }
Ejemplo n.º 43
0
        private async void SetBackground()
        {
            childList = new ZIndexList();

            PixelmapImage image = new PixelmapImage(1, 1);
            await image.SetSource(new Uri("ms-appx:///Assets/background.png"));

            ImageBrush brush = new ImageBrush();
            brush.ImageSource = await image.ToWriteableBitmapImage();
            //Grid someGrid = new Grid() { Width = 100, Height = 100, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left, Background = brush, Name = "someGrid" };
            //MainP.Children.Add(someGrid);

            image = await image.StretchToFit(210, 210);

            brush = new ImageBrush();
            brush.ImageSource = await image.ToWriteableBitmapImage();

            TPanel f = new TPanel() { Background = brush, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left, Height = 210, Margin = new Thickness(63, 291, 0, 0), VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top, Width = 210 };
            f.Tapped += Button_Tapped;
            childList.Add(f);
            MainP.Children.Add(f);

            TransitionCollection tc = new TransitionCollection();
            tc.Add(new Windows.UI.Xaml.Media.Animation.AddDeleteThemeTransition());

            //someGrid.RenderTransform = new CompositeTransform();

            sb = new Storyboard();
            DoubleAnimation da = new DoubleAnimation();
            //Storyboard.SetTarget(da, someGrid);
            Storyboard.SetTargetProperty(da, "(UIElement.RenderTransform).(CompositeTransform.TranslateX)");
            da.From = 500;
            da.To = 1000;
                da.Duration = new Duration(new TimeSpan(0,0,0,0,100));
                //da.AutoReverse = true;
                da.Completed += (source, e) => { go = !go; (source as DoubleAnimation).To = go ? 500 : 1000; (source as DoubleAnimation).From = go ? 1000 : 500; if(go)sb.Begin();  };
            sb.Children.Add(da);

            for (int i = 0; i < 5; i++)
            {
                TPanel r = new TPanel() { Transitions = tc, Background = brush, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left, Height = 210, Margin = new Thickness((childList.Last() as TPanel).Margin.Left + elementDistance, 291, 0, 0), VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top, Width = 210 };
                r.Tapped += Button_Tapped;
                RotatedText ro = new RotatedText();
                ro.text.Text = "Text " + i;
                ro.text.Loaded += (source, e) => { (source as TextBlock).Margin = new Thickness(0, (source as TextBlock).ActualWidth + 5, 0, 0); };
                r.Children.Add(ro);
                childList.Add(r);
                MainP.Children.Add(r);
            }
        }
Ejemplo n.º 44
0
        public MainPage()
        {
            this.InitializeComponent();
            this.RegisterPropertyChangedCallback(ViewModelProperty, (_, __) =>
            {
                StrongTypeViewModel = this.ViewModel as MainPage_Model;
            });
            StrongTypeViewModel = this.ViewModel as MainPage_Model;

            var transitions = new TransitionCollection();
            var transition = new NavigationThemeTransition();
            transitions.Add(transition);
            VMFrame.ContentTransitions = transitions;
        }
Ejemplo n.º 45
0
        internal FrameFacade(Frame frame)
        {
            Frame = frame;
            frame.Navigated += (s, e) => FacadeNavigatedEventHandler(s, e);
            frame.Navigating += (s, e) => FacadeNavigatingCancelEventHandler(s, e);

            // setup animations
            var c = new TransitionCollection { };
            var t = new NavigationThemeTransition { };
            var i = new EntranceNavigationTransitionInfo();
            t.DefaultNavigationTransitionInfo = i;
            c.Add(t);
            Frame.ContentTransitions = c;
        }
Ejemplo n.º 46
0
        public MainPage()
        {
            TransitionCollection collection = new TransitionCollection();
            NavigationThemeTransition theme = new NavigationThemeTransition();

            var info = new ContinuumNavigationTransitionInfo();

            theme.DefaultNavigationTransitionInfo = info;
            collection.Add(theme);
            this.Transitions = collection;

            SystemNavigationManager systemNavigationManager = SystemNavigationManager.GetForCurrentView();
            systemNavigationManager.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;


            this.InitializeComponent();
        }
Ejemplo n.º 47
0
        /// <summary>
        /// Initializes <see cref="NavigationService"/> instance
        /// </summary>
        /// <param name="mainPageType">The type of the main application page</param>
        /// <param name="parameter">Initial navigation parameter</param>
        public void Initialize(Type mainPageType, NavigationParameter parameter)
        {
            this.mainPageType = mainPageType;
            Frame frame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active.
            if (frame == null)
            {
                logger.LogMessage("NavigationService: No root frame found. Creating the new one.");
                frame = new Frame
                {
                    CacheSize = 1,
                    Language = ApplicationLanguages.Languages[0]
                };
                Window.Current.Content = frame;
                logger.LogMessage("NavigationService: Root frame created successfully.");
            }

            if (frame.Content == null)
            {
                logger.LogMessage("NavigationService: Root frame is empty. Removing transitions for the first-time navigation.");
                if (frame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in frame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                frame.ContentTransitions = null;
                frame.Navigated -= onRootFrameFirstNavigated;
                frame.Navigated += onRootFrameFirstNavigated;
            }

            this.frame = frame;
            if (!frame.Navigate(mainPageType, parameter))
            {
                string message = "Navigation service initialization error.";
                logger.LogMessage(message, LoggingLevel.Critical);
                throw new Exception(message);
            }

            logger.LogMessage("NavigationService initialized.", LoggingLevel.Information);
        }
Ejemplo n.º 48
0
        public Settings()
        {
            System.Diagnostics.Debug.WriteLine("Loading Settings");

            TransitionCollection collection = new TransitionCollection();
            NavigationThemeTransition theme = new NavigationThemeTransition();

            var info = new ContinuumNavigationTransitionInfo();



            theme.DefaultNavigationTransitionInfo = info;
            collection.Add(theme);
            this.Transitions = collection;
            this.InitializeComponent();


        }
Ejemplo n.º 49
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            #if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
            #endif

            var rootFrame = Window.Current.Content as Frame;
            if (rootFrame == null)
            {
                rootFrame = new Frame {CacheSize = 1};

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                        transitions.Add(c);
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof (NewsFeedPage), e.Arguments))
                    throw new Exception("Failed to create initial page");
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 50
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.CacheSize = 1;
                Window.Current.Content = rootFrame;
                ClearCache();
            }

            if (rootFrame.Content == null)
            {
#if WINDOWS_PHONE_APP
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (Transition c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;
#endif

                if (!rootFrame.Navigate(typeof (MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            Window.Current.Activate();
        }
        private void ItemsGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var container = ItemsGridView.ContainerFromItem(e.ClickedItem) as GridViewItem;
            if (container != null)
            {
                var root = (FrameworkElement)container.ContentTemplateRoot;
                var image = (UIElement)root.FindName("Image");

                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("Image", image);
            }

            var item = (Thumbnail)e.ClickedItem;

            // Add a fade out effect
            Transitions = new TransitionCollection();
            Transitions.Add(new ContentThemeTransition());

            Frame.Navigate(typeof(ConnectedAnimationDetail), _navigatedUri = item.ImageUrl);
        }
Ejemplo n.º 52
0
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (e.Arguments == Constants.LaunchCalendarArguments)
            {
                DelayedExit(100);
                await AppointmentManager.ShowTimeFrameAsync(DateTimeOffset.Now, TimeSpan.FromDays(1));
            }

            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.CacheSize = 1;
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
                Window.Current.Content = rootFrame;

                HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            }

            if (rootFrame.Content == null)
            {
                if (rootFrame.ContentTransitions != null)
                {
                    _transitions = new TransitionCollection();
                    foreach (var transition in rootFrame.ContentTransitions)
                    {
                        _transitions.Add(transition);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;
                
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            
            Window.Current.Activate();
        }
Ejemplo n.º 53
0
        public Browser()
        {

            TransitionCollection collection = new TransitionCollection();
            NavigationThemeTransition theme = new NavigationThemeTransition();

            var info = new ContinuumNavigationTransitionInfo();



            theme.DefaultNavigationTransitionInfo = info;

            collection.Add(theme);
            this.Transitions = collection;

            this.InitializeComponent();

            systemNavigationManager.BackRequested += Go_Back;
            systemNavigationManager.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;

        }
Ejemplo n.º 54
0
        public Shell()
        {
            this.InitializeComponent();

            var vm = new ShellViewModel();
            vm.MenuItems.Add(new MenuItem { Icon = "", Title = "Welcome", PageType = typeof(WelcomePage) });
            vm.MenuItems.Add(new MenuItem { Icon = "", Title = "Page 1", PageType = typeof(Page1) });
            vm.MenuItems.Add(new MenuItem { Icon = "", Title = "Page 2", PageType = typeof(Page2) });
            vm.MenuItems.Add(new MenuItem { Icon = "", Title = "Page 3", PageType = typeof(Page3) });

            // select the first menu item
            vm.SelectedMenuItem = vm.MenuItems.First();

            this.ViewModel = vm;

            // add entry animations
            var transitions = new TransitionCollection { };
            var transition = new NavigationThemeTransition { };
            transitions.Add(transition);
            this.Frame.ContentTransitions = transitions;
        }
Ejemplo n.º 55
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
                DebugSettings.EnableFrameRateCounter = true;
#endif
            AppManager.Init();

#if WINDOWS_APP
            SettingsPane.GetForCurrentView().CommandsRequested += SettingsPane_CommandsRequested;
#endif

            // Before using any of the ApplicationBuildingBlocks, this class should be initialized with the version of the application.
            //ApplicationUsageHelper.Init(AppManager.AppVersion);

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                // Associate the frame with a SuspensionManager key                                
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                rootFrame.NavigationFailed += OnNavigationFailed;
                UnhandledException += App_UnhandledException;


                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();

                        //This will ensure that the ApplicationUsageHelper is initialized again if the application has been in Tombstoned state.
                        //ApplicationUsageHelper.OnApplicationActivated();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
#if WINDOWS_PHONE_APP
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                        transitions.Add(c);
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;
#endif

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(ProfilesPage), e.Arguments))
                    throw new Exception("Failed to create initial page");
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 56
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            Messenger.Default.Send(new NotificationMessage(Constants.Messages.RefreshPinMsg));
            var rootFrame = Window.Current.Content as Frame;

            //var themeManager = Current.Resources["ThemeManager"];
            StartServices().ConfigureAwait(false);

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.CacheSize = 3;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
#if WINDOWS_PHONE_APP
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    _transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        _transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;
#endif

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            if (!string.IsNullOrEmpty(e.Arguments))
            {
                var query = new Uri(e.Arguments).QueryDictionary();
                if (query.ContainsKey("source"))
                {
                    var source = query["source"];
                    var type = Type.GetType($"Speader.Views.Sources.{source}View");
                    rootFrame.Navigate(type, new NavigationParameters { ShowHomeButton = true });
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 57
0
        private void BuildPopup(FrameworkElement source)
        {
            var windowBounds = Window.Current.Bounds;
            var rootVisual = Window.Current.Content;

            GeneralTransform gt = source.TransformToVisual(rootVisual);

            var absolutePosition = gt.TransformPoint(new Point(0, 0));

            var content = (FrameworkElement)_popup.Child;
            content.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

            var contentWidth = double.IsNaN(content.Width) ? content.DesiredSize.Width : content.Width;
            var contentHeight = double.IsNaN(content.Height) ? content.DesiredSize.Height : content.Height;
            double vOffset = 0;
            double hOffset = 0;

            double vOffsetAnim = 0;
            double hOffsetAnim = 0;
            switch (PopupPlacement)
            {
                case Placement.Above:
                    vOffset = absolutePosition.Y - contentHeight - 10;
                    hOffset = (absolutePosition.X) + source.ActualWidth / 2 - contentWidth / 2;
                    vOffsetAnim = 20;
                    break;
                case Placement.Below:
                    vOffset = absolutePosition.Y + source.ActualHeight + 10;
                    hOffset = (absolutePosition.X) + source.ActualWidth / 2 - contentWidth / 2;
                    vOffsetAnim = -20;
                    break;
                case Placement.Default:
                case Placement.Left:
                    vOffset = absolutePosition.Y - contentHeight / 2 + source.ActualHeight / 2;
                    hOffset = (absolutePosition.X) - 10 - contentWidth;
                    hOffsetAnim = 20;
                    break;
                case Placement.Right:
                    vOffset = absolutePosition.Y - contentHeight / 2 + source.ActualHeight / 2;
                    hOffset = (absolutePosition.X) + 10 + source.ActualWidth;
                    hOffsetAnim = -20;
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            //Limite position to windows bound
            vOffset = Math.Max(10, Math.Min(vOffset, windowBounds.Height - contentHeight - 10));
            hOffset = Math.Max(10, Math.Min(hOffset, windowBounds.Width - contentWidth - 10));

            _popup.VerticalOffset = vOffset;
            _popup.HorizontalOffset = hOffset;

            if (UseAnimation)
            {
                var transitions = new TransitionCollection();
                transitions.Add(new PopupThemeTransition()
                    {
                        FromHorizontalOffset = hOffsetAnim,
                        FromVerticalOffset = vOffsetAnim
                    });
                _popup.ChildTransitions = transitions;
            }
        }
Ejemplo n.º 58
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    _transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        _transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();

            // MVVM Light's DispatcherHelper for cross-thread handling.
            DispatcherHelper.Initialize();

            // Illustrates how to use the Messenger by receiving a message
            // and sending a message back.
            Messenger.Default.Register<NotificationMessageAction<string>>(
                this,
                HandleNotificationMessage);
        }
Ejemplo n.º 59
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                     TransitionCollection transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += this.RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(LoginPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
            // http://go.microsoft.com/fwlink/?LinkId=290986&clcid=0x409
            //Diya.diyaPush.UploadChannel();
        }
        /// <summary>
        /// Show the caption settings
        /// </summary>
        /// <param name="command">the command</param>
        private void OnShowCaptionSettings(IUICommand command)
        {
            if (this.OnLoadCaptionSettings != null)
            {
                this.OnLoadCaptionSettings(this, new CustomCaptionSettingsEventArgs(this.Settings));
            }

            this.windowBounds = Window.Current.Bounds;

            var transitions = new TransitionCollection();
            transitions.Add(new EntranceThemeTransition());

            Window.Current.Activated += this.Current_Activated;

            var control = new CaptionSettingsControl
            {
                CaptionSettings = this.Settings,
                IsDefault = this.IsDefault,
            };

            control.OnApplyCaptionSettings += this.OnApplyCaptionSettings;

            control.IsDefaultChanged += delegate(object sender, System.EventArgs e)
            {
                this.IsDefault = control.IsDefault;

                this.ApplyCaptionSettings(this.Settings);
            };

            var settingsControl = new SettingsControl
            {
                Style = this.Style,
                Label = this.Label,
                Content = control,
                Width = NarrowWidth,
                Height = this.windowBounds.Height
            };

            this.settingsPopup = new Popup
            {
                Child = settingsControl,
                Transitions = transitions,
                IsLightDismissEnabled = true,
                Width = NarrowWidth,
                Height = this.windowBounds.Height,
            };

            this.settingsPopup.Closed += this.OnPopupClosed;
            this.settingsPopup.SetValue(Canvas.LeftProperty, this.windowBounds.Width - NarrowWidth);
            this.settingsPopup.SetValue(Canvas.TopProperty, 0);

            this.settingsPopup.IsOpen = true;
        }