Exemple #1
0
        /// <summary>
        /// Adds Component to Danu. Adds its name and all its interfaces if they are not present.
        /// </summary>
        public void AddComponent(Component component)
        {
            DanuComponent newComponent = new DanuComponent(component.Name);

            components.Add(newComponent.Name, newComponent);

            foreach (InterfaceObject io in component.Interfaces)
            {
                if (!interfaces.ContainsKey(io.Name))
                {
                    AddInterface(io);
                }

                newComponent.Interfaces.Add(interfaces[io.Name]);
            }

            EshuClass     mainClass = new EshuClass(component.Name);
            EshuComponent comp      = new EshuComponent(component.Name);

            foreach (DanuInterfaceObject io in newComponent.Interfaces)
            {
                if (io.Eshu == null)
                {
                    EshuInterface newIo = new EshuInterface(io.Name);
                    io.Eshu = newIo;
                }
                mainClass.AddInterface(io.Eshu);
                mainClass.Parent = comp;
                comp.Interfaces.Add(io.Eshu);
                io.Eshu.Parent = mainClass;
            }

            comp.Classes.Add(mainClass);
            newComponent.Specification = comp;
        }
Exemple #2
0
        private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.InterfaceObject.Name = this.textBoxInterfaceName.Text;
                EshuInterface eshuInterface = this.InterfaceObject.Eshu;
                eshuInterface.ClearMethods();

                foreach (MethodEditor methodEditor in this.stackPanelMethodEditor.Children.OfType <MethodEditor>())
                {
                    EshuMethod eshuMethod = methodEditor.GetEshuMethod();
                    eshuInterface.AddMethod(eshuMethod);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "PlugSPL Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }