CSI UA API and C#

Use this forum to discuss data providers like CSI, charting, or other non testing software.
Post Reply
jungle
Full Member
Full Member
Posts: 20
Joined: Tue Mar 25, 2008 3:31 pm

CSI UA API and C#

Post by jungle » Thu Mar 27, 2008 6:50 am

is it possible to write to the api using C#? api support is somewhat lacking, which is why i'm posting this here.

there is some demo code included as part of the UA download, but the examples are in VBA or C++.

[edit: i know you could probably create a wrapper class for the C++ code but i'd rather not.]

Roger Rines
Roundtable Knight
Roundtable Knight
Posts: 1946
Joined: Wed Oct 06, 2004 10:52 am
Location: San Jose, CA

Post by Roger Rines » Thu Mar 27, 2008 9:04 am

CSI API uses a COM interface. C# should support that without too much of an effort.

Bernd
Roundtable Knight
Roundtable Knight
Posts: 126
Joined: Wed Apr 30, 2003 6:39 am

Post by Bernd » Thu Mar 27, 2008 9:19 am

- -
Last edited by Bernd on Sat Apr 19, 2008 7:42 am, edited 2 times in total.

Roger Rines
Roundtable Knight
Roundtable Knight
Posts: 1946
Joined: Wed Oct 06, 2004 10:52 am
Location: San Jose, CA

Re: CSI UA API and C#

Post by Roger Rines » Thu Mar 27, 2008 9:30 am

Bernd wrote:
is it possible to write to the api using C#?
Yes.
Direct Access requires the use of the ATL interface. Much more work than is necessary given the built-in support C# has for COM.

Bernd
Roundtable Knight
Roundtable Knight
Posts: 126
Joined: Wed Apr 30, 2003 6:39 am

Post by Bernd » Thu Mar 27, 2008 2:14 pm

- -
Last edited by Bernd on Sat Apr 19, 2008 7:42 am, edited 2 times in total.

jungle
Full Member
Full Member
Posts: 20
Joined: Tue Mar 25, 2008 3:31 pm

Post by jungle » Wed Apr 02, 2008 6:39 am

Thanks for the responses. Writing to the API is straightforward, even if the documentation/support are somewhat lacking.

jungle
Full Member
Full Member
Posts: 20
Joined: Tue Mar 25, 2008 3:31 pm

Post by jungle » Mon Apr 07, 2008 4:59 am

When finished with the UA API, is there a method to dispose of the object? I asked CSI and their response was uaApi2 delete; (where uaApi2 is API2Class object), but that results in an error.

Bernd
Roundtable Knight
Roundtable Knight
Posts: 126
Joined: Wed Apr 30, 2003 6:39 am

Post by Bernd » Mon Apr 07, 2008 5:32 am

- -
Last edited by Bernd on Sat Apr 19, 2008 7:43 am, edited 2 times in total.

jungle
Full Member
Full Member
Posts: 20
Joined: Tue Mar 25, 2008 3:31 pm

Post by jungle » Mon Apr 07, 2008 5:40 pm

Thanks Bernd. My (limited) understanding is that it's good practice to dispose of objects, in spite of the garbage collection --- this seems to be why using{...} is recommended, as it implicitly calls .dispose(). But I'm a n00b to C# and am very happy to be corrected by those more knowledgeable!

jungle
Full Member
Full Member
Posts: 20
Joined: Tue Mar 25, 2008 3:31 pm

Post by jungle » Wed Apr 09, 2008 7:10 am

I spoke to an experienced C# programmer, who said that it's not necessary to use .Close() or .Dispose(). I live and learn...

jungle
Full Member
Full Member
Posts: 20
Joined: Tue Mar 25, 2008 3:31 pm

Post by jungle » Mon Apr 14, 2008 9:18 am

Is there a way to avoid downloading cash data? I have set uaApi2.FillInCashPrice = 0; but the cash data still downloads. The API documentation (such as it is) says "non-zero is true", so I don't think the issue is '0' rather than 'false'.

EDIT: To skip cash data, you'll need something like if(CSIdeliveryCode != 54){ ... }.

Post Reply