Пример #1
0
        public void GetPreviousSearchedSentence()
        {
            if (App.Corpus != null)
            {
                int newIndex = SearchedIndex - 1;

                if (newIndex < ListSentByCat.Count() && newIndex >= 0)
                {
                    SearchedIndex = newIndex;
                }
                else if (newIndex == ListSentByCat.Count)
                {
                    SearchedIndex = 0;
                }
                else if (newIndex < 0)
                {
                    SearchedIndex = ListSentByCat.Count - 1;
                }

                if (ListSentByCat.Any())
                {
                    SearchedSent = ListSentByCat.ElementAt(SearchedIndex);
                }
            }
        }
Пример #2
0
        public void SearchSentByCategory(string cat)
        {
            if (cat != "")
            {
                ListSentByCat.Clear();

                foreach (var sysSen in App.Corpus.SystemSentences)
                {
                    var foundAnno = sysSen.Annotations.Where(x => x.AnnoDim.Name == cat).ToList();

                    if (foundAnno.Any())
                    {
                        ActiveSentence localSent = sentenceService.GetActiveSentenceByIndex(sysSen.Index);
                        ListSentByCat.Add(localSent);
                    }
                }

                if (ListSentByCat.Any())
                {
                    SearchedIndex = 0;
                    SearchedSent  = ListSentByCat.ElementAt(SearchedIndex);
                }
                else
                {
                    SearchedIndex = 0;
                    SearchedSent  = new ActiveSentence()
                    {
                        ActiveIndex          = 0,
                        ActiveModSysSentence = new Sentence()
                        {
                            Index = 0, Text = ""
                        },
                        ActiveRefSentence = new Sentence()
                        {
                            Index = 0, Text = ""
                        },
                        ActiveSrcSentence = new Sentence()
                        {
                            Index = 0, Text = ""
                        },
                        ActiveSysSentence = new SysSentence()
                        {
                            Index = 0, Text = "", Annotations = null
                        }
                    };
                }
            }
            else
            {
                ListSentByCat.Clear();
                SearchedIndex = 0;
                SearchedSent  = new ActiveSentence()
                {
                    ActiveIndex          = 0,
                    ActiveModSysSentence = new Sentence()
                    {
                        Index = 0, Text = ""
                    },
                    ActiveRefSentence = new Sentence()
                    {
                        Index = 0, Text = ""
                    },
                    ActiveSrcSentence = new Sentence()
                    {
                        Index = 0, Text = ""
                    },
                    ActiveSysSentence = new SysSentence()
                    {
                        Index = 0, Text = "", Annotations = null
                    }
                };
            }
        }