Any interest in a .NET client for Spark Cloud API?

I’ve got the basic functions working. Read values and execute functions. I’ve used it to make a Tinker client. Works like a charm for all analog and digital pins.

If there’s interest I can separate it from my project solution and put it up on git. Maybe package it up as a nuget package.


As a C# fan myself, I think that’d be cool!

Absolutely. If you want to kick it out on github I am sure some of us would be happy to use ti and possibly extent it a bit.

Absolutely put it on GIthub, i going to make my own later if i dont find any, but we can have it as a open source project for the basic stuff.

Alright. Here goes. Certified Works-On-My-Machine. :slight_smile:

I think I have all the basics covered. Your feedback and pull requests would be appreciated.

I’m not really happy how errors are handled. Thinking of throwing exceptions.

If you want to run the TinkerClient tests, you have to have the Tinker Firmware flashed.


Just realized a decent design flaw in GetVariable vs. ExecuteFunction. Looks like this is going to need dedicated test firmware. I’ll update soon.

Ok. Should be good to go now.
You need to flash the TestFirmware.cpp to run the SparkClientTests.
You need to flash the Tinker app firmware to run the TinkerClientTests.

1 Like

Has anyone tried this with Windows Phone 8.1? I compiled the DLL, tried the same exact code with Windows Desktop app and Windows Phone 8.1. On the Windows app it works great, but from the Windows Phone 8.1 app, I get an error
"An exception of type ‘System.IO.FileNotFoundException’ occurred in SharpSpark.DLL but was not handled in user code"
when calling " var result = CloudPost(functionKey, args);"
any ideas why this might be happening?

I thought maybe it’s an internet connection error, but i check for internet connectivity before calling the function.

Thanks for your help

Wow. Missed this post entirely.
My guess is it’s not built as a portable class library. It’s on my todo list.

Have you had any success since posting this?

It was JSON version problem. I had to write a new code based on the WP8 JSON library.

Hello @kareem613!
Will you please if you can attach a simple example of the library.
For example reading and writing variable and function by using a windows form. So I need a simple example just a few functions.
There are many files I do not know how to incorporate in the project. Which files should should be included in the project? Whether they could make a dll?
I’m emebedded / HW guy :slight_smile:
I do not know much about C #. I’m still a beginner …
I hope you will help me.

can anyone here tell me how to use this or link me to a place that can. I’m in dire need of it currently as windows phone is the only device i can write apps for at the moment.

@MasterVizz & @developer_bt, the library comes with some test programs and nice readme that should get you started quite nicely.
Once you have built and tried these test app, you might be able to ask some more focused questions.
A general “help, I don’t understand” is a bit too foggy to help you in any useful way.

ok, let me rephrase my question, where do i need to copy the files to use them in the app I’m writing, I’m not that familiar with visual studio yet.

I see :eyes:

Usually I’d put the whole project into the VS projects directory and build it once.

When you then write your own program you’d just add a reference to the built DLL and the appropriate using directive to use it in your own code.

well that makes sense, maybe one day i will good at this, thanks for the help. :smiley:

can you possibly post the difference between the version provided and the one you used? ive run into the same error and im not sure what to change.

What’s the error your getting? Did you get as far is compiling? Running the tests?

@ScruffR Thanks for helping out!

@developer_bt @MasterVizz Check out It might already do what you’re looking for. I built it using this .NET library.

1 Like

the error word for word is:

An exception of type’System.IO.FileNotFoundException’ occured in SharpSpark.dll but was not handled in user code

Additional information: Could not load file or assembly ‘System.Core, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’ or one of its dependencies. The system cannot find the file specified.

this error occured when trying to perform this line of code:

var result = CloudPost(functionKey, args);

it should be noted that i am trying to do this in a windows phone 8 app. the error is the same as the one mrabie had above, unfortunately he never explained fully what was needed to be done to fix it.