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 »

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: 2038
Joined: Wed Oct 06, 2004 10:52 am
Location: San Marcos, CA

Post by Roger Rines »

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 »

- -
Last edited by Bernd on Sat Apr 19, 2008 7:42 am, edited 2 times in total.
Roger Rines
Roundtable Knight
Roundtable Knight
Posts: 2038
Joined: Wed Oct 06, 2004 10:52 am
Location: San Marcos, CA

Re: CSI UA API and C#

Post by Roger Rines »

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 »

- -
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 »

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 »

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 »

- -
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 »

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 »

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 »

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