public AssociationDisplayOptions(Shape shape)
 {
     //try
     {
         InitializeComponent();
         if (shape != null)
         {
             m_shape = new VisioClass(shape);
             SetCheckBoxFromShape(DisplayName, shape, "HideText");
             SetCheckBoxFromShape(DisplayEnd1Name, m_shape["end1_name"], "HideText");
             SetCheckBoxFromShape(DisplayEnd2Name, m_shape["end2_name"], "HideText");
             SetCheckBoxFromShape(DisplayEnd1MP, m_shape["end1_mp"], "HideText");
             SetCheckBoxFromShape(DisplayEnd2MP, m_shape["end2_mp"], "HideText");
             if (VisioHelpers.GetShapeType(shape) == Constants.Composition)
             {
                 DisplayArrows.Enabled = false;
             }
             else
             {
                 DisplayArrows.Enabled = true;
                 SetArrowCheckBoxFromShape(DisplayArrows, m_shape.Shape, "BeginArrow");
             }
         }
     }
     //catch (Exception e)
     //{
     //    Debug.WriteLine(e.Message + "Possible cause: Shape or child shape doesn't have user.type cell");
     //}
 }
示例#2
0
文件: DslSync.cs 项目: Obles/vwdaddin
        private static void FixRoles(VisioConnector Connector, DomainRelationship Relationship)
        {
            String SourceName = new VisioClass(Connector.Source).Name;
            String TargetName = new VisioClass(Connector.Target).Name;

            //if (Relationship.Source.RolePlayer == SourceName &&
            //    Relationship.Target.RolePlayer == TargetName) return;

            String SourceText = Connector.SourceText == String.Empty ? SourceName : Connector.SourceText;
            String TargetText = Connector.TargetText == String.Empty ? TargetName : Connector.TargetText;

            DomainRole source = Relationship.Source;
            source.SetAttribute("Name", "s" + SourceName + "Name");
            source.SetAttribute("DisplayName", SourceText);
            source.SetAttribute("PropertyName", "s" + TargetName + "Prop");
            source.SetAttribute("PropertyDisplayName", TargetText);
            source.Multiplicity = MultiplicityHelper.Compatible(Connector.SourceMultiplicity);

            DomainRole target = Relationship.Target;
            target.SetAttribute("Name", "t" + TargetName + "Name");
            target.SetAttribute("DisplayName", TargetText);
            target.SetAttribute("PropertyName", "t" + SourceName + "Prop");
            target.SetAttribute("PropertyDisplayName", SourceText);
            target.Multiplicity = MultiplicityHelper.Compatible(Connector.TargetMultiplicity);
        }
示例#3
0
 private static bool ExistsSame(VisioPage Page, VisioClass VisioClass, String Name)
 {
     foreach (VisioClass vc in Page.Classes)
     {
         if (!VisioClass.Equals(vc) && vc.Name == Name)
         {
             return true;
         }
     }
     return false;
 }
示例#4
0
        public static String UniqueName(VisioPage Page, VisioClass VisioClass)
        {
            String Name = VisioClass.Name;
            Regex regex = new Regex(@"^(.*?)([0-9]+)$");
            Match m = regex.Match(Name);
            String BaseName = m.Success ? m.Groups[1].Value : Name;
            int index = m.Success ? int.Parse(m.Groups[2].Value) : 1;

            while (ExistsSame(Page, VisioClass, Name))
            {
                Name = BaseName + (++index);
            }

            Trace.WriteLine(Name);
            return Name;
        }
示例#5
0
 public ClassProperties(Shape shape)
 {
     InitializeComponent();
     //try
     {
         m_shape = new VisioClass(shape);
         colorBox.BackColor = m_shape.Color;
         ClassNameTextBox.Text = m_shape["class_name"].Text;
         ClassDSLNameTextBox.Text = m_shape.Name;
         m_attributes = m_shape["attr_section"].Text.Split(new Char[] { '\n' });
         AttrListBox.Items.Clear();
         foreach (string attribute in m_attributes)
         {
             if (!attribute.Equals(string.Empty))
                 AttrListBox.Items.Add(attribute);
         }
         DSLRootClass.Checked = m_shape.IsRootClass;
     }
     //catch (Exception e)
     //{
     //    Debug.WriteLine(e.Message + "Possible cause: Shape or child shape doesn't have user.type cell");
     //}
 }
示例#6
0
文件: DslSync.cs 项目: Obles/vwdaddin
        private void SynchronizeProperties(DomainRelationship dr, VisioClass vc)
        {
            // Приводим в порядок атрибуты
            String attrstr = "\n";
            String[] attrs = vc.Attributes.Split('\n');
            for (int i = 0; i < attrs.Length; i++)
            {
                attrs[i] = attrs[i].Trim();
                attrstr += attrs[i] + "\n";
            }

            // Добавляем новые свойства
            foreach (String attr in attrs)
            {
                if (attr.Length == 0) continue;
                if (dr.Properties[attr].Xml == null)
                {
                    dr.CreateProperty("/System/String", attr, attr);
                }
            }

            // Удаляем ненужные свойства
            for (int i = 0; i < dr.Properties.Count; i++)
            {
                DomainProperty prop = dr.Properties[i] as DomainProperty;
                if (!attrstr.Contains("\n" + prop.Xml.GetAttribute("Name") + "\n"))
                {
                    dr.Properties.RemoveLinked(prop);
                    i--;
                }
            }
        }
示例#7
0
        private void SynchronizeClasses(List<DomainClass> implementationOnlyClasses)
        {
            Trace.WriteLine("Synchronizing Classes");
            Trace.Indent();
            foreach (DomainClass dc in Doc.Dsl.Classes)
            {
                if (!implementationOnlyClasses.Contains(dc))
                {
                    Shape shape = Page.Find(dc.GUID);
                    VisioClass vc = new VisioClass(shape == null ? VisioMaster.Drop(Page.Document, "Class") : shape);
                    vc.GUID = dc.GUID;
                    vc.Name = dc.Xml.GetAttribute("Name");
                    vc.DisplayName = dc.Xml.GetAttribute("DisplayName");
                    String attrs = "";
                    foreach (DomainProperty prop in dc.Properties)
                    {
                        attrs += prop.Xml.GetAttribute("Name") + "\n";
                    }
                    vc.Attributes = attrs.Trim();
                }
            }
            foreach (DomainClass dc in Doc.Dsl.Classes)
            {
                if (!implementationOnlyClasses.Contains(dc))
                {
                    if (dc.BaseClass != null)
                    {
                        Shape vc = Page.Find(dc.GUID);
                        Shape bc = Page.Find(Doc.Dsl.Classes[dc.BaseClass].GUID);

                        VisioList<VisioConnector> connectors = new VisioList<VisioConnector>(
                            Page.Shapes,
                            delegate(Shape shape)
                            {
                                VisioConnector conn = new VisioConnector(shape);
                                return conn.Source == vc && conn.Target == bc;
                            }
                        );
                        if (connectors.Count == 0)
                        {
                            VisioMaster.DropConnection(vc, bc, Constants.Generalization);
                        }
                    }
                }
            }
            Trace.Unindent();
        }
示例#8
0
 public ClassAction(VisioClass targetShape)
 {
     ClassShape = targetShape.ToStaticClass();
 }
示例#9
0
 public ClassDeleted(VisioClass targetShape)
     : base(targetShape)
 {
 }