Ejemplo n.º 1
0
        /// <summary>
        /// Coroutine, which unloads profile after a period of time
        /// </summary>
        /// <param name="username"></param>
        /// <param name="delay"></param>
        /// <returns></returns>
        private async void UnloadProfile(string username, float delay)
        {
            // Wait for the delay
            await Task.Delay(TimeSpan.FromSeconds(delay));

            // If user is not actually logged in, remove the profile
            if (_auth.IsUserLoggedIn(username))
            {
                return;
            }

            ObservableServerProfile profile;

            profiles.TryGetValue(username, out profile);

            if (profile == null)
            {
                return;
            }

            // Remove profile
            profiles.Remove(username);

            // Remove listeners
            profile.ModifiedInServer -= OnProfileChanged;
        }