Interaction logic for PloaroidWithText.xaml
Inheritance: System.Windows.Controls.UserControl
        public ScrollableView(string pageType)
        {
            InitializeComponent();
            listOfObjects = new List<PoloroidWithText>();

            //add new poloroidWithTexts with all the data specified
            var temp =
                XMLUtilities.GetContentFromPage(@"http://www.childcancer.org.nz/News-and-events/" + pageType + ".aspx");
            var n = 1;
            while (true)
            {
                //go throug the templist
                var nodeText = temp.TextList.Where(text => text.node == "" + n).ToList();
                if (nodeText.Count == 0)
                    break;
                //create new poloroids for each item in temp
                var polaroid = new PoloroidWithText();
                //set date for poloroid
                polaroid.setTitle(nodeText.Where(t => t.type == "title").FirstOrDefault().Value);
                polaroid.setDate(nodeText.Where(t => t.type == "date").FirstOrDefault().Value);
                polaroid.setDescription(nodeText.Where(t => t.type == "info").FirstOrDefault().Value);
                polaroid.setPlace(pageType == "Events"
                    ? nodeText.Where(t => t.type == "place").FirstOrDefault().Value
                    : "");
                var image = temp.ImageList.Where(img => img.node == "" + n).FirstOrDefault();
                if (image != null)
                    polaroid.setImage(image.Value);
                addPoloroidtoList(polaroid);
                n++;
            }

            sbIn = new Storyboard();
            foreach (FrameworkElement fElement in listOfObjects)
            {
                Util.FadeIn(sbIn, fElement);
            }
        }
 /// <summary>
 ///     add poloroids to the stackpanel
 /// </summary>
 /// <param name="pol"></param>
 private void addPoloroidtoList(PoloroidWithText pol)
 {
     listOfObjects.Add(pol);
     listView.addContent(pol);
 }
Exemple #3
0
 /// <summary>
 ///     add new polaroids to the stackpanel
 /// </summary>
 /// <param name="pol"></param>
 public void addContent(PoloroidWithText pol)
 {
     //add the Polaroid with a margin
     pol.Margin = new Thickness(30);
     panel.Children.Add(pol);
 }