Пример #1
0
        /// <summary>
        /// Saves the application settings.
        /// </summary>
        /// <returns></returns>
        public bool SaveSettings()
        {
            var settings = ProtobufHandler.Serialize(this.m_Account);

            StorageManager.WriteObject(settings, "appSettings");
            return(true);
        }
Пример #2
0
        /// <summary>
        /// Loads the application settings.
        /// </summary>
        /// <returns></returns>
        public bool LoadSettings()
        {
            // Attempt to load the app settings from the phone storage..
            var settings = StorageManager.ReadObject <byte[]>("appSettings");

            if (settings == null)
            {
                return(false);
            }

            try
            {
                // Deserialize the account object..
                this.m_Account            = ProtobufHandler.Deserialize <Account>(settings);
                this.m_Account.RememberMe = (!string.IsNullOrEmpty(this.m_Account.Username) && !string.IsNullOrEmpty(this.m_Account.Password));
                return(true);
            }
            catch
            {
                this.m_Account = new Account();
                return(false);
            }
        }