protected void OnDestroy() { Instance = null; if (this.discoveryClient != null) { discoveryClient.RemoveListener(discoveryClientAdapter); discoveryClient.Dispose(); discoveryClient = null; if (discoveryClientAdapter != null) { discoveryClientAdapter.Dispose(); discoveryClientAdapter = null; } } if (this.sharingMgr != null) { // Force a disconnection so that we can stop and start Unity without connections hanging around this.sharingMgr.GetPairedConnection().Disconnect(); this.sharingMgr.GetServerConnection().Disconnect(); // Release the XTools manager so that it cleans up the C++ copy this.sharingMgr.Dispose(); this.sharingMgr = null; } // Forces a garbage collection to try to clean up any additional reference to SWIG-wrapped objects System.GC.Collect(); }
protected override void OnDestroy() { base.OnDestroy(); if (discoveryClient != null) { discoveryClient.RemoveListener(discoveryClientAdapter); discoveryClient.Dispose(); discoveryClient = null; if (discoveryClientAdapter != null) { discoveryClientAdapter.Dispose(); discoveryClientAdapter = null; } } if (Manager != null) { // Force a disconnection so that we can stop and start Unity without connections hanging around Manager.GetPairedConnection().Disconnect(); Manager.GetServerConnection().Disconnect(); } // Release the Sharing resources if (SessionUsersTracker != null) { SessionUsersTracker.Dispose(); SessionUsersTracker = null; } if (SessionsTracker != null) { SessionsTracker.Dispose(); SessionsTracker = null; } if (networkConnection != null) { networkConnection.RemoveListener((byte)MessageID.StatusOnly, networkConnectionAdapter); networkConnection.Dispose(); networkConnection = null; if (networkConnectionAdapter != null) { networkConnectionAdapter.Dispose(); networkConnectionAdapter = null; } } if (Manager != null) { Manager.Dispose(); Manager = null; } // Forces a garbage collection to try to clean up any additional reference to SWIG-wrapped objects GC.Collect(); }
private void AutoDiscoverInit() { discoveryClientAdapter = new DiscoveryClientAdapter(); discoveryClientAdapter.DiscoveredEvent += OnSystemDiscovered; discoveryClient = DiscoveryClient.Create(); discoveryClient.AddListener(discoveryClientAdapter); //Start Finding Server isTryingToFindServer = true; }
private void AutoDiscoverInit() { if (ShowDetailedLogs) { Debug.Log("Looking for servers..."); } discoveryClientAdapter = new DiscoveryClientAdapter(); discoveryClientAdapter.DiscoveredEvent += OnSystemDiscovered; discoveryClient = DiscoveryClient.Create(); discoveryClient.AddListener(discoveryClientAdapter); //Start Finding Server isTryingToFindServer = true; }
protected override void OnDestroy() { if (discoveryClient != null) { discoveryClient.RemoveListener(discoveryClientAdapter); discoveryClient.Dispose(); discoveryClient = null; if (discoveryClientAdapter != null) { discoveryClientAdapter.Dispose(); discoveryClientAdapter = null; } } if (networkConnection != null) { networkConnection.RemoveListener((byte)MessageID.StatusOnly, networkConnectionAdapter); networkConnection.Dispose(); networkConnection = null; if (networkConnectionAdapter != null) { networkConnectionAdapter.Dispose(); networkConnectionAdapter = null; } } if (sharingMgr != null) { // Force a disconnection so that we can stop and start Unity without connections hanging around sharingMgr.GetPairedConnection().Disconnect(); sharingMgr.GetServerConnection().Disconnect(); // Release the XTools manager so that it cleans up the C++ copy sharingMgr.Dispose(); sharingMgr = null; } // Forces a garbage collection to try to clean up any additional reference to SWIG-wrapped objects GC.Collect(); base.OnDestroy(); }
private readonly int pingRefreshRate = 2; // seconds public AddAppDialog() { InitializeComponent(); listener = new DiscoveryClientAdapter(); listener.DiscoveredEvent += OnSystemDiscovered; listener.LostEvent += OnSystemLost; discoveryClient = DiscoveryClient.Create(); discoveryClient.AddListener(listener); discoveryClient.Ping(); updateTimer = new DispatcherTimer(); updateTimer.Tick += UpdateDiscoveredApps; updateTimer.Interval = new TimeSpan(0, 0, 0, 0, 1000 / 30); // 30 updates per second updateTimer.Start(); refreshTimer = new DispatcherTimer(); refreshTimer.Tick += RefreshPing; refreshTimer.Interval = new TimeSpan(0, 0, 0, pingRefreshRate, 0); refreshTimer.Start(); }