public GenerateFakeData ( IDatastore dataStore ) : void | ||
dataStore | IDatastore | |
return | void |
protected override IDatastore CreateDatastoreWithFakeData() { var inMemoryDatastore = new InMemoryDatastore(); var fakeDataGenerator = new FakeDataGenerator(); fakeDataGenerator.GenerateFakeData(inMemoryDatastore); return inMemoryDatastore; }
public MainPageViewModel(INavigationService navigationService) { Tags = new ObservableCollection<TagViewModel>(); Accounts = new ObservableCollection<AccountViewModel>(); _navigationService = navigationService; var selectedDatastore = IsolatedStorageHelper.GetApplicationSetting("dataStore") as IDatastore; if (selectedDatastore == null) { var app = Application.Current as App; if (app != null) { _dataStore = app.Datastores.GetSelectedDatastore(); } else { var init = new Init(); _dataStore = init.GetDatastores().GetSelectedDatastore(); } var fakeData = new FakeDataGenerator(); fakeData.GenerateFakeData(_dataStore); } else { _dataStore = selectedDatastore; } _accounts = new Accounts(_dataStore); UpdateUi(); // _dataStore.OnSaved += RepositoryChanged; }
protected override IDatastore CreateDatastoreWithFakeData() { var xmlDatastore = CreateEmptyDatastore(); var fakeDataGenerator = new FakeDataGenerator(); fakeDataGenerator.GenerateFakeData(xmlDatastore); return xmlDatastore; }
public Main() { // const string xmlFileName = @"PassFruit.xml"; var xmlFilePath = Path.GetTempFileName(); File.Delete(xmlFilePath); var fileExists = File.Exists(xmlFilePath); var xmlDatastoreConfiguration = new XmlDatastoreConfiguration( () => fileExists ? XDocument.Load(xmlFilePath) : new XDocument(), xDocument => xDocument.Save(xmlFilePath) ); _dataStore = new XmlDatastore(xmlDatastoreConfiguration); if (!fileExists) { var fakeDataGenerator = new FakeDataGenerator(); fakeDataGenerator.GenerateFakeData(_dataStore); } }