コード例 #1
0
        public bool addATag(Tag t)
        {
            Search.Text = "";
            bool found = false;

            if (!forChange)     //ako se ne menja nista, samo trazi govnara
            {
                foreach (var tt in ExistTags)
                {
                    if (tt.ID.Equals(t.ID))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    ExistTags.Add(t);
                    existAllTags.Add(t);
                    notSaved = true;
                    return(true);
                }

                return(false);
            }

            forChange = false;
            //nesto se menja -> treba da se nadje kopija i doda asaf
            if (!copy.Equals(t))
            {
                ExistTags.Remove(copy);
                existAllTags.Remove(copy);
                ExistTags.Add(t);
                existAllTags.Add(t);
                MyTags.Remove(copy);
                myAllTags.Remove(copy);
                MyTags.Add(t);
                myAllTags.Add(t);
            }

            notSaved = true;
            return(true);
        }
コード例 #2
0
        private void Go_OnClick(object sender, TextChangedEventArgs e)
        {
            bool flag = false;

            string input = Search.Text.Trim();

            if (ExistTags != null)
            {
                for (int i = ExistTags.Count - 1; i >= 0; i--)
                {
                    ExistTags.RemoveAt(i);
                }

                if (input.Equals("") || input.Equals("Search for tag"))
                {
                    flag = true;
                    foreach (var l in existAllTags)
                    {
                        ExistTags.Add(l);
                    }
                }

                if (flag == false)
                {
                    foreach (var l in existAllTags)
                    {
                        if (l.Similar(input))
                        {
                            ExistTags.Add(l);
                        }
                    }
                }
            }

            flag = false;
            if (MyTags != null)
            {
                for (int i = MyTags.Count - 1; i >= 0; i--)
                {
                    MyTags.RemoveAt(i);
                }

                if (input.Equals("") || input.Equals("Search for tag"))
                {
                    flag = true;
                    foreach (var l in myAllTags)
                    {
                        MyTags.Add(l);
                    }
                }

                if (flag == false)
                {
                    foreach (var l in myAllTags)
                    {
                        if (l.Similar(input))
                        {
                            MyTags.Add(l);
                        }
                    }
                }
            }
        }