xyzt
Posts: 11
Joined: Sun Feb 26, 2006 1:14 pm
Location: Turkey

Casting from ObexEventArgs to ObexCopyEventArgs..?

Tue Apr 04, 2006 8:20 pm

Hello,
In my m_objectPush_DisconnectEnd function, converting from ObexEventArgs to ObexCopyEventArgs, I receive an error at runtime. The error is :
"Unable to cast object of type 'Franson.Protocols.Obex.ObexEventArgs' to type 'Franson.Protocols.Obex.ObexCopyEventArgs'."

Code: Select all

private void m_objectPush_DisconnectEnd(object sender,ObexEventArgs e)
{
      if (m_streamCurrent != null)
      {
          m_streamCurrent.Close();
      }
      if (!m_flag_vcardfile_send_start)
      {
          Yolla(ayarlar.KampanyaDosyasi);
          m_flag_vcardfile_send_start = true;
          return;
      }
      else
      {
Error---> ObexCopyEventArgs copyArgs = (ObexCopyEventArgs)e;
          if (copyArgs != null)
              copyArgs.Stream.Close();
          m_flag_vcardfile_send_start = false;
          RemoveTheFirst();
          FindServices();
      }
}
Why can not it be converted? The documentation says:

"public class ObexCopyEventArgs : ObexEventArgs" so it could be casted..

May you help me pls?

Thank you very much...

Never say never

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: Casting from ObexEventArgs to ObexCopyEventArgs..?

Tue Apr 04, 2006 9:45 pm

DisconnectEnd does not offer any ObexCopyEventArgs. That sort of argument is only available for PutFile- and GetFile type of events.

The Stream you attempt to close is the Stream used for either writing or reading; the one specified in either PutFile or GetFile.


Regards,
Jonas
Franson Support

Return to “BlueTools”