Ejemplo n.º 1
0
        public static void IndexPrograms()
        {
            Win32[]           w = { };
            UWP.Application[] u = { };
            var t1 = Task.Run(() =>
            {
                w = Win32.All(_settings);
            });
            var t2 = Task.Run(() =>
            {
                var windows10 = new Version(10, 0);
                var support   = Environment.OSVersion.Version.Major >= windows10.Major;
                if (support)
                {
                    u = UWP.All();
                }
                else
                {
                    u = new UWP.Application[] { };
                }
            });

            Task.WaitAll(t1, t2);

            lock (IndexLock)
            {
                _win32s = w;
                _uwps   = u;
            }
        }
Ejemplo n.º 2
0
Archivo: Main.cs Proyecto: xueyawei/Wox
        public static void IndexPrograms()
        {
            var t1 = Task.Run(() =>
            {
                _win32s = Win32.All(_settings);
            });
            var t2 = Task.Run(() =>
            {
                _uwps = UWP.All();
            });

            Task.WaitAll(t1, t2);
        }
Ejemplo n.º 3
0
        public void AllShouldNotReturnPackageFrameworksWhenCalled()
        {
            // Arrange
            Main._settings = new ProgramPluginSettings();
            List <IPackage> packages = new List <IPackage>()
            {
                FrameworkApp, PackagedApp
            };
            var mock = new Mock <IPackageManager>();

            mock.Setup(x => x.FindPackagesForCurrentUser()).Returns(packages);
            UWP.PackageManagerWrapper = mock.Object;

            // Act
            var applications = UWP.All();

            // Assert
            Assert.AreEqual(applications.Length, 1);
            Assert.IsTrue(applications.FindAll(x => x.Name == "PackagedApp").Length > 0);
        }
Ejemplo n.º 4
0
        public void PowerToysRunShouldNotAddInvalidAppWhenIndexingUWPApplications()
        {
            // Arrange
            PackageWrapper invalidPackagedApp = new PackageWrapper();

            Main._settings = new ProgramPluginSettings();
            List <IPackage> packages = new List <IPackage>()
            {
                invalidPackagedApp
            };
            var mock = new Mock <IPackageManager>();

            mock.Setup(x => x.FindPackagesForCurrentUser()).Returns(packages);
            UWP.PackageManagerWrapper = mock.Object;

            // Act
            var applications = UWP.All();

            // Assert
            Assert.AreEqual(applications.Length, 0);
        }
Ejemplo n.º 5
0
        public void All_ShouldReturnPackagesWithDevelopmentMode_WhenCalled()
        {
            // Arrange
            Main._settings = new Settings();
            List <IPackage> packages = new List <IPackage>()
            {
                developmentModeApp, packagedApp
            };
            var mock = new Mock <IPackageManager>();

            mock.Setup(x => x.FindPackagesForCurrentUser()).Returns(packages);
            UWP.PackageManagerWrapper = mock.Object;

            // Act
            var applications = UWP.All();

            // Assert
            Assert.AreEqual(applications.Length, 2);
            Assert.IsTrue(applications.FindAll(x => x.Name == "DevelopmentApp").Length > 0);
            Assert.IsTrue(applications.FindAll(x => x.Name == "PackagedApp").Length > 0);
        }
Ejemplo n.º 6
0
        public static void IndexPrograms()
        {
            Win32[]           w = { };
            UWP.Application[] u = { };
            var t1 = Task.Run(() =>
            {
                w = Win32.All(_settings);
            });
            var t2 = Task.Run(() =>
            {
                u = UWP.All();
            });

            Task.WaitAll(t1, t2);

            lock (IndexLock)
            {
                _win32s = w;
                _uwps   = u;
            }
        }
Ejemplo n.º 7
0
 public static void IndexPrograms()
 {
     _win32s = Win32.All(_settings);
     _uwps   = UWP.All();
 }