0

我正在构建一个 Rss 阅读器应用程序并遇到 gif 问题。

有谁知道如何构建 ImageConverter 类,以便将 gif 转换为 png?在代码中转换 gif 也对我有用。我的应用程序的工作方式是从提要中获取所有内容,首先将其放入 list() 中,然后填充列表框(以用户选择的方式)。GIF 留下空白图像 :(

所以基本上转换器必须使用链接,而不是直接数据流。

我将添加一些关于我的数据如何更新的代码:

ObservableCollection<FeedItem> slika0; //where the feeditems from the selected category go 

    public ObservableCollection<FeedItem> Slika0
    {
        get { return slika0; }
        set
        {
            slika0 = value;
            OnPropertyChanged("Slika0");
        }
    }

    int broj_elemenata = 0;
    bool nema_elemenata = false;
    private void UpdateFeedList(string feedXML)
    {
        StringReader stringReader = new StringReader(feedXML);
        XmlReader xmlReader = XmlReader.Create(stringReader);
        SyndicationFeed feed = SyndicationFeed.Load(xmlReader);

        List<string> kategorije = new List<string>();
        foreach (SyndicationItem sitem in feed.Items)
        {
            foreach (SyndicationCategory sc in feed.Categories)
            {
                if (!kategorije.Contains(sc.Name))
                {
                    kategorije.Add(sc.Name);
                }
            }
        }

        FeedItem FeedItem = new FeedItem();
        Slika0 = new ObservableCollection<FeedItem>();
        //SyndicationCategory tražena_kat = new SyndicationCategory("Trendy");

        foreach (SyndicationItem item in feed.Items)
        {
            foreach (SyndicationCategory sc in item.Categories)
            {
                FeedItem.Content_List.Add(sc.Name);

                foreach (SyndicationElementExtension ext in item.ElementExtensions)
                {
                    XElement ele = ext.GetObject<XElement>();

                    if (ele.Name.LocalName == "encoded" && ele.Name.Namespace.ToString().Contains("content"))
                    {
                        FeedItem.Content_List.Add(item.Title.Text);
                        FeedItem.Content_List.Add(ele.Value);//takes the content of the feed
                    }
                }

                foreach (SyndicationLink link in item.Links)
                {

                    FeedItem.Content_List.Add(link.Uri.AbsoluteUri); //takes the links for  browsing and the image 

                }
            }
        }
        IsolatedStorageSettings.ApplicationSettings["ContentList"] = FeedItem.Content_List;

        Deployment.Current.Dispatcher.BeginInvoke(() =>
        {

            int i;
            int x = 0;

            Slika0.Clear();
            foreach (var item in FeedItem.Content_List)
            {
                i = FeedItem.Content_List.IndexOf(item, x); //x = index of category in the list

                if (item == "Trendy")
                {
                    FeedItem FF = new FeedItem();
                    FF.Post_text = FeedItem.Content_List[i + 1];//title of article
                    FF.Content_link = FeedItem.Content_List[i + 2];//content
                    FF.Post_link = FeedItem.Content_List[i + 3];//the location of link for browsing
                    FF.Post_slika = FeedItem.Content_List[i + 4]; //location of image link

                    if (FF.Post_slika == "") //if there is no link for picture code is executed
                    {
                        FF.Post_slika = "Slike/zimo_veliki_tile.png";
                    }

                    Slika0.Add(FF);
                    this.lsSlika_P.ItemsSource = Slika0; //take

                    x = i + 5;
                    broj_elemenata++;
                }
            }

            if (lsSlika_P.Items.Count <= 3)
            {
                scroll_panorama.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
            }

            if (lsSlika_P.Items.Count == 0)
            {
                nema_elemenata = true;
            }
            else nema_elemenata = false;


        });
        pan_progres.Visibility = Visibility.Collapsed;//progress bar
    }
4

0 回答 0