TFS Get Latest Code - GettingEventArgs properties 'Total' and 'Current' not visible

半世苍凉 提交于 2019-12-13 04:39:25

问题


I have written code to get latest from TFS using the client APIs. I would like to be updated on the progress and I understand that the properties "Total" and "Current" of GettingEventArgs can be used. But these properties are not visible during design time but only visible at runtime (see image below). But event at runtime, I am unable to fetch them using reflection as give below.

    static void versionControl_Getting(object sender, GettingEventArgs e)
    {
        GettingEventArgs status = (GettingEventArgs)e;

        int curr = (int)status.GetType().GetProperty("Current").GetValue(status, null);
        int tot = (int)status.GetType().GetProperty("Total").GetValue(status, null);
     }

This does not find the property and I get a Null reference on the "GetProperty". I hope the syntax is correct.

Any thoughts on how to get hold of these property values?


回答1:


There is an error in GettingEventArgs status = (GettingEventArgs)e;. You probably ment

OperationStatus status = e.Status;


来源:https://stackoverflow.com/questions/9644994/tfs-get-latest-code-gettingeventargs-properties-total-and-current-not-visi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!