Ejemplo n.º 1
0
        public async Task <bool> SaveHistoryAction(HistoryAction action)
        {
            try
            {
                action.Background = Background;
                string actionToString = FileStorageHelper.ActionToString(action);
                if (Background)
                {
                    StorageFolder folder = await GetFolder(Background?BackgroundActionsFolder : ForegroundActionsFolder);

                    StorageFile file = await folder.CreateFileAsync(ActionsFileName, CreationCollisionOption.OpenIfExists);

                    return(await RetryAppending(file, actionToString));
                }
                else
                {
                    await ForegroundHistoryActionWriter.WriteLine(actionToString);

                    return(true);
                }
            }
            catch (Exception e)
            {
                Logger.Error("Error writing HistoryAction", e);
            }
            return(false);
        }