Exemplo n.º 1
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Terms.Clear();
                var items = await App.Database.GetTermsAsync();

                foreach (var item in items)
                {
                    Terms.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 2
0
        async Task LoadTerms()
        {
            IsBusy = true;
            try
            {
                var terms = await SqliteConn.Table <Term>().OrderBy(term => term.Start).ToListAsync();

                lock (termsLock)
                {
                    Terms.Clear();
                    foreach (var term in terms)
                    {
                        Terms.Add(term);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 3
0
 private void RefreshTerms()
 {
     Terms.Clear();
     foreach (var term in AllTerms)
     {
         Terms.Add(term);
     }
 }
Exemplo n.º 4
0
        private async void PopulateTerms()
        {
            List <Term> terms = await App.Database.GetTermsAsync();

            Terms.Clear();
            foreach (Term term in terms)
            {
                Terms.Add(term);
            }
        }
        public async void PopulateTermList()
        {
            List <Term> terms = await App.DB.ShowTerms();

            Terms.Clear();
            foreach (Term term in terms)
            {
                Terms.Add(term);
            }
        }
        async Task ExecuteLoadTermsCommand()
        {
            Terms.Clear();
            var terms = await App.DB.ShowTerms();

            foreach (var term in terms)
            {
                Terms.Add(term);
            }
        }
Exemplo n.º 7
0
        private async Task Refresh()
        {
            IsBusy = true;
            Terms.Clear();
            var terms = await DBService.GetAllTerm();

            foreach (Models.Term term in terms)
            {
                Terms.Add(term);
            }
            IsBusy = false;
        }
Exemplo n.º 8
0
 public override void DeleteTermsOperation()
 {
     foreach (var item in Terms)
     {
         if (item != null)
         {
             Terms.Variable x = item as Terms.Variable;
             x.Clean();
         }
     }
     Terms.Clear();
 }
Exemplo n.º 9
0
        private void loadTerms(UniqueEntityView item)
        {
            Terms.Clear();
            if (item is null)
            {
                return;
            }
            terms.FixedFilter = GetMember.Name <UnitTermData>(x => x.MasterId);
            terms.FixedValue  = item.Id;
            var list = terms.Get().GetAwaiter().GetResult();

            foreach (var e in list)
            {
                Terms.Add(UnitTermViewFactory.Create(e));
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Clear this set expression
 /// </summary>
 public void Clear()
 {
     Terms.Clear();
 }
Exemplo n.º 11
0
 public override void DeleteTermsOperation()
 {
     W.DeleteResults();
     Terms.Clear();
 }
Exemplo n.º 12
0
        public void Update(SetInfo si)
        {
            if (ID != si.ID)
            {
                throw new InvalidOperationException("Cannot update Set view model with data from another group");
            }

            Title    = si.Title;
            Author   = si.Author;
            Created  = si.Created;
            Modified = si.Modified;

            for (int i = 0; i < Subjects.Count; ++i)
            {
                if (!si.Subjects.Contains(Subjects[i].Subject))
                {
                    Subjects.RemoveAt(i);
                }
            }

            foreach (var subject in si.Subjects)
            {
                if (Subjects.All(svm => svm.Subject != subject))
                {
                    Subjects.Add(new SubjectViewModel(subject));
                }
            }

            switch (si.Editable)
            {
            case "groups": editPermissions = SetEditPermissions.Groups; break;

            case "password": editPermissions = SetEditPermissions.Password; break;

            default: editPermissions = SetEditPermissions.OnlyMe; break;
            }

            switch (si.Visibility)
            {
            case "public": visibility = SetVisibility.Public; break;

            case "groups": visibility = SetVisibility.Groups; break;

            case "password": visibility = SetVisibility.Password; break;

            default: visibility = SetVisibility.OnlyMe; break;
            }

            HasAccess     = si.HasAccess;
            hasDiscussion = si.HasDiscussion;
            Description   = si.Description;
            Uri           = si.Uri;

            if (si.Terms != null)
            {
                TermsLoaded = true;

                Terms.Clear();
                foreach (var ti in (IEnumerable <TermInfo>)si.Terms)
                {
                    Terms.Add(new TermViewModel(ti));
                }

                TermCount = Terms.Count;
            }
            else
            {
                TermCount = si.TermCount;
            }

            TermLanguageCode       = si.TermLanguageCode;
            DefinitionLanguageCode = si.DefinitionLanguageCode;
        }