예제 #1
0
 private void lb_data_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.A)
     {
         NewsModul news = (NewsModul)lb_data.SelectedItem;
         if (news == null)
         {
             return;
         }
         //   selectedList.Add(news);
         lb_SelectedData.Items.Add(news);
         NachrichtList.Remove(news);
         lb_data.Items.Refresh();
     }
     if (e.Key == Key.Delete)
     {
         NewsModul news = (NewsModul)lb_data.SelectedItem;
         if (news == null)
         {
             return;
         }
         NachrichtList.Remove(news);
         lb_data.Items.Refresh();
     }
 }
예제 #2
0
        public NewsModul GetContent(string htmlStr, string rTitel, string rDate, string rContent, string Linkstr, string NewsCat, string quelle)
        {
            string        Matchstr;
            NewsModul     nr    = new NewsModul();
            List <string> zlist = new List <string>();

            nr.Link    = Linkstr;
            nr.Htmlstr = htmlStr;

            Regex regexTitel   = new Regex(rTitel);
            Regex regexDate    = new Regex(rDate);
            Regex regexContent = new Regex(rContent);
            Match match;

            if (regexTitel.Matches(htmlStr).Count > 0)
            {
                match = regexTitel.Matches(htmlStr)[0];
                if (!zlist.Contains(match.ToString()))
                {
                    Matchstr = match.ToString();
                    Matchstr = Matchstr.Replace("\n", "");
                    Matchstr = GetCleanTitle(Matchstr);
                    nr.Title = Matchstr;
                }
            }

            if (regexDate.Matches(htmlStr).Count > 0)
            {
                match = regexDate.Matches(htmlStr)[0];
                if (!zlist.Contains(match.ToString()))
                {
                    Matchstr = match.ToString();
                    Matchstr = Matchstr.Replace("\n", "");
                    nr.date  = GetCleanDate(Matchstr);
                }
            }

            if (regexContent.Matches(htmlStr).Count > 0)
            {
                match = regexContent.Matches(htmlStr)[0];
                if (!zlist.Contains(match.ToString()))
                {
                    Matchstr   = match.ToString();
                    Matchstr   = Matchstr.Replace("\n", "");
                    nr.Content = GetCleanText(Matchstr);
                }
            }

            nr.Catagory     = NewsCat;
            nr.Quelle       = quelle;
            nr.Introduction = "";

            return(nr);
        }
예제 #3
0
        private void btnRemove_Click(object sender, RoutedEventArgs e)
        {
            NewsModul news = (NewsModul)lb_SelectedData.SelectedItem;

            if (news == null)
            {
                return;
            }
            //selectedList.Remove(news);
            lb_SelectedData.Items.Remove(lb_SelectedData.SelectedItem);
            NachrichtList.Add(news);
            lb_data.Items.Refresh();
        }
예제 #4
0
        private void lbNewslist_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox lb = sender as ListBox;

            if (lb == null)
            {
                return;
            }
            NewsModul result = (from news in NachrichtList
                                where news.Title.Equals((lb.SelectedItem as ListBoxItem).Content)
                                select news).First();
            string output = Regex.Replace(result.Content, "<[pP]>(.+?)</[pP]>", "\n$1\n");

            tbNewsContent.Text = output;
        }
예제 #5
0
        private void lb_SelectedData_Drop(object sender, DragEventArgs e)
        {
            NewsModul nr = (NewsModul)e.Data.GetData(typeof(NewsModul));

            if (selectedList.Contains(nr))
            {
                return;
            }
            selectedList.Add((NewsModul)e.Data.GetData(typeof(NewsModul)));
            lb_SelectedData.Items.Refresh();
            #region old
            //StackPanel panel = new StackPanel();
            //panel.Orientation = Orientation.Horizontal;
            //TextBlock tb = new TextBlock();
            //tb.FontSize = 12;
            //tb.Width = 240;
            //Button btn = new Button();
            //Button btnStufe = new Button();
            //btnStufe.Width = 40;
            //btnStufe.FontSize = 10;
            //btnStufe.Margin = new Thickness(3);
            //btnStufe.Content = "low";
            //btnStufe.Click += StufeChange;
            //btn.Width = 0;
            //btn.Content = e.Data.GetData(typeof(NewsModul));
            //ComboBox cb = new ComboBox();
            //cb.FontSize = 10;
            //cb.Items.Add("Framework");
            //cb.Items.Add("Markt");
            //cb.Items.Add("Company");
            //cb.Items.Add("Technology");
            //tb.Text = ((NewsModul)e.Data.GetData(typeof(NewsModul))).Title;
            //IAddChild container = panel;

            //container.AddChild(btn);
            //container.AddChild(tb);
            //container.AddChild(btnStufe);
            //container.AddChild(cb);
            //container = item;
            //container.AddChild(panel);
            //lb_SelectedData.Items.Add(item);
            #endregion
        }
예제 #6
0
        private void lb_SelectedData_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox lb = sender as ListBox;

            if (lb == null)
            {
                return;
            }
            if (lb.SelectedItem == null)
            {
                return;
            }
            selectedNews    = (NewsModul)lb.SelectedItem;
            tbContent.Text  = selectedNews.Content;
            tb_title.Text   = selectedNews.Title;
            block_From.Text = selectedNews.Quelle;
            block_date.Text = selectedNews.date;
            block_cap.Text  = selectedNews.Catagory;
            tBlockLink.Text = selectedNews.Link;
        }
예제 #7
0
        private void lb_data_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox lb = sender as ListBox;

            if (lb == null)
            {
                return;
            }
            if (lb.SelectedItem == null)
            {
                return;
            }
            selectedNews    = (NewsModul)lb.SelectedItem;
            tbContent.Text  = selectedNews.Content;
            tb_title.Text   = selectedNews.Title;
            block_From.Text = selectedNews.Quelle;
            block_date.Text = selectedNews.date;
            block_cap.Text  = selectedNews.Catagory;
            tBlockLink.Text = selectedNews.Link;
            //WebOutput.NavigateToString(selectedNews.Htmlstr);
            DragDrop.DoDragDrop(lb, lb.SelectedItem, DragDropEffects.Copy);
        }