/// <summary>
        /// Deletes all selected project items.
        /// </summary>
        private void DeleteSelectedItems()
        {
            if (this.GetSelectedProjectItems().IsNullOrEmpty())
            {
                return;
            }

            System.Windows.MessageBoxResult result = System.Windows.MessageBoxResult.No;
            ControlThreadingHelper.InvokeControlAction(
                this.projectExplorerTreeView,
                () =>
            {
                result = CenteredDialogBox.Show(
                    System.Windows.Application.Current.MainWindow,
                    "Delete selected items?",
                    "Confirm",
                    System.Windows.MessageBoxButton.OKCancel,
                    System.Windows.MessageBoxImage.Warning);
            });

            if (result == System.Windows.MessageBoxResult.OK)
            {
                ProjectExplorerViewModel.GetInstance().DeleteSelectionCommand.Execute(null);
            }
        }
Example #2
0
 /// <summary>
 /// Updates the selected target objects.
 /// </summary>
 /// <param name="targetObjects">The selected target objects.</param>
 public void Update(Object[] targetObjects)
 {
     ControlThreadingHelper.InvokeControlAction(
         this.propertyGrid,
         () =>
     {
         this.propertyGrid.SelectedObjects = targetObjects == null || targetObjects.Contains(null) ? new Object[] { } : targetObjects;
     });
 }
        /// <summary>
        /// Event received when a key is pressed.
        /// </summary>
        /// <param name="key">The key that was pressed.</param>
        public void OnKeyPress(Key key)
        {
            ControlThreadingHelper.InvokeControlAction(
                this.projectExplorerTreeView,
                () =>
            {
                if (!this.projectExplorerTreeView.Focused)
                {
                    return;
                }

                switch (key)
                {
                case Key.Space:
                    this.ActivateSelectedItems();
                    break;

                case Key.Delete:
                    this.DeleteSelectedItems();
                    break;

                case Key.C:
                    if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        this.CopySelection();
                    }

                    break;

                case Key.X:
                    if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        this.CutSelection();
                    }

                    break;

                case Key.V:
                    if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                    {
                        this.PasteSelection();
                    }

                    break;
                }
            });
        }