Esempio n. 1
0
        private static void EndSessionRequest()
        {
            var req = new EndSessionRequest();

            req.Send(r =>
            {
                if (r.HasErrors)
                {
                    Console.WriteLine("EndSessionError: {0}", r.JSONString);
                }
                else
                {
                    Console.WriteLine("EndSessionRequest Successful");
                }
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Shutdown and call the onDone callback when the shutdown is complete.
        /// </summary>
        public void ShutDown(System.Action onDone)
        {
            if (Instances.Values.Contains(this))
            {
                Instances.Remove(Name);
            }

            if (GSPlatform == null)
            {
                // If no platform is set, then we were never initialised. We can just return here.
                return;
            }
            // we don't care about the response but to clean up properly we wait for it.
            EndSessionRequest r = new EndSessionRequest(this);

            r.Send((response) =>
            {
                if (_mainLoopTimer != null)
                {
                    _mainLoopTimer.Stop();
                    _mainLoopTimer = null;
                }

                if (_durableWriteTimer != null)
                {
                    _durableWriteTimer.Stop();
                    _durableWriteTimer = null;
                }

                _paused = true;

                Stop(true);

                if (onDone != null)
                {
                    onDone();
                }
            });

            if (Instances.ContainsKey(Name))
            {
                Instances.Remove(Name);
            }
        }