Exemplo n.º 1
0
        private void marketplace_contentView_SelectedItemsChanged(object sender, BetterListViewSelectedItemsChangedEventArgs eventArgs)
        {
            if (InvokeRequired)
            {
                return;
            }
            try
            {
                _prevItem?.Tokensource?.Cancel();
            }
            catch (ObjectDisposedException odex)
            {
                _prevItem = null;
                //We can Ignore this as we are Intentionally Disposing of the Tokensource
            }

            if (_prevItem != null && _content.Contains(_prevItem))
            {
                display_pic.Image = null;
            }
            if (contentview.SelectedValue != null)
            {
                MarketPlaceContent item = (MarketPlaceContent)contentview.SelectedValue;
                gametitle_text.Text      = item.Title;
                developer_text.Text      = item.Developer;
                publisher_text.Text      = item.Publisher;
                release_text.Text        = item.Releasedate.ToString(CultureInfo.CurrentCulture);
                genre_text.Text          = item.OffersCount;
                description_textbox.Text = item.Description;
                if (item.Thumb == null && item.Thumburl != null)
                {
                    var result = item.InitImageAsync(item.Thumburl);
                    result.ContinueWith(task =>
                    {
                        if (item.Tokensource != null)
                        {
                            display_pic.Image = task.Result;
                            item.Tokensource  = null;
                        }
                    }, item.Tokensource.Token);
                }
                else if (item.Thumb != null)
                {
                    display_pic.Image = item.Thumb;
                }
                if (display_pic.Image == null)
                {
                }                                 //todo:Load graphic for "Banner Not Found"
                _prevItem = item;

                if (item.Capabilities == null)
                {
                    extrainfo_btn.Enabled = false;
                }
                else
                {
                    extrainfo_btn.Enabled = true;
                }
            }
        }