Exemplo n.º 1
0
        private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
        {
            var                   directory_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "/" + "feed";
            List <App.Feed>       feeds          = new List <App.Feed>();
            List <Task <string> > taskres        = new List <Task <string> >();


            List <App.Feed_Data> nfeed = new List <App.Feed_Data>();
            int i = 1;

            foreach (var item0 in File.ReadAllLines(directory_path + "/feed_list.txt"))
            {
                if (!item0.Contains("http"))
                {
                    continue;
                }
                try
                {
                    var ng = Path.GetInvalidFileNameChars();

                    var filename = item0 + ".txt";
                    foreach (var item1 in ng)
                    {
                        filename = filename.Replace(item1, ' ');
                    }
                    if (File.Exists(directory_path + "/" + filename))
                    {
                        try
                        {
                            var ss = App.getfeedxml(directory_path + "/" + filename);
                            foreach (var item in ss.content)
                            {
                                App.Feed_Data tm = item;

                                if (tm.title.IndexOf(e.NewTextValue, StringComparison.OrdinalIgnoreCase) >= 0 | tm.content.IndexOf(e.NewTextValue, StringComparison.OrdinalIgnoreCase) >= 0)
                                {
                                    tm.title = i.ToString() + "." + item.title;
                                    nfeed.Add(tm);
                                    i++;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                    }
                }
                catch (Exception)
                {
                }
            }

            listView.ItemsSource = nfeed;
        }
Exemplo n.º 2
0
        public WebPage(App.Feed_Data feed)
        {
            InitializeComponent();

            Device.BeginInvokeOnMainThread(async() => {
                await Browser.OpenAsync(feed.link, new BrowserLaunchOptions
                {
                    LaunchMode = BrowserLaunchMode.SystemPreferred,
                    TitleMode  = BrowserTitleMode.Default
                });

                await Navigation.PopAsync();
            });


            //webview.Source = feed.link;
        }
Exemplo n.º 3
0
        public FeedPage(App.Feed feed)
        {
            InitializeComponent();
            this.feed = feed;

            label_title.Text        = feed.title;
            label_updated_time.Text = feed.updatedate;

            feed.content.Reverse();


            int i = 1;
            List <App.Feed_Data> n = new List <App.Feed_Data>();

            foreach (var item in feed.content)
            {
                App.Feed_Data tm = item;
                tm.title = i.ToString() + "." + item.title;

                //上から1000まで表示 20201208
                if (tm.content.Length > 1000)
                {
                    tm.content = tm.content.Substring(0, 1000) + "... hide " + 1000.ToString() + "/" + tm.content.Length.ToString();
                }


                n.Add(tm);
                i++;
            }
            feed.content = n;

            listView.ItemsSource = feed.content;

            if (feed.lastaclink != "")
            {
                foreach (var item in feed.content)
                {
                    if (item.link == feed.lastaclink)
                    {
                        listView.SelectedItem = item;
                        listView.ScrollTo(listView.SelectedItem, ScrollToPosition.Start, false);
                        break;
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
        {
            List <App.Feed_Data> nfeed = new List <App.Feed_Data>();
            int i = 1;

            foreach (var item in feed.content)
            {
                App.Feed_Data tm = item;

                if (tm.title.IndexOf(e.NewTextValue, StringComparison.OrdinalIgnoreCase) >= 0 | tm.content.IndexOf(e.NewTextValue, StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    tm.title = i.ToString() + "." + item.title;
                    nfeed.Add(tm);
                    i++;
                }
            }
            listView.ItemsSource = nfeed;
        }
Exemplo n.º 5
0
        public FeedPage_Search(App.Feed feed)
        {
            InitializeComponent();
            this.feed = feed;


            feed.content.Reverse();


            int i = 1;
            List <App.Feed_Data> n = new List <App.Feed_Data>();

            foreach (var item in feed.content)
            {
                App.Feed_Data tm = item;
                tm.title = i.ToString() + "." + item.title;
                n.Add(tm);
                i++;
            }
            feed.content = n;

            listView.ItemsSource = feed.content;
        }