thanks for your interest in iMON Display API Wrapper#. Here is a simple code snippet to get started (I have not tested this exact code I just copy/pasted the import parts here):
iMonWrapperApi imon = new iMonWrapperApi();
imon.StateChanged += wrapperApi_StateChanged;
imon.Error += wrapperApi_Error;
imon.Log += wrapperApi_Log;
imon.LogError += wrapperApi_LogError;
imon.Initialize();
// do something until you get the StateChanged event
// do something with the display
imon.Uninitialize();
This was the setup. It is important to remember that Initialize() and Uninitialize() do not return whether the display has been initialized or not because that happens asynchronously. You'll have to wait for the StateChanged event which will tell you if the display has been initialized or not. The Error event will let you know about any errors that occur (during any call to the wrapper). The Log and LogError are simply for debug purposes if you get an error and would like to know more about it.
Your event handlers would look something like this:
private void wrapperApi_StateChanged(object sender, iMonStateChangedEventArgs e)
{
if (e.IsInitialized)
{
// now you can use the display but check iMonWrapperApi.DisplayType to see what display type you have available
}
else
{
// now the display is uninitialized and you can't use it anymore
}
}
private void wrapperApi_Error(object sender, iMonErrorEventArgs e)
{
// check e.Type to find out what kind of error occured
}
If you want to see more you can look into the code of my project "XBMC on iMON Display" here on sourceforge as well.
I'm happy to answer further questions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks so much for helping! What using statement do I need to add in my class? ex(using iMonDisplayApiSharp or iMonDisplayApiWrapperSharp) I am not sure which dll I need to reference.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should reference the iMonDisplayApiSharp and iMonDisplayApiWrapperSharp dlls in your Visual Studio project.
The only using statement you need should be
using iMon.DisplayApi;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am not a seasoned programmer and wondered if someone could explain very very briefly how to implement this api wrapper in a VS project.
Hey
thanks for your interest in iMON Display API Wrapper#. Here is a simple code snippet to get started (I have not tested this exact code I just copy/pasted the import parts here):
This was the setup. It is important to remember that Initialize() and Uninitialize() do not return whether the display has been initialized or not because that happens asynchronously. You'll have to wait for the StateChanged event which will tell you if the display has been initialized or not. The Error event will let you know about any errors that occur (during any call to the wrapper). The Log and LogError are simply for debug purposes if you get an error and would like to know more about it.
Your event handlers would look something like this:
If you want to see more you can look into the code of my project "XBMC on iMON Display" here on sourceforge as well.
I'm happy to answer further questions.
Thanks so much for helping! What using statement do I need to add in my class? ex(using iMonDisplayApiSharp or iMonDisplayApiWrapperSharp) I am not sure which dll I need to reference.
You should reference the iMonDisplayApiSharp and iMonDisplayApiWrapperSharp dlls in your Visual Studio project.
The only using statement you need should be