Ejemplo n.º 1
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 (e != null)
            {
                if (e.PreviousExecutionState == ApplicationExecutionState.Running)
                {
                    Window.Current.Activate();
                    return;
                }
                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
                if (e.Kind == ActivationKind.VoiceCommand)
                {
                }
            }
            try
            {
                var index = SettingsSetters.GetThemeIndex();
                if (index == 1)
                {
                    StatusBar.GetForCurrentView().ForegroundColor = Colors.Black;
                }
                else
                {
                    StatusBar.GetForCurrentView().ForegroundColor = Colors.White;
                }
            }
            catch { }
            StartFluent();
            Resources["ToggleButtonBackgroundChecked"]            = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlHighlightListAccentLowBrush"] = Color.FromArgb(255, 96, 165, 255);
            Resources["ToggleSwitchFillOn"]                 = Color.FromArgb(255, 96, 165, 255);
            Resources["HyperlinkButtonForeground"]          = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlBackgroundAccentBrush"] = Color.FromArgb(255, 96, 165, 255);
            SplashScreen         splashScreen = e.SplashScreen;
            ExtendedSplashScreen eSplash      = null;

            if (e.Arguments != "")
            {
                var sp = e.Arguments.Split(',');
                eSplash = new ExtendedSplashScreen(splashScreen, new Uri($"https://google.com/maps/@?api=1&map_action=map&center={sp[0]},{sp[1]}&zoom=17", UriKind.RelativeOrAbsolute));
            }
            else
            {
                eSplash = new ExtendedSplashScreen(splashScreen);
            }
            // Register an event handler to be executed when the splash screen has been dismissed.
            Window.Current.Content = eSplash;
            Window.Current.Activate();
            App.Current.Suspending  += Current_Suspending;
            CoreApplication.Exiting += CoreApplication_Exiting;
        }
Ejemplo n.º 2
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 (e.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }
            if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }
            try
            {
                StatusBar.GetForCurrentView().ForegroundColor = Colors.Black;
            }
            catch { }
            SplashScreen splashScreen = e.SplashScreen;
            var          eSplash      = new ExtendedSplashScreen(splashScreen);

            // Register an event handler to be executed when the splash screen has been dismissed.
            Window.Current.Content = eSplash;
            Window.Current.Activate();
        }
Ejemplo n.º 3
0
        protected override void OnActivated(IActivatedEventArgs args)
        {
            base.OnActivated(args);
            #region Start app

            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;

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }
            #endregion
            try
            {
                StatusBar.GetForCurrentView().ForegroundColor = Colors.Black;
            }
            catch { }
            StartFluent();
            Resources["ToggleButtonBackgroundChecked"]            = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlHighlightListAccentLowBrush"] = Color.FromArgb(255, 96, 165, 255);
            Resources["ToggleSwitchFillOn"]                 = Color.FromArgb(255, 96, 165, 255);
            Resources["HyperlinkButtonForeground"]          = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlBackgroundAccentBrush"] = Color.FromArgb(255, 96, 165, 255);
            SplashScreen         splashScreen = args.SplashScreen;
            ExtendedSplashScreen eSplash      = null;

            if (args.Kind == ActivationKind.VoiceCommand)
            {
                var voiceArgs = (VoiceCommandActivatedEventArgs)args;
                var Rule      = voiceArgs.Result.RulePath.FirstOrDefault();
                var input     = voiceArgs.Result.SemanticInterpretation.Properties.Where(x => x.Key == "UserInput").FirstOrDefault().Value.FirstOrDefault();
                if (Rule == "DirectionsCommand")
                {
                    eSplash = new ExtendedSplashScreen(splashScreen, new Uri("https://google.com/maps/@searchplace=" + input, UriKind.RelativeOrAbsolute));
                }
                if (Rule == "FindPlace")
                {
                    eSplash = new ExtendedSplashScreen(splashScreen, new Uri("https://google.com/maps/@searchplace=" + input, UriKind.RelativeOrAbsolute));
                }
                if (Rule == "WhereAmI")
                {
                    eSplash = new ExtendedSplashScreen(splashScreen);
                }
            }
            if (args.Kind == ActivationKind.Protocol)
            {
                var protocolArgs = (ProtocolActivatedEventArgs)args;
                var x            = protocolArgs.Uri.ToString();

                // Register an event handler to be executed when the splash screen has been dismissed.
                //Type deepLinkPageType = typeof(PageLogin);
                if (rootFrame.Content == null)
                {
                    try
                    {
                        switch (protocolArgs.Uri.AbsolutePath.ToLower().Replace("/maps", string.Empty).Split('/')[1].ToString())
                        {
                        case "search":
                            eSplash = new ExtendedSplashScreen(splashScreen, protocolArgs.Uri);
                            break;

                        case "dir":
                            eSplash = new ExtendedSplashScreen(splashScreen, protocolArgs.Uri);
                            break;

                        case "@":
                            eSplash = new ExtendedSplashScreen(splashScreen, protocolArgs.Uri);
                            break;

                        default:
                            eSplash = new ExtendedSplashScreen(splashScreen);
                            break;
                        }
                    }
                    catch
                    {
                        eSplash = new ExtendedSplashScreen(splashScreen, protocolArgs.Uri);
                    }
                }
            }
            Window.Current.Content = eSplash;
            Window.Current.Activate();
        }