Example #1
0
        private void AddBlocked_Click(object sender, RoutedEventArgs e)
        {
            var appname = NewBlockTextBox.Text;
            if (!String.IsNullOrEmpty(appname))
            {
                if (Manager.TryAddBlocked(appname) && !BlockedApps.Items.Contains(appname) && !BlockedApps.Items.Contains(appname + ".exe"))
                {
                    var newBlocked = new ApplicationWithRemoveButton();
                    newBlocked.SetContent(appname + ".exe");
                    newBlocked.Remove_Button.Visibility = Visibility.Hidden;

                    BlockedApps.Items.Add(newBlocked);
                }
            }
        }
Example #2
0
        private void AddIgnored_Click(object sender, RoutedEventArgs e)
        {
            var appname = NewIgnoredTextBox.Text;
            if (!String.IsNullOrEmpty(appname) && Manager.IgnoredApps.All(a => a != appname))
            {
                Manager.AddIgnored(appname);
                var newIgnored = new ApplicationWithRemoveButton();
                newIgnored.SetContent(appname);
                newIgnored.Remove_Button.Visibility = Visibility.Hidden;

                IgnoredList.Items.Add(newIgnored);
            }
        }
Example #3
0
        private void LoadPersistedToGui(IEnumerable<string> blocked, IEnumerable<string> ignored,
                                        IEnumerable<Project> projects)
        {
            foreach (var app in blocked)
            {
                var newBlocked = new ApplicationWithRemoveButton();
                newBlocked.SetContent(app);
                newBlocked.Remove_Button.Visibility = Visibility.Hidden;

                BlockedApps.Items.Add(newBlocked);
            }
            foreach (var app in ignored)
            {
                var newIgnored = new ApplicationWithRemoveButton();
                newIgnored.SetContent(app);
                newIgnored.Remove_Button.Visibility = Visibility.Hidden;

                IgnoredList.Items.Add(newIgnored);
            }
            foreach (var proj in projects)
            {
                Projects.Items.Add(proj);
            }
        }
Example #4
0
        private void ManagerOnBlockAppPrompt(object sender, EventArgs eventArgs)
        {
            var handler = (ApplicationHandler) sender;
            var proc = handler.Handled;
            handler.HandlerStatus = AppHandlerStatus.Working;

            var dialog = new BlockOrIgnoreDialog(handler);

            if (dialog.ShowDialog() == true)
            {
                if (dialog.Blocked)
                {
                    Manager.TryAddBlocked(proc.ProcessName);
                    var newBlocked = new ApplicationWithRemoveButton();
                    newBlocked.SetContent(proc.ProcessName + ".exe");
                    newBlocked.Remove_Button.Visibility = Visibility.Hidden;
                    handler.HandlerStatus = AppHandlerStatus.Allowed;
                    BlockedApps.Items.Add(newBlocked);

                }
                else
                {
                    Manager.AddIgnored(proc.ProcessName);
                    var newIgnored = new ApplicationWithRemoveButton();
                    newIgnored.SetContent(proc.ProcessName);
                    newIgnored.Remove_Button.Visibility = Visibility.Hidden;
                    handler.HandlerStatus = AppHandlerStatus.Ignored;
                    IgnoredList.Items.Add(newIgnored);
                }
            }
        }
Example #5
0
        private void GuiAddBlocked(object sender, EventArgs e)
        {
            var newBlocked = new ApplicationWithRemoveButton();
            newBlocked.SetContent(sender as string);
            newBlocked.Remove_Button.Visibility = Visibility.Hidden;

            BlockedApps.Items.Add(newBlocked);
        }