Example #1
0
 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();
     });
 }
Example #2
0
 public void Init()
 {
     if (store != null)
         return;
     DBError error;
     store = DBDatastore.OpenDefaultStore (DBAccountManager.SharedManager.LinkedAccount, out error);
     store.Sync (out error);
     store.AddObserver (store, () => {
         LoadData ();
     });
     AutoUpdating = true;
 }
Example #3
0
 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 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 ()
		{
			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);
				});
			});

		}