Page 1 of 1

CSI UA API and C#

Posted: Thu Mar 27, 2008 6:50 am
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.]

Posted: Thu Mar 27, 2008 9:04 am
by Roger Rines
CSI API uses a COM interface. C# should support that without too much of an effort.

Posted: Thu Mar 27, 2008 9:19 am
by Bernd
- -

Re: CSI UA API and C#

Posted: Thu Mar 27, 2008 9:30 am
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.

Posted: Thu Mar 27, 2008 2:14 pm
by Bernd
- -

Posted: Wed Apr 02, 2008 6:39 am
by jungle
Thanks for the responses. Writing to the API is straightforward, even if the documentation/support are somewhat lacking.

Posted: Mon Apr 07, 2008 4:59 am
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.

Posted: Mon Apr 07, 2008 5:32 am
by Bernd
- -

Posted: Mon Apr 07, 2008 5:40 pm
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!

Posted: Wed Apr 09, 2008 7:10 am
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...

Posted: Mon Apr 14, 2008 9:18 am
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){ ... }.