private void ExecuteDeleteIgnoredApplicationCommand(IgnoredApplication ignoredApp)
        {
            var collection = IgnoredApplications;

            collection.Remove(collection.Single(app => app.ApplicationIdentifier == ignoredApp.ApplicationIdentifier));
            IgnoredApplications = collection;
            Logger.Instance.Information($"The application '{ignoredApp.ApplicationIdentifier}' has been removed from the ignored app list.");
        }
        private void ExecuteAddWindowToIgnoreListCommand(Window window)
        {
            if (window == null || window.Handle == IntPtr.Zero)
            {
                return;
            }

            var collection = IgnoredApplications;
            var ignoredApp = new IgnoredApplication
            {
                ApplicationIdentifier = window.ApplicationIdentifier
            };

            if (window.IsWindowsStoreApp)
            {
                ignoredApp.Icon = window.Icon;
            }
            else if (File.Exists(window.ApplicationIdentifier))
            {
                var icon = Icon.ExtractAssociatedIcon(window.ApplicationIdentifier)?.ToBitmap();

                if (icon != null)
                {
                    ignoredApp.Icon = DataHelper.BitmapToBitmapImage(new Bitmap(icon, Consts.WindowsIconsSize, Consts.WindowsIconsSize), Consts.WindowsIconsSize);
                }
                else
                {
                    ignoredApp.Icon = window.Icon;
                }
            }
            else
            {
                ignoredApp.Icon = window.Icon;
            }

            if (window.IsWindowsStoreApp)
            {
                ignoredApp.DisplayName = window.ApplicationIdentifier.Split('_').First();
            }
            else
            {
                ignoredApp.DisplayName = Path.GetFileNameWithoutExtension(window.ApplicationIdentifier);
            }

            if (collection.Any(app => app.DisplayName == ignoredApp.DisplayName))
            {
                return;
            }

            collection.Add(ignoredApp);
            IgnoredApplications = collection;

            WindowsList.Remove(window);
            Logger.Instance.Information($"The application '{ignoredApp.ApplicationIdentifier}' has been added to the ignored app list.");
        }
Exemplo n.º 3
0
        private void btnEditIgnoredApp_Click(object sender, RoutedEventArgs e)
        {
            IgnoredApplication ia = this.lstIgnoredApplications.SelectedItem as IgnoredApplication;

            if (ia == null)
            {
                return;
            }

            ApplicationDialog applicationDialog = new ApplicationDialog(ia);

            applicationDialog.ShowDialog();
        }
        private void DetectPasswordsManager()
        {
            var processes           = Process.GetProcesses();
            var passwordManagerList = new Dictionary <string, string>
            {
                // Process name, Application title in the ignored list
                { "PasswordZanager", "PasswordZanager" },
                { "AgileBits.OnePassword.Desktop", "1Password" },
                { "Dashlane", "Dashlane" },
                { "KeePass", "KeePass Password Safe" }
            };

            foreach (var process in processes)
            {
                var passwordManagerDetected = passwordManagerList.FirstOrDefault(item => string.Equals(item.Key, process.ProcessName, StringComparison.OrdinalIgnoreCase));
                if (!passwordManagerDetected.Equals(default(KeyValuePair <string, string>)))
                {
                    var ignoredApp            = new IgnoredApplication();
                    var applicationIdentifier = SystemInfoHelper.GetExecutablePath(process.Id);

                    ignoredApp.DisplayName           = passwordManagerDetected.Value;
                    ignoredApp.ApplicationIdentifier = applicationIdentifier;

                    if (File.Exists(applicationIdentifier))
                    {
                        var tempIcon = Icon.ExtractAssociatedIcon(applicationIdentifier)?.ToBitmap();
                        if (tempIcon != null)
                        {
                            ignoredApp.Icon = DataHelper.BitmapToBitmapImage(new Bitmap(tempIcon, Consts.WindowsIconsSize, Consts.WindowsIconsSize), Consts.WindowsIconsSize);
                        }
                    }

                    var collection = IgnoredApplications;
                    if (collection.Any(app => app.DisplayName == ignoredApp.DisplayName))
                    {
                        continue;
                    }

                    collection.Add(ignoredApp);
                    IgnoredApplications = collection;
                    Logger.Instance.Information($"The application '{ignoredApp.ApplicationIdentifier}' has been added to the ignored app list.");
                }
            }
        }