Exemplo n.º 1
0
        /// <summary>
        /// Copy command can execute.
        /// </summary>
        private bool CopyAllTreeCommand_CanExecute()
        {
            Collection <ModelElement> modelElements = new Collection <ModelElement>();

            if (this.SelectedItem is ModelTreeViewModel)
            {
                foreach (BaseModelElementViewModel vm in this.ModelTreeViewModel.SelectedItems)
                {
                    if (vm.GetHostedElement() == null)
                    {
                        continue;
                    }

                    if (!(vm.GetHostedElement() is DomainClass))
                    {
                        continue;
                    }

                    modelElements.Add(vm.GetHostedElement());
                }
            }

            if (modelElements.Count == 1)
            {
                if (CopyAndPasteOperations.CanExecuteCopy(modelElements))
                {
                    modelElements.Clear();
                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        /// Copy command can execute.
        /// </summary>
        public virtual bool OnCopyCommandCanExecute()
        {
            if (!this.IsDomainModel)
            {
                Collection <ModelElement> modelElements = new Collection <ModelElement>();
                modelElements.Add(this.Element);

                return(CopyAndPasteOperations.CanExecuteCopy(modelElements));
            }

            return(false);
        }