Exemplo n.º 1
0
 public Realm GetRealm()
 {
     return(Realm.GetInstance(_realmFileName));
 }
Exemplo n.º 2
0
 public CycleService()
 {
     realm = Realm.GetInstance();
 }
Exemplo n.º 3
0
 public void SetUp()
 {
     _lazyRealm = new Lazy <Realm>(() => Realm.GetInstance(Path.GetTempFileName()));
 }
Exemplo n.º 4
0
 private ProjectsController()
 {
     this.realm = Realm.GetInstance();
 }
Exemplo n.º 5
0
        public void Notifications()
        {
            myRealmAppId = Config.appid;
            var app   = App.Create(myRealmAppId);
            var realm = Realm.GetInstance("");

            //:code-block-start:notifications
            // Observe realm notifications.
            realm.RealmChanged += (sender, eventArgs) =>
            {
                // sender is the realm that has changed.
                // eventArgs is reserved for future use.
                // ... update UI ...
            };
            //:code-block-end:

            //:code-block-start:collection-notifications
            // Observe collection notifications. Retain the token to keep observing.
            var token = realm.All <Dog>()
                        .SubscribeForNotifications((sender, changes, error) =>
            {
                if (error != null)
                {
                    // Show error message
                    return;
                }

                if (changes == null)
                {
                    // This is the case when the notification is called
                    // for the first time.
                    // Populate tableview/listview with all the items
                    // from `collection`
                    return;
                }

                // Handle individual changes

                foreach (var i in changes.DeletedIndices)
                {
                    // ... handle deletions ...
                }

                foreach (var i in changes.InsertedIndices)
                {
                    // ... handle insertions ...
                }

                foreach (var i in changes.NewModifiedIndices)
                {
                    // ... handle modifications ...
                }
            });

            // Later, when you no longer wish to receive notifications
            token.Dispose();
            //:code-block-end:


            realm.Write(() =>
            {
                realm.Add(new PersonN {
                    Id = ObjectId.GenerateNewId(), Name = "Elvis Presley"
                });
            });
            //:code-block-start:object-notifications
            // :replace-start: {
            //  "terms": {
            //   "PersonN": "Person" }
            // }
            var theKing = realm.All <PersonN>()
                          .FirstOrDefault(p => p.Name == "Elvis Presley");

            theKing.PropertyChanged += (sender, eventArgs) =>
            {
                Debug.WriteLine("New value set for The King: " +
                                eventArgs.PropertyName);
            };
        }
Exemplo n.º 6
0
 public void Setup()
 {
     Realm.DeleteRealm(RealmConfiguration.DefaultConfiguration);
     _realm = Realm.GetInstance();
 }
        public void Setup()
        {
            Realm.DeleteRealm(RealmConfiguration.DefaultConfiguration);
            realm = Realm.GetInstance();

            // we don't keep any variables pointing to these as they are all added to Realm
            using (var trans = realm.BeginWrite())
            {
                /* syntax we want back needs ability for constructor to auto-bind to active write transaction
                 * new Owner {Name = "Tim", Dogs = new RealmList<Dog> {
                 *  new Dog {Name = "Bilbo Fleabaggins"},
                 *  new Dog {Name = "Earl Yippington III" }
                 *  } };
                 */
                Owner o1 = realm.CreateObject <Owner> ();
                o1.Name = "Tim";

                Dog d1 = realm.CreateObject <Dog> ();
                d1.Name   = "Bilbo Fleabaggins";
                d1.Color  = "Black";
                o1.TopDog = d1;  // set a one-one relationship
                o1.Dogs.Add(d1);

                Dog d2 = realm.CreateObject <Dog> ();
                d2.Name  = "Earl Yippington III";
                d2.Color = "White";
                o1.Dogs.Add(d2);

                // lonely people and dogs
                Owner o2 = realm.CreateObject <Owner> ();
                o2.Name = "Dani";                     // the dog-less

                Dog d3 = realm.CreateObject <Dog> (); // will remain unassigned
                d3.Name  = "Maggie Mongrel";
                d3.Color = "Grey";

                /*
                 * These would work if we can preserve init through weaving, like:
                 * public RealmList<Dog> Dogs { get; set; } = new RealmList<Dog>();
                 *
                 * new Owner {Name = "JP", Dogs = { new Dog { Name = "Deputy Dawg", Vaccinated=false } } };
                 * new Owner {Name = "Arwa", Dogs = { new Dog { Name = "Hairy Pawter", Color = "Black" } } };
                 * new Owner {Name = "Joe", Dogs = { new Dog { Name = "Jabba the Mutt", Vaccinated = false } } };
                 * new Owner {Name = "Alex", Dogs = { new Dog { Name = "Hairy Pawter", Color = "Black" } } };
                 * new Owner {Name = "Michael", Dogs = { new Dog { Name = "Nerf Herder", Color="Red" } } };
                 * new Owner {Name = "Adam", Dogs = { new Dog { Name = "Defense Secretary Waggles" } } };
                 * new Owner {Name = "Samuel", Dogs = { new Dog { Name = "Salacious B. Crumb", Color="Tan" } } };
                 * new Owner {Name = "Kristen"}; // Kristen's dog was abducted by Tim so she doesn't have any
                 * new Owner {Name = "Emily", Dogs = { new Dog { Name = "Pickles McPorkchop" } } };
                 * new Owner {Name = "Katsumi", Dogs = { new Dog { Name = "Sir Yaps-a-lot", Vaccinated = false } } };
                 * new Owner {Name = "Morgan", Dogs = { new Dog { Name = "Rudy Loosebooty" } } };
                 */
                // to show you can assign later, create the Owner then assign their Dog

                /* syntax for later
                 * var b = new Owner {Name = "Bjarne"};
                 * b.Dogs = new RealmList<Dog> { new Dog { Name = "Madame Barklouder", Vaccinated = false, Color = "White" }};
                 */
                trans.Commit();
            }
        }
Exemplo n.º 8
0
 public void GetInstanceWithJustFilenameTest()
 {
     // Arrange, act and "assert" that no exception is thrown, using default location + unique name
     Realm.GetInstance(SpecialRealmName).Dispose();
 }
        private void RunManagedTests <T>(IList <T> items, T[] toAdd)
        {
            AsyncContext.Run(async() =>
            {
                if (toAdd == null)
                {
                    toAdd = new T[0];
                }

                var notifications = new List <ChangeSet>();
                var token         = items.SubscribeForNotifications((sender, changes, error) =>
                {
                    if (changes != null)
                    {
                        notifications.Add(changes);
                    }
                });

                // Test add
                _realm.Write(() =>
                {
                    foreach (var item in toAdd)
                    {
                        items.Add(item);
                    }
                });

                // Test notifications
                if (toAdd.Any())
                {
                    VerifyNotifications(notifications, () =>
                    {
                        Assert.That(notifications[0].InsertedIndices, Is.EquivalentTo(Enumerable.Range(0, toAdd.Length)));
                    });
                }

                // Test iterating
                var iterator = 0;
                foreach (var item in items)
                {
                    Assert.That(item, Is.EqualTo(toAdd[iterator++]));
                }

                // Test access by index
                for (var i = 0; i < items.Count; i++)
                {
                    Assert.That(items[i], Is.EqualTo(toAdd[i]));
                }

                Assert.That(() => items[-1], Throws.TypeOf <ArgumentOutOfRangeException>());
                Assert.That(() => items[items.Count], Throws.TypeOf <ArgumentOutOfRangeException>());

                // Test indexOf
                foreach (var item in toAdd)
                {
                    Assert.That(items.IndexOf(item), Is.EqualTo(Array.IndexOf(toAdd, item)));
                }

                // Test threadsafe reference
                var reference = ThreadSafeReference.Create(items);
                await Task.Run(() =>
                {
                    using (var realm = Realm.GetInstance(_realm.Config))
                    {
                        var backgroundList = realm.ResolveReference(reference);
                        for (var i = 0; i < backgroundList.Count; i++)
                        {
                            Assert.That(backgroundList[i], Is.EqualTo(toAdd[i]));
                        }
                    }
                });

                if (toAdd.Any())
                {
                    // Test insert
                    var toInsert = toAdd[_random.Next(0, toAdd.Length)];
                    _realm.Write(() =>
                    {
                        items.Insert(0, toInsert);
                        items.Insert(items.Count, toInsert);

                        Assert.That(() => items.Insert(-1, toInsert), Throws.TypeOf <ArgumentOutOfRangeException>());
                        Assert.That(() => items.Insert(items.Count + 1, toInsert), Throws.TypeOf <ArgumentOutOfRangeException>());
                    });

                    Assert.That(items.First(), Is.EqualTo(toInsert));
                    Assert.That(items.Last(), Is.EqualTo(toInsert));

                    // Test notifications
                    VerifyNotifications(notifications, () =>
                    {
                        Assert.That(notifications[0].InsertedIndices, Is.EquivalentTo(new[] { 0, items.Count - 1 }));
                    });

                    // Test remove
                    _realm.Write(() =>
                    {
                        items.Remove(toInsert);
                        items.RemoveAt(items.Count - 1);

                        Assert.That(() => items.RemoveAt(-1), Throws.TypeOf <ArgumentOutOfRangeException>());
                        Assert.That(() => items.RemoveAt(items.Count + 1), Throws.TypeOf <ArgumentOutOfRangeException>());
                    });

                    CollectionAssert.AreEqual(items, toAdd);

                    // Test notifications
                    VerifyNotifications(notifications, () =>
                    {
                        Assert.That(notifications[0].DeletedIndices, Is.EquivalentTo(new[] { 0, items.Count + 1 }));
                    });

                    // Test move
                    var from = TestHelpers.Random.Next(0, items.Count);
                    var to   = TestHelpers.Random.Next(0, items.Count);

                    _realm.Write(() =>
                    {
                        items.Move(from, to);

                        Assert.That(() => items.Move(-1, to), Throws.TypeOf <ArgumentOutOfRangeException>());
                        Assert.That(() => items.Move(from, -1), Throws.TypeOf <ArgumentOutOfRangeException>());
                        Assert.That(() => items.Move(items.Count + 1, to), Throws.TypeOf <ArgumentOutOfRangeException>());
                        Assert.That(() => items.Move(from, items.Count + 1), Throws.TypeOf <ArgumentOutOfRangeException>());
                    });

                    Assert.That(items[to], Is.EqualTo(toAdd[from]));

                    // Test notifications
                    if (from != to)
                    {
                        VerifyNotifications(notifications, () =>
                        {
                            Assert.That(notifications[0].Moves.Length, Is.EqualTo(1));
                            var move = notifications[0].Moves[0];

                            // Moves may be reported with swapped from/to arguments if the elements are adjacent
                            if (move.From == to)
                            {
                                Assert.That(move.From, Is.EqualTo(to));
                                Assert.That(move.To, Is.EqualTo(from));
                            }
                            else
                            {
                                Assert.That(move.From, Is.EqualTo(from));
                                Assert.That(move.To, Is.EqualTo(to));
                            }
                        });
                    }
                }

                // Test Clear
                _realm.Write(() =>
                {
                    items.Clear();
                });

                Assert.That(items, Is.Empty);

                // Test notifications
                if (toAdd.Any())
                {
                    VerifyNotifications(notifications, () =>
                    {
                        // TODO: verify notifications contains the expected Deletions collection
                    });
                }

                token.Dispose();
            });
        }
Exemplo n.º 10
0
 public void GetInstanceShouldThrowWithBadPath()
 {
     // Arrange
     Assert.Throws <RealmPermissionDeniedException>(() => Realm.GetInstance("/"));
 }
Exemplo n.º 11
0
 public void GetInstanceTest()
 {
     // Arrange, act and "assert" that no exception is thrown, using default location
     Realm.GetInstance().Dispose();
 }
Exemplo n.º 12
0
 private Realm GetRealmInstance()
 {
     return(Realm.GetInstance("delivery"));
 }
Exemplo n.º 13
0
        public ObservableCollection <BasePlace> GetPlaces()
        {
            Realm _realm = Realm.GetInstance();

            return(new ObservableCollection <RealmPlace>(_realm.All <RealmPlace>()).ToBasePlace());
        }
Exemplo n.º 14
0
        public static Realm GetRealm()
        {
            var instance = Realm.GetInstance(RealmConfiguration);

            return(instance);
        }
Exemplo n.º 15
0
        private async void SaveDraftCommandRecieverAsync()
        {
            try
            {
                Loader.StartLoading();
                var location = await _geolocationService.GetLastLocationAsync();

                ManifestModel manifestModel = null;

                try
                {
                    manifestModel = GenerateManifest(PalletCollection ?? new List <PalletModel>(), location ?? new Xamarin.Essentials.Location(0, 0));
                    if (manifestModel != null)
                    {
                        manifestModel.IsDraft = true;
                        var isNew = Realm.GetInstance(RealmDbManager.GetRealmDbConfig()).Find <ManifestModel>(manifestModel.ManifestId);
                        if (isNew != null)
                        {
                            try
                            {
                                var RealmDb = Realm.GetInstance(RealmDbManager.GetRealmDbConfig());
                                RealmDb.Write(() =>
                                {
                                    RealmDb.Add(manifestModel, update: true);
                                });
                            }
                            catch (Exception ex)
                            {
                                Crashes.TrackError(ex);
                            }
                        }
                        else
                        {
                            try
                            {
                                var RealmDb = Realm.GetInstance(RealmDbManager.GetRealmDbConfig());
                                RealmDb.Write(() =>
                                {
                                    RealmDb.Add(manifestModel);
                                });
                            }
                            catch (Exception ex)
                            {
                                Crashes.TrackError(ex);
                            }
                        }

                        Loader.StopLoading();
                        await _navigationService.NavigateAsync("ManifestsView",
                                                               new NavigationParameters
                        {
                            { "LoadDraftManifestAsync", "LoadDraftManifestAsync" }
                        }, animated : false);
                    }
                    else
                    {
                        await _dialogService.DisplayAlertAsync("Error", "Could not save manifest.", "Ok");
                    }
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                }
                finally
                {
                    manifestModel = null;
                    Cleanup();
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                Loader.StopLoading();
            }
        }
Exemplo n.º 16
0
 public BaseModel()
 {
     _realmInstance = Realm.GetInstance();
 }
Exemplo n.º 17
0
 // We capture the current SynchronizationContext when opening a Realm.
 // However, NUnit replaces the SynchronizationContext after the SetUp method and before the async test method.
 // That's why we make sure we open the Realm in the test method by accessing it lazily.
 protected override void CustomSetUp()
 {
     _lazyRealm = new Lazy <Realm>(() => Realm.GetInstance());
     base.CustomSetUp();
 }
Exemplo n.º 18
0
 /// <summary>
 /// Realm をインスタンス化する
 /// </summary>
 public void ExcecuteSample01()
 {
     //スコープ外になった際にデータベースは自動でクローズされる。。
     var realm = Realm.GetInstance();
 }
Exemplo n.º 19
0
        /// <summary>
        /// Updates the local database by syncing with the server
        /// </summary>
        /// <returns>an awaitable task for the completion of syncing</returns>
        public static async Task UpdateLocalDatabaseAsync()
        {
            if (App.Path != null && App.UserPath.Length > 2)
            {
                RealmConfiguration threadConfig = App.realmConfiguration(RosterPath);
                Realm threadInstance            = Realm.GetInstance(threadConfig);

                List <QuizInfo> QuizInfos = new List <QuizInfo>(threadInstance.All <QuizInfo>());
                if (CrossConnectivity.Current.IsConnected)
                {
                    for (int i = 0; i < QuizInfos.Count(); i++)
                    {
                        if (CredentialManager.IsLoggedIn)
                        {
                            if (QuizInfos[i].IsDeletedLocally)
                            {
                                if (await ServerOperations.DeleteQuiz(QuizInfos[i].DBId) == OperationReturnMessage.True)
                                {
                                    string toDeleteDBId = QuizInfos[i].DBId;
                                    QuizInfos.Remove(QuizInfos[i]);
                                    DeleteQuizInfo(toDeleteDBId);
                                }
                            }
                            else if (QuizInfos[i].SyncStatus != (int)SyncStatusEnum.NotDownloadedAndNeedDownload)
                            {
                                string lastModifiedDate = ServerOperations.GetLastModifiedDate(QuizInfos[i].DBId);
                                if (lastModifiedDate == "") // returns empty string could not reach server
                                {
                                    QuizInfo copy = new QuizInfo(QuizInfos[i])
                                    {
                                        SyncStatus = (int)SyncStatusEnum.Offline // 3 represents offline
                                    };
                                    EditQuizInfo(copy, threadInstance);
                                }
                                else
                                {
                                    // Server returns "false" if quiz is not already on the server
                                    if (lastModifiedDate == "false" || lastModifiedDate == null)
                                    {
                                        QuizInfo copy = new QuizInfo(QuizInfos[i])
                                        {
                                            SyncStatus = (int)SyncStatusEnum.NeedUpload // 1 represents need upload
                                        };
                                        EditQuizInfo(copy, threadInstance);
                                    }
                                    else
                                    {
                                        DateTime localModifiedDateTime  = Convert.ToDateTime(QuizInfos[i].LastModifiedDate);
                                        DateTime serverModifiedDateTime = Convert.ToDateTime(lastModifiedDate);
                                        if (localModifiedDateTime > serverModifiedDateTime)
                                        {
                                            QuizInfo copy = new QuizInfo(QuizInfos[i])
                                            {
                                                SyncStatus = (int)SyncStatusEnum.NeedUpload // 1 represents need upload
                                            };
                                            EditQuizInfo(copy, threadInstance);
                                        }
                                        else if (localModifiedDateTime < serverModifiedDateTime)
                                        {
                                            QuizInfo copy = new QuizInfo(QuizInfos[i])
                                            {
                                                SyncStatus = (int)SyncStatusEnum.NeedDownload // 0 represents needs download
                                            };
                                            EditQuizInfo(copy, threadInstance);
                                        }
                                        else if (localModifiedDateTime == serverModifiedDateTime)
                                        {
                                            QuizInfo copy = new QuizInfo(QuizInfos[i])
                                            {
                                                SyncStatus = (int)SyncStatusEnum.Synced // 2 represents in sync
                                            };
                                            EditQuizInfo(copy, threadInstance);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            QuizInfo copy = new QuizInfo(QuizInfos[i])
                            {
                                SyncStatus = (int)SyncStatusEnum.Synced // 2 represents in sync
                            };
                            EditQuizInfo(copy, threadInstance);
                        }
                    }

                    string[] dbIds = new string[QuizInfos.Count];
                    for (int i = 0; i < dbIds.Length; i++)
                    {
                        dbIds[i] = QuizInfos[i].DBId;
                    }

                    List <string[]> missingQuizs = ServerOperations.GetMissingQuizzesByAuthorName(CredentialManager.Username, dbIds);
                    foreach (string[] missingQuiz in missingQuizs)
                    {
                        QuizInfo info = new QuizInfo
                        {
                            DBId             = missingQuiz[0],
                            AuthorName       = missingQuiz[1],
                            QuizName         = missingQuiz[2],
                            Category         = missingQuiz[3],
                            LastModifiedDate = missingQuiz[4],
                            SubscriberCount  = int.Parse(missingQuiz[5]),
                            SyncStatus       = (int)SyncStatusEnum.NotDownloadedAndNeedDownload
                        };
                        threadInstance.Write(() =>
                        {
                            threadInstance.Add(info);
                        });
                    }
                }
                else
                {
                    for (int i = 0; i < QuizInfos.Count; i++)
                    {
                        QuizInfo copy = new QuizInfo(QuizInfos[i])
                        {
                            SyncStatus = (int)SyncStatusEnum.Offline // 3 represents offline
                        };
                        EditQuizInfo(copy, threadInstance);
                    }
                }
            }
        }
        private async void SubmitCommandRecieverAsync()
        {
            NewPartnerRequestModel newPartnerRequestModel = new NewPartnerRequestModel
            {
                AccountNumber   = AccountNumber,
                BillAddress     = BillAddress,
                ContactEmail    = ContactEmail,
                ContactName     = ContactName,
                Fax             = Fax,
                IsInternal      = IsInternalOn,
                IsNotify        = IsNotify,
                IsShared        = IsSharedOn,
                LocationCode    = LocationCode,
                LocationStatus  = LocationStatus,
                Notes           = Notes,
                FirstName       = PartnerName,
                LastName        = PartnerName,
                ParentPartnerId = IsInternalOn ? AppSettings.CompanyId : _uuidManager.GetUuId(),
                PartnerId       = _uuidManager.GetUuId(),
                PartnerName     = PartnerName,
                PartnerTypeCode = SelectedPartnerType.Code,
                Phone           = Phone,
                PrivateKey      = PrivateKey,
                ReferenceKey    = ReferenceKey,
                RouteName       = RouteName,
                ShipAddress     = ShipAddress,
                SmsAddress      = SmsAddress,
                TimeZone        = "+05:30", //PTTimeZone;
                Website         = ""        //Website;
            };

            try
            {
                Loader.StartLoading();
                var result = await _moveService.PostNewPartnerAsync(newPartnerRequestModel, AppSettings.SessionId, RequestType : Configuration.NewPartner);

                if (result != null)
                {
                    try
                    {
                        PartnerModel partnerModel = new PartnerModel
                        {
                            Address             = BillingAddress,
                            Address1            = ShippingAddress,
                            City                = newPartnerRequestModel.BillAddress != null ? newPartnerRequestModel.BillAddress.City : string.Empty,
                            ParentPartnerId     = newPartnerRequestModel.ParentPartnerId,
                            ParentPartnerName   = newPartnerRequestModel.PartnerName,
                            PartnerId           = newPartnerRequestModel.PartnerId,
                            PartnershipIsActive = newPartnerRequestModel.IsInternal,
                            IsInternal          = newPartnerRequestModel.IsInternal,
                            IsShared            = newPartnerRequestModel.IsShared,
                            Lat             = newPartnerRequestModel.BillAddress != null ? newPartnerRequestModel.BillAddress.Latitude : default(double),
                            LocationCode    = newPartnerRequestModel.LocationCode,
                            LocationStatus  = newPartnerRequestModel.LocationStatus,
                            Lon             = newPartnerRequestModel.BillAddress != null ? newPartnerRequestModel.BillAddress.Longitude : default(double),
                            MasterCompanyId = newPartnerRequestModel.ParentPartnerId,
                            PartnerTypeCode = newPartnerRequestModel.PartnerTypeCode,
                            PartnerTypeName = newPartnerRequestModel.PartnerName,
                            PhoneNumber     = newPartnerRequestModel.PartnerName,
                            PostalCode      = newPartnerRequestModel.BillAddress != null ? newPartnerRequestModel.BillAddress.PostalCode : string.Empty,
                            SourceKey       = newPartnerRequestModel.RouteName,
                            State           = newPartnerRequestModel.BillAddress != null ? newPartnerRequestModel.BillAddress.State : string.Empty,
                            FullName        = newPartnerRequestModel.PartnerName,
                        };
                        var RealmDb = Realm.GetInstance(RealmDbManager.GetRealmDbConfig());
                        await RealmDb.WriteAsync((realmDb) =>
                        {
                            realmDb.Add(partnerModel);
                        });

                        await _navigationService.GoBackAsync(new NavigationParameters
                        {
                            { "partnerModel", partnerModel }
                        }, animated : false);
                    }
                    catch (Exception ex)
                    {
                        Crashes.TrackError(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
            finally
            {
                Loader.StopLoading();
            }
        }
Exemplo n.º 21
0
        public static async Task <bool> UpdateLocalTeamMembers()
        {
            using (var realm = Realm.GetInstance())
            {
                var members = await QuantiServer.GetTeamMembers();

                if (members == null)
                {
                    return(false);
                }

                foreach (var m in members)
                {
                    if (m.username == QuantiServer.Username)                            //	Don't add self!
                    {
                        continue;
                    }

                    var objs = realm.All <TeamMember>().Where(tm => tm.Identifier == m.id);

                    if (objs.Count() == 0)
                    {
                        //	The team member does not exist in the database...

                        realm.Write(() =>
                        {
                            realm.Add(new TeamMember
                            {
                                Identifier = m.id,
                                Name       = m.name,
                                Username   = m.username
                            });
                        });
                    }
                    else
                    {
                        //	The team member exists...

                        var fo = objs.First();

                        if (fo.Name != m.name)
                        {
                            //	But has changed their name!

                            realm.Write(() =>
                            {
                                fo.Name = m.name;
                            });
                        }
                    }
                }

                //	Now, disabling all the (old) team members, and re-enabling
                //	everyone who may have come back... (Hey, welcome back!)

                var allSaved = realm.All <TeamMember>();

                foreach (var saved in allSaved)
                {
                    bool found = false;

                    foreach (var current in members)
                    {
                        if (current.id == saved.Identifier)
                        {
                            found = true;

                            break;
                        }
                    }

                    realm.Write(() =>
                    {
                        saved.IsCurrentlyMember = found;
                    });
                }

                return(true);
            }
        }
Exemplo n.º 22
0
        static CardDataStore()
        {
            RealmConfiguration config = new RealmConfiguration("cards.db");

            realm = Realm.GetInstance(config);
        }
Exemplo n.º 23
0
 public RealmService()
 {
     realm = Realm.GetInstance();
 }
Exemplo n.º 24
0
 public DayLayOutProvider()
 {
     db = Realm.GetInstance();             //Get default realm database for App
 }
Exemplo n.º 25
0
 public NotificationUnsub()
 {
     realm = Realm.GetInstance("");
 }
Exemplo n.º 26
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="runID"></param>
 /// <returns></returns>
 public static List <RunData> GetRunDataFromRun(string runID)
 {
     return(Realm.GetInstance().All <RunData>().Where(rd => rd.runID == runID).ToList());
 }
Exemplo n.º 27
0
 public RealmLoggingDbCtx(RealmConfiguration config)
 {
     _realm = Realm.GetInstance(config);
 }
 public TodoItemDatabase()
 {
     realm = Realm.GetInstance();
 }
Exemplo n.º 29
0
 public void Main()
 {
     Realm.GetInstance();
 }
Exemplo n.º 30
0
 public RealmDBService()
 {
     RealmInstance = Realm.GetInstance();
 }