Exemple #1
0
        private async Task LaunchWithStartupMode(IActivatedEventArgs LaunchArgs)
        {
            StartupMode Mode = StartupModeController.GetStartupMode();

            switch (Mode)
            {
            case StartupMode.CreateNewTab:
            {
                ExtendedSplash extendedSplash = new ExtendedSplash(LaunchArgs.SplashScreen);
                Window.Current.Content = extendedSplash;
                break;
            }

            case StartupMode.LastOpenedTab:
            {
                List <string[]> LastOpenedPathArray = await StartupModeController.GetAllPathAsync(Mode).ToListAsync();

                StartupModeController.Clear(StartupMode.LastOpenedTab);

                if (LastOpenedPathArray.Count == 0)
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(LaunchArgs.SplashScreen);
                    Window.Current.Content = extendedSplash;
                }
                else
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(LaunchArgs.SplashScreen, LastOpenedPathArray);
                    Window.Current.Content = extendedSplash;
                }

                break;
            }

            case StartupMode.SpecificTab:
            {
                string[] SpecificPathArray = await StartupModeController.GetAllPathAsync(Mode).Select((Item) => Item.FirstOrDefault()).OfType <string>().ToArrayAsync();

                if (SpecificPathArray.Length == 0)
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(LaunchArgs.SplashScreen);
                    Window.Current.Content = extendedSplash;
                }
                else
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(LaunchArgs.SplashScreen, SpecificPathArray);
                    Window.Current.Content = extendedSplash;
                }

                break;
            }
            }
        }
Exemple #2
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            Microsoft.Toolkit.Uwp.Helpers.SystemInformation.Instance.TrackAppUse(e);

            ApplicationViewTitleBar TitleBar = ApplicationView.GetForCurrentView().TitleBar;

            TitleBar.ButtonBackgroundColor         = Colors.Transparent;
            TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            if (Window.Current.Content is Frame frame)
            {
                if (frame.Content is MainPage Main && Main.Nav.Content is TabViewContainer TabContainer)
                {
                    if (!string.IsNullOrWhiteSpace(e.Arguments) && await FileSystemStorageItemBase.CheckExistAsync(e.Arguments))
                    {
                        await TabContainer.CreateNewTabAsync(e.Arguments);
                    }
                    else
                    {
                        await TabContainer.CreateNewTabAsync();
                    }
                }
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(e.Arguments) && await FileSystemStorageItemBase.CheckExistAsync(e.Arguments))
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen, new List <string[]> {
                        new string[] { e.Arguments }
                    });
                    Window.Current.Content = extendedSplash;
                }
                else
                {
                    StartupMode Mode = StartupModeController.GetStartupMode();

                    switch (Mode)
                    {
                    case StartupMode.CreateNewTab:
                    {
                        ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen);
                        Window.Current.Content = extendedSplash;
                        break;
                    }

                    case StartupMode.LastOpenedTab:
                    {
                        List <string[]> LastOpenedPathArray = await StartupModeController.GetAllPathAsync(Mode).ToListAsync();

                        StartupModeController.Clear(StartupMode.LastOpenedTab);

                        if (LastOpenedPathArray.Count == 0)
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen);
                            Window.Current.Content = extendedSplash;
                        }
                        else
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen, LastOpenedPathArray);
                            Window.Current.Content = extendedSplash;
                        }

                        break;
                    }

                    case StartupMode.SpecificTab:
                    {
                        string[] SpecificPathArray = await StartupModeController.GetAllPathAsync(Mode).Select((Item) => Item.FirstOrDefault()).OfType <string>().ToArrayAsync();

                        if (SpecificPathArray.Length == 0)
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen);
                            Window.Current.Content = extendedSplash;
                        }
                        else
                        {
                            ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen, SpecificPathArray);
                            Window.Current.Content = extendedSplash;
                        }

                        break;
                    }
                    }
                }
            }

            Window.Current.Activate();
        }