Example #1
0
        private static CommandItem CreateItem(Process proc)
        {
            CommandItem app = null;

            if (proc.MainWindowTitle.Length > 1)
            {
                app = RunningAppItem.build(proc);
            }

            return(app);
        }
Example #2
0
        private static bool IsValid(RunningAppItem command)
        {
            if (command == null)
            {
                return(false);
            }

            using (var appx = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Appx"))
            {
                var packageRoot = appx.GetValue("PackageRoot");
                if (command.Path.IndexOf(packageRoot.ToString()) == 0)
                {
                    return(false);
                }
            }
            return(true);
        }
Example #3
0
        static public RunningAppItem build(Process proc)
        {
            RunningAppItem command = null;

            try
            {
                command = new RunningAppItem(proc);
            }
            catch (NullReferenceException)
            {
                // ignore
            }

            if (!IsValid(command))
            {
                command = null;
            }

            return(command);
        }