public void Init() { if (_generalStore != null) { return; } DBError error; var manager = DBDatastoreManager.Manager(DBAccountManager.SharedManager.LinkedAccount); if (string.IsNullOrEmpty(DatastoreId)) { _generalStore = manager.CreateDatastore(out error); Debug.WriteLine("Datastore created, take a note of this:", _generalStore.DatastoreId); _generalStore.SetRole("public", DBRole.Editor); } else { _generalStore = manager.OpenDatastore(DatastoreId, out error); } _generalStore.Sync(out error); // DeleteAll(); _generalStore.Sync(out error); _generalStore.AddObserver(_generalStore, () => { LoadData(); }); AutoUpdating = true; if (!_generalStore.Status.IsConnected) { LoadData(); } }
public void SetRace(string code) { if (!_raceDictionary.ContainsKey(code)) { return; } AutoUpdating = false; _race = _raceDictionary[code]; DBError error; if (_raceStore != null) { _raceStore.Close(); } var manager = DBDatastoreManager.Manager(DBAccountManager.SharedManager.LinkedAccount); _raceStore = manager.OpenDatastore(_race.DataStoreID, out error); _raceStore.Sync(out error); UpdateBoatInformation(); UpdateEventData(true); _raceStore.AddObserver(_raceStore, () => { UpdateEventData(false); // true will curtail the write each time }); AutoUpdating = true; }
public void Init() { if (store != null) { return; } DBError error; store = DBDatastore.OpenDefaultStoreForAccount(DBAccountManager.SharedManager.LinkedAccount, out error); var sync = store.Sync(null); store.AddObserver(store, () => { LoadData(); }); AutoUpdating = true; store.BeginInvokeOnMainThread(() => { timer = NSTimer.CreateRepeatingScheduledTimer(1, () => { if (!AutoUpdating) { return; } store.Sync(null); }); }); }
public void Init() { if (store != null) { return; } DBError error; store = DBDatastore.OpenDefaultStoreForAccount(DBAccountManager.SharedManager.LinkedAccount, out error); store.Sync(null); store.AddObserver(store, () => { LoadData(); }); }
public void Init() { Console.Write("Init"); if (store != null) { return; } DBError error; store = DBDatastore.OpenDefaultStore(DBAccountManager.SharedManager.LinkedAccount, out error); DBError error1; var sync = store.Sync(out error1); store.AddObserver(store, () => { Console.Write("AddObserver"); DBError error2; store.Sync(out error2); // needed? var table = store.GetTable(tableName); var results = table.Query(null, out error); Console.WriteLine(results.Length); ProccessResults(results); }); // TIMER TO AUTOUPDATE AutoUpdating = true; store.BeginInvokeOnMainThread(() => { timer = NSTimer.CreateRepeatingScheduledTimer(2, () => { if (!AutoUpdating) { return; } //Console.WriteLine("AutoUpdating"); // SPAM DBError error3; store.Sync(out error3); }); }); }