Exemple #1
0
 protected override void OnExecute(object parameter)
 {
     if (ToolboxUserDialogs.AskUserForReset() == MessageBoxResult.Yes)
     {
         _serializer.ResetFromBackup(_backupProvider.Backup);
     }
 }
Exemple #2
0
 protected override void OnExecute(object parameter)
 {
     if (!(parameter is IToolboxItem item))
     {
         return;
     }
     if (ToolboxUserDialogs.AskUserForRemove(item) == MessageBoxResult.OK)
     {
         item.Parent?.RemoveItem(item);
     }
 }
Exemple #3
0
        protected override void OnExecute(object parameter)
        {
            if (!(_toolbox.SelectedNode is IToolboxItem item))
            {
                return;
            }

            IDataObject dataObject;

            if (item.DataSource.Data.Format == DataFormats.Text)
            {
                dataObject = new DataObject(DataFormats.Text, item.DataSource.Data.Data);
            }
            else
            {
                var dataSource = new ToolboxItemDefinition(item.DataSource);
                if (!IsSerializable(dataSource))
                {
                    return;
                }
                dataObject = new DataObject(ToolboxItemDataFormats.DataSource, dataSource);
            }
            Clipboard.SetDataObject(dataObject, true);

            if ((bool)parameter)
            {
                var result = ToolboxUserDialogs.AskUserForRemove(item);
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                var category = item.Parent;
                category.Items.Remove(item);
                _toolbox.SelectedNode = category;
            }
        }