Пример #1
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Microsoft.Toolkit.Uwp.Helpers.SystemInformation.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) && WIN_Native_API.CheckExist(e.Arguments))
                    {
                        TabContainer.CreateNewTabAndOpenTargetFolder(e.Arguments);
                    }
                    else
                    {
                        TabContainer.CreateNewTabAndOpenTargetFolder(string.Empty);
                    }
                }
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(e.Arguments) && WIN_Native_API.CheckExist(e.Arguments))
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen, $"PathActivate||{e.Arguments}");
                    Window.Current.Content = extendedSplash;
                }
                else
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(e.SplashScreen);
                    Window.Current.Content = extendedSplash;
                }
            }

            Window.Current.Activate();
        }
Пример #2
0
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            ApplicationViewTitleBar TitleBar = ApplicationView.GetForCurrentView().TitleBar;

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

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

            if (args is CommandLineActivatedEventArgs CmdArgs)
            {
                string[] Arguments = CmdArgs.Operation.Arguments.Split(" ", StringSplitOptions.RemoveEmptyEntries);

                if (Window.Current.Content is Frame frame)
                {
                    if (frame.Content is MainPage Main && Main.Nav.Content is TabViewContainer TabContainer)
                    {
                        if (Arguments.Length > 1)
                        {
                            string Path = string.Join(" ", Arguments.Skip(1));

                            if (Regex.IsMatch(Path, @"::\{[0-9A-F\-]+\}", RegexOptions.IgnoreCase))
                            {
                                await TabContainer.CreateNewTabAndOpenTargetFolder(string.Empty).ConfigureAwait(true);
                            }
                            else
                            {
                                await TabContainer.CreateNewTabAndOpenTargetFolder(Path).ConfigureAwait(true);
                            }
                        }
                        else
                        {
                            await TabContainer.CreateNewTabAndOpenTargetFolder(string.Empty).ConfigureAwait(true);
                        }
                    }
                }
                else
                {
                    string Path = string.Join(" ", Arguments.Skip(1));

                    if (Arguments.Length > 1 && !Regex.IsMatch(Path, @"::\{[0-9A-F\-]+\}", RegexOptions.IgnoreCase))
                    {
                        ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, $"PathActivate||{Path}");
                        Window.Current.Content = extendedSplash;
                    }
                    else
                    {
                        ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen);
                        Window.Current.Content = extendedSplash;
                    }
                }
            }
            else if (args is ProtocolActivatedEventArgs ProtocalArgs)
            {
                if (!string.IsNullOrWhiteSpace(ProtocalArgs.Uri.LocalPath))
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, $"PathActivate||{ProtocalArgs.Uri.LocalPath}");
                    Window.Current.Content = extendedSplash;
                }
                else
                {
                    ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen);
                    Window.Current.Content = extendedSplash;
                }
            }
            else
            {
                ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen);
                Window.Current.Content = extendedSplash;
            }

            Window.Current.Activate();
        }