示例#1
0
        private void DeleteEmpty(object sender, EventArgs e)
        {
            Topic_Keyword tmp = sender as Topic_Keyword;

            tmp.Items.CollectionChanged -= changedKeyword;
            keyWords.Remove(tmp);
            topic.Remove(tmp.Date);
        }
示例#2
0
        public Topic_Folder _list()
        {
            ObservableCollection <Topic_Keyword> tmp = new ObservableCollection <Topic_Keyword>();

            foreach (XmlNode x in list)
            {
                Topic_Keyword sth = new Topic_Keyword(x.date, x.keyword);
                tmp.Add(sth);
            }

            return(new Topic_Folder(tmp));
        }
示例#3
0
        public ObservableCollection <Topic_Keyword> OpenKeyWords(ComboBox Topic_Combo)
        {
            ObservableCollection <Topic_Keyword> keys = new ObservableCollection <Topic_Keyword>();

            try
            {
                using (StreamReader reader = new StreamReader("../../XML/TopicKeywords.xml"))
                {
                    XmlSerializer seri = new XmlSerializer(typeof(XmlTree));
                    keyWord = (seri.Deserialize(reader) as XmlTree)._list();
                    keys    = keyWord.Item;
                    foreach (Topic_Keyword x in keys)
                    {
                        if (x.Date == DateTime.Today.ToShortDateString())
                        {
                            txtBxNull = x;
                        }


                        Topic_Combo.Items.Add(new ComboBoxItem()
                        {
                            Content = x.Date, DataContext = x
                        });
                        keyWord.Topic.Add(x.Date);
                    }

                    Topic_Combo.SelectedItem = null;
                }
            }

            catch (Exception)
            {
            }

            if (txtBxNull == null)
            {
                txtBxNull = new Topic_Keyword();
            }

            return(keys);
        }
示例#4
0
        //public void Add(string s, ComboBoxItem _date = null)
        //{
        //    string date = DateTime.Today.ToShortDateString();
        //    if (_date != null)
        //    {
        //        date = _date.Content.ToString();
        //    }

        //    //if (!Contains(s))
        //    //{

        //        if (!String.IsNullOrEmpty(date) && !String.IsNullOrWhiteSpace(date))
        //        {
        //            foreach (Topic_Keyword x in keyWords)
        //            {
        //                if (x.Date == date)
        //                {
        //                    x.Add(s);
        //                    if(_date != null && _date.DataContext != x)
        //                    {
        //                        _date.DataContext = x;
        //                    }
        //                    return;
        //                }
        //            }

        //        //}

        //        Topic_Keyword it = new Topic_Keyword(date);
        //        it.Add(s);
        //        it.Items.CollectionChanged += changedKeyword;
        //        keyWords.Add(it);

        //    }
        //}

        public void AddK(Topic_Keyword x)
        {
            x.PropertyChanged         += DeleteEmpty;
            x.Items.CollectionChanged += changedKeyword;
            keyWords.Add(x);
        }