TFS Get Latest Code - GettingEventArgs properties

2019-09-08 07:03发布

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.

Properties in quickwatch

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

1条回答
Luminary・发光体
2楼-- · 2019-09-08 07:55

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

OperationStatus status = e.Status;
查看更多
登录 后发表回答