using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
+using Tizen.Applications;
namespace Tizen.Network.Connection
{
private Interop.ConnectionProfile.ProfileStateChangedCallback _profileChangedCallback;
+ private TizenSynchronizationContext context = new TizenSynchronizationContext();
+
internal IntPtr GetHandle()
{
return ProfileHandle;
add
{
Log.Debug(Globals.LogTag, "ProfileStateChanged add");
- if (_ProfileStateChanged == null)
+ context.Post((x) =>
{
- ProfileStateChangedStart();
- }
- _ProfileStateChanged += value;
+ if (_ProfileStateChanged == null)
+ {
+ ProfileStateChangedStart();
+ }
+ _ProfileStateChanged += value;
+ }, null);
}
remove
{
Log.Debug(Globals.LogTag, "ProfileStateChanged remove");
- _ProfileStateChanged -= value;
- if (_ProfileStateChanged == null)
+ context.Post((x) =>
{
- ProfileStateChangedStop();
- }
+ _ProfileStateChanged -= value;
+ if (_ProfileStateChanged == null)
+ {
+ ProfileStateChangedStop();
+ }
+ }, null);
}
}
{
_profileChangedCallback = (ProfileState state, IntPtr userData) =>
{
+ Log.Info(Globals.LogTag, "***** MOON ProfileStateChanged occur");
if (_ProfileStateChanged != null)
{
_ProfileStateChanged(null, new ProfileStateEventArgs(state));
IPv6 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.IPv6);
}
+ /// <summary>
+ /// Destroy the ConnectionProfile object
+ /// </summary>
~ConnectionProfile()
{
Dispose(false);
if (disposed)
return;
- if (disposing)
- {
- // Free managed objects.
- UnregisterEvents();
- Destroy();
- }
+ // Free unmanaged objects
+ UnregisterEvents();
+ Destroy();
disposed = true;
}