コード例 #1
0
ファイル: StorageProvider.cs プロジェクト: northsteel/bnoerj
        /// <summary>
        /// Called to cancel a session.
        /// </summary>
        void CancelSession()
        {
            currentSessionContext.SessionCanceled();
            currentSessionContext = null;

            UpdateStatusFromDevice();
        }
コード例 #2
0
ファイル: StorageProvider.cs プロジェクト: northsteel/bnoerj
        /// <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
ファイル: Game1.cs プロジェクト: northsteel/bnoerj
 public void ContainerSessionFinished()
 {
     storageSessionContext = null;
 }
コード例 #4
0
ファイル: Game1.cs プロジェクト: northsteel/bnoerj
        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);
        }