Exemple #1
0
 //private ICollection<AppFileModel> _appFiles;
 //private ICollection<AppFileModel> _thumbnail;
 public BookModel()
 {
     _appFile   = new EFAppFile();
     _publisher = new EFPublisher();
     _author    = new EFAuthor();
     _mapper    = DIManager.Instance.Provider.GetService <IMapper>();
 }
Exemple #2
0
 //private readonly IBooks _books;
 public AuthorModel()
 {
     Id       = Guid.Empty;
     _appFile = new EFAppFile();
     _mapper  = DIManager.Instance.Provider.GetService <IMapper>();
     //   _books = new EFBook();
 }
Exemple #3
0
 public UserController(IMongoUserFavoritesAndReads mongoUserFavorites, IMapper mapper, IUserFavoriteAndReadBook userFavoriteAndReadBook, IBooks books, IAuthor authors, IAppFile appFile, IUserRates userRates, IUserReadPage userReadPage)
 {
     _mongoUserReadAndFavorites = mongoUserFavorites;
     _mapper = mapper;
     _userFavoriteAndReadBook = userFavoriteAndReadBook;
     _books        = books;
     _authors      = authors;
     _appFile      = appFile;
     _userRates    = userRates;
     _userReadPage = userReadPage;
 }
        /// <inheritdoc />
        public async Task SaveAsync()
        {
            await this.fileAccessSemaphore.WaitAsync();

            try
            {
#if WINDOWS_UWP
                StorageFile file = null;
#elif ANDROID || iOS
                IAppFile file = null;
#endif

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

                if (file != null)
                {
                    await file.SaveDataAsync(this.profileData);
                }
            }
            finally
            {
                this.fileAccessSemaphore.Release();
            }
        }
Exemple #5
0
 public ViewModelBaseAdd(INavigationService navigationService, IDataService ds, IPageDialogService dialog, IAppFile appFile, IAppSettings appSet) : base(navigationService, dialog)
 {
     Ds      = ds;
     AppFile = appFile;
     AppSet  = appSet;
 }
 public MainPageViewModel(INavigationService navigationService, IDataService ds, IPageDialogService dialog, IAppFile appFile, IAppSettings appSet)
     : base(navigationService, ds, dialog, appFile, appSet)
 {
     Title          = AppRes.AppTitle;
     AddCommand     = new DelegateCommand(AddCommandExec);
     DeleteCommand  = new DelegateCommand(DeleteCommandExec);
     SearchCommand  = new DelegateCommand <string>(SearchCommandExec);
     DevicesCommand = new DelegateCommand(DevicesCommandExec);
     SendCommand    = new DelegateCommand(SendCommandExec);
     InitSettings();
 }
 public static async Task SaveDataAsync <T>(this IAppFile storageFile, T data)
 {
     var json = SerializationService.Json.Serialize(data);
     await storageFile.WriteTextAsync(json);
 }
        public static async Task <T> GetDataAsync <T>(this IAppFile storageFile)
        {
            var dataString = await storageFile.ReadTextAsync();

            return(SerializationService.Json.Deserialize <T>(dataString));
        }
 public AppFileController(IMapper mapper, IAppFile appFile)
 {
     _mapper  = mapper;
     _appFile = appFile;
 }
 public GameObjPageViewModel(INavigationService navigationService, IDataService ds, IPageDialogService dialog, IAppFile appFile, IAppSettings appSet, IPicturePicker picker)
     : base(navigationService, ds, dialog, appFile, appSet)
 {
     Title            = AppRes.NewGame;
     SaveCommand      = new DelegateCommand(SaveCommandExecute);
     SelectImgCommand = new DelegateCommand(SelectImgCommandExecute);
     _picker          = picker;
 }