Beispiel #1
0
        private async Task PerformMainLandingNavigation(MainWindow window, LaunchActivatedEventArgs e)
        {
            var deeplink = ParseDeepLink(e);

            if (this.Log().IsEnabled(LogLevel.Debug))
            {
                typeof(App).Log().Debug("handling deeplink: " + (deeplink ?? "<null>"));
            }

            if (deeplink is FileInfo file)
            {
                if (!FileUtility.IsSupportedFile(file.FullName))
                {
                    throw new InvalidOperationException("Unsupported file type: " + file.Extension);
                }
                if (!file.Exists)
                {
                    throw new FileNotFoundException("No such file", file.FullName);
                }

                await window.OpenLocalPackage(file.FullName);
            }
            else if (deeplink is string searchTerm)
            {
                await window.OpenPackageFromRepository(searchTerm);
            }
            else if (deeplink is PackageIdentity identity)
            {
                await window.DownloadAndOpenDataServicePackage(
                    NuGetPackageExplorer.Constants.NuGetOrgSource,
                    identity.Id,
                    identity.Version
                    );
            }
        }
Beispiel #2
0
 private static bool LoadFile(MainWindow window, string file)
 {
     if (FileUtility.IsSupportedFile(file) && File.Exists(file)) {
         window.OpenLocalPackage(file);
         return true;
     }
     else {
         return false;
     }
 }
Beispiel #3
0
 private static bool LoadFile(MainWindow window, string file)
 {
     if (FileUtility.IsSupportedFile(file) && File.Exists(file))
     {
         window.OpenLocalPackage(file);
         return(true);
     }
     else
     {
         return(false);
     }
 }