GetDeferral() публичный Метод

public GetDeferral ( ) : SetVersionDeferral
Результат SetVersionDeferral
        void SetVersionHandler1(SetVersionRequest request)
        {
            SetVersionDeferral deferral = request.GetDeferral();

            uint version = appData.Version;

            switch (version)
            {
                case 0:
                    // Need to convert data from v0 to v1.

                    // This sample simulates that conversion by writing a version-specific value.
                    appData.LocalSettings.Values[settingName] = settingValue1;

                    break;

                case 1:
                    // Version is already 1.  Nothing to do.
                    break;

                default:
                    throw new Exception("Unexpected ApplicationData Version: " + version);
            }

            deferral.Complete();
        }
Пример #2
0
        internal static void AppDataSetVersion(Windows.Storage.SetVersionRequest request)
        {
            var deferral = request.GetDeferral();

            switch (request.CurrentVersion)
            {
            case 0:
                BaseAlarmSettings.Instance.ConvertVersion0To1();
                break;
            }

            deferral.Complete();
        }
Пример #3
0
        /// <summary>
        /// Handles the request to set the version of the application data in the application data store.
        /// </summary>
        /// <param name="request">The set version request.</param>
        /// <remarks>
        /// Application data migration should be done here.
        /// </remarks>
        void SetVersionHandler(SetVersionRequest request)
        {
            SetVersionDeferral deferral = request.GetDeferral();

            // Downgrades are not supported...
            if (request.DesiredVersion < request.CurrentVersion)
            {
                ApplicationData.Current.ClearAsync().AsTask().Wait();
            }

            //if (request.CurrentVersion < 1 && request.DesiredVersion >= 1)
            //{
            //}

            //if (request.CurrentVersion < 2)
            //{
            //}

            //if (request.CurrentVersion < 3)
            //{
            //}

            deferral.Complete();
        }
Пример #4
0
        private async void SetVersionHandlerAsync(SetVersionRequest request)
        {
            SetVersionDeferral deferral = request.GetDeferral();
            AppData.CurrentVersion = request.CurrentVersion;

            if (request.DesiredVersion == 1)
            {
                AppData.ClearServicesAsync();
            }
            else if (request.CurrentVersion <= 1 && request.DesiredVersion > 1)
            {
                await AppData.CreateSampleServicesAsync();
            }
            else if (request.CurrentVersion == 2 && request.DesiredVersion > 2)
            {
                await AppData.UpdateSampleServicesAsync();
            }

            deferral.Complete();
        }