3 Replies Latest reply on Nov 24, 2016 7:34 PM by Lee CS Young

    Callback Interface for IEdmBatchGet (i.e. IEdmGetOpCallback)

    Greg Thomson

      I've implemented the callback interface IEdmGetOpCallback for the IEdmBatchGet interface and submitting it with my call to IEdmBatchGet.GetFiles().


      All seems to be working well as I get callbacks to ProgressBegin() and ProgressEnd(), but I don't seem to be getting any calls to ProgressStep() ?  I copied the interface specification directly from the interface, so I don't believe I have any syntactical or other errorsin my code.  Its just not getting called?


      I was wondering if anyone else has seen this?  Is this normal behavior?  Should I be using IEdmBatchGet2 or IEdmGetOpCallback2 or 3 instead?


      Any words of wisdom would be appreciated.  PregressStep() is where all the real progress information is fed back to the user.



      EPDM 2016 SP3

        • Re: Callback Interface for IEdmBatchGet (i.e. IEdmGetOpCallback)
          Lee CS Young

          I haven't had any issues using it. I use it quite often to check to see if the user has cancelled the operation. I have it used the callback both with IEdmBatchGet and IEdmBatchGet2.


          Are you setting a breakpoint? Are you attempting to get a relatively large amount of files? Did you clear your cache first?


          Here's an example. There's some bits missing but it should give you an idea on how I implemented it.


          batch.AddSelection((EdmVault5)Globals.Vault, ref fileArray);
            + (int)EdmGetCmdFlags.Egcf_ForPreview 
            + (int)EdmGetCmdFlags.Egcf_RefreshFileListing 
            + (int)EdmGetCmdFlags.Egcf_SkipLockRefFiles);
          callback = new EdmGetOpCallback(filesToRetrieve.Count);
          callback.ProgressEventStep += Callback_ProgressEventStep;
          callback.ProgressRange += Callback_ProgressRange;
          callback.ProgressEnded += Callback_ProgressEnded;                    
          batch.GetFiles(0, callback);


          public class EdmGetOpCallback : IEdmGetOpCallback
            #region IEdmGetOpCallback Members
            public delegate void ProgressRangeEventHandler(object sender, ProgressEventArgs e);
            public event ProgressRangeEventHandler ProgressRange;
            public delegate void ProgressStepEventHandler(object sender, ProgressEventArgs e);
            public event ProgressStepEventHandler ProgressEventStep;
            public delegate void ProgressEndEventHandler(object sender, ProgressEventArgs e);
            public event ProgressEndEventHandler ProgressEnded;
            private ProgressEventArgs m_eventArgs;
            private int m_max;
            public bool ShouldCancel { private get; set; }
            public EdmGetOpCallback(int max)
            this.m_max = max;
            m_eventArgs = new ProgressEventArgs(0);
            public void ProgressBegin(EdmProgressType eType, int lSteps)
            double step = lSteps / this.m_max;
            if (ProgressRange != null)
            m_eventArgs.Value = 0;
            m_eventArgs.Step = (int)Math.Ceiling(step);
            m_eventArgs.Range = lSteps;
            ProgressRange(this, m_eventArgs);
            public void ProgressEnd(EdmProgressType eType)
            if (ProgressEnded != null)
            ProgressEnded(this, new ProgressEventArgs(eType));
            public bool ProgressStep(EdmProgressType eType, string bsMessage, int lProgressPos)
            if (ProgressEventStep != null)                            
            ProgressEventStep(this, new ProgressEventArgs(lProgressPos, bsMessage, eType));
            if (ShouldCancel)
            return false;
            return true;