ok so writing API to control image viewing system. We have their API in our program. We pickup all the shared events using register events like
context_server.PasswordChange += ContextServer_PasswordChange;
so now I set the password in my code
connector.ContextServer.password = MCrypto.EncryptPasswordAnsi(password);
which makes us fires the event on our side
void ContextServer_PasswordChange(string Password_string)
so now.. I initiated that call... so when we do that.. the other system changes the password on its side and we see that call happen again...as a response... so right now I have a variable saying WeInitiated=true right before I call some code that will fire each registered event and when it happens I set it to false.. so then when they call I know they initiated it. so looks like this
void ContextServer_PasswordChange(string Password_string)
{
String fn = "ContextServer_PasswordChange: ";
if (WeInitiated)
{
log.Debug(fn + " WeInitiated");
WeInitiated = false;
}
else
{
log.Debug(fn + " They Initiated");
}}
So I'm trying to see if there is a better way to do this.. is there a way to know who initiated the call to the registered event ? FYI.. I'm no pro at registered events.. this is my first time using it..
any insights or tips are appreciated..