Topic
  • 3 replies
  • Latest Post - ‏2011-10-26T07:39:03Z by Kinguli
SystemAdmin
SystemAdmin
741 Posts

Pinned topic RPX and C#

‏2003-11-20T23:23:59Z |
Does anybode succeed to build utilities using RPX and C# or VB.NET language.
I tried to do it and I met a problem to initialize GUIApp object
Updated on 2011-10-26T07:39:03Z at 2011-10-26T07:39:03Z by Kinguli
  • SystemAdmin
    SystemAdmin
    741 Posts

    re: RPX and C#

    ‏2003-12-01T23:46:43Z  
    Eugene,

    Here is an example using late binding:

    Mark
    //------------------------------------------------
    using System;
    using System.Reflection;
    using ReqPro40;
    using RqCallback;

    class GuiWrapper
    {
    private Callback m_oCallback;

    public void OpenProject()
    {

    //get interface
    Type objAddType = Type.GetTypeFromProgID("ReqPro40.GUIApp");

    //create instance
    object objAdd = Activator.CreateInstance(objAddType);

    //add all the args to an array
    m_oCallback = new CallbackClass();

    object[] myArguments = {"C:\\program files\\rational\\requisitepro\\samples\\Learning_Project-Traditional\\LEARNING - TRADITIONAL.rqs",
    ReqPro40.enumOpenProjectOptions.eOpenProjOpt_RQSFile,
    "admin",
    "",
    ReqPro40.enumProjectFlags.eProjFlag_Normal,
    m_oCallback};

    //invoke method
    object c = objAddType.InvokeMember("OpenProject", BindingFlags.InvokeMethod, null, objAdd, myArguments);

    while (!m_oCallback.IsDone())
    {
    Console.Write(".");
    }

    Console.WriteLine(c);
    }
    }

    Eugene Sherman wrote on Nov 20, 2003 - 02:23 PM ET
    >> Does anybode succeed to build utilities using RPX and C# or VB.NET language.
    >> I tried to do it and I met a problem to initialize GUIApp object
  • SystemAdmin
    SystemAdmin
    741 Posts

    re: RPX and C#

    ‏2003-12-05T18:23:07Z  
    Hi Eugene,

    RPX Gui has not implemented the interface distributed by Rational. The only way to make calls to the RPX Gui is to make late-bound calls - hence the example. The non-gui RPX can be early-bound by referencing the assembly.

    Tips:
    1. Remember to call Marshal.ReleaseComObject to release references to your COM instances returned by the app.
    2. It is easier to get a running instance of the ReqPro application, than creating a new instance (does not always work). A running instance is accessed using the Activator.GetObject
    3. Add this attribute to your callback class to allow it to be called by ReqPro http://ClassInterface(ClassInterfaceType.None)
    4. If you repeatedly send commands to the RPX at too high a call rate, I find the RPX will occasionally throw an unknown error. If you back off for a moment and try the call again, it generally will be successful.

    Hope that helps.

    Thanks,
    B.
  • Kinguli
    Kinguli
    1 Post

    Re: re: RPX and C#

    ‏2011-10-26T07:39:03Z  
    Hi Eugene,

    RPX Gui has not implemented the interface distributed by Rational. The only way to make calls to the RPX Gui is to make late-bound calls - hence the example. The non-gui RPX can be early-bound by referencing the assembly.

    Tips:
    1. Remember to call Marshal.ReleaseComObject to release references to your COM instances returned by the app.
    2. It is easier to get a running instance of the ReqPro application, than creating a new instance (does not always work). A running instance is accessed using the Activator.GetObject
    3. Add this attribute to your callback class to allow it to be called by ReqPro http://ClassInterface(ClassInterfaceType.None)
    4. If you repeatedly send commands to the RPX at too high a call rate, I find the RPX will occasionally throw an unknown error. If you back off for a moment and try the call again, it generally will be successful.

    Hope that helps.

    Thanks,
    B.
    Hello,
    I am really in need of to complete a task which is retrieving requirements and their properties from ReqPro to C# program! I am done with the C# classes which has to do the other works.
    I only have problem with related C# class to reqpro which I can not get any result.

    If you can kindly help me I will really appreciate.

    Here is my Mail add: behrooz.09@gmail.com

    BR,
    Behrooz.