示例#1
0
        /// <summary>
        /// Called to cancel a session.
        /// </summary>
        void CancelSession()
        {
            currentSessionContext.SessionCanceled();
            currentSessionContext = null;

            UpdateStatusFromDevice();
        }
示例#2
0
        /// <summary>
        /// Opens a session.
        /// </summary>
        /// <param name="context">The context.</param>
        public void OpenSession(IStorageSessionContext context)
        {
            if (currentSessionContext != null)
            {
                throw new InvalidOperationException("A storage session is already open for this player.");
            }

            currentSessionContext = context;
            if (Status == StorageProviderStatus.Connected)
            {
                using (var container = device.OpenContainer(titleName))
                {
                    var session = new StorageSession(this, container);
                    context.SessionOpened(session);
                }

                currentSessionContext = null;
            }
            else
            {
                SelectDevice();
            }
        }
示例#3
0
 public void ContainerSessionFinished()
 {
     storageSessionContext = null;
 }
示例#4
0
        void HandleInput()
        {
            if (activeGamePadState.IsButtonDown(Buttons.X) == true)
            {
                if (activeGamePadState.Player.IsSignedIn() == false)
                {
                    Guide.ShowSignIn(1, false);
                }

                statusText.Length = 0;
                statusText.AppendFormat("Creating writing session for {0}...",
                                        activeGamePadState.Player);
                statusText.AppendLine("");

                storageSessionContext = new WritingSessionContext(this, activeGamePadState.Player, text.ToString());
                storageService.OpenSession(storageSessionContext);
            }
            else if (activeGamePadState.IsButtonDown(Buttons.Y) == true)
            {
                if (activeGamePadState.Player.IsSignedIn() == false)
                {
                    Guide.ShowSignIn(1, false);
                }

                statusText.Length = 0;
                statusText.AppendFormat("Creating reading session for {0}...",
                                        activeGamePadState.Player);
                statusText.AppendLine("");

                storageSessionContext = new ReadingSessionContext(this, activeGamePadState.Player, text);
                storageService.OpenSession(storageSessionContext);
            }
            else if (activeGamePadState.IsButtonDown(Buttons.A) == true)
            {
                if (statusText.Length == 0 || statusText.Length > 5)
                {
                    statusText.Length = 0;
                    statusText.Append("Dirty");
                }

                text.Append("A");
                if (text.Length % 20 == 0)
                {
                    text.Append("\n");
                }
            }
            else if (activeGamePadState.IsButtonDown(Buttons.B) == true)
            {
                if (statusText.Length == 0 || statusText.Length > 5)
                {
                    statusText.Length = 0;
                    statusText.Append("Dirty");
                }

                text.Append("B");
                if (text.Length % 20 == 0)
                {
                    text.Append("\n");
                }
            }
        }
示例#5
0
        /// <summary>
        /// Opens a session.
        /// </summary>
        /// <param name="context">An instance of IStorageSessionContext defining the requirements and callbacks.</param>
        public void OpenSession(IStorageSessionContext context)
        {
            var provider = GetProvider(context.Requirements);

            provider.OpenSession(context);
        }