示例#1
0
        /// <summary>
        /// Returns a list of SimpleCommands based on the app's state. This is used
        /// to populate the Settings panel.
        /// </summary>
        public List <SimpleCommand> GetSettingsCommands()
        {
            List <SimpleCommand> commands = new List <SimpleCommand>();

            // If no user, no need to return any commands
            if (App.MobileService.CurrentUser == null)
            {
                return(commands);
            }

            // Create the sign out command
            SimpleCommand signOut = new SimpleCommand();

            signOut.Text   = string.Format("Sign Out {0}", User.Name);
            signOut.Action = () =>
            {
                App.MobileService.Logout();
                SetViewMode(ViewMode.LoggedOut);
            };
            commands.Add(signOut);
            return(commands);
        }
        /// <summary>
        /// Returns a list of SimpleCommands based on the apps state. This is used
        /// to populate the Settings panel.
        /// </summary>
        public List <SimpleCommand> GetSettingsCommands()
        {
            List <SimpleCommand> commands = new List <SimpleCommand>();

            // if no user, no need to return any commands
            if (_mobileServiceClient.CurrentUser == null || _liveAuthClient.CanLogout == false)
            {
                return(commands);
            }

            // Create the sign out command
            SimpleCommand signOut = new SimpleCommand();

            signOut.Text   = string.Format("Sign Out {0}", User.Name);
            signOut.Action = () =>
            {
                _mobileServiceClient.Logout();
                _liveAuthClient.Logout();
                SetViewState(ViewState.LoggedOut);
            };
            commands.Add(signOut);
            return(commands);
        }
        /// <summary>
        /// Returns a list of SimpleCommands based on the apps state. This is used
        /// to populate the Settings panel.
        /// </summary>
        public List<SimpleCommand> GetSettingsCommands()
        {
            List<SimpleCommand> commands = new List<SimpleCommand>();

            // if no user, no need to return any commands
            if (_mobileServiceClient.CurrentUser == null || _liveAuthClient.CanLogout == false)
            {
                return commands;
            }

            // Create the sign out command
            SimpleCommand signOut = new SimpleCommand();
            signOut.Text = string.Format("Sign Out {0}", User.Name);
            signOut.Action = () =>
            {
                _mobileServiceClient.Logout();
                _liveAuthClient.Logout();
                SetViewState(ViewState.LoggedOut);
            };
            commands.Add(signOut);
            return commands;
        }
        /// <summary>
        /// Returns a list of SimpleCommands based on the app's state. This is used
        /// to populate the Settings panel.
        /// </summary>
        public List<SimpleCommand> GetSettingsCommands()
        {
            List<SimpleCommand> commands = new List<SimpleCommand>();

            // If no user, no need to return any commands
            if (App.MobileService.CurrentUser == null)
            {
                return commands;
            }

            // Create the sign out command
            SimpleCommand signOut = new SimpleCommand();
            signOut.Text = string.Format("Sign Out {0}", User.Name);
            signOut.Action = () =>
            {
                App.MobileService.Logout();
                SetViewMode(ViewMode.LoggedOut);
            };
            commands.Add(signOut);
            return commands;
        }