예제 #1
0
 public override void Execute(CommandParameter parameter, IInputElement target)
 {
     //var divisibleArea = GlobalApplicationViewModel.GetApplicationViewModel.CurrentlyDisplayedFile.
     //                        CurrentlySelectedComponent as IDivisible;
     //if (divisibleArea == null) return;
     //divisibleArea.AddDivision((DivisionType)parameter);
     //base.Execute(parameter, target);
 }
예제 #2
0
        /// <summary>
        /// Executes the <see cref="T:System.Windows.Input.RoutedCommand"/> on the current command target.
        /// Save the parameters (parameter and target) in a CommandGeneric instance and then save the instance in the command history that handle this file
        /// </summary>
        /// <param name="parameter">User defined parameter to be passed to the handler have to be a <see cref="CommandParameter"/>.</param>
        /// <param name="target">Element at which to being looking for command handlers.</param>
        /// <exception cref="T:System.InvalidOperationException">
        ///   <paramref name="target"/> is not a <see cref="T:System.Windows.UIElement"/> or <see cref="T:System.Windows.ContentElement"/>.</exception>
        ///   
        /// <exception cref="ArgumentNullException">if parameter is null</exception>
        public override void Execute(CommandParameter parameter, IInputElement target)
        {
            _newShape = parameter.Parameter as ShapeViewModel;

            if (_newShape == null)
                throw new ArgumentNullException("parameter");


            _oldShape = parameter.FileTargeted.RootCoatOfArm.CurrentShape;

            parameter.FileTargeted.RootCoatOfArm.CurrentShape = _newShape;

            Description = String.Format(CultureInfo.CurrentCulture,
                                        Resources.CommandDescChangeShape,
                                        _oldShape == null ? BlasonVocabulary.NoShape : _oldShape.LocalizedName,
                                        _newShape.LocalizedName
                );

            //sauvegarde, c'est affreux, je peux pas le faire dans la classe abstraite parceque c'est cette instance que je dois cloner :(
            //copie de code pour tous les execute !!
            Parameter = parameter;
            Done = true;
            parameter.FileTargeted.CommandsApplied.CommandHistory.Add((ChangeShapeCommand)Clone());
        }
예제 #3
0
 /// <summary>
 /// Executes the <see cref="T:System.Windows.Input.RoutedCommand"/> on the current command target.
 /// Save the parameters (parameter and target) in a CommandGeneric instance and then save the instance in the command history that handle this file
 /// </summary>
 /// <param name="parameter">User defined parameter to be passed to the handler.</param>
 /// <param name="target">Element at which to being looking for command handlers.</param>
 /// <exception cref="T:System.InvalidOperationException">
 ///   <paramref name="target"/> is not a <see cref="T:System.Windows.UIElement"/> or <see cref="T:System.Windows.ContentElement"/>.</exception>
 public abstract void Execute(CommandParameter parameter, IInputElement target);