예제 #1
0
        private void menuItemEdit_Click(object sender, RoutedEventArgs e)
        {
            if (ListViewExcludes.SelectedItems.Count == 0)
            {
                return;
            }

            var excItem = ListViewExcludes.SelectedItem as ExcludeItem;
            var pos     = ExcludeArray.IndexOf(excItem);

            if (pos == -1)
            {
                MessageBox.Show(Application.Current.MainWindow, "The selected entry could not be found.",
                                Utils.ProductName, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            var editExcludeItem = new AddEditExcludeItem(excItem);

            if (!editExcludeItem.ShowDialog().GetValueOrDefault())
            {
                return;
            }

            ExcludeArray[pos] = editExcludeItem.ExcludeItem;

            MessageBox.Show(Application.Current.MainWindow, "Successfully updated exclude entry.", Utils.ProductName,
                            MessageBoxButton.OK, MessageBoxImage.Information);

            UpdateSettings();
            ListViewExcludes.AutoResizeColumns();
        }
예제 #2
0
        private void menuItemAddRegKey_Click(object sender, RoutedEventArgs e)
        {
            var addExcludeItem = new AddEditExcludeItem(AddEditExcludeItem.ExcludeTypes.Registry);

            if (!addExcludeItem.ShowDialog().GetValueOrDefault())
            {
                return;
            }

            var excludeItem = addExcludeItem.ExcludeItem;

            if (!ExcludeArray.Contains(excludeItem))
            {
                ExcludeArray.Add(excludeItem);

                MessageBox.Show(Application.Current.MainWindow, "Successfully added registry key to exclude list.",
                                Utils.ProductName, MessageBoxButton.OK, MessageBoxImage.Information);

                UpdateSettings();
                ListViewExcludes.AutoResizeColumns();
            }
            else
            {
                MessageBox.Show(Application.Current.MainWindow,
                                $"Registry key ({addExcludeItem.RegistryPath}) already exists", Utils.ProductName,
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #3
0
        private void menuItemRemove_Click(object sender, RoutedEventArgs e)
        {
            if (ListViewExcludes.SelectedItems.Count == 0)
            {
                return;
            }

            if (
                MessageBox.Show(Application.Current.MainWindow, "Are you sure?", Utils.ProductName,
                                MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
            {
                return;
            }

            ExcludeArray.Remove(ListViewExcludes.SelectedItem as ExcludeItem);

            UpdateSettings();
            ListViewExcludes.AutoResizeColumns();
        }