示例#1
0
        /// <summary>
        /// Execute the command
        /// </summary>
        public void Exec()
        {
            CandleModel system = _shape.ModelElement as CandleModel;

            // Si la commande a été lancé sur le composant, on référence le modèle
            if (system == null)
            {
                BinaryComponent component = _shape.ModelElement as BinaryComponent;
                if (component != null)
                {
                    system = component.Model;
                }
            }

            // Peut etre à null si le composant n'est pas de type Binary
            if (system != null)
            {
                // Affiche la fenetre de dialogue permettant de choisir les assemblies
                IAssemblySelectorDialog selector = ServiceLocator.Instance.GetService <IAssemblySelectorDialog>();
                if (selector.ShowDialog(0))
                {
                    ImportAssemblies(system, selector.SelectedAssemblies);

                    // On arrange les shapes du composant
                    IList <PresentationElement> componentShapes = PresentationViewsSubject.GetPresentation(system.Component);
                    ArrangeShapesCommand        cmd             = new ArrangeShapesCommand((NodeShape)componentShapes[0]);
                    cmd.Exec();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Execute the command
        /// </summary>
        public void Exec()
        {
            if (_layer == null)
            {
                return;
            }

            ReverseModelsForm form = new ReverseModelsForm(delegate(Type type) { return(type.IsInterface && type.IsPublic); });

            Project prj = ServiceLocator.Instance.ShellHelper.FindProjectByName(_layer.Name);

            if (prj != null)
            {
                try
                {
                    // TODO prendre la valeur dans la config du projet
                    string path = String.Format(@"{0}\bin\debug\{1}", Path.GetDirectoryName(prj.FileName), prj.Properties.Item("AssemblyName").Value);
                    form.Init(path);
                }
                catch { }
            }

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            ReverseInterfaces action = new ReverseInterfaces(_layer);

            action.AddAssembly(form.FullPath, form.SelectedClasses);

            ArrangeShapesCommand command = new ArrangeShapesCommand(_shape);

            if (command.Visible())
            {
                command.Exec();
            }
        }