Esempio n. 1
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="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            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();

                if (args.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)
            {
                // 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), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Esempio n. 2
0
 protected override void OnLaunched(LaunchActivatedEventArgs e) {
     Frame rootFrame = Window.Current.Content as Frame;
     if(rootFrame == null) {
         rootFrame = new Frame();
         rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
         rootFrame.NavigationFailed += OnNavigationFailed;
         Window.Current.Content = rootFrame;
     }
     if(rootFrame.Content == null) {
         rootFrame.Navigate(typeof(MainPage), e.Arguments);
     }
     Window.Current.Activate();
 }
Esempio n. 3
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {

#if DEBUG
            if (Debugger.IsAttached)
            {
                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();

                rootFrame.NavigationFailed += OnNavigationFailed;

                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)
            {
                // 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(MainPage), e.Arguments);
            }
            // 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>
        /// <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
            GetAppData();
            UpdateAppTiles();

            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;
            }

            NavigationService.Initialize(this.GetType(), rootFrame);

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

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

#if WINDOWS_PHONE_APP
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
#else
                //// Keyboard and mouse navigation only apply when occupying the entire window
                //if (Page.ActualHeight == Window.Current.Bounds.Height &&
                //    Page.ActualWidth == Window.Current.Bounds.Width)
                //{
                // Listen to the window directly so focus isn't required
                Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated += CoreDispatcher_AcceleratorKeyActivated;
                Window.Current.CoreWindow.PointerPressed += this.CoreWindow_PointerPressed;
                //}
#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");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Esempio n. 5
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 async 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();

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

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

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate.
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    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)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.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(HubPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active.
            Window.Current.Activate();
        }
Esempio n. 6
0
 protected override void OnLaunched(LaunchActivatedEventArgs e)
 {
     _bootstrapper.OnLaunched(e);
 }
        /// <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;

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

                Xamarin.Forms.Forms.Init(e);

                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)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.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(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
 protected override Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
 {
     NavigationService.Navigate("Main", null);
     return(Task.CompletedTask);
 }
Esempio n. 9
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="args">Details about the launch request and process.</param>
 protected override void OnLaunched(LaunchActivatedEventArgs args)
 {
     _window = _host.GetExport <MainWindow>();
     _window.Activate();
 }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedSplashScreen"/> class.
        /// </summary>
        /// <param name="args">The <see cref="LaunchActivatedEventArgs"/> instance provided by the
        /// <see cref="global::Windows.UI.Xaml.Application"/> when it was launched.</param>
        /// <param name="nextPage">The type of the page to which the application will navigate when loading is done.</param>
        /// <param name="parameter">An optional navigation parameter.</param>
        public ExtendedSplashScreen(LaunchActivatedEventArgs args, Type nextPage, object parameter = null)
            : this()
        {
            _nextPage = nextPage;

            this.NavigationParameter = parameter;

            this.LaunchArgs = args;
        }
Esempio n. 11
0
 public Setup(XamlControls.Frame rootFrame, LaunchActivatedEventArgs e) : base(rootFrame)
 {
     _launchActivatedEventArgs = e;
 }
Esempio n. 12
0
 protected override void OnLaunched(LaunchActivatedEventArgs activationArgs)
 {
     base.OnLaunched(activationArgs);
     FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
 }
Esempio n. 13
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="args">Details about the launch request and process.</param>
 protected override void OnLaunched(LaunchActivatedEventArgs args)
 {
     splashScreen = args.SplashScreen;
     InitializeUnity(args.Arguments);
 }
Esempio n. 14
0
        /// <summary>
        /// Preserves the previous execution state in MetroGamePlatform and returns the constructed game object initialized with the given window.
        /// </summary>
        /// <param name="args">The command line arguments from launch.</param>
        /// <param name="window">The core window object.</param>
        /// <param name="swapChainBackgroundPanel">The XAML SwapChainBackgroundPanel to which we render the scene and recieve input events.</param>
        /// <returns></returns>
        static public T Create(LaunchActivatedEventArgs args, CoreWindow window, SwapChainBackgroundPanel swapChainBackgroundPanel)
        {
            MetroGamePlatform.PreviousExecutionState = args.PreviousExecutionState;

            return(Create(args.Arguments, window, swapChainBackgroundPanel));
        }
 // Add any OnLaunched customization here.
 partial void LaunchCompleted(LaunchActivatedEventArgs e);
Esempio n. 16
0
        /// <summary>
        /// Richiamato quando l'applicazione viene avviata normalmente dall'utente.  All'avvio dell'applicazione
        /// verranno utilizzati altri punti di ingresso per aprire un file specifico, per visualizzare
        /// risultati di ricerche e così via.
        /// </summary>
        /// <param name="e">Dettagli sulla richiesta e il processo di avvio.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Non ripetere l'inizializzazione dell'applicazione se la finestra già dispone di contenuto,
            // assicurarsi solo che la finestra sia attiva.
            if (rootFrame == null)
            {
                // Creare un frame che agisca da contesto di navigazione e passare alla prima pagina.
                rootFrame = new Frame();

                // Associare il frame a una chiave SuspensionManager.
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                // TODO: modificare questo valore su una dimensione di cache appropriata per l'applicazione.
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Ripristinare lo stato della sessione salvata solo se appropriato.
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        // Errore durante il ripristino dello stato.
                        // Si presuppone che non esista alcuno stato e continua.
                    }
                }

                // Posizionare il frame nella finestra corrente.
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Rimuove l'avvio della navigazione turnstile.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

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

                if (!Settings.Spot)
                {
                    if (Shop.getProductStatus())
                    {
                        Settings.Spot = false;
                    }
                }
                Settings.AppOpened++;

                // Quando lo stack di navigazione non viene ripristinato, esegui la navigazione alla prima pagina,
                // configurando la nuova pagina per passare le informazioni richieste come parametro di
                // navigazione.
                if (!Settings.firstLaunch)
                {
                    if (!rootFrame.Navigate(typeof(Welcome), e.Arguments))
                    {
                        throw new Exception("Failed to create initial page");
                    }
                }
                else
                {
                    string arguments = e.Arguments;
                    Settings.comando = arguments;
                    try
                    {
                        string[] argomenti = arguments.Split(',');
                        System.Diagnostics.Debug.WriteLine(arguments);
                        if (argomenti[0] == "st")
                        {
                            //MessageDialog msg = new MessageDialog("CI SONOO " + argomenti[1]);
                            //await msg.ShowAsync();
                            int idStazione = Convert.ToInt16(argomenti[1]);
                            if (!rootFrame.Navigate(typeof(SectionPage), idStazione))
                            {
                                throw new Exception("Failed to create initial page");
                            }
                        }
                        else
                        {
                            if (!rootFrame.Navigate(typeof(HubPage), e.Arguments))
                            {
                                throw new Exception("Failed to create initial page");
                            }
                        }
                    } catch (NullReferenceException ex)
                    {
                        System.Diagnostics.Debug.WriteLine("ERRORE  ARGOMENTI " + ex.ToString());
                        if (!rootFrame.Navigate(typeof(HubPage), e.Arguments))
                        {
                            throw new Exception("Failed to create initial page");
                        }
                    }
                }
            }

            // Assicurarsi che la finestra corrente sia attiva.
            Window.Current.Activate();
        }
Esempio 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 async override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = false;
            }
#endif

            #region ScheduledTask

            var scheduledTaskRegistered = BackgroundTaskRegistration.AllTasks.Any(task => task.Value.Name == "KursnaLista.Tasks.ScheduledTask");

            if (!scheduledTaskRegistered)
            {
#if WINDOWS_PHONE_APP
                await BackgroundExecutionManager.RequestAccessAsync();
#endif

                var builder = new BackgroundTaskBuilder();

                builder.Name           = "ScheduledTask";
                builder.TaskEntryPoint = "KursnaLista.Tasks.ScheduledTask";
                builder.SetTrigger(new TimeTrigger(15, false));

                builder.Register();
            }

            #endregion

            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();

                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

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

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    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;
            }

            ViewModelLocator.NavigationService.Frame = rootFrame;


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

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += this.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 (!ViewModelLocator.NavigationService.NavigateTo <IMainPageView>())
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            if (!string.IsNullOrEmpty(e.Arguments))
            {
                var fromTo = e.Arguments.Split(':');
                if (!ViewModelLocator.NavigationService.NavigateTo <IConverterPageView>(new { From = fromTo[0], To = fromTo[1] },
                                                                                        ViewModelLocator.NavigationService.Frame.Content is IConverterPageView))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Esempio n. 18
0
        private async void OnLaunched(LaunchActivatedEventArgs e, Music music)
        {
            await Settings.Init();

            await MusicLibraryPage.Init();

            if (Settings.settings.LastPage == "Albums")
            {
                await AlbumsPage.Init();
            }
            await Helper.Init();

            await UpdateHelper.Init();

            Frame rootFrame = Window.Current.Content as Frame;

            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e?.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 从之前挂起的应用程序加载状态
                }

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
            }

            if (e == null || e.PrelaunchActivated == false)
            {
                if (Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch"))
                {
                    Windows.ApplicationModel.Core.CoreApplication.EnablePrelaunch(true);
                }
                if (rootFrame.Content == null)
                {
                    // 当导航堆栈尚未还原时,导航到第一页,
                    // 并通过将所需信息作为导航参数传入来配置
                    // 参数
                    rootFrame.Navigate(typeof(MainPage), e?.Arguments);
                    if (e != null && e.TileId != "App")
                    {
                        var tileId = System.Net.WebUtility.UrlDecode(e.TileId);
                        MainPage.Instance.NavigateToPage(bool.Parse(e.Arguments) ? typeof(PlaylistsPage) :
                                                         tileId.StartsWith(Helper.Localize(MenuFlyoutHelper.MyFavorites)) ? typeof(MyFavoritesPage) : typeof(AlbumPage), tileId);
                    }
                }
                // 确保当前窗口处于活动状态
                Window.Current.Activate();
            }
            Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            MediaHelper.Init(music);
            await AlbumsPage.Init();

            await RecentPage.Init();

            ToastHelper.Init();
            //LaunchVoiceAssistant();

            foreach (var listener in LoadedListeners)
            {
                listener.Invoke();
            }
            Inited = true;
            // If background task is already registered, do nothing
            if (BackgroundTaskRegistration.AllTasks.Any(i => i.Value.Name.Equals(ToastHelper.ToastTaskName)))
            {
                return;
            }
            // Otherwise request access
            BackgroundAccessStatus status = await BackgroundExecutionManager.RequestAccessAsync();

            // Create the background task
            BackgroundTaskBuilder builder = new BackgroundTaskBuilder()
            {
                Name = ToastHelper.ToastTaskName
            };

            // Assign the toast action trigger
            builder.SetTrigger(new ToastNotificationActionTrigger());

            // And register the task
            BackgroundTaskRegistration registration = builder.Register();
        }
Esempio n. 19
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 async 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();

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

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

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate.
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    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)
            {
                // 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 (PivotPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active.
            Window.Current.Activate();
        }
Esempio n. 20
0
 protected override void OnLaunched(LaunchActivatedEventArgs args)
 {
     CarnaWinUIRunner.Run();
 }
Esempio n. 21
0
 protected override void OnLaunched(LaunchActivatedEventArgs args)
 {
     DisplayRootViewFor <ShellViewModel>();
 }
Esempio n. 22
0
 /// <summary>
 /// 在应用程序由最终用户正常启动时进行调用。
 /// 将在启动应用程序以打开特定文件等情况下使用。
 /// </summary>
 /// <param name="e">有关启动请求和过程的详细信息。</param>
 protected override void OnLaunched(LaunchActivatedEventArgs e)
 {
     OnLaunchedOrActivated(e);
 }
Esempio n. 23
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 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)
            {
                Color currentAccentColorHex         = ((SolidColorBrush)Application.Current.Resources["SystemControlHighlightAccentBrush"]).Color;
                Color currentInactiveAccentColorHex = ((Color)Application.Current.Resources["SystemDisabledWindowAppbarColor"]);

                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
                {
                    var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                    if (titleBar != null)
                    {
                        titleBar.ButtonBackgroundColor = currentAccentColorHex;
                        titleBar.ButtonForegroundColor = Colors.White;
                        titleBar.BackgroundColor       = currentAccentColorHex;
                        titleBar.ForegroundColor       = Colors.White;

                        titleBar.InactiveBackgroundColor       = currentInactiveAccentColorHex;
                        titleBar.ButtonInactiveBackgroundColor = currentInactiveAccentColorHex;
                    }
                }

                //Mobile customization
                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    var statusBar = StatusBar.GetForCurrentView();
                    if (statusBar != null)
                    {
                        statusBar.BackgroundOpacity = 1;
                        statusBar.BackgroundColor   = currentAccentColorHex;
                        statusBar.ForegroundColor   = Colors.White;
                    }
                }

                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Xamarin.Forms.Forms.Init(e);

                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)
            {
                // 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(MainPage), e.Arguments);
            }

            if (ApiInformation.IsPropertyPresent(typeof(LaunchActivatedEventArgs).FullName, nameof(LaunchActivatedEventArgs.TileActivatedInfo)))
            {
                // If clicked on from tile
                if (e.TileActivatedInfo != null)
                {
                    // If tile notification(s) were present
                    if (e.TileActivatedInfo.RecentlyShownNotifications.Count > 0)
                    {
                        // Get arguments from the notifications that were recently displayed
                        string currencyRedirectionArgument = e.TileActivatedInfo.RecentlyShownNotifications
                                                             .Select(i => i.Arguments)
                                                             .Where(x => x.Contains(Constants.CurrencyRedirectionArgumentSeparator) && x.StartsWith(Constants.CurrencyRedirectionArgumentCode))
                                                             .FirstOrDefault();

                        var redirectionToCurrency = string.IsNullOrEmpty(currencyRedirectionArgument) ? null : currencyRedirectionArgument.Split(Constants.CurrencyRedirectionArgumentSeparator[0]).Last();

                        if (!string.IsNullOrEmpty(redirectionToCurrency))
                        {
                            Settings.SetLastViewedCurrency(redirectionToCurrency);
                            ServiceLocator.Current.GetInstance <ICurrencyNavigateService>().NavigateToCurrency(redirectionToCurrency);
                        }
                    }
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Esempio n. 24
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 void OnLaunched(LaunchActivatedEventArgs e)
        {
            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (!(Window.Current.Content is Frame rootFrame))
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;

                // beim Store Build werden die Assemblies aus Nuget Packages nicht richtig mitgeladen, hiermit behoben
                var rendererAssemblies = new[]
                {
                    // Die nicht im Projekt benötigten Renderer können entfernt werden
                    typeof(CartesianChartRenderer).GetTypeInfo().Assembly,
                    typeof(LegendRenderer).GetTypeInfo().Assembly,
                    typeof(PieChartRenderer).GetTypeInfo().Assembly,
                    typeof(PieLabelRenderer).GetTypeInfo().Assembly,
                    typeof(CardActionViewRenderer).GetTypeInfo().Assembly,
                    typeof(ChatListViewRenderer).GetTypeInfo().Assembly,
                    typeof(ListViewRenderer).GetTypeInfo().Assembly,
                    typeof(TreeViewRenderer).GetTypeInfo().Assembly,
                    typeof(ItemsControlRenderer).GetTypeInfo().Assembly,
                    typeof(AutoCompleteLabelRenderer).GetTypeInfo().Assembly,
                    typeof(AutoCompleteRenderer).GetTypeInfo().Assembly,
                    typeof(ButtonRenderer).GetTypeInfo().Assembly,
                    typeof(CalendarRenderer).GetTypeInfo().Assembly,
                    typeof(DataFormRenderer).GetTypeInfo().Assembly,
                    typeof(EntryRenderer).GetTypeInfo().Assembly,
                    typeof(MaskedInputRenderer).GetTypeInfo().Assembly,
                    typeof(SegmentedControlRenderer).GetTypeInfo().Assembly,
                    typeof(TimePickerItemViewRenderer).GetTypeInfo().Assembly,
                    typeof(BorderRenderer).GetTypeInfo().Assembly,
                    typeof(CheckBoxRenderer).GetTypeInfo().Assembly,
                    typeof(ScrollViewRenderer).GetTypeInfo().Assembly,
                    typeof(SideDrawerRenderer).GetTypeInfo().Assembly,
                    typeof(SlideViewLabelRenderer).GetTypeInfo().Assembly,
                    typeof(SlideViewRenderer).GetTypeInfo().Assembly,
                    typeof(TabViewHeaderItemRenderer).GetTypeInfo().Assembly,
                    typeof(ZXingBarcodeImageViewRenderer).GetTypeInfo().Assembly,
                    typeof(ZXingScannerViewRenderer).GetTypeInfo().Assembly,
                    typeof(WriteableBitmapRenderer).GetTypeInfo().Assembly,
                    typeof(PixelDataRenderer).GetTypeInfo().Assembly,
                    typeof(SvgRenderer).GetTypeInfo().Assembly,
                    typeof(SKCanvasViewRenderer).GetTypeInfo().Assembly,
                    typeof(SKGLViewRenderer).GetTypeInfo().Assembly
                };

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

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

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }

            // Azure Mobile Center Push Notifizierungen
            Push.CheckLaunchedFromNotification(e);

            if (e.Arguments != null)
            {
                var customData = ParseLaunchString(e.Arguments);

                if (customData != null)
                {
                    foreach (var data in customData)
                    {
                        Logging.Log.LogInfo("NotificationData: " + data.Key + ": " + data.Value);
                    }

                    ProjectViewModelBase.PushReceived(customData);
                }
            }
        }
 /// <summary>
 /// Called whenever the app is launched normally meaning <see cref="ActivationKind"/>
 /// is <see cref="ActivationKind.Launch"/> with <see cref="ApplicationExecutionState"/>
 /// equal to <see cref="ApplicationExecutionState.Suspended"/>
 /// </summary>
 /// <param name="args">The <see cref="LaunchActivatedEventArgs"/> instance containing the event data.</param>
 protected abstract Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args);
Esempio n. 26
0
 protected override void OnLaunched(LaunchActivatedEventArgs args)
 {
     DisplayRootView <SchemeListView>();
 }
 /// <summary>
 /// Called everytime a secondery tile is pressed, if this launches the application
 /// <see cref="OnLaunchApplicationAsync(LaunchActivatedEventArgs)"/> will be called first.
 /// this doesn't check if <see cref="ActivationKind"/> is <see cref="ActivationKind.Launch"/>
 /// with <see cref="ApplicationExecutionState"/> equal to <see cref="ApplicationExecutionState.Suspended"/>
 /// </summary>
 /// <param name="args"></param>
 protected virtual Task OnSeconderyLaunchAsync(LaunchActivatedEventArgs args) => Task.CompletedTask;
Esempio n. 28
0
        protected override Task OnLaunchApplicationAsync(LaunchActivatedEventArgs e)
        {
            NavigationService.Navigate <SearchViewModel>();

            return(Task.CompletedTask);
        }
Esempio n. 29
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 async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            bool canEnablePrelaunch = Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch");

            if (e != null)
            {
                if (e.PreviousExecutionState == ApplicationExecutionState.Running)
                {
                    Window.Current.Activate();
                    return;
                }
            }
            Helper.ChangeAppMinSize(540, 744);

            try
            {
                //StoreServicesNotificationChannelParameters parameters =
                //    new StoreServicesNotificationChannelParameters();
                //parameters.CustomNotificationChannelUri = "Assign your channel URI here";

                //StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault();
                //await engagementManager.RegisterNotificationChannelAsync(parameters);

                await Helper.RunInBackground(async() =>
                {
                    StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault();

                    await engagementManager.RegisterNotificationChannelAsync();
                });
            }
            catch
            {
                //
            }

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

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
                if (e.PreviousExecutionState != ApplicationExecutionState.Running)
                {
                    bool       loadState      = (e.PreviousExecutionState == ApplicationExecutionState.Terminated);
                    SplashView extendedSplash = new SplashView(e.SplashScreen, loadState);
                    rootFrame.Content = extendedSplash;
                    //rootFrame.Content = new Views.BlankPage1();

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

            if (e.PrelaunchActivated == false)
            {
                if (canEnablePrelaunch)
                {
                    TryEnablePrelaunch();
                }
                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(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
Esempio n. 30
0
 protected override void OnLaunched(LaunchActivatedEventArgs args)
 {
     Window.Current.Content = new Page();
     Window.Current.Activate();
 }
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            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();

                rootFrame.NavigationFailed += OnNavigationFailed;

                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)
            {
                // 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(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();

            // ====================  LOCAL SETTINGS  ====================

            // -----  Adapted from https://msdn.microsoft.com/library/windows/apps/xaml/windows.storage.applicationdata.localsettings.aspx  -----

            // =====  Pin Code  =====

            // Access local settings
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            // Read local settings for pin code
            Object loadPin = localSettings.Values["pinCode"];

            // If there is no pincode set one to a default value
            if (loadPin == null)
            {
                localSettings.Values["pinCode"] = "9999";
            }

            // =====  Sentence Size  =====

            // Read local settings for sentence size
            Object size = localSettings.Values["sentenceSize"];

            // If there is no size set one to a default value
            if (size == null)
            {
                localSettings.Values["sentenceSize"] = "2";
            }
        }// End OnLaunched
Esempio n. 32
0
 protected override async Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
 {
     await LaunchApplicationAsync(PageTokens.MainPage, null);
 }
Esempio n. 33
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 void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // This just gets in the way.
                //this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            AppShell shell = Window.Current.Content as AppShell;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (shell == null)
            {
                // propogate settings to the core library
                SettingsHelper.Instance.SettingsChanged += (target, args) =>
                {
                    FaceServiceHelper.ApiKey   = SettingsHelper.Instance.FaceApiKey;
                    VisionServiceHelper.ApiKey = SettingsHelper.Instance.VisionApiKey;
                    ImageAnalyzer.PeopleGroupsUserDataFilter     = SettingsHelper.Instance.WorkspaceKey;
                    FaceListManager.FaceListsUserDataFilter      = SettingsHelper.Instance.WorkspaceKey;
                    CoreUtil.MinDetectableFaceCoveragePercentage = SettingsHelper.Instance.MinDetectableFaceCoveragePercentage;
                };

                // callbacks for core library
                FaceServiceHelper.Throttled        = () => ShowThrottlingToast("Face");
                VisionServiceHelper.Throttled      = () => ShowThrottlingToast("Vision");
                ErrorTrackingHelper.TrackException = (ex, msg) => LogException(ex, msg);
                ErrorTrackingHelper.GenericApiCallExceptionHandler = Util.GenericApiCallExceptionHandler;

                SettingsHelper.Instance.Initialize();

                // Since it can be a pain to enter these keys in an IoT device, this is a good place to hardcode them if necessary.
                //SettingsHelper.Instance.WorkspaceKey = "";
                //SettingsHelper.Instance.FaceApiKey = "";
                //SettingsHelper.Instance.VisionApiKey = "";

                // Create a AppShell to act as the navigation context and navigate to the first page
                shell = new AppShell();

                // Set the default language
                shell.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                shell.AppFrame.NavigationFailed += OnNavigationFailed;

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

                // Set the TitleBar to Dark Theme
                var appView  = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
                var titleBar = appView.TitleBar;
                titleBar.BackgroundColor       = Windows.UI.Colors.Black;
                titleBar.ForegroundColor       = Windows.UI.Colors.White;
                titleBar.ButtonBackgroundColor = Windows.UI.Colors.Black;
                titleBar.ButtonForegroundColor = Windows.UI.Colors.White;
            }

            // Place our app shell in the current Window
            Window.Current.Content = shell;

            if (shell.AppFrame.Content == null)
            {
                // When the navigation stack isn't restored, navigate to the first page
                // suppressing the initial entrance animation.
                shell.AppFrame.Navigate(typeof(DemoLauncherPage), e.Arguments, new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Esempio n. 34
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)
 {
     await ActivateAsync(e);
 }
Esempio n. 35
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)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = false;
            }
#endif
            Logger.Instance.LogMessage($"App Launched with {e.Arguments}");

            if (PushChannel == null)
            {
                PushChannel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

                Logger.Instance.LogMessage($"Setup Push {PushChannel.Uri}");
                PushChannel.PushNotificationReceived += PushNotificationReceived;
            }

            if (ConnectedDevicesManager == null)
            {
                Logger.Instance.LogMessage($"Setup ConnectedDevicesManager");
                ConnectedDevicesManager = new ConnectedDevicesManager();
            }

            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
                {
                    // Set the default language
                    Language = Windows.Globalization.ApplicationLanguages.Languages[0]
                };

                rootFrame.NavigationFailed += OnNavigationFailed;

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

                // Place the frame in the current Window
                Window.Current.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(MainPage), e.Arguments);
            }

            if (!string.IsNullOrEmpty(e.Arguments))
            {
                var result = JsonConvert.DeserializeObject <AppLauchArgs>(e.Arguments);
                await ConnectedDevicesManager.RefreshAsync();

                await ConnectedDevicesManager.ActivateAsync(result.notificationId, false);
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Esempio n. 36
0
 protected override void OnLaunched(LaunchActivatedEventArgs args) {
     DevExpress.TestFramework.TestRunner.RunTests(this.GetType(), args:args);
 }
Esempio n. 37
0
 /// <summary>
 /// Overrides the default behavior when the application is launched.
 /// </summary>
 /// <param name="args">The <see cref="LaunchActivatedEventArgs"/> event data.</param>
 protected override void OnLaunched( LaunchActivatedEventArgs args )
 {
     Activation = args;
     Init();
 }