1 Reply Latest reply on Aug 15, 2018 5:00 PM by Parker Roach-Reasor

    C# menu command/hook can't capture all files

    Parker Roach-Reasor

      Good evening,

       

      I have an add-in that was designed in visual basics and we are transitioning over to C# for functionality purposes. This issue is that I'm having trouble translating some of the functionality over since some of the documentation doesn't seem to match up. I'll give an example of how I accomplished this and how its not working in the C#.

      Thank in advance,

       

      Visual Basics(working)

      Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As System.Array) Implements IEdmAddIn5.OnCmd

           for a = 0 to ppoDataCount

                filename = ppoData(a) // I can use the ppoData aray to get all values

                ...

                ...

       

       

      C#(not working)

      public void OnCmd(ref EdmCmd poCmd, ref Array ppoData)
              {
                //can't parse through the ppodata as an array here
                temp = ((EdmCmdData)ppoData.GetValue(0)).mbsStrData2.ToString(); //this is how values have to be pulled
                temp = "target workflow state
      
      
      
      

       

      My issue is that I can't loop through ppoData and don't know how to loop through all selected files. I can only get the first one

        • Re: C# menu command/hook can't capture all files
          Parker Roach-Reasor

          Alright I got it finally here's how I'm doing it:

           

          public void OnCmd(ref EdmCmd poCmd, ref Array ppoData) 
          { 
                    ppoDataCount = ppodata.Length
                    for(int i = 0; i < ppoDataCount: i++)
                    {
                        temp = ((EdmCmdData)ppoData.GetValue(i)).mbsStrData2.ToString(); //GetValue(i) "i" used to select values within ppodata
                        Console.WriteLine(temp);
                    }
          
          }