Пример #1
0
        /// <summary>
        /// This is a method thar runs on the initialization of the class
        /// to load all objects using the service class
        /// </summary>
        /// <returns></returns>
        protected override async Task LoadAll()
        {
            try
            {
                if (AllObjects?.Count > 0)
                {
                    AllObjects.Clear();
                }

                if (FilteredCollection?.Count > 0)
                {
                    FilteredCollection.Clear();
                }

                await RunMethodAsync(() =>
                {
                    var allObjects = service.GetAll() ?? new List <T>();
                    AllObjects     = FilteredCollection = new ObservableCollection <T>(allObjects);
                }, () => IsBusy);
            }
            catch (Exception e)
            {
                toaster.ShowErrorToast(Toaster.ErrorTitle, e.Message);
            }
        }
Пример #2
0
 static MainApiController()
 {
     _cleaner = new Timer(
         obj => { AllObjects.Clear(); },
         null,
         new TimeSpan(1, 0, 0),
         new TimeSpan(1, 0, 0)
         );
 }
Пример #3
0
        /// <summary>
        /// Resets each world to the state it was in when first loaded
        /// </summary>
        public void ResetWorld()
        {
            AllObjects.Clear();
            QuadTree = new QuadTreeNode(0, 0, width * 64, height * 64);

            foreach (Enemy e in initialEnemies)
            {
                Enemy clone = e.Clone(e.Texture, e.HP, QuadTree);
                AllObjects.Add(clone);
            }

            foreach (Warp w in warps)
            {
                AllObjects.Add(w);
            }
        }
Пример #4
0
        // Delete all of IFolders and IFiles in IFolder "iparent"
        async void IDleteAllObjects(IFolder iparent)
        {
            // Get ALl IFolders and IFiles in the IFolder "parent"
            IList <IFolder> ifolders = await iparent.GetFoldersAsync();

            IList <IFile> ifiles = await iparent.GetFilesAsync();

            // Delete All IFolders
            foreach (IFolder ifolder in ifolders)
            {
                await ifolder.DeleteAsync();
            }

            // Delete All IFiles
            foreach (IFile ifile in ifiles)
            {
                await ifile.DeleteAsync();
            }

            // Clear All Objects (Folders&Files)
            CurrentDisplayObjects.Clear();
            AllObjects.Clear();
            UpdateFinder(CurrentDisplayObjects);
        }
Пример #5
0
        void UpdateAllObjects()
        {
            List <ThingsListModel> things  = thingRepository.GetAll();
            List <PersonListModel> persons = personRepository.GetAll();

            AllObjects.Clear();
            foreach (var thingsListModel in things)
            {
                AllObjects.Add(new ObjectsListModel()
                {
                    Id   = thingsListModel.Id,
                    Name = thingsListModel.Name
                });
            }

            foreach (var personsListModel in persons)
            {
                AllObjects.Add(new ObjectsListModel()
                {
                    Id   = personsListModel.Id,
                    Name = personsListModel.Firstname + " " + personsListModel.Surname
                });
            }
        }