예제 #1
0
        /// <inheritdoc />
        public async Task SaveAsync()
        {
            await this.fileAccessSemaphore.WaitAsync();

            try
            {
#if WINDOWS_UWP
                StorageFile file = null;
#elif ANDROID || IOS
                IStorageFile file = null;
#endif

                try
                {
                    file = await ApplicationData.Current.LocalFolder.CreateFileAsync(
                        FileName,
                        CreationCollisionOption.OpenIfExists);
                }
                catch (Exception ex)
                {
#if DEBUG
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
#endif
                }

                if (file != null)
                {
                    await file.SaveDataAsync(this.profileData);
                }
            }
            finally
            {
                this.fileAccessSemaphore.Release();
            }
        }