Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jafuentes

Pages: [1]
1
I've solved!

Code: [Select]
Diagram currentDiagram = r.GetCurrentDiagram();

r.ReloadDiagram(currentDiagram.DiagramID);

Where r is a Repository.

Bye.

2
I have hidden the items now. I remove the diagramObject to achieve this and if I want to show the items, I add the diagramObject again.

The problem now is that when I delete a diagramObject, the diagram does not refresh automatically. I need to close the diagram and reopen it. Is there a method to update the diagram?

Thanks.

3
Hello,

I need hide elements of a diagram. For example, in a diagram there are many classes, stereotypes... and I would want to hide classes. I´m using C#.

Is this possible? there is any method associated with the elements to hide these items?

Thanks. Bye

4
Automation Interface, Add-Ins and Tools / Serialize Repository using C#
« on: October 26, 2010, 02:50:33 am »
Hello,

I´ve following problem. I´ve a model that i need to serialize. I´m using EA8 and VS2010/C#. In an Addin, i call the method SerializeObject:

Code: [Select]
private String UTF8ByteArrayToString(Byte[] characters)
{
    UTF8Encoding encoding = new UTF8Encoding();
    String constructedString = encoding.GetString(characters);
    return (constructedString);
}

private Byte[] StringToUTF8ByteArray(String pXmlString)
{
   UTF8Encoding encoding = new UTF8Encoding();
   Byte[] byteArray = encoding.GetBytes(pXmlString);
   return byteArray;
}

public String SerializeObject(Repository rep)
{
 try{
      String XmlizedString = null;
      MemoryStream memoryStream = new MemoryStream();
      XmlSerializer xs = new XmlSerializer(typeof(rep.GetType()));
      XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);

      xs.Serialize(xmlTextWriter, rep);
      memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
      XmlizedString = UTF8ByteArrayToString(memoryStream.ToArray());
      return XmlizedString;
  }
  catch (Exception e){
      System.Console.WriteLine(e);
      return null;
  }
}

when executed this line:

Code: [Select]
XmlSerializer xs = new XmlSerializer(rep.GetType());

And exception ocurrs. The error is:

Code: [Select]
$exception      {"Unable to generate a temporary class (result=1).\r\nerror CS0122: 'System.__ComObject' is inaccessible due to its protection level\r\nerror CS0051: Inconsistent accessibility: parameter type 'System.__ComObject' is less accessible than method 'Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter__ComObject.Write3___ComObject(string, string, System.__ComObject, bool, bool)'\r\nerror CS0122: 'System.__ComObject' is inaccessible due to its protection level\r\nerror CS0050: Inconsistent accessibility: return type 'System.__ComObject' is less accessible than method 'Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader__ComObject.Read3___ComObject(bool, bool)'\r\n"}      System.Exception {System.InvalidOperationException}

How I can serialize rep?

Thanks. Regards

Pages: [1]