using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Windows.Media.Imaging;
using System.Windows.Media.Animation;
namespace test2
{
partial class Windowdundundun : MainWindow
{
int count;
private List<ImageEntities> Images = ImageViews.GetAllImageData();
class ImageEntities
{
public String ImagePath
{
get;
set;
}
}
public static class ImageViews
{
public static List<ImageEntities> GetAllImageData()
{
try
{
//Load XML File
XDocument XDoc = Xdocument.Load("Images.xml");
// Query for retriving all Image data from XML
var Query = from Q in XDoc.Descendants("Image")
select new ImageEntities
{
ImagePath = Q.Element("ImagePath").Value
};
// Return Image Data
return Query.ToList<ImageEntities>();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
public void btnNext_Click(object sender, RoutedEventArgs e)
{
if (count < Images.Count - 1)
{
count++;
PlaySlideShow(count);
}
else
{
count = 0;
PlaySlideShow(count);
}
}
public void btnPrev_Click(object sender, RoutedEventArgs e)
{
if (count > 0)
{
count--;
PlaySlideShow(count);
}
else
{
count = Images.Count - 1;
PlaySlideShow(count);
}
}
public void PlaySlideShow(int cnt)
{
BitmapImage image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(Images[cnt].ImagePath, UriKind.Relative);
image.EndInit();
myImage.Source = image;
}
}
}
I don't know if I am even doing it right first of all, but that's besides the point. I get an error in
public static List<ImageEntities> GetAllImageData()That says "Inconsistent Accessability" error I don't understand why it gives me that error as I understand that it is just trying to get something that it is unable to, but everything is public.
Any knowledge on the subject and if I'm even doing it right would be greatly appreciated.

New Topic/Question
Reply


MultiQuote






|